diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-07-16 16:29:01 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-07-20 16:10:55 +1000 |
commit | 14f4a50b4b51bc4bdf56cfd43d8ae598579c4e6d (patch) | |
tree | b664579f2051c2f7bb3d141e91ccbf7c4fb53546 /utils/mount/nfs4mount.c | |
parent | c0f7366f3ae8de8a62e3cc6824080e02e780f3b2 (diff) | |
download | nfs-utils-14f4a50b4b51bc4bdf56cfd43d8ae598579c4e6d.tar.gz nfs-utils-14f4a50b4b51bc4bdf56cfd43d8ae598579c4e6d.tar.xz nfs-utils-14f4a50b4b51bc4bdf56cfd43d8ae598579c4e6d.zip |
mount.nfs: No need to return nfs_mount_data structs
Refactor mount processing slightly to remove an output parameter and an
unnecessary type cast. The mount syscall is now made from inside
nfs_mount or nfs4mount, rather than in common code after those are called.
Code review suggests that EX_BG was never returned by mount.nfs because the
logic I just replaced was always returning EX_FAIL. The new logic should
properly return EX_BG when appropriate.
However, it is unclear whether /bin/mount handles backgrounding the mount
request, or whether mount.nfs should.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/nfs4mount.c')
-rw-r--r-- | utils/mount/nfs4mount.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c index cc6eaf2..a0a1cab 100644 --- a/utils/mount/nfs4mount.c +++ b/utils/mount/nfs4mount.c @@ -25,6 +25,7 @@ #include <netdb.h> #include <time.h> #include <sys/stat.h> +#include <sys/mount.h> #include <netinet/in.h> #include <arpa/inet.h> #include <rpc/auth.h> @@ -41,6 +42,7 @@ #include "conn.h" #include "xcommon.h" +#include "mount_constants.h" #include "nfs4_mount.h" #include "nfs_mount.h" #include "error.h" @@ -166,8 +168,7 @@ static int get_my_ipv4addr(char *ip_addr, int len) } int nfs4mount(const char *spec, const char *node, int *flags, - char **extra_opts, char **mount_opts, - int running_bg) + char **extra_opts, int running_bg, int fake) { static struct nfs4_mount_data data; static char hostdir[1024]; @@ -441,8 +442,14 @@ int nfs4mount(const char *spec, const char *node, int *flags, continue; } - *mount_opts = (char *) &data; - /* clean up */ + if (!fake) { + if (mount(spec, node, "nfs4", + *flags & ~(MS_USER|MS_USERS), &data)) { + mount_error(spec, node, errno); + goto fail; + } + } + return 0; fail: |