symlink: nfs41_create() can create symlinks
added optional symlink argument to nfs41_create(), used when type is NF4LNK changed createttype4.u.lnk.linkdata from char[] to const char* and updated encoding in nfs41_xdr.c Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
parent
08c2618551
commit
8c4c98b669
4 changed files with 10 additions and 4 deletions
|
|
@ -411,6 +411,7 @@ int nfs41_create(
|
|||
IN nfs41_session *session,
|
||||
IN uint32_t type,
|
||||
IN uint32_t mode,
|
||||
IN OPTIONAL const char *symlink,
|
||||
IN nfs41_path_fh *parent,
|
||||
OUT nfs41_path_fh *file)
|
||||
{
|
||||
|
|
@ -450,6 +451,10 @@ int nfs41_create(
|
|||
|
||||
compound_add_op(&compound, OP_CREATE, &create_args, &create_res);
|
||||
create_args.objtype.type = type;
|
||||
if (type == NF4LNK) {
|
||||
create_args.objtype.u.lnk.linkdata = symlink;
|
||||
create_args.objtype.u.lnk.linkdata_len = (uint32_t)strlen(symlink);
|
||||
}
|
||||
create_args.name = &file->name;
|
||||
create_args.createattrs.info.attrmask.count = 2;
|
||||
create_args.createattrs.info.attrmask.arr[0] = 0;
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ typedef struct __createtype4 {
|
|||
/* case NF4LNK: */
|
||||
struct __create_type_lnk {
|
||||
uint32_t linkdata_len;
|
||||
char linkdata[NFS4_OPAQUE_LIMIT];
|
||||
const char *linkdata;
|
||||
} lnk;
|
||||
/* case NF4BLK, NF4CHR: */
|
||||
specdata4 devdata;
|
||||
|
|
@ -909,6 +909,7 @@ int nfs41_create(
|
|||
IN nfs41_session *session,
|
||||
IN uint32_t type,
|
||||
IN uint32_t mode,
|
||||
IN OPTIONAL const char *symlink,
|
||||
IN nfs41_path_fh *parent,
|
||||
OUT nfs41_path_fh *file);
|
||||
|
||||
|
|
|
|||
|
|
@ -1168,7 +1168,7 @@ static bool_t encode_createtype4(
|
|||
createtype4 *ct)
|
||||
{
|
||||
bool_t result = TRUE;
|
||||
char *linkdata;
|
||||
const char *linkdata;
|
||||
|
||||
if (!xdr_u_int32_t(xdr, &ct->type))
|
||||
return FALSE;
|
||||
|
|
@ -1177,7 +1177,7 @@ static bool_t encode_createtype4(
|
|||
{
|
||||
case NF4LNK:
|
||||
linkdata = ct->u.lnk.linkdata;
|
||||
result = xdr_bytes(xdr, &linkdata, &ct->u.lnk.linkdata_len,
|
||||
result = xdr_bytes(xdr, (char**)&linkdata, &ct->u.lnk.linkdata_len,
|
||||
NFS4_OPAQUE_LIMIT);
|
||||
break;
|
||||
case NF4BLK:
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ int handle_open(nfs41_upcall *upcall)
|
|||
|
||||
if (create == OPEN4_CREATE && (args->create_opts & FILE_DIRECTORY_FILE)) {
|
||||
status = nfs41_create(state->session, NF4DIR, args->mode,
|
||||
&state->parent, &state->file);
|
||||
NULL, &state->parent, &state->file);
|
||||
args->std_info.Directory = 1;
|
||||
args->created = status == NFS4_OK;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue