symlink: nfs41_readlink() takes buf,len instead of nfs41_abs_path
also changed nfs41_readlink_res.link from a buffer to a pointer to avoid the extra copy Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
77dcd5bc02
commit
374e7ad083
2 changed files with 11 additions and 12 deletions
|
|
@ -1349,7 +1349,9 @@ out:
|
||||||
int nfs41_readlink(
|
int nfs41_readlink(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
IN nfs41_path_fh *file,
|
IN nfs41_path_fh *file,
|
||||||
OUT nfs41_abs_path *link_out)
|
IN uint32_t max_len,
|
||||||
|
OUT char *link_out,
|
||||||
|
OUT uint32_t *len_out)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
nfs41_compound compound;
|
nfs41_compound compound;
|
||||||
|
|
@ -1373,7 +1375,8 @@ int nfs41_readlink(
|
||||||
putfh_args.in_recovery = 0;
|
putfh_args.in_recovery = 0;
|
||||||
|
|
||||||
compound_add_op(&compound, OP_READLINK, NULL, &readlink_res);
|
compound_add_op(&compound, OP_READLINK, NULL, &readlink_res);
|
||||||
readlink_res.link_len = NFS4_OPAQUE_LIMIT;
|
readlink_res.link_len = max_len - 1;
|
||||||
|
readlink_res.link = link_out;
|
||||||
|
|
||||||
status = compound_encode_send_decode(session, &compound, 0, 0);
|
status = compound_encode_send_decode(session, &compound, 0, 0);
|
||||||
if (status)
|
if (status)
|
||||||
|
|
@ -1382,14 +1385,8 @@ int nfs41_readlink(
|
||||||
if (compound_error(status = compound.res.status))
|
if (compound_error(status = compound.res.status))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (readlink_res.link_len >= NFS41_MAX_PATH_LEN) {
|
link_out[readlink_res.link_len] = '\0';
|
||||||
status = NFS4ERR_REP_TOO_BIG;
|
*len_out = readlink_res.link_len;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
AcquireSRWLockExclusive(&link_out->lock);
|
|
||||||
link_out->len = (unsigned short)readlink_res.link_len;
|
|
||||||
memcpy(link_out->path, readlink_res.link, readlink_res.link_len);
|
|
||||||
ReleaseSRWLockExclusive(&link_out->lock);
|
|
||||||
out:
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,7 @@ typedef struct __nfs41_readlink_res {
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
/* case NFS4_OK: */
|
/* case NFS4_OK: */
|
||||||
uint32_t link_len;
|
uint32_t link_len;
|
||||||
char link[NFS4_OPAQUE_LIMIT];
|
char *link;
|
||||||
} nfs41_readlink_res;
|
} nfs41_readlink_res;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1023,7 +1023,9 @@ int nfs41_link(
|
||||||
int nfs41_readlink(
|
int nfs41_readlink(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
IN nfs41_path_fh *file,
|
IN nfs41_path_fh *file,
|
||||||
OUT nfs41_abs_path *link_out);
|
IN uint32_t max_len,
|
||||||
|
OUT char *link_out,
|
||||||
|
OUT uint32_t *len_out);
|
||||||
|
|
||||||
int nfs41_access(
|
int nfs41_access(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue