aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/internal.h19
-rw-r--r--fs/nfs/nfs4namespace.c2
-rw-r--r--fs/nfs/super.c6
3 files changed, 4 insertions, 23 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index cf1da3e22004..c2f171a3d70e 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -368,22 +368,3 @@ unsigned int nfs_page_array_len(unsigned int base, size_t len)
368 return ((unsigned long)len + (unsigned long)base + 368 return ((unsigned long)len + (unsigned long)base +
369 PAGE_SIZE - 1) >> PAGE_SHIFT; 369 PAGE_SIZE - 1) >> PAGE_SHIFT;
370} 370}
371
372/*
373 * Set the port number in an address. Be agnostic about the address
374 * family.
375 */
376static inline void nfs_set_port(struct sockaddr *sap, unsigned short port)
377{
378 struct sockaddr_in *ap = (struct sockaddr_in *)sap;
379 struct sockaddr_in6 *ap6 = (struct sockaddr_in6 *)sap;
380
381 switch (sap->sa_family) {
382 case AF_INET:
383 ap->sin_port = htons(port);
384 break;
385 case AF_INET6:
386 ap6->sin6_port = htons(port);
387 break;
388 }
389}
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 43c86b7556e1..ef22ee89aa77 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -125,7 +125,7 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
125 mountdata->addr, mountdata->addrlen); 125 mountdata->addr, mountdata->addrlen);
126 if (mountdata->addrlen == 0) 126 if (mountdata->addrlen == 0)
127 continue; 127 continue;
128 nfs_set_port(mountdata->addr, NFS_PORT); 128 rpc_set_port(mountdata->addr, NFS_PORT);
129 129
130 memcpy(page2, buf->data, buf->len); 130 memcpy(page2, buf->data, buf->len);
131 page2[buf->len] = '\0'; 131 page2[buf->len] = '\0';
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 1eeba8e53802..9c85cdb353aa 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1409,7 +1409,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
1409 /* 1409 /*
1410 * autobind will be used if mount_server.port == 0 1410 * autobind will be used if mount_server.port == 0
1411 */ 1411 */
1412 nfs_set_port(request.sap, args->mount_server.port); 1412 rpc_set_port(request.sap, args->mount_server.port);
1413 1413
1414 /* 1414 /*
1415 * Now ask the mount server to map our export path 1415 * Now ask the mount server to map our export path
@@ -1703,7 +1703,7 @@ static int nfs_validate_mount_data(void *options,
1703 &args->nfs_server.address)) 1703 &args->nfs_server.address))
1704 goto out_no_address; 1704 goto out_no_address;
1705 1705
1706 nfs_set_port((struct sockaddr *)&args->nfs_server.address, 1706 rpc_set_port((struct sockaddr *)&args->nfs_server.address,
1707 args->nfs_server.port); 1707 args->nfs_server.port);
1708 1708
1709 nfs_set_mount_transport_protocol(args); 1709 nfs_set_mount_transport_protocol(args);
@@ -2336,7 +2336,7 @@ static int nfs4_validate_mount_data(void *options,
2336 &args->nfs_server.address)) 2336 &args->nfs_server.address))
2337 return -EINVAL; 2337 return -EINVAL;
2338 2338
2339 nfs_set_port((struct sockaddr *)&args->nfs_server.address, 2339 rpc_set_port((struct sockaddr *)&args->nfs_server.address,
2340 args->nfs_server.port); 2340 args->nfs_server.port);
2341 2341
2342 nfs_validate_transport_protocol(args); 2342 nfs_validate_transport_protocol(args);