public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: linux-cachefs@redhat.com, linux-kernel@vger.kernel.org
Cc: dhowells@redhat.com, arnd@arndb.de, gregkh@linuxfoundation.org
Subject: [PATCH] cachefiles: allocate static minor for /dev/cachefiles
Date: Thu, 15 Jun 2023 18:08:06 +0200	[thread overview]
Message-ID: <20230615160806.94000-1-marcel@holtmann.org> (raw)

The cachefiles misc character device uses MISC_DYNAMIC_MINOR and thus
doesn't support module auto-loading. Assign a static minor number for it
and provide appropriate module aliases for it. This is enough for kmod to
create the /dev/cachefiles device node on startup and facility module
auto-loading.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 Documentation/admin-guide/devices.txt | 3 ++-
 fs/cachefiles/main.c                  | 4 +++-
 include/linux/miscdevice.h            | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
index 06c525e01ea5..21b2dda10006 100644
--- a/Documentation/admin-guide/devices.txt
+++ b/Documentation/admin-guide/devices.txt
@@ -376,8 +376,9 @@
 		240 = /dev/userio	Serio driver testing device
 		241 = /dev/vhost-vsock	Host kernel driver for virtio vsock
 		242 = /dev/rfkill	Turning off radio transmissions (rfkill)
+		243 = /dev/cachefiles	Filesystem caching on files
 
-		243-254			Reserved for local use
+		244-254			Reserved for local use
 		255			Reserved for MISC_DYNAMIC_MINOR
 
   11 char	Raw keyboard device	(Linux/SPARC only)
diff --git a/fs/cachefiles/main.c b/fs/cachefiles/main.c
index 3f369c6f816d..eead7b5016a7 100644
--- a/fs/cachefiles/main.c
+++ b/fs/cachefiles/main.c
@@ -30,11 +30,13 @@ MODULE_PARM_DESC(cachefiles_debug, "CacheFiles debugging mask");
 MODULE_DESCRIPTION("Mounted-filesystem based cache");
 MODULE_AUTHOR("Red Hat, Inc.");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("devname:cachefiles");
+MODULE_ALIAS_MISCDEV(CACHEFILES_MINOR);
 
 struct kmem_cache *cachefiles_object_jar;
 
 static struct miscdevice cachefiles_dev = {
-	.minor	= MISC_DYNAMIC_MINOR,
+	.minor	= CACHEFILES_MINOR,
 	.name	= "cachefiles",
 	.fops	= &cachefiles_daemon_fops,
 };
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index c0fea6ca5076..d7f989f593b0 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -71,6 +71,7 @@
 #define USERIO_MINOR		240
 #define VHOST_VSOCK_MINOR	241
 #define RFKILL_MINOR		242
+#define CACHEFILES_MINOR	243
 #define MISC_DYNAMIC_MINOR	255
 
 struct device;
-- 
2.40.1


             reply	other threads:[~2023-06-15 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 16:08 Marcel Holtmann [this message]
2023-06-22 13:42 ` [PATCH] cachefiles: allocate static minor for /dev/cachefiles David Howells
2023-06-22 14:51   ` Greg KH
2023-06-25  8:49 ` Greg KH

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=20230615160806.94000-1-marcel@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=arnd@arndb.de \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-cachefs@redhat.com \
    --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