Merge commit 'v2.6.30' into for-2.6.31
[safe/jmp/linux-2.6] / fs / nfs / mount_clnt.c
index 779d2eb..ca905a5 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/sunrpc/clnt.h>
 #include <linux/sunrpc/sched.h>
 #include <linux/nfs_fs.h>
+#include "internal.h"
 
 #ifdef RPC_DEBUG
 # define NFSDBG_FACILITY       NFSDBG_MOUNT
@@ -28,47 +29,43 @@ struct mnt_fhstatus {
 
 /**
  * nfs_mount - Obtain an NFS file handle for the given host and path
- * @addr: pointer to server's address
- * @len: size of server's address
- * @hostname: name of server host, or NULL
- * @path: pointer to string containing export path to mount
- * @version: mount version to use for this request
- * @protocol: transport protocol to use for thie request
- * @fh: pointer to location to place returned file handle
+ * @info: pointer to mount request arguments
  *
  * Uses default timeout parameters specified by underlying transport.
  */
-int nfs_mount(struct sockaddr *addr, size_t len, char *hostname, char *path,
-             int version, int protocol, struct nfs_fh *fh)
+int nfs_mount(struct nfs_mount_request *info)
 {
        struct mnt_fhstatus     result = {
-               .fh             = fh
+               .fh             = info->fh
        };
        struct rpc_message msg  = {
-               .rpc_argp       = path,
+               .rpc_argp       = info->dirpath,
                .rpc_resp       = &result,
        };
        struct rpc_create_args args = {
-               .protocol       = protocol,
-               .address        = addr,
-               .addrsize       = len,
-               .servername     = hostname,
+               .protocol       = info->protocol,
+               .address        = info->sap,
+               .addrsize       = info->salen,
+               .servername     = info->hostname,
                .program        = &mnt_program,
-               .version        = version,
+               .version        = info->version,
                .authflavor     = RPC_AUTH_UNIX,
-               .flags          = 0,
        };
        struct rpc_clnt         *mnt_clnt;
        int                     status;
 
        dprintk("NFS: sending MNT request for %s:%s\n",
-               (hostname ? hostname : "server"), path);
+               (info->hostname ? info->hostname : "server"),
+                       info->dirpath);
+
+       if (info->noresvport)
+               args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
 
        mnt_clnt = rpc_create(&args);
        if (IS_ERR(mnt_clnt))
                goto out_clnt_err;
 
-       if (version == NFS_MNT3_VERSION)
+       if (info->version == NFS_MNT3_VERSION)
                msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC3_MNT];
        else
                msg.rpc_proc = &mnt_clnt->cl_procinfo[MNTPROC_MNT];
@@ -98,7 +95,7 @@ out_call_err:
 
 out_mnt_err:
        dprintk("NFS: MNT server returned result %d\n", result.status);
-       status = -EACCES;
+       status = nfs_stat_to_errno(result.status);
        goto out;
 }