NFS: rename nfs_fs_context pointer arg in a few functions
Split out from commit "NFS: Add fs_context support." Rename cfg to ctx in nfs_init_server(), nfs_verify_authflavors(), and nfs_request_mount(). No functional changes. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
e558100fda
commit
38465f5d1a
|
@ -658,28 +658,28 @@ EXPORT_SYMBOL_GPL(nfs_init_client);
|
||||||
* Create a version 2 or 3 client
|
* Create a version 2 or 3 client
|
||||||
*/
|
*/
|
||||||
static int nfs_init_server(struct nfs_server *server,
|
static int nfs_init_server(struct nfs_server *server,
|
||||||
const struct nfs_fs_context *cfg,
|
const struct nfs_fs_context *ctx,
|
||||||
struct nfs_subversion *nfs_mod)
|
struct nfs_subversion *nfs_mod)
|
||||||
{
|
{
|
||||||
struct rpc_timeout timeparms;
|
struct rpc_timeout timeparms;
|
||||||
struct nfs_client_initdata cl_init = {
|
struct nfs_client_initdata cl_init = {
|
||||||
.hostname = cfg->nfs_server.hostname,
|
.hostname = ctx->nfs_server.hostname,
|
||||||
.addr = (const struct sockaddr *)&cfg->nfs_server.address,
|
.addr = (const struct sockaddr *)&ctx->nfs_server.address,
|
||||||
.addrlen = cfg->nfs_server.addrlen,
|
.addrlen = ctx->nfs_server.addrlen,
|
||||||
.nfs_mod = nfs_mod,
|
.nfs_mod = nfs_mod,
|
||||||
.proto = cfg->nfs_server.protocol,
|
.proto = ctx->nfs_server.protocol,
|
||||||
.net = cfg->net,
|
.net = ctx->net,
|
||||||
.timeparms = &timeparms,
|
.timeparms = &timeparms,
|
||||||
.cred = server->cred,
|
.cred = server->cred,
|
||||||
.nconnect = cfg->nfs_server.nconnect,
|
.nconnect = ctx->nfs_server.nconnect,
|
||||||
.init_flags = (1UL << NFS_CS_REUSEPORT),
|
.init_flags = (1UL << NFS_CS_REUSEPORT),
|
||||||
};
|
};
|
||||||
struct nfs_client *clp;
|
struct nfs_client *clp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
nfs_init_timeout_values(&timeparms, cfg->nfs_server.protocol,
|
nfs_init_timeout_values(&timeparms, ctx->nfs_server.protocol,
|
||||||
cfg->timeo, cfg->retrans);
|
ctx->timeo, ctx->retrans);
|
||||||
if (cfg->flags & NFS_MOUNT_NORESVPORT)
|
if (ctx->flags & NFS_MOUNT_NORESVPORT)
|
||||||
set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);
|
set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);
|
||||||
|
|
||||||
/* Allocate or find a client reference we can use */
|
/* Allocate or find a client reference we can use */
|
||||||
|
@ -690,46 +690,46 @@ static int nfs_init_server(struct nfs_server *server,
|
||||||
server->nfs_client = clp;
|
server->nfs_client = clp;
|
||||||
|
|
||||||
/* Initialise the client representation from the mount data */
|
/* Initialise the client representation from the mount data */
|
||||||
server->flags = cfg->flags;
|
server->flags = ctx->flags;
|
||||||
server->options = cfg->options;
|
server->options = ctx->options;
|
||||||
server->caps |= NFS_CAP_HARDLINKS|NFS_CAP_SYMLINKS|NFS_CAP_FILEID|
|
server->caps |= NFS_CAP_HARDLINKS|NFS_CAP_SYMLINKS|NFS_CAP_FILEID|
|
||||||
NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER|NFS_CAP_OWNER_GROUP|
|
NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER|NFS_CAP_OWNER_GROUP|
|
||||||
NFS_CAP_ATIME|NFS_CAP_CTIME|NFS_CAP_MTIME;
|
NFS_CAP_ATIME|NFS_CAP_CTIME|NFS_CAP_MTIME;
|
||||||
|
|
||||||
if (cfg->rsize)
|
if (ctx->rsize)
|
||||||
server->rsize = nfs_block_size(cfg->rsize, NULL);
|
server->rsize = nfs_block_size(ctx->rsize, NULL);
|
||||||
if (cfg->wsize)
|
if (ctx->wsize)
|
||||||
server->wsize = nfs_block_size(cfg->wsize, NULL);
|
server->wsize = nfs_block_size(ctx->wsize, NULL);
|
||||||
|
|
||||||
server->acregmin = cfg->acregmin * HZ;
|
server->acregmin = ctx->acregmin * HZ;
|
||||||
server->acregmax = cfg->acregmax * HZ;
|
server->acregmax = ctx->acregmax * HZ;
|
||||||
server->acdirmin = cfg->acdirmin * HZ;
|
server->acdirmin = ctx->acdirmin * HZ;
|
||||||
server->acdirmax = cfg->acdirmax * HZ;
|
server->acdirmax = ctx->acdirmax * HZ;
|
||||||
|
|
||||||
/* Start lockd here, before we might error out */
|
/* Start lockd here, before we might error out */
|
||||||
error = nfs_start_lockd(server);
|
error = nfs_start_lockd(server);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
server->port = cfg->nfs_server.port;
|
server->port = ctx->nfs_server.port;
|
||||||
server->auth_info = cfg->auth_info;
|
server->auth_info = ctx->auth_info;
|
||||||
|
|
||||||
error = nfs_init_server_rpcclient(server, &timeparms,
|
error = nfs_init_server_rpcclient(server, &timeparms,
|
||||||
cfg->selected_flavor);
|
ctx->selected_flavor);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Preserve the values of mount_server-related mount options */
|
/* Preserve the values of mount_server-related mount options */
|
||||||
if (cfg->mount_server.addrlen) {
|
if (ctx->mount_server.addrlen) {
|
||||||
memcpy(&server->mountd_address, &cfg->mount_server.address,
|
memcpy(&server->mountd_address, &ctx->mount_server.address,
|
||||||
cfg->mount_server.addrlen);
|
ctx->mount_server.addrlen);
|
||||||
server->mountd_addrlen = cfg->mount_server.addrlen;
|
server->mountd_addrlen = ctx->mount_server.addrlen;
|
||||||
}
|
}
|
||||||
server->mountd_version = cfg->mount_server.version;
|
server->mountd_version = ctx->mount_server.version;
|
||||||
server->mountd_port = cfg->mount_server.port;
|
server->mountd_port = ctx->mount_server.port;
|
||||||
server->mountd_protocol = cfg->mount_server.protocol;
|
server->mountd_protocol = ctx->mount_server.protocol;
|
||||||
|
|
||||||
server->namelen = cfg->namlen;
|
server->namelen = ctx->namlen;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
|
@ -726,11 +726,11 @@ bool nfs_auth_info_match(const struct nfs_auth_info *auth_info,
|
||||||
EXPORT_SYMBOL_GPL(nfs_auth_info_match);
|
EXPORT_SYMBOL_GPL(nfs_auth_info_match);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure that a specified authtype in cfg->auth_info is supported by
|
* Ensure that a specified authtype in ctx->auth_info is supported by
|
||||||
* the server. Returns 0 and sets cfg->selected_flavor if it's ok, and
|
* the server. Returns 0 and sets ctx->selected_flavor if it's ok, and
|
||||||
* -EACCES if not.
|
* -EACCES if not.
|
||||||
*/
|
*/
|
||||||
static int nfs_verify_authflavors(struct nfs_fs_context *cfg,
|
static int nfs_verify_authflavors(struct nfs_fs_context *ctx,
|
||||||
rpc_authflavor_t *server_authlist,
|
rpc_authflavor_t *server_authlist,
|
||||||
unsigned int count)
|
unsigned int count)
|
||||||
{
|
{
|
||||||
|
@ -753,7 +753,7 @@ static int nfs_verify_authflavors(struct nfs_fs_context *cfg,
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
flavor = server_authlist[i];
|
flavor = server_authlist[i];
|
||||||
|
|
||||||
if (nfs_auth_info_match(&cfg->auth_info, flavor))
|
if (nfs_auth_info_match(&ctx->auth_info, flavor))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (flavor == RPC_AUTH_NULL)
|
if (flavor == RPC_AUTH_NULL)
|
||||||
|
@ -761,7 +761,7 @@ static int nfs_verify_authflavors(struct nfs_fs_context *cfg,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found_auth_null) {
|
if (found_auth_null) {
|
||||||
flavor = cfg->auth_info.flavors[0];
|
flavor = ctx->auth_info.flavors[0];
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,8 +770,8 @@ static int nfs_verify_authflavors(struct nfs_fs_context *cfg,
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
cfg->selected_flavor = flavor;
|
ctx->selected_flavor = flavor;
|
||||||
dfprintk(MOUNT, "NFS: using auth flavor %u\n", cfg->selected_flavor);
|
dfprintk(MOUNT, "NFS: using auth flavor %u\n", ctx->selected_flavor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,50 +779,50 @@ static int nfs_verify_authflavors(struct nfs_fs_context *cfg,
|
||||||
* Use the remote server's MOUNT service to request the NFS file handle
|
* Use the remote server's MOUNT service to request the NFS file handle
|
||||||
* corresponding to the provided path.
|
* corresponding to the provided path.
|
||||||
*/
|
*/
|
||||||
static int nfs_request_mount(struct nfs_fs_context *cfg,
|
static int nfs_request_mount(struct nfs_fs_context *ctx,
|
||||||
struct nfs_fh *root_fh,
|
struct nfs_fh *root_fh,
|
||||||
rpc_authflavor_t *server_authlist,
|
rpc_authflavor_t *server_authlist,
|
||||||
unsigned int *server_authlist_len)
|
unsigned int *server_authlist_len)
|
||||||
{
|
{
|
||||||
struct nfs_mount_request request = {
|
struct nfs_mount_request request = {
|
||||||
.sap = (struct sockaddr *)
|
.sap = (struct sockaddr *)
|
||||||
&cfg->mount_server.address,
|
&ctx->mount_server.address,
|
||||||
.dirpath = cfg->nfs_server.export_path,
|
.dirpath = ctx->nfs_server.export_path,
|
||||||
.protocol = cfg->mount_server.protocol,
|
.protocol = ctx->mount_server.protocol,
|
||||||
.fh = root_fh,
|
.fh = root_fh,
|
||||||
.noresvport = cfg->flags & NFS_MOUNT_NORESVPORT,
|
.noresvport = ctx->flags & NFS_MOUNT_NORESVPORT,
|
||||||
.auth_flav_len = server_authlist_len,
|
.auth_flav_len = server_authlist_len,
|
||||||
.auth_flavs = server_authlist,
|
.auth_flavs = server_authlist,
|
||||||
.net = cfg->net,
|
.net = ctx->net,
|
||||||
};
|
};
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (cfg->mount_server.version == 0) {
|
if (ctx->mount_server.version == 0) {
|
||||||
switch (cfg->version) {
|
switch (ctx->version) {
|
||||||
default:
|
default:
|
||||||
cfg->mount_server.version = NFS_MNT3_VERSION;
|
ctx->mount_server.version = NFS_MNT3_VERSION;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
cfg->mount_server.version = NFS_MNT_VERSION;
|
ctx->mount_server.version = NFS_MNT_VERSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request.version = cfg->mount_server.version;
|
request.version = ctx->mount_server.version;
|
||||||
|
|
||||||
if (cfg->mount_server.hostname)
|
if (ctx->mount_server.hostname)
|
||||||
request.hostname = cfg->mount_server.hostname;
|
request.hostname = ctx->mount_server.hostname;
|
||||||
else
|
else
|
||||||
request.hostname = cfg->nfs_server.hostname;
|
request.hostname = ctx->nfs_server.hostname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct the mount server's address.
|
* Construct the mount server's address.
|
||||||
*/
|
*/
|
||||||
if (cfg->mount_server.address.sa_family == AF_UNSPEC) {
|
if (ctx->mount_server.address.sa_family == AF_UNSPEC) {
|
||||||
memcpy(request.sap, &cfg->nfs_server.address,
|
memcpy(request.sap, &ctx->nfs_server.address,
|
||||||
cfg->nfs_server.addrlen);
|
ctx->nfs_server.addrlen);
|
||||||
cfg->mount_server.addrlen = cfg->nfs_server.addrlen;
|
ctx->mount_server.addrlen = ctx->nfs_server.addrlen;
|
||||||
}
|
}
|
||||||
request.salen = cfg->mount_server.addrlen;
|
request.salen = ctx->mount_server.addrlen;
|
||||||
nfs_set_port(request.sap, &cfg->mount_server.port, 0);
|
nfs_set_port(request.sap, &ctx->mount_server.port, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now ask the mount server to map our export path
|
* Now ask the mount server to map our export path
|
||||||
|
|
Loading…
Reference in New Issue