aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/mount_clnt.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-07-01 12:13:22 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:46 -0400
commit43780b87fa799ae65df11d89d4539d8d6a7c67eb (patch)
tree46fce452807c8672af77666bb03cab5ff4191e94 /fs/nfs/mount_clnt.c
parent45160d6275814e0c86206e6981f0b92c61a50a21 (diff)
SUNRPC: Add a convenient default for the hostname when calling rpc_create()
A couple of callers just use a stringified IP address for the rpc client's hostname. Move the logic for constructing this into rpc_create(), so it can be shared. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/mount_clnt.c')
-rw-r--r--fs/nfs/mount_clnt.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 878d7a5cb6d4..2892ec843066 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -28,8 +28,7 @@
28#define MOUNT_UMNT 3 28#define MOUNT_UMNT 3
29 */ 29 */
30 30
31static struct rpc_clnt * mnt_create(char *, struct sockaddr_in *, 31static struct rpc_clnt * mnt_create(struct sockaddr_in *, int, int);
32 int, int);
33static struct rpc_program mnt_program; 32static struct rpc_program mnt_program;
34 33
35struct mnt_fhstatus { 34struct mnt_fhstatus {
@@ -52,14 +51,12 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh,
52 .rpc_argp = path, 51 .rpc_argp = path,
53 .rpc_resp = &result, 52 .rpc_resp = &result,
54 }; 53 };
55 char hostname[32];
56 int status; 54 int status;
57 55
58 dprintk("NFS: nfs_mount(%08x:%s)\n", 56 dprintk("NFS: nfs_mount(%08x:%s)\n",
59 (unsigned)ntohl(addr->sin_addr.s_addr), path); 57 (unsigned)ntohl(addr->sin_addr.s_addr), path);
60 58
61 sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(addr->sin_addr.s_addr)); 59 mnt_clnt = mnt_create(addr, version, protocol);
62 mnt_clnt = mnt_create(hostname, addr, version, protocol);
63 if (IS_ERR(mnt_clnt)) 60 if (IS_ERR(mnt_clnt))
64 return PTR_ERR(mnt_clnt); 61 return PTR_ERR(mnt_clnt);
65 62
@@ -73,15 +70,13 @@ nfsroot_mount(struct sockaddr_in *addr, char *path, struct nfs_fh *fh,
73 return status < 0? status : (result.status? -EACCES : 0); 70 return status < 0? status : (result.status? -EACCES : 0);
74} 71}
75 72
76static struct rpc_clnt * 73static struct rpc_clnt *mnt_create(struct sockaddr_in *srvaddr, int version,
77mnt_create(char *hostname, struct sockaddr_in *srvaddr, int version, 74 int protocol)
78 int protocol)
79{ 75{
80 struct rpc_create_args args = { 76 struct rpc_create_args args = {
81 .protocol = protocol, 77 .protocol = protocol,
82 .address = (struct sockaddr *)srvaddr, 78 .address = (struct sockaddr *)srvaddr,
83 .addrsize = sizeof(*srvaddr), 79 .addrsize = sizeof(*srvaddr),
84 .servername = hostname,
85 .program = &mnt_program, 80 .program = &mnt_program,
86 .version = version, 81 .version = version,
87 .authflavor = RPC_AUTH_UNIX, 82 .authflavor = RPC_AUTH_UNIX,