Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp85124yba; Mon, 20 May 2019 05:26:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCIDlVNYUDmiS5K2PcGHg3/hJclfyVIaUQ5FbvoMeOkkL7otUvhNUX5qzaQDb4SIgPVECO X-Received: by 2002:a62:bd0e:: with SMTP id a14mr60399191pff.44.1558355212318; Mon, 20 May 2019 05:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355212; cv=none; d=google.com; s=arc-20160816; b=Em/ZYfuKs7/TphJpj0OYcL78z9iQFH2hIRn7w9462gKIq97Tcd4OSwYihU+IOoN296 q1v+OYjCh5MvUFf/FUKIyM//vwjKmQIvV5r2JIHhpHcbgITFrfY/m9mMASIrnQY0XJ+E W7lpCetpfMcU0BSsxDKAMo3uOnszWNSaQ10qjSsQE8rDdfcNKyXz2XLw6qAusS+jHdGM kOBrqABzTLlDxQJXV0B5YQg2DRm0MvAQxMtU6nDnyuhacLVew3l5OpfXex3tlazyMtm7 d51QNnf1o3e1R1B2AOEzqqg2aU7Alk/pDjdRPlLsvZeBkjUjCr4UEXXZDFGwUpzJG0NT pIjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D2ApipcoPjKY+Cy5KxE8n89jOI9ov2Ba9oat1W2VgBI=; b=IpOKWDJLFb4M19Ornh++fx6i8iSb1YwF2AK3xb0uDQ/RxzK9CYkJPOHf4IHLTs7+3W p08Hqk/PR6J9bmsfqp2gytQnbIgs+l9n030N/BAl7bSKHe5s+rmzSz3ELr522j/LBDJQ QGBhuxob8kP2NY/4b2h90k744S2OSlxoOVCW9/GU8G81OaKSafmTXmqmbtJWBdiyIe10 LmUKlaUuiS0bG/EwI9BKfM/5VRW/bu0lAbRCofo1AB26Kw4Hqng/FX+e24tVt6driFlG o8bBRM1jjW8rfik93cjPwtfmHGIQD7KLx7jOewAZpxaP0e1RS2XQYBwZFu/H4u6P6OZb sM+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GJb9uMNb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b13si18812852pge.437.2019.05.20.05.26.37; Mon, 20 May 2019 05:26:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GJb9uMNb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388985AbfETMZG (ORCPT + 99 others); Mon, 20 May 2019 08:25:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:40058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388944AbfETMZE (ORCPT ); Mon, 20 May 2019 08:25:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5C9E20675; Mon, 20 May 2019 12:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355104; bh=ZkGxzEZLWwXrpJJkC8GbzMTCaMlIEBREVKnobzH24Dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJb9uMNbIB046kV77s2WPWn9gUvLLkK6E1ED42G7Zb0v6TrZh/l7nKXK3rvMRCMKd usvxv9HfW4RKkCuLq2/CeI9agI90if/Eoxm5xitsn+vUzXmhy2t9qsgHWc/f0xDPM4 WfYnqPAPxxvfFOwJL8M2HTxdo8xxwXghPPod878Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Guenter Roeck Subject: [PATCH 4.19 099/105] pstore: Centralize init/exit routines Date: Mon, 20 May 2019 14:14:45 +0200 Message-Id: <20190520115254.063413847@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook commit cb095afd44768bf495894b9ad063bd078e4bb201 upstream. In preparation for having additional actions during init/exit, this moves the init/exit into platform.c, centralizing the logic to make call outs to the fs init/exit. Signed-off-by: Kees Cook Tested-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- fs/pstore/inode.c | 11 ++--------- fs/pstore/internal.h | 5 +++-- fs/pstore/platform.c | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -482,12 +482,10 @@ static struct file_system_type pstore_fs .kill_sb = pstore_kill_sb, }; -static int __init init_pstore_fs(void) +int __init pstore_init_fs(void) { int err; - pstore_choose_compression(); - /* Create a convenient mount point for people to access pstore */ err = sysfs_create_mount_point(fs_kobj, "pstore"); if (err) @@ -500,14 +498,9 @@ static int __init init_pstore_fs(void) out: return err; } -module_init(init_pstore_fs) -static void __exit exit_pstore_fs(void) +void __exit pstore_exit_fs(void) { unregister_filesystem(&pstore_fs_type); sysfs_remove_mount_point(fs_kobj, "pstore"); } -module_exit(exit_pstore_fs) - -MODULE_AUTHOR("Tony Luck "); -MODULE_LICENSE("GPL"); --- a/fs/pstore/internal.h +++ b/fs/pstore/internal.h @@ -37,7 +37,8 @@ extern bool pstore_is_mounted(void); extern void pstore_record_init(struct pstore_record *record, struct pstore_info *psi); -/* Called during module_init() */ -extern void __init pstore_choose_compression(void); +/* Called during pstore init/exit. */ +int __init pstore_init_fs(void); +void __exit pstore_exit_fs(void); #endif --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -780,8 +780,31 @@ void __init pstore_choose_compression(vo } } +static int __init pstore_init(void) +{ + int ret; + + pstore_choose_compression(); + + ret = pstore_init_fs(); + if (ret) + return ret; + + return 0; +} +module_init(pstore_init) + +static void __exit pstore_exit(void) +{ + pstore_exit_fs(); +} +module_exit(pstore_exit) + module_param(compress, charp, 0444); MODULE_PARM_DESC(compress, "Pstore compression to use"); module_param(backend, charp, 0444); MODULE_PARM_DESC(backend, "Pstore backend to use"); + +MODULE_AUTHOR("Tony Luck "); +MODULE_LICENSE("GPL");