Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1379939rwd; Thu, 15 Jun 2023 09:43:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4gYQbAYRy6R0rHw+TiqJi6tZhuIcl8IuV0jXVQcCsieywn75xOptbxs0itEhvw+pxu+Wv2 X-Received: by 2002:a17:902:eecc:b0:1af:b957:718b with SMTP id h12-20020a170902eecc00b001afb957718bmr13862719plb.39.1686847419917; Thu, 15 Jun 2023 09:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686847419; cv=none; d=google.com; s=arc-20160816; b=0u3DZN6KeRl57B13gKeRkzB/Inx6vMeZgadcucSrNw9Jedwb40D6IYcnyrDpOPvN4x GoVI9eYx8o8XrQkQJBCebUFpfbyEHcwIdVnErNbXCgftw2BLerRGxwhbQHRS4aieuyB/ Q9UNK5Z7oGwiHfXDzBPJ+RnhKSIQwNVjiZlAKc0eGpBQZEC0Eeco+dL/jF4buxNTGrnb UwEb6WxGC1dJj8r/NWr+hYpLLIIfJtCv2LFF68Vy7utLmYqVlKsf5aQpfDSipP49KQ0f YDFpY/+9VdNfkvNhhQEwqF9uQS4XcxNUe7tZ1Pql9omWkSdetEv7vJfIiIPMAX1z7h7U ZGYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ci9Tvs7VQk88UEF91b234GT9H3leOfWpd14qiCrzRIE=; b=FYR9HfF/ZI8tO4oFb+6KtMNW5D8ti2M21CQ4h5S5ZMURs3MqWbTo+jkJMoZTTPtUxD iS8nmjArYmzXpN+3oazChk/09yi9tJ7Lck8/+75eE88vv9lFWyxtRYhi0KLKVS5IGVt+ oNk0UmrhccD1pjylo2kmNlJhzWrwyBfavtCfYeiQkShMTIPSXAl+52CQvtaSF5QkHEp9 btvby06YrFUmgInY69Bz6z/1wrD6/h2zr2PJkAehdXZfHH5PBJi5MN0S5PE3USYPUz7V BMhYXGech2numVCQ1W9knRfMMM3P86vEhW1DJsHyGAq7S8kFzqEsgScIh+pEj6HSHysV sseg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a170902b49000b001b02fa876c7si13143122plr.578.2023.06.15.09.43.26; Thu, 15 Jun 2023 09:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232599AbjFOQRL (ORCPT + 99 others); Thu, 15 Jun 2023 12:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233686AbjFOQRH (ORCPT ); Thu, 15 Jun 2023 12:17:07 -0400 X-Greylist: delayed 532 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 15 Jun 2023 09:17:04 PDT Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CAB77ED for ; Thu, 15 Jun 2023 09:17:04 -0700 (PDT) Received: from fedora.. (p5b3d25f5.dip0.t-ipconnect.de [91.61.37.245]) by mail.holtmann.org (Postfix) with ESMTPSA id 4A1AACECD7; Thu, 15 Jun 2023 18:08:10 +0200 (CEST) From: Marcel Holtmann 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 Message-Id: <20230615160806.94000-1-marcel@holtmann.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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