Commit e558100f authored by David Howells's avatar David Howells Committed by Anna Schumaker

NFS: Do some tidying of the parsing code

Do some tidying of the parsing code, including:

 (*) Returning 0/error rather than true/false.

 (*) Putting the nfs_fs_context pointer first in some arg lists.

 (*) Unwrap some lines that will now fit on one line.

 (*) Provide unioned sockaddr/sockaddr_storage fields to avoid casts.

 (*) nfs_parse_devname() can paste its return values directly into the
     nfs_fs_context struct as that's where the caller puts them.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 48be8a66
This diff is collapsed.
...@@ -82,11 +82,11 @@ struct nfs_client_initdata { ...@@ -82,11 +82,11 @@ struct nfs_client_initdata {
* In-kernel mount arguments * In-kernel mount arguments
*/ */
struct nfs_fs_context { struct nfs_fs_context {
int flags; unsigned int flags; /* NFS{,4}_MOUNT_* flags */
unsigned int rsize, wsize; unsigned int rsize, wsize;
unsigned int timeo, retrans; unsigned int timeo, retrans;
unsigned int acregmin, acregmax, unsigned int acregmin, acregmax;
acdirmin, acdirmax; unsigned int acdirmin, acdirmax;
unsigned int namlen; unsigned int namlen;
unsigned int options; unsigned int options;
unsigned int bsize; unsigned int bsize;
...@@ -102,7 +102,10 @@ struct nfs_fs_context { ...@@ -102,7 +102,10 @@ struct nfs_fs_context {
bool sloppy; bool sloppy;
struct { struct {
struct sockaddr_storage address; union {
struct sockaddr address;
struct sockaddr_storage _address;
};
size_t addrlen; size_t addrlen;
char *hostname; char *hostname;
u32 version; u32 version;
...@@ -111,7 +114,10 @@ struct nfs_fs_context { ...@@ -111,7 +114,10 @@ struct nfs_fs_context {
} mount_server; } mount_server;
struct { struct {
struct sockaddr_storage address; union {
struct sockaddr address;
struct sockaddr_storage _address;
};
size_t addrlen; size_t addrlen;
char *hostname; char *hostname;
char *export_path; char *export_path;
......
...@@ -816,7 +816,7 @@ static int nfs_request_mount(struct nfs_fs_context *cfg, ...@@ -816,7 +816,7 @@ static int nfs_request_mount(struct nfs_fs_context *cfg,
/* /*
* Construct the mount server's address. * Construct the mount server's address.
*/ */
if (cfg->mount_server.address.ss_family == AF_UNSPEC) { if (cfg->mount_server.address.sa_family == AF_UNSPEC) {
memcpy(request.sap, &cfg->nfs_server.address, memcpy(request.sap, &cfg->nfs_server.address,
cfg->nfs_server.addrlen); cfg->nfs_server.addrlen);
cfg->mount_server.addrlen = cfg->nfs_server.addrlen; cfg->mount_server.addrlen = cfg->nfs_server.addrlen;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment