diff options
Diffstat (limited to 'fs/nfs/mount_clnt.c')
-rw-r--r-- | fs/nfs/mount_clnt.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 2892ec843066..ee4899d96629 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/nfs_fs.h> | 18 | #include <linux/nfs_fs.h> |
19 | 19 | ||
20 | #ifdef RPC_DEBUG | 20 | #ifdef RPC_DEBUG |
21 | # define NFSDBG_FACILITY NFSDBG_ROOT | 21 | # define NFSDBG_FACILITY NFSDBG_MOUNT |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | /* | 24 | /* |
@@ -28,7 +28,6 @@ | |||
28 | #define MOUNT_UMNT 3 | 28 | #define MOUNT_UMNT 3 |
29 | */ | 29 | */ |
30 | 30 | ||
31 | static struct rpc_clnt * mnt_create(struct sockaddr_in *, int, int); | ||
32 | static struct rpc_program mnt_program; | 31 | static struct rpc_program mnt_program; |
33 | 32 | ||
34 | struct mnt_fhstatus { | 33 | struct mnt_fhstatus { |
@@ -36,14 +35,21 @@ struct mnt_fhstatus { | |||
36 | struct nfs_fh * fh; | 35 | struct nfs_fh * fh; |
37 | }; | 36 | }; |
38 | 37 | ||
39 | /* | 38 | /** |
40 | * Obtain an NFS file handle for the given host and path | 39 | * nfs_mount - Obtain an NFS file handle for the given host and path |
40 | * @addr: pointer to server's address | ||
41 | * @len: size of server's address | ||
42 | * @hostname: name of server host, or NULL | ||
43 | * @path: pointer to string containing export path to mount | ||
44 | * @version: mount version to use for this request | ||
45 | * @protocol: transport protocol to use for thie request | ||
46 | * @fh: pointer to location to place returned file handle | ||
47 | * | ||
48 | * Uses default timeout parameters specified by underlying transport. | ||
41 | */ | 49 | */ |
42 | int | 50 | int nfs_mount(struct sockaddr *addr, size_t len, char *hostname, char *path, |
43 | nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, | 51 | int version, int protocol, struct nfs_fh *fh) |
44 | int version, int protocol) | ||
45 | { | 52 | { |
46 | struct rpc_clnt *mnt_clnt; | ||
47 | struct mnt_fhstatus result = { | 53 | struct mnt_fhstatus result = { |
48 | .fh = fh | 54 | .fh = fh |
49 | }; | 55 | }; |
@@ -51,12 +57,23 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, | |||
51 | .rpc_argp = path, | 57 | .rpc_argp = path, |
52 | .rpc_resp = &result, | 58 | .rpc_resp = &result, |
53 | }; | 59 | }; |
60 | struct rpc_create_args args = { | ||
61 | .protocol = protocol, | ||
62 | .address = addr, | ||
63 | .addrsize = len, | ||
64 | .servername = hostname, | ||
65 | .program = &mnt_program, | ||
66 | .version = version, | ||
67 | .authflavor = RPC_AUTH_UNIX, | ||
68 | .flags = RPC_CLNT_CREATE_INTR, | ||
69 | }; | ||
70 | struct rpc_clnt *mnt_clnt; | ||
54 | int status; | 71 | int status; |
55 | 72 | ||
56 | dprintk("NFS: nfs_mount(%08x:%s)\n", | 73 | dprintk("NFS: sending MNT request for %s:%s\n", |
57 | (unsigned)ntohl(addr->sin_addr.s_addr), path); | 74 | (hostname ? hostname : "server"), path); |
58 | 75 | ||
59 | mnt_clnt = mnt_create(addr, version, protocol); | 76 | mnt_clnt = rpc_create(&args); |
60 | if (IS_ERR(mnt_clnt)) | 77 | if (IS_ERR(mnt_clnt)) |
61 | return PTR_ERR(mnt_clnt); | 78 | return PTR_ERR(mnt_clnt); |
62 | 79 | ||
@@ -70,22 +87,6 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh, | |||
70 | return status < 0? status : (result.status? -EACCES : 0); | 87 | return status < 0? status : (result.status? -EACCES : 0); |
71 | } | 88 | } |
72 | 89 | ||
73 | static struct rpc_clnt *mnt_create(struct sockaddr_in *srvaddr, int version, | ||
74 | int protocol) | ||
75 | { | ||
76 | struct rpc_create_args args = { | ||
77 | .protocol = protocol, | ||
78 | .address = (struct sockaddr *)srvaddr, | ||
79 | .addrsize = sizeof(*srvaddr), | ||
80 | .program = &mnt_program, | ||
81 | .version = version, | ||
82 | .authflavor = RPC_AUTH_UNIX, | ||
83 | .flags = RPC_CLNT_CREATE_INTR, | ||
84 | }; | ||
85 | |||
86 | return rpc_create(&args); | ||
87 | } | ||
88 | |||
89 | /* | 90 | /* |
90 | * XDR encode/decode functions for MOUNT | 91 | * XDR encode/decode functions for MOUNT |
91 | */ | 92 | */ |