Skip to contentSkip to conversation

libnfs.a: eliminate another dependency on a global variable

PATCH In review Chuck Lever 1 participant 1 message Jul 29, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 22/23 libnfs.a: eliminate another dependency on a global variable

The file support/nfs/fstab.c, which is linked into libnfs.a, depends on the global variable "verbose." This variable is defined and used only in the mount command, and the functions in fstab.c are used only by the mount command.

Move fstab.c and support/include/fstab.h to utils/mount. This file placement is also consistent with at least one other mount helper, mount.ocfs2.

---

 support/include/Makefile.am |    1 
 support/include/fstab.h     |   30 --
 support/nfs/Makefile.am     |    2 
 support/nfs/fstab.c         |  554 -------------------------------------------
 utils/mount/Makefile.am     |    4 
 utils/mount/fstab.c         |  554 +++++++++++++++++++++++++++++++++++++++++++
 utils/mount/fstab.h         |   30 ++
 7 files changed, 587 insertions(+), 588 deletions(-)
support/include/Makefile.am +0 -1
index 69c4503..718abda 100644
@@ -4,7 +4,6 @@ SUBDIRS = nfs rpcsvc sys
 
 noinst_HEADERS = \
 	exportfs.h \
-	fstab.h \
 	ha-callout.h \
 	misc.h \
 	nfs_mntent.h \
support/include/fstab.h deleted +0 -30
deleted file mode 100644
index 64c8355..0000000
@@ -1,30 +0,0 @@
-#ifndef _NFS_FSTAB_H
-#define _NFS_FSTAB_H
-
-#include "nfs_mntent.h"
-
-#ifndef _PATH_FSTAB
-#define _PATH_FSTAB "/etc/fstab"
-#endif
-
-int mtab_is_writable(void);
-int mtab_does_not_exist(void);
-
-struct mntentchn {
-	struct mntentchn *nxt, *prev;
-	struct mntent m;
-};
-
-struct mntentchn *getmntoptfile (const char *file);
-struct mntentchn *getmntdirbackward (const char *dir, struct mntentchn *mc);
-struct mntentchn *getmntdevbackward (const char *dev, struct mntentchn *mc);
-
-struct mntentchn *getfsfile (const char *file);
-struct mntentchn *getfsspec (const char *spec);
-
-void lock_mtab (void);
-void unlock_mtab (void);
-void update_mtab (const char *special, struct mntent *with);
-
-#endif /* _NFS_FSTAB_H */
-
support/nfs/Makefile.am +1 -1
index 82353a9..87f3949 100644
@@ -4,7 +4,7 @@ noinst_LIBRARIES = libnfs.a
 libnfs_a_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \
 		   xlog.c xcommon.c wildmat.c nfssvc.c nfsclient.c \
 		   nfsexport.c getfh.c nfsctl.c \
-		   svc_socket.c cacheio.c closeall.c fstab.c nfs_mntent.c
+		   svc_socket.c cacheio.c closeall.c nfs_mntent.c
 
 MAINTAINERCLEANFILES = Makefile.in
 
support/nfs/fstab.c deleted +0 -554

554 lines not on this page · raw message

utils/mount/Makefile.am +2 -2
index be83e2c..a5d7292 100644
@@ -9,10 +9,10 @@ man5_MANS	= nfs.man
 
 sbin_PROGRAMS	= mount.nfs
 EXTRA_DIST = nfsmount.x $(man8_MANS) $(man5_MANS)
-mount_nfs_SOURCES = mount.c error.c network.c \
+mount_nfs_SOURCES = mount.c error.c network.c fstab.c \
 		    nfsmount.c nfs4mount.c \
 		    nfsumount.c \
-		    mount_constants.h error.h network.h \
+		    mount_constants.h error.h network.h fstab.h \
 		    nfs4_mount.h nfs_mount4.h
 
 mount_nfs_LDADD = ../../support/nfs/libnfs.a \
utils/mount/fstab.c new file +554 -0

554 lines not on this page · raw message

utils/mount/fstab.h new file +30 -0
new file mode 100644
index 0000000..64c8355
@@ -0,0 +1,30 @@
+#ifndef _NFS_FSTAB_H
+#define _NFS_FSTAB_H
+
+#include "nfs_mntent.h"
+
+#ifndef _PATH_FSTAB
+#define _PATH_FSTAB "/etc/fstab"
+#endif
+
+int mtab_is_writable(void);
+int mtab_does_not_exist(void);
+
+struct mntentchn {
+	struct mntentchn *nxt, *prev;
+	struct mntent m;
+};
+
+struct mntentchn *getmntoptfile (const char *file);
+struct mntentchn *getmntdirbackward (const char *dir, struct mntentchn *mc);
+struct mntentchn *getmntdevbackward (const char *dev, struct mntentchn *mc);
+
+struct mntentchn *getfsfile (const char *file);
+struct mntentchn *getfsspec (const char *spec);
+
+void lock_mtab (void);
+void unlock_mtab (void);
+void update_mtab (const char *special, struct mntent *with);
+
+#endif /* _NFS_FSTAB_H */
+

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs