Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0076d7b7bab580ca2e94637d351fa7cd357743a8
Commit:     0076d7b7bab580ca2e94637d351fa7cd357743a8
Parent:     bf0fd7680f1cf31b9cbabcc037a204548e2c866d
Author:     Chuck Lever <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 1 12:13:49 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 23:40:47 2007 -0400

    NFS: Introduce generic mount client API
    
    For NFSv2 and v3 mounts, the first step is to contact the server's MOUNTD
    and request the file handle for the root of the mounted share.  Add a
    function to the NFS client that handles this operation.
    
    Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/super.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 7e56411..48db52a 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -992,6 +992,63 @@ out_unknown:
 }
 
 /*
+ * Use the remote server's MOUNT service to request the NFS file handle
+ * corresponding to the provided path.
+ */
+static int nfs_try_mount(struct nfs_parsed_mount_data *args,
+                        struct nfs_fh *root_fh)
+{
+       struct sockaddr_in sin;
+       int status;
+
+       if (args->mount_server.version == 0) {
+               if (args->flags & NFS_MOUNT_VER3)
+                       args->mount_server.version = NFS_MNT3_VERSION;
+               else
+                       args->mount_server.version = NFS_MNT_VERSION;
+       }
+
+       /*
+        * Construct the mount server's address.
+        */
+       if (args->mount_server.address.sin_addr.s_addr != INADDR_ANY)
+               sin = args->mount_server.address;
+       else
+               sin = args->nfs_server.address;
+       if (args->mount_server.port == 0) {
+               status = rpcb_getport_sync(&sin,
+                                          args->mount_server.program,
+                                          args->mount_server.version,
+                                          args->mount_server.protocol);
+               if (status < 0)
+                       goto out_err;
+               sin.sin_port = htons(status);
+       } else
+               sin.sin_port = htons(args->mount_server.port);
+
+       /*
+        * Now ask the mount server to map our export path
+        * to a file handle.
+        */
+       status = nfs_mount((struct sockaddr *) &sin,
+                          sizeof(sin),
+                          args->nfs_server.hostname,
+                          args->nfs_server.export_path,
+                          args->mount_server.version,
+                          args->mount_server.protocol,
+                          root_fh);
+       if (status < 0)
+               goto out_err;
+
+       return status;
+
+out_err:
+       dfprintk(MOUNT, "NFS: unable to contact server on host "
+                NIPQUAD_FMT "\n", NIPQUAD(sin.sin_addr.s_addr));
+       return status;
+}
+
+/*
  * Validate the NFS2/NFS3 mount data
  * - fills in the mount root filehandle
  */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to