diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-01-15 16:04:20 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:06:07 -0500 |
commit | 883bb163f84e0a54b29846c61621f52db3f27393 (patch) | |
tree | ea11b2d1ba85cbb4422ae7ff615d6d186d709af1 /fs | |
parent | 1093a60ef34bb12010fe7ea4b780bee1c57cfbbe (diff) |
NLM: Introduce an arguments structure for nlmclnt_init()
Clean up: pass 5 arguments to nlmclnt_init() in a structure similar to the
new nfs_client_initdata structure.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/lockd/clntlock.c | 22 | ||||
-rw-r--r-- | fs/nfs/client.c | 17 |
2 files changed, 18 insertions, 21 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 9a8f4f45c19e..0b45fd3a4bfd 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -43,31 +43,25 @@ static LIST_HEAD(nlm_blocked); | |||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * nlmclnt_init - Set up per-NFS mount point lockd data structures | 45 | * nlmclnt_init - Set up per-NFS mount point lockd data structures |
46 | * @server_name: server's hostname | 46 | * @nlm_init: pointer to arguments structure |
47 | * @server_address: server's network address | ||
48 | * @server_addrlen: length of server's address | ||
49 | * @protocol: transport protocol lockd should use | ||
50 | * @nfs_version: NFS protocol version for this mount point | ||
51 | * | 47 | * |
52 | * Returns pointer to an appropriate nlm_host struct, | 48 | * Returns pointer to an appropriate nlm_host struct, |
53 | * or an ERR_PTR value. | 49 | * or an ERR_PTR value. |
54 | */ | 50 | */ |
55 | struct nlm_host *nlmclnt_init(const char *server_name, | 51 | struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init) |
56 | const struct sockaddr *server_address, | ||
57 | size_t server_addrlen, | ||
58 | unsigned short protocol, u32 nfs_version) | ||
59 | { | 52 | { |
60 | struct nlm_host *host; | 53 | struct nlm_host *host; |
61 | u32 nlm_version = (nfs_version == 2) ? 1 : 4; | 54 | u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4; |
62 | int status; | 55 | int status; |
63 | 56 | ||
64 | status = lockd_up(protocol); | 57 | status = lockd_up(nlm_init->protocol); |
65 | if (status < 0) | 58 | if (status < 0) |
66 | return ERR_PTR(status); | 59 | return ERR_PTR(status); |
67 | 60 | ||
68 | host = nlmclnt_lookup_host((struct sockaddr_in *)server_address, | 61 | host = nlmclnt_lookup_host((struct sockaddr_in *)nlm_init->address, |
69 | protocol, nlm_version, | 62 | nlm_init->protocol, nlm_version, |
70 | server_name, strlen(server_name)); | 63 | nlm_init->hostname, |
64 | strlen(nlm_init->hostname)); | ||
71 | if (host == NULL) { | 65 | if (host == NULL) { |
72 | lockd_down(); | 66 | lockd_down(); |
73 | return ERR_PTR(-ENOLCK); | 67 | return ERR_PTR(-ENOLCK); |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 0b3ce86f6fc9..7a15832369e9 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -468,18 +468,21 @@ static int nfs_start_lockd(struct nfs_server *server) | |||
468 | { | 468 | { |
469 | struct nlm_host *host; | 469 | struct nlm_host *host; |
470 | struct nfs_client *clp = server->nfs_client; | 470 | struct nfs_client *clp = server->nfs_client; |
471 | u32 nfs_version = clp->rpc_ops->version; | 471 | struct nlmclnt_initdata nlm_init = { |
472 | unsigned short protocol = server->flags & NFS_MOUNT_TCP ? | 472 | .hostname = clp->cl_hostname, |
473 | IPPROTO_TCP : IPPROTO_UDP; | 473 | .address = (struct sockaddr *)&clp->cl_addr, |
474 | .addrlen = clp->cl_addrlen, | ||
475 | .protocol = server->flags & NFS_MOUNT_TCP ? | ||
476 | IPPROTO_TCP : IPPROTO_UDP, | ||
477 | .nfs_version = clp->rpc_ops->version, | ||
478 | }; | ||
474 | 479 | ||
475 | if (nfs_version > 3) | 480 | if (nlm_init.nfs_version > 3) |
476 | return 0; | 481 | return 0; |
477 | if (server->flags & NFS_MOUNT_NONLM) | 482 | if (server->flags & NFS_MOUNT_NONLM) |
478 | return 0; | 483 | return 0; |
479 | 484 | ||
480 | host = nlmclnt_init(clp->cl_hostname, | 485 | host = nlmclnt_init(&nlm_init); |
481 | (struct sockaddr *)&clp->cl_addr, | ||
482 | clp->cl_addrlen, protocol, nfs_version); | ||
483 | if (IS_ERR(host)) | 486 | if (IS_ERR(host)) |
484 | return PTR_ERR(host); | 487 | return PTR_ERR(host); |
485 | 488 | ||