git: cb07628d9e7c - main - nfscl: Delete unneeded redundant MODULE_DEPEND() calls

Rick Macklem rmacklem at FreeBSD.org
Tue May 11 00:38:08 UTC 2021


The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb07628d9e7c84019f99e2dfeadbe0957e5c22e8

commit cb07628d9e7c84019f99e2dfeadbe0957e5c22e8
Author:     Rick Macklem <rmacklem at FreeBSD.org>
AuthorDate: 2021-05-11 00:34:29 +0000
Commit:     Rick Macklem <rmacklem at FreeBSD.org>
CommitDate: 2021-05-11 00:34:29 +0000

    nfscl: Delete unneeded redundant MODULE_DEPEND() calls
    
    There are two module declarations in the nfscl.ko module for "nfscl"
    and "nfs".  Both of these declarations had MODULE_DEPEND() calls.
    This patch deletes the MODULE_DEPEND() calls for "nfs" to avoid
    confusion with respect to what modules this module is dependent upon.
    
    The patch also adds comments explaining why there are two module
    declarations within the module.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D30102
---
 sys/fs/nfsclient/nfs_clport.c   |  9 +++++++++
 sys/fs/nfsclient/nfs_clvfsops.c | 14 ++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c
index 492b93340e4e..4676f09f8e86 100644
--- a/sys/fs/nfsclient/nfs_clport.c
+++ b/sys/fs/nfsclient/nfs_clport.c
@@ -1438,6 +1438,14 @@ static moduledata_t nfscl_mod = {
 	nfscl_modevent,
 	NULL,
 };
+/*
+ * This is the main module declaration for the NFS client.  The
+ * nfscl_modevent() function is needed to ensure that the module
+ * cannot be unloaded, among other things.
+ * There is also a module declaration in sys/fs/nfsclient/nfs_clvfsops.c
+ * for the name "nfs" within the VFS_SET() macro that defines the "nfs"
+ * file system type.
+ */
 DECLARE_MODULE(nfscl, nfscl_mod, SI_SUB_VFS, SI_ORDER_FIRST);
 
 /* So that loader and kldload(2) can find us, wherever we are.. */
@@ -1445,3 +1453,4 @@ MODULE_VERSION(nfscl, 1);
 MODULE_DEPEND(nfscl, nfscommon, 1, 1, 1);
 MODULE_DEPEND(nfscl, krpc, 1, 1, 1);
 MODULE_DEPEND(nfscl, nfssvc, 1, 1, 1);
+MODULE_DEPEND(nfscl, xdr, 1, 1, 1);
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index 08a25c6fe632..847bf72acf0c 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
-#include <sys/module.h>
 #include <sys/mount.h>
 #include <sys/proc.h>
 #include <sys/socket.h>
@@ -148,14 +147,17 @@ static struct vfsops nfs_vfsops = {
 	.vfs_sysctl =		nfs_sysctl,
 	.vfs_purge =		nfs_purge,
 };
+/*
+ * This macro declares that the file system type is named "nfs".
+ * It also declares a module name of "nfs" and uses vfs_modevent()
+ * as the event handling function.
+ * The main module declaration is found in sys/fs/nfsclient/nfs_clport.c
+ * for "nfscl" and is needed so that a custom event handling
+ * function gets called.  MODULE_DEPEND() macros are found there.
+ */
 VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK | VFCF_SBDRY);
 
-/* So that loader and kldload(2) can find us, wherever we are.. */
 MODULE_VERSION(nfs, 1);
-MODULE_DEPEND(nfs, nfscommon, 1, 1, 1);
-MODULE_DEPEND(nfs, krpc, 1, 1, 1);
-MODULE_DEPEND(nfs, nfssvc, 1, 1, 1);
-MODULE_DEPEND(nfs, xdr, 1, 1, 1);
 
 /*
  * This structure is now defined in sys/nfs/nfs_diskless.c so that it


More information about the dev-commits-src-all mailing list