/** * nfs_mount - Obtain an NFS file handle for the given host and path * @info: pointer to mount request arguments * @timeo: deciseconds the mount waits for a response before it retries * @retrans: number of times the mount retries a request * * Uses timeout parameters specified by caller. On successful return, the * auth_flavs list and auth_flav_len will be populated with the list from the * server or a faked-up list if the server didn't provide one.
*/ int nfs_mount(struct nfs_mount_request *info, int timeo, int retrans)
{ struct rpc_timeout mnt_timeout; struct mountres result = {
.fh = info->fh,
.auth_count = info->auth_flav_len,
.auth_flavors = info->auth_flavs,
}; struct rpc_message msg = {
.rpc_argp = info->dirpath,
.rpc_resp = &result,
}; struct rpc_create_args args = {
.net = info->net,
.protocol = info->protocol,
.address = (struct sockaddr *)info->sap,
.addrsize = info->salen,
.timeout = &mnt_timeout,
.servername = info->hostname,
.program = &mnt_program,
.version = info->version,
.authflavor = RPC_AUTH_UNIX,
.cred = current_cred(),
}; struct rpc_clnt *mnt_clnt; int status;
status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT);
rpc_shutdown_client(mnt_clnt);
if (status < 0) goto out_call_err; if (result.errno != 0) goto out_mnt_err;
dprintk("NFS: MNT request succeeded\n");
status = 0;
/* * If the server didn't provide a flavor list, allow the * client to try any flavor.
*/ if (info->version != NFS_MNT3_VERSION || *info->auth_flav_len == 0) {
dprintk("NFS: Faking up auth_flavs list\n");
info->auth_flavs[0] = RPC_AUTH_NULL;
*info->auth_flav_len = 1;
}
out: return status;
out_clnt_err:
status = PTR_ERR(mnt_clnt);
dprintk("NFS: failed to create MNT RPC client, status=%d\n", status); goto out;
/* * RFC 1094: "A non-zero status indicates some sort of error. In this * case, the status is a UNIX error number." This can be problematic * if the server and client use different errno values for the same * error. * * However, the OpenGroup XNFS spec provides a simple mapping that is * independent of local errno values on the server and the client.
*/ staticint decode_status(struct xdr_stream *xdr, struct mountres *res)
{ unsignedint i;
u32 status;
__be32 *p;
p = xdr_inline_decode(xdr, 4); if (unlikely(p == NULL)) return -EIO;
status = be32_to_cpup(p);
for (i = 0; i < ARRAY_SIZE(mnt_errtbl); i++) { if (mnt_errtbl[i].status == status) {
res->errno = mnt_errtbl[i].errno; return 0;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.