public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: <linux-kernel@vger.kernel.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
	Arnd Bergmann <arnd@arndb.de>, Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH] fs/crypto: make crypto.c explicitly non-modular
Date: Sat, 27 Feb 2016 15:20:49 -0500	[thread overview]
Message-ID: <1456604449-4666-1-git-send-email-paul.gortmaker@windriver.com> (raw)

As of commit 47134e6084f70fdf4381af75d4569cec6c7ebd50 ("fs crypto:
add Makefile and Kconfig") the compile of fs/crypto/crypto.c tripped
my local audit for non-modules using modular infrastructure vs. their
built in counterparts.

The Kconfig currently controlling compilation of this code is:

config FS_ENCRYPTION
        bool "FS Encryption (Per-file encryption)"

combined with:

obj-$(CONFIG_FS_ENCRYPTION)     += crypto.o policy.o keyinfo.o

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the use of fs_initcall (which seems appropriate for fs code)
means the init comes slightly earlier.  However boot testing an
x86-64 defconfig didn't show this to be causing any issues.

We replace module.h with moduleparam.h since the file does declare
some module parameters, and leaving them as such is currently the
easiest way to remain compatible with existing boot arg use cases.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 fs/crypto/crypto.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index ed17895cda11..abca51e75572 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -23,7 +23,7 @@
 #include <linux/ecryptfs.h>
 #include <linux/pagemap.h>
 #include <linux/mempool.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/scatterlist.h>
 #include <linux/ratelimit.h>
 #include <linux/bio.h>
@@ -33,6 +33,10 @@
 static unsigned int num_prealloc_crypto_pages = 32;
 static unsigned int num_prealloc_crypto_ctxs = 128;
 
+/*
+ * Not really modular but using module_param is the easiest way to
+ * remain consistent with existing use cases for now.
+ */
 module_param(num_prealloc_crypto_pages, uint, 0444);
 MODULE_PARM_DESC(num_prealloc_crypto_pages,
 		"Number of crypto pages to preallocate");
@@ -537,18 +541,4 @@ fail_free_queue:
 fail:
 	return -ENOMEM;
 }
-module_init(fscrypt_init)
-
-/**
- * fscrypt_exit() - Shutdown the fs encryption system
- */
-void __exit fscrypt_exit(void)
-{
-	fscrypt_destroy();
-
-	if (fscrypt_read_workqueue)
-		destroy_workqueue(fscrypt_read_workqueue);
-	kmem_cache_destroy(fscrypt_ctx_cachep);
-	kmem_cache_destroy(fscrypt_info_cachep);
-}
-module_exit(fscrypt_exit);
+fs_initcall(fscrypt_init)
-- 
2.6.1

             reply	other threads:[~2016-02-27 20:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-27 20:20 Paul Gortmaker [this message]
2016-02-29  9:56 ` [PATCH] fs/crypto: make crypto.c explicitly non-modular Arnd Bergmann
2016-02-29 14:31   ` Paul Gortmaker
2016-03-02 17:37     ` Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456604449-4666-1-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=arnd@arndb.de \
    --cc=jaegeuk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox