Skip to contentSkip to conversation

mount.nfs: Change *flags to flags

PATCH In review Chuck Lever 2 participants 3 messages Jul 16, 2007

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

PATCH 12/17 mount.nfs: Change *flags to flags

It's not necessary to treat the *flags parameter to nfsmount and nfs4mount as an output parameter. Nothing is passed back. Replace it with a normal call-by-value.

---

 utils/mount/mount.c      |    4 ++--
 utils/mount/nfs4_mount.h |    2 +-
 utils/mount/nfs4mount.c  |    4 ++--
 utils/mount/nfs_mount.h  |    2 +-
 utils/mount/nfsmount.c   |    6 +++---
 5 files changed, 9 insertions(+), 9 deletions(-)
utils/mount/mount.c +2 -2
index bc2e53a..3f869ee 100644
@@ -467,9 +467,9 @@ int main(int argc, char *argv[])
 		exit(EX_FAIL);
 
 	if (!strcmp(fs_type, "nfs4"))
-		mnt_err = nfs4mount(spec, mount_point, &flags, &extra_opts, 0, fake);
+		mnt_err = nfs4mount(spec, mount_point, flags, &extra_opts, 0, fake);
 	else
-		mnt_err = nfsmount(spec, mount_point, &flags, &extra_opts, 0, fake);
+		mnt_err = nfsmount(spec, mount_point, flags, &extra_opts, 0, fake);
 
 	if (mnt_err)
 		exit(EX_FAIL);
utils/mount/nfs4_mount.h +1 -1
index 921739b..b03792e 100644
@@ -68,6 +68,6 @@ struct nfs4_mount_data {
 #define NFS4_MOUNT_UNSHARED	0x8000	/* 5 */
 #define NFS4_MOUNT_FLAGMASK	0xFFFF
 
-int nfs4mount(const char *, const char *, int *, char **, int, int);
+int nfs4mount(const char *, const char *, int, char **, int, int);
 
 #endif
utils/mount/nfs4mount.c +2 -2
index c8fa0de..2c85db9 100644
@@ -167,7 +167,7 @@ static int get_my_ipv4addr(char *ip_addr, int len)
 	return 0;
 }
 
-int nfs4mount(const char *spec, const char *node, int *flags,
+int nfs4mount(const char *spec, const char *node, int flags,
 	      char **extra_opts, int running_bg, int fake)
 {
 	static struct nfs4_mount_data data;
@@ -444,7 +444,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
 
 	if (!fake) {
 		if (mount(spec, node, "nfs4",
-				*flags & ~(MS_USER|MS_USERS), &data)) {
+				flags & ~(MS_USER|MS_USERS), &data)) {
 			mount_error(spec, node, errno);
 			goto fail;
 		}
utils/mount/nfs_mount.h +1 -1
index 169f12e..8c46ce2 100644
@@ -80,6 +80,6 @@ struct nfs_mount_data {
 #define AUTH_GSS_SPKMP		390011
 #endif
 
-int nfsmount(const char *, const char *, int *, char **, int, int);
+int nfsmount(const char *, const char *, int , char **, int, int);
 
 #endif /* _NFS_MOUNT_H */
utils/mount/nfsmount.c +3 -3
index 4ce8a4e..74b5f93 100644
@@ -486,7 +486,7 @@ out_bad:
 }
 
 int
-nfsmount(const char *spec, const char *node, int *flags,
+nfsmount(const char *spec, const char *node, int flags,
 	 char **extra_opts, int running_bg, int fake)
 {
 	static char *prev_bg_host;
@@ -618,7 +618,7 @@ nfsmount(const char *spec, const char *node, int *flags,
 
 	data.version = nfs_mount_data_version;
 
-	if (*flags & MS_REMOUNT)
+	if (flags & MS_REMOUNT)
 		goto out_ok;
 
 	/*
@@ -862,7 +862,7 @@ noauth_flavors:
 
 	if (!fake) {
 		if (mount(spec, node, "nfs",
-				*flags & ~(MS_USER|MS_USERS), &data)) {
+				flags & ~(MS_USER|MS_USERS), &data)) {
 			mount_error(spec, node, errno);
 			goto fail;
 		}

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw
Quoted 3 lines · On Sunday July 15, [email protected] wrote:

It's not necessary to treat the *flags parameter to nfsmount and nfs4mount as an output parameter. Nothing is passed back. Replace it with a normal call-by-value.

And, in fact, very little is passed forward.
nfs4mount doesn't use 'flags' at all... maybe it should? nfsmount uses it for one thing - checking in MS_REMOUNT was set. So maybe we should change the name to 'remount' and pass down 'flags & MS_REMOUNT' ??

Most of the stuff the nfsmount doesn't do if MS_REMOUNT is talking to mountd which obviously is not relevant for NFSv4. But NFSv4 still tries to ping the server... Should that be excluded in MS_REMOUNT is set, do you think?

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw
Quoted 10 lines · Neil Brown
Quoted 3 lines · On Sunday July 15, [email protected] wrote:

It's not necessary to treat the *flags parameter to nfsmount and nfs4mount as an output parameter. Nothing is passed back. Replace it with a normal call-by-value.

And, in fact, very little is passed forward.
nfs4mount doesn't use 'flags' at all... maybe it should? nfsmount uses it for one thing - checking in MS_REMOUNT was set. So maybe we should change the name to 'remount' and pass down 'flags & MS_REMOUNT' ??

The earlier patch to move the mount system call into nfsmount.c will need the whole set of flags. Likewise for nfs4mount.c.

Note this is also why MS_USER and MS_USERS need to be moved into mount_constants.h ! ;-)

Quoted 4 lines

Most of the stuff the nfsmount doesn't do if MS_REMOUNT is talking to mountd which obviously is not relevant for NFSv4. But NFSv4 still tries to ping the server... Should that be excluded in MS_REMOUNT is set, do you think?

I can take a look at that as a separate clean up.

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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