moving session and open_state in upcall header
every upcall (except few) pass session and open_state pointer, so add that to marshal_nfs41_header() in the driver. remove passing of session and open_state elsewhere in marshal functions. in the deamon, upcall.c now reads and stores pointers to session and open_state in nfs41_upcall datastructure instead of having each individual upcall store their own pointers. setattrl and readdir args keeping pointer because the rest of the code uses them a lot. in upcall_parse() up refcounts on session and open_state if valid handles were passed in. down refcounts upcall_cleanup() as before. but need to be careful with count value for mount and open upcalls. we need to take an extra ref because upcall_cleanup() now will always decrement it.
This commit is contained in:
parent
ea390c1d25
commit
529d7ce6db
13 changed files with 132 additions and 334 deletions
24
daemon/acl.c
24
daemon/acl.c
|
|
@ -37,17 +37,10 @@ static int parse_getacl(unsigned char *buffer, uint32_t length,
|
|||
int status;
|
||||
getacl_upcall_args *args = &upcall->args.getacl;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
|
||||
if (status) goto out;
|
||||
|
||||
dprintf(1, "parsing NFS41_ACL_QUERY: info_class=%d root=0x%p "
|
||||
"open_state=0x%p\n", args->query, args->root, args->state);
|
||||
dprintf(1, "parsing NFS41_ACL_QUERY: info_class=%d\n", args->query);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -273,7 +266,7 @@ static int handle_getacl(nfs41_upcall *upcall)
|
|||
{
|
||||
int status = ERROR_NOT_SUPPORTED;
|
||||
getacl_upcall_args *args = &upcall->args.getacl;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
nfs41_file_info info;
|
||||
bitmap4 attr_request;
|
||||
LPSTR domain = NULL;
|
||||
|
|
@ -429,12 +422,6 @@ static int parse_setacl(unsigned char *buffer, uint32_t length,
|
|||
setacl_upcall_args *args = &upcall->args.setacl;
|
||||
ULONG sec_desc_len;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &sec_desc_len, sizeof(ULONG));
|
||||
|
|
@ -453,9 +440,8 @@ static int parse_setacl(unsigned char *buffer, uint32_t length,
|
|||
goto out_free;
|
||||
} else status = 0;
|
||||
|
||||
dprintf(1, "parsing NFS41_ACL_SET: info_class=%d root=0x%p open_state=0x%p"
|
||||
" sec_desc_len=%d\n", args->query, args->root, args->state,
|
||||
sec_desc_len);
|
||||
dprintf(1, "parsing NFS41_ACL_SET: info_class=%d sec_desc_len=%d\n",
|
||||
args->query, sec_desc_len);
|
||||
out:
|
||||
return status;
|
||||
out_free:
|
||||
|
|
@ -710,7 +696,7 @@ static int handle_setacl(nfs41_upcall *upcall)
|
|||
{
|
||||
int status = ERROR_NOT_SUPPORTED;
|
||||
setacl_upcall_args *args = &upcall->args.setacl;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
nfs41_file_info info;
|
||||
stateid_arg stateid;
|
||||
nfsacl41 nfs4_acl;
|
||||
|
|
|
|||
|
|
@ -67,16 +67,9 @@ static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
|
|||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
|
||||
dprintf(1, "parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d "
|
||||
"root=0x%p open_state=0x%p\n",
|
||||
args->query_class, args->buf_len, args->root, args->state);
|
||||
dprintf(1, "parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d\n",
|
||||
args->query_class, args->buf_len);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -85,7 +78,7 @@ static int handle_getattr(nfs41_upcall *upcall)
|
|||
{
|
||||
int status;
|
||||
getattr_upcall_args *args = &upcall->args.getattr;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
nfs41_file_info info;
|
||||
|
||||
ZeroMemory(&info, sizeof(info));
|
||||
|
|
@ -98,7 +91,7 @@ static int handle_getattr(nfs41_upcall *upcall)
|
|||
|
||||
if (info.type == NF4LNK) {
|
||||
nfs41_file_info target_info;
|
||||
int target_status = nfs41_symlink_follow(args->root,
|
||||
int target_status = nfs41_symlink_follow(upcall->root_ref,
|
||||
state->session, &state->file, &target_info);
|
||||
if (target_status == NO_ERROR && target_info.type == NF4DIR)
|
||||
info.symlink_dir = TRUE;
|
||||
|
|
|
|||
|
|
@ -122,12 +122,6 @@ static int parse_lock(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
|
|||
int status;
|
||||
lock_upcall_args *args = &upcall->args.lock;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->offset, sizeof(LONGLONG));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->length, sizeof(LONGLONG));
|
||||
|
|
@ -137,10 +131,9 @@ static int parse_lock(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
|
|||
status = safe_read(&buffer, &length, &args->blocking, sizeof(BOOLEAN));
|
||||
if (status) goto out;
|
||||
|
||||
dprintf(1, "parsing NFS41_LOCK: state=%p root=%p offset=0x%llx "
|
||||
"length=0x%llx exclusive=%u blocking=%u\n",
|
||||
args->state, args->root, args->offset, args->length,
|
||||
args->exclusive, args->blocking);
|
||||
dprintf(1, "parsing NFS41_LOCK: offset=0x%llx length=0x%llx exclusive=%u "
|
||||
"blocking=%u\n", args->offset, args->length, args->exclusive,
|
||||
args->blocking);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -156,7 +149,7 @@ static int handle_lock(nfs41_upcall *upcall)
|
|||
{
|
||||
stateid_arg stateid;
|
||||
lock_upcall_args *args = &upcall->args.lock;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
const uint32_t type = get_lock_type(args->exclusive, args->blocking);
|
||||
int status;
|
||||
|
||||
|
|
@ -182,7 +175,7 @@ static void cancel_lock(IN nfs41_upcall *upcall)
|
|||
{
|
||||
stateid_arg stateid;
|
||||
lock_upcall_args *args = &upcall->args.lock;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
int status = NO_ERROR;
|
||||
|
||||
dprintf(1, "--> cancel_lock()\n");
|
||||
|
|
@ -213,20 +206,13 @@ static int parse_unlock(unsigned char *buffer, uint32_t length, nfs41_upcall *up
|
|||
int status;
|
||||
unlock_upcall_args *args = &upcall->args.unlock;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->count, sizeof(ULONG));
|
||||
if (status) goto out;
|
||||
|
||||
args->buf = buffer;
|
||||
args->buf_len = length;
|
||||
|
||||
dprintf(1, "parsing NFS41_UNLOCK: state=%p root=%p count=%u\n",
|
||||
args->state, args->root, args->count);
|
||||
dprintf(1, "parsing NFS41_UNLOCK: count=%u\n", args->count);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -235,7 +221,7 @@ static int handle_unlock(nfs41_upcall *upcall)
|
|||
{
|
||||
stateid_arg stateid;
|
||||
unlock_upcall_args *args = &upcall->args.unlock;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
uint32_t i, nsuccess = 0;
|
||||
unsigned char *buf = args->buf;
|
||||
uint32_t buf_len = args->buf_len;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,8 @@ static int handle_mount(nfs41_upcall *upcall)
|
|||
goto out_err;
|
||||
}
|
||||
|
||||
args->root = root;
|
||||
upcall->root_ref = root;
|
||||
nfs41_root_ref(upcall->root_ref);
|
||||
out:
|
||||
return status;
|
||||
|
||||
|
|
@ -112,10 +113,9 @@ out_err:
|
|||
static int marshall_mount(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
|
||||
{
|
||||
int status;
|
||||
mount_upcall_args *args = &upcall->args.mount;
|
||||
dprintf(2, "NFS41_MOUNT: writing pointer to nfs41_root %p and version %d\n",
|
||||
args->root, NFS41D_VERSION);
|
||||
status = safe_write(&buffer, length, &args->root, sizeof(args->root));
|
||||
upcall->root_ref, NFS41D_VERSION);
|
||||
status = safe_write(&buffer, length, &upcall->root_ref, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
status = safe_write(&buffer, length, &NFS41D_VERSION, sizeof(DWORD));
|
||||
out:
|
||||
|
|
@ -124,8 +124,7 @@ out:
|
|||
|
||||
static void cancel_mount(IN nfs41_upcall *upcall)
|
||||
{
|
||||
mount_upcall_args *args = &upcall->args.mount;
|
||||
nfs41_root_deref(args->root);
|
||||
nfs41_root_deref(upcall->root_ref);
|
||||
}
|
||||
|
||||
const nfs41_upcall_op nfs41_op_mount = {
|
||||
|
|
@ -139,24 +138,15 @@ const nfs41_upcall_op nfs41_op_mount = {
|
|||
/* NFS41_UNMOUNT */
|
||||
static int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
|
||||
{
|
||||
int status;
|
||||
unmount_upcall_args *args = &upcall->args.unmount;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(nfs41_session *));
|
||||
if (status) goto out;
|
||||
|
||||
dprintf(1, "parsing NFS41_UNMOUNT: unmount root=%p\n", args->root);
|
||||
out:
|
||||
return status;
|
||||
dprintf(1, "parsing NFS41_UNMOUNT: root=%p\n", upcall->root_ref);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static int handle_unmount(nfs41_upcall *upcall)
|
||||
{
|
||||
int status = NO_ERROR;
|
||||
unmount_upcall_args *args = &upcall->args.unmount;
|
||||
/* release the original reference from nfs41_root_create() */
|
||||
nfs41_root_deref(args->root);
|
||||
return status;
|
||||
nfs41_root_deref(upcall->root_ref);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
const nfs41_upcall_op nfs41_op_unmount = {
|
||||
|
|
|
|||
|
|
@ -158,9 +158,6 @@ static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
|
|||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->disposition, sizeof(ULONG));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(ULONG));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->mode, sizeof(DWORD));
|
||||
|
|
@ -168,10 +165,9 @@ static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
|
|||
|
||||
dprintf(1, "parsing NFS41_OPEN: filename='%s' access mask=%d "
|
||||
"access mode=%d\n\tfile attrs=0x%x create attrs=0x%x "
|
||||
"(kernel) disposition=%d\n\tsession=%p open_owner_id=%d mode=%o\n",
|
||||
"(kernel) disposition=%d\n\topen_owner_id=%d mode=%o\n",
|
||||
args->path, args->access_mask, args->access_mode, args->file_attrs,
|
||||
args->create_opts, args->disposition, args->root, args->open_owner_id,
|
||||
args->mode);
|
||||
args->create_opts, args->disposition, args->open_owner_id, args->mode);
|
||||
print_disposition(2, args->disposition);
|
||||
print_access_mask(2, args->access_mask);
|
||||
print_share_mode(2, args->access_mode);
|
||||
|
|
@ -295,7 +291,7 @@ static int handle_open(nfs41_upcall *upcall)
|
|||
state->type = NF4REG;
|
||||
|
||||
// always do a lookup
|
||||
status = nfs41_lookup(args->root, nfs41_root_session(args->root),
|
||||
status = nfs41_lookup(upcall->root_ref, nfs41_root_session(upcall->root_ref),
|
||||
&state->path, &state->parent, &state->file, &info, &state->session);
|
||||
|
||||
if (status == ERROR_REPARSE) {
|
||||
|
|
@ -317,7 +313,7 @@ static int handle_open(nfs41_upcall *upcall)
|
|||
}
|
||||
|
||||
/* redo the lookup until it doesn't return REPARSE */
|
||||
status = nfs41_lookup(args->root, state->session,
|
||||
status = nfs41_lookup(upcall->root_ref, state->session,
|
||||
&state->path, &state->parent, NULL, NULL, &state->session);
|
||||
} while (status == ERROR_REPARSE);
|
||||
|
||||
|
|
@ -356,7 +352,7 @@ static int handle_open(nfs41_upcall *upcall)
|
|||
/* continue and open the symlink itself, but we need to
|
||||
* know if the target is a regular file or directory */
|
||||
nfs41_file_info target_info;
|
||||
int target_status = nfs41_symlink_follow(args->root,
|
||||
int target_status = nfs41_symlink_follow(upcall->root_ref,
|
||||
state->session, &state->file, &target_info);
|
||||
if (target_status == NO_ERROR && target_info.type == NF4DIR)
|
||||
info.symlink_dir = TRUE;
|
||||
|
|
@ -460,7 +456,8 @@ static int handle_open(nfs41_upcall *upcall)
|
|||
goto out_free_state;
|
||||
}
|
||||
}
|
||||
args->state = state;
|
||||
upcall->state_ref = state;
|
||||
nfs41_open_state_ref(upcall->state_ref);
|
||||
out:
|
||||
return status;
|
||||
out_free_state:
|
||||
|
|
@ -477,7 +474,7 @@ static int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *
|
|||
if (status) goto out;
|
||||
status = safe_write(&buffer, length, &args->std_info, sizeof(args->std_info));
|
||||
if (status) goto out;
|
||||
status = safe_write(&buffer, length, &args->state, sizeof(args->state));
|
||||
status = safe_write(&buffer, length, &upcall->state_ref, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
status = safe_write(&buffer, length, &args->mode, sizeof(args->mode));
|
||||
if (status) goto out;
|
||||
|
|
@ -498,7 +495,7 @@ static int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *
|
|||
}
|
||||
}
|
||||
dprintf(2, "NFS41_OPEN: passing open_state=0x%p mode %o changeattr 0x%x\n",
|
||||
args->state, args->mode, args->changeattr);
|
||||
upcall->state_ref, args->mode, args->changeattr);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -507,7 +504,7 @@ static void cancel_open(IN nfs41_upcall *upcall)
|
|||
{
|
||||
int status = NFS4_OK;
|
||||
open_upcall_args *args = &upcall->args.open;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
|
||||
dprintf(1, "--> cancel_open('%s')\n", args->path);
|
||||
|
||||
|
|
@ -546,11 +543,6 @@ static int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
|
|||
int status;
|
||||
close_upcall_args *args = &upcall->args.close;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(nfs41_open_state *));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->remove, sizeof(BOOLEAN));
|
||||
if (status) goto out;
|
||||
if (args->remove) {
|
||||
|
|
@ -560,10 +552,8 @@ static int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
|
|||
if (status) goto out;
|
||||
}
|
||||
|
||||
dprintf(1, "parsing NFS41_CLOSE: close root=0x%p "
|
||||
"open_state=0x%p remove=%d renamed=%d filename='%s'\n",
|
||||
args->root, args->state, args->remove, args->renamed,
|
||||
args->remove ? args->path : "");
|
||||
dprintf(1, "parsing NFS41_CLOSE: remove=%d renamed=%d filename='%s'\n",
|
||||
args->remove, args->renamed, args->remove ? args->path : "");
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -572,7 +562,7 @@ static int handle_close(nfs41_upcall *upcall)
|
|||
{
|
||||
int status = NFS4_OK, rm_status = NFS4_OK;
|
||||
close_upcall_args *args = &upcall->args.close;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
|
||||
/* return associated file layouts if necessary */
|
||||
if (state->type == NF4REG)
|
||||
|
|
@ -618,10 +608,8 @@ static int handle_close(nfs41_upcall *upcall)
|
|||
|
||||
static void cleanup_close(nfs41_upcall *upcall)
|
||||
{
|
||||
close_upcall_args *args = &upcall->args.close;
|
||||
|
||||
/* release the initial reference from create_open_state() */
|
||||
nfs41_open_state_deref(args->state);
|
||||
nfs41_open_state_deref(upcall->state_ref);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,19 +60,13 @@ static int parse_readdir(unsigned char *buffer, uint32_t length, nfs41_upcall *u
|
|||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->single, sizeof(args->single));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(args->root));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
args->root = upcall->root_ref;
|
||||
args->state = upcall->state_ref;
|
||||
|
||||
dprintf(1, "parsing NFS41_DIR_QUERY: info_class=%d buf_len=%d "
|
||||
"filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d "
|
||||
"root=0x%p state=0x%p\n",
|
||||
"filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d\n",
|
||||
args->query_class, args->buf_len, args->filter,
|
||||
args->initial, args->restart, args->single,
|
||||
args->root, args->state);
|
||||
args->initial, args->restart, args->single);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -454,7 +448,7 @@ static int handle_readdir(nfs41_upcall *upcall)
|
|||
{
|
||||
int status;
|
||||
readdir_upcall_args *args = &upcall->args.readdir;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
unsigned char *entry_buf = NULL;
|
||||
uint32_t entry_buf_len;
|
||||
bitmap4 attr_request;
|
||||
|
|
@ -544,7 +538,7 @@ fetch_entries:
|
|||
StringCbCopyA(entry->name, entry->name_len, args->filter);
|
||||
entry->next_entry_offset = 0;
|
||||
|
||||
status = lookup_entry(args->root,
|
||||
status = lookup_entry(upcall->root_ref,
|
||||
state->session, &state->file, entry);
|
||||
if (status) {
|
||||
dprintf(1, "single_lookup failed with %d\n", status);
|
||||
|
|
|
|||
|
|
@ -45,16 +45,9 @@ static int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall
|
|||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->buffer, sizeof(args->buffer));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(args->root));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
|
||||
dprintf(1, "parsing %s len=%ld offset=%ld buf=%p root=%p "
|
||||
"open_state=0x%p\n", opcode2string(upcall->opcode), args->len,
|
||||
args->offset, args->buffer, args->root, args->state);
|
||||
dprintf(1, "parsing %s len=%ld offset=%ld buf=%p\n",
|
||||
opcode2string(upcall->opcode), args->len, args->offset, args->buffer);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -155,10 +148,10 @@ static int handle_read(nfs41_upcall *upcall)
|
|||
ULONG pnfs_bytes_read = 0;
|
||||
int status = NO_ERROR;
|
||||
|
||||
nfs41_lock_stateid_arg(args->state, &stateid);
|
||||
nfs41_lock_stateid_arg(upcall->state_ref, &stateid);
|
||||
|
||||
#ifdef PNFS_ENABLE_READ
|
||||
status = read_from_pnfs(args->root, args->state, &stateid,
|
||||
status = read_from_pnfs(upcall->root_ref, upcall->state_ref, &stateid,
|
||||
args->offset, args->len, args->buffer, &args->out_len);
|
||||
|
||||
if (status == NO_ERROR || status == ERROR_HANDLE_EOF)
|
||||
|
|
@ -174,7 +167,7 @@ static int handle_read(nfs41_upcall *upcall)
|
|||
}
|
||||
#endif
|
||||
|
||||
status = read_from_mds(args->state->session, &args->state->file,
|
||||
status = read_from_mds(upcall->state_ref->session, &upcall->state_ref->file,
|
||||
&stateid, args->offset, args->len, args->buffer, &args->out_len);
|
||||
|
||||
args->out_len += pnfs_bytes_read;
|
||||
|
|
@ -276,10 +269,10 @@ static int handle_write(nfs41_upcall *upcall)
|
|||
ULONG pnfs_bytes_written = 0;
|
||||
int status;
|
||||
|
||||
nfs41_lock_stateid_arg(args->state, &stateid);
|
||||
nfs41_lock_stateid_arg(upcall->state_ref, &stateid);
|
||||
|
||||
#ifdef PNFS_ENABLE_WRITE
|
||||
status = write_to_pnfs(args->root, args->state, &stateid,
|
||||
status = write_to_pnfs(upcall->root_ref, upcall->state_ref, &stateid,
|
||||
args->offset, args->len, args->buffer, &args->out_len);
|
||||
|
||||
if (status == NO_ERROR)
|
||||
|
|
@ -295,7 +288,7 @@ static int handle_write(nfs41_upcall *upcall)
|
|||
}
|
||||
#endif
|
||||
|
||||
status = write_to_mds(args->state->session, &args->state->file,
|
||||
status = write_to_mds(upcall->state_ref->session, &upcall->state_ref->file,
|
||||
&stateid, args->offset, args->len, args->buffer, &args->out_len);
|
||||
|
||||
args->out_len += pnfs_bytes_written;
|
||||
|
|
|
|||
|
|
@ -52,22 +52,18 @@ static int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
|
|||
}
|
||||
status = safe_read(&buffer, &length, args->buf, args->buf_len);
|
||||
if (status) goto out_free;
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(args->root));
|
||||
if (status) goto out_free;
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out_free;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(ULONG));
|
||||
if (status) goto out_free;
|
||||
status = safe_read(&buffer, &length, &args->access_mask, sizeof(ULONG));
|
||||
if (status) goto out_free;
|
||||
status = safe_read(&buffer, &length, &args->access_mode, sizeof(ULONG));
|
||||
if (status) goto out_free;
|
||||
args->root = upcall->root_ref;
|
||||
args->state = upcall->state_ref;
|
||||
|
||||
dprintf(1, "parsing NFS41_FILE_SET: filename='%s' info_class=%d "
|
||||
"buf_len=%d root=%p open_state=%p\nopen_owner_id=%d "
|
||||
"access_mask=%x access_mode=%x\n", args->path, args->set_class,
|
||||
args->buf_len, args->root, args->state, args->open_owner_id,
|
||||
"buf_len=%d\nopen_owner_id=%d access_mask=%x access_mode=%x\n",
|
||||
args->path, args->set_class, args->buf_len, args->open_owner_id,
|
||||
args->access_mask, args->access_mode);
|
||||
out:
|
||||
return status;
|
||||
|
|
@ -468,7 +464,7 @@ out:
|
|||
static int handle_setattr(nfs41_upcall *upcall)
|
||||
{
|
||||
setattr_upcall_args *args = &upcall->args.setattr;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
int status;
|
||||
|
||||
switch (args->set_class) {
|
||||
|
|
@ -529,17 +525,10 @@ static int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall
|
|||
int status;
|
||||
setexattr_upcall_args *args = &upcall->args.setexattr;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(args->root));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(args->state));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = safe_read(&buffer, &length, &args->mode, sizeof(args->mode));
|
||||
if (status) goto out;
|
||||
|
||||
dprintf(1, "parsing NFS41_EA_SET: root=%p open_state=%p mode=%o\n",
|
||||
args->root, args->state, args->mode);
|
||||
dprintf(1, "parsing NFS41_EA_SET: mode=%o\n", args->mode);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -548,7 +537,7 @@ static int handle_setexattr(nfs41_upcall *upcall)
|
|||
{
|
||||
int status;
|
||||
setexattr_upcall_args *args = &upcall->args.setexattr;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
stateid_arg stateid;
|
||||
nfs41_file_info info;
|
||||
|
||||
|
|
|
|||
|
|
@ -195,12 +195,6 @@ static int parse_symlink(unsigned char *buffer, uint32_t length, nfs41_upcall *u
|
|||
symlink_upcall_args *args = &upcall->args.symlink;
|
||||
int status;
|
||||
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(nfs41_open_state *));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
status = get_name(&buffer, &length, &args->path);
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &args->set, sizeof(BOOLEAN));
|
||||
|
|
@ -211,8 +205,7 @@ static int parse_symlink(unsigned char *buffer, uint32_t length, nfs41_upcall *u
|
|||
else
|
||||
args->target_set = NULL;
|
||||
|
||||
dprintf(1, "parsing NFS41_SYMLINK: root=0x%p open_state=0x%p "
|
||||
"path='%s' set=%u target='%s'\n", args->root, args->state,
|
||||
dprintf(1, "parsing NFS41_SYMLINK: path='%s' set=%u target='%s'\n",
|
||||
args->path, args->set, args->target_set);
|
||||
out:
|
||||
return status;
|
||||
|
|
@ -231,7 +224,7 @@ static int map_symlink_errors(int status)
|
|||
static int handle_symlink(nfs41_upcall *upcall)
|
||||
{
|
||||
symlink_upcall_args *args = &upcall->args.symlink;
|
||||
nfs41_open_state *state = args->state;
|
||||
nfs41_open_state *state = upcall->state_ref;
|
||||
int status = NO_ERROR;
|
||||
|
||||
if (args->set) {
|
||||
|
|
|
|||
|
|
@ -97,9 +97,18 @@ int upcall_parse(
|
|||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &upcall->opcode, sizeof(uint32_t));
|
||||
if (status) goto out;
|
||||
status = safe_read(&buffer, &length, &upcall->root_ref, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
if (upcall->root_ref != INVALID_HANDLE_VALUE)
|
||||
nfs41_root_ref(upcall->root_ref);
|
||||
status = safe_read(&buffer, &length, &upcall->state_ref, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
if (upcall->state_ref != INVALID_HANDLE_VALUE)
|
||||
nfs41_open_state_ref(upcall->state_ref);
|
||||
|
||||
dprintf(2, "version=%d xid=%d opcode=%s\n", version, upcall->xid,
|
||||
opcode2string(upcall->opcode));
|
||||
dprintf(2, "version=%d xid=%d opcode=%s session=0x%x open_state=0x%x\n",
|
||||
version, upcall->xid, opcode2string(upcall->opcode), upcall->root_ref,
|
||||
upcall->state_ref);
|
||||
if (version != NFS41D_VERSION) {
|
||||
eprintf("received version %d expecting version %d\n", version, NFS41D_VERSION);
|
||||
upcall->status = status = NFSD_VERSION_MISMATCH;
|
||||
|
|
@ -196,11 +205,11 @@ void upcall_cleanup(
|
|||
if (op && op->cleanup && upcall->status != NFSD_VERSION_MISMATCH)
|
||||
op->cleanup(upcall);
|
||||
|
||||
if (upcall->state_ref) {
|
||||
if (upcall->state_ref && upcall->state_ref != INVALID_HANDLE_VALUE) {
|
||||
nfs41_open_state_deref(upcall->state_ref);
|
||||
upcall->state_ref = NULL;
|
||||
}
|
||||
if (upcall->root_ref) {
|
||||
if (upcall->root_ref && upcall->root_ref != INVALID_HANDLE_VALUE) {
|
||||
nfs41_root_deref(upcall->root_ref);
|
||||
upcall->root_ref = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,21 +31,14 @@
|
|||
typedef struct __mount_upcall_args {
|
||||
const char *hostname;
|
||||
const char *path;
|
||||
nfs41_root *root;
|
||||
DWORD sec_flavor;
|
||||
} mount_upcall_args;
|
||||
|
||||
typedef struct __unmount_upcall_args {
|
||||
nfs41_root *root;
|
||||
} unmount_upcall_args;
|
||||
|
||||
typedef struct __open_upcall_args {
|
||||
nfs41_abs_path symlink;
|
||||
FILE_BASIC_INFO basic_info;
|
||||
FILE_STANDARD_INFO std_info;
|
||||
const char *path;
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
ULONG access_mask;
|
||||
ULONG access_mode;
|
||||
ULONG file_attrs;
|
||||
|
|
@ -60,15 +53,11 @@ typedef struct __open_upcall_args {
|
|||
|
||||
typedef struct __close_upcall_args {
|
||||
const char *path;
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
BOOLEAN remove;
|
||||
BOOLEAN renamed;
|
||||
} close_upcall_args;
|
||||
|
||||
typedef struct __readwrite_upcall_args {
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
unsigned char *buffer;
|
||||
LONGLONG offset;
|
||||
ULONG len;
|
||||
|
|
@ -76,8 +65,6 @@ typedef struct __readwrite_upcall_args {
|
|||
} readwrite_upcall_args;
|
||||
|
||||
typedef struct __lock_upcall_args {
|
||||
nfs41_open_state *state;
|
||||
nfs41_root *root;
|
||||
LONGLONG offset;
|
||||
LONGLONG length;
|
||||
BOOLEAN exclusive;
|
||||
|
|
@ -85,8 +72,6 @@ typedef struct __lock_upcall_args {
|
|||
} lock_upcall_args;
|
||||
|
||||
typedef struct __unlock_upcall_args {
|
||||
nfs41_open_state *state;
|
||||
nfs41_root *root;
|
||||
uint32_t count;
|
||||
unsigned char *buf;
|
||||
uint32_t buf_len;
|
||||
|
|
@ -97,8 +82,6 @@ typedef struct __getattr_upcall_args {
|
|||
FILE_STANDARD_INFO std_info;
|
||||
FILE_ATTRIBUTE_TAG_INFO tag_info;
|
||||
FILE_INTERNAL_INFORMATION intr_info;
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
int query_class;
|
||||
int buf_len;
|
||||
int query_reply_len;
|
||||
|
|
@ -117,8 +100,6 @@ typedef struct __setattr_upcall_args {
|
|||
} setattr_upcall_args;
|
||||
|
||||
typedef struct __setexattr_upcall_args {
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
uint32_t mode;
|
||||
} setexattr_upcall_args;
|
||||
|
||||
|
|
@ -138,15 +119,11 @@ typedef struct __readdir_upcall_args {
|
|||
typedef struct __symlink_upcall_args {
|
||||
nfs41_abs_path target_get;
|
||||
char *target_set;
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
const char *path;
|
||||
BOOLEAN set;
|
||||
} symlink_upcall_args;
|
||||
|
||||
typedef struct __volume_upcall_args {
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
FS_INFORMATION_CLASS query;
|
||||
int len;
|
||||
union {
|
||||
|
|
@ -157,23 +134,18 @@ typedef struct __volume_upcall_args {
|
|||
} volume_upcall_args;
|
||||
|
||||
typedef struct __getacl_upcall_args {
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
SECURITY_INFORMATION query;
|
||||
PSECURITY_DESCRIPTOR sec_desc;
|
||||
DWORD sec_desc_len;
|
||||
} getacl_upcall_args;
|
||||
|
||||
typedef struct __setacl_upcall_args {
|
||||
nfs41_root *root;
|
||||
nfs41_open_state *state;
|
||||
SECURITY_INFORMATION query;
|
||||
PSECURITY_DESCRIPTOR sec_desc;
|
||||
} setacl_upcall_args;
|
||||
|
||||
typedef union __upcall_args {
|
||||
mount_upcall_args mount;
|
||||
unmount_upcall_args unmount;
|
||||
open_upcall_args open;
|
||||
close_upcall_args close;
|
||||
readwrite_upcall_args rw;
|
||||
|
|
@ -244,21 +216,4 @@ void upcall_cancel(
|
|||
void upcall_cleanup(
|
||||
IN nfs41_upcall *upcall);
|
||||
|
||||
|
||||
static __inline void upcall_root_ref(
|
||||
IN nfs41_upcall *upcall,
|
||||
IN nfs41_root *root)
|
||||
{
|
||||
nfs41_root_ref(root);
|
||||
upcall->root_ref = root;
|
||||
}
|
||||
|
||||
static __inline void upcall_open_state_ref(
|
||||
IN nfs41_upcall *upcall,
|
||||
IN nfs41_open_state *state)
|
||||
{
|
||||
nfs41_open_state_ref(state);
|
||||
upcall->state_ref = state;
|
||||
}
|
||||
|
||||
#endif /* !__NFS41_DAEMON_UPCALL_H__ */
|
||||
|
|
|
|||
|
|
@ -46,17 +46,11 @@ static int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *up
|
|||
{
|
||||
int status;
|
||||
volume_upcall_args *args = &upcall->args.volume;
|
||||
status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_root_ref(upcall, args->root);
|
||||
status = safe_read(&buffer, &length, &args->state, sizeof(HANDLE));
|
||||
if (status) goto out;
|
||||
upcall_open_state_ref(upcall, args->state);
|
||||
|
||||
status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
|
||||
if (status) goto out;
|
||||
|
||||
dprintf(1, "parsing NFS41_VOLUME_QUERY: root=0x%p, query=%d\n",
|
||||
args->root, args->query);
|
||||
dprintf(1, "parsing NFS41_VOLUME_QUERY: query=%d\n", args->query);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -95,7 +89,8 @@ out:
|
|||
|
||||
static int handle_volume_attributes(
|
||||
IN nfs41_session *session,
|
||||
IN volume_upcall_args *args)
|
||||
IN volume_upcall_args *args,
|
||||
IN nfs41_open_state *state)
|
||||
{
|
||||
/* query the case_ attributes of the root filesystem */
|
||||
nfs41_file_info info = { 0 };
|
||||
|
|
@ -105,7 +100,7 @@ static int handle_volume_attributes(
|
|||
PFILE_FS_ATTRIBUTE_INFORMATION attr = &args->info.attribute;
|
||||
int status = NO_ERROR;
|
||||
|
||||
status = nfs41_getattr(session, &args->state->file, &attr_request, &info);
|
||||
status = nfs41_getattr(session, &state->file, &attr_request, &info);
|
||||
if (status) {
|
||||
eprintf("nfs41_getattr() failed with %s\n",
|
||||
nfs_error_string(status));
|
||||
|
|
@ -122,7 +117,7 @@ static int handle_volume_attributes(
|
|||
attr->FileSystemAttributes |= FILE_CASE_PRESERVED_NAMES;
|
||||
if (!info.case_insensitive)
|
||||
attr->FileSystemAttributes |= FILE_CASE_SENSITIVE_SEARCH;
|
||||
if (args->state->file.fh.superblock->aclsupport)
|
||||
if (state->file.fh.superblock->aclsupport)
|
||||
attr->FileSystemAttributes |= FILE_PERSISTENT_ACLS;
|
||||
|
||||
attr->MaximumComponentNameLength = NFS41_MAX_COMPONENT_LEN;
|
||||
|
|
@ -142,7 +137,7 @@ out:
|
|||
static int handle_volume(nfs41_upcall *upcall)
|
||||
{
|
||||
volume_upcall_args *args = &upcall->args.volume;
|
||||
nfs41_session *session = nfs41_root_session(args->root);
|
||||
nfs41_session *session = nfs41_root_session(upcall->root_ref);
|
||||
int status;
|
||||
|
||||
switch (args->query) {
|
||||
|
|
@ -151,7 +146,7 @@ static int handle_volume(nfs41_upcall *upcall)
|
|||
args->info.size.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
|
||||
args->info.size.BytesPerSector = BYTES_PER_SECTOR;
|
||||
|
||||
status = get_volume_size_info(session, args->state,
|
||||
status = get_volume_size_info(session, upcall->state_ref,
|
||||
"FileFsSizeInformation",
|
||||
&args->info.size.TotalAllocationUnits.QuadPart,
|
||||
&args->info.size.AvailableAllocationUnits.QuadPart,
|
||||
|
|
@ -163,7 +158,7 @@ static int handle_volume(nfs41_upcall *upcall)
|
|||
args->info.fullsize.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
|
||||
args->info.fullsize.BytesPerSector = BYTES_PER_SECTOR;
|
||||
|
||||
status = get_volume_size_info(session, args->state,
|
||||
status = get_volume_size_info(session, upcall->state_ref,
|
||||
"FileFsFullSizeInformation",
|
||||
&args->info.fullsize.TotalAllocationUnits.QuadPart,
|
||||
&args->info.fullsize.CallerAvailableAllocationUnits.QuadPart,
|
||||
|
|
@ -171,7 +166,7 @@ static int handle_volume(nfs41_upcall *upcall)
|
|||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
status = handle_volume_attributes(session, args);
|
||||
status = handle_volume_attributes(session, args, upcall->state_ref);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -454,7 +454,8 @@ NTSTATUS marshal_nfs41_header(nfs41_updowncall_entry *entry,
|
|||
ULONG header_len = 0;
|
||||
unsigned char *tmp = buf;
|
||||
|
||||
header_len = sizeof(entry->version) + sizeof(entry->xid) + sizeof(entry->opcode);
|
||||
header_len = sizeof(entry->version) + sizeof(entry->xid) +
|
||||
sizeof(entry->opcode) + 2 * sizeof(HANDLE);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
|
|
@ -462,13 +463,19 @@ NTSTATUS marshal_nfs41_header(nfs41_updowncall_entry *entry,
|
|||
else
|
||||
*len = header_len;
|
||||
RtlCopyMemory(tmp, &entry->version, sizeof(entry->version));
|
||||
tmp += sizeof(DWORD);
|
||||
tmp += sizeof(entry->version);
|
||||
RtlCopyMemory(tmp, &entry->xid, sizeof(entry->xid));
|
||||
tmp += sizeof(xid);
|
||||
tmp += sizeof(entry->xid);
|
||||
RtlCopyMemory(tmp, &entry->opcode, sizeof(entry->opcode));
|
||||
tmp += sizeof(entry->opcode);
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
|
||||
DbgP("[upcall] entry=%p xid=%d opcode=%d version=%d\n", entry, entry->xid,
|
||||
entry->opcode, entry->version);
|
||||
DbgP("[upcall] entry=%p xid=%d opcode=%d version=%d session=0x%x "
|
||||
"open_state=0x%x\n", entry, entry->xid, entry->opcode, entry->version,
|
||||
entry->session, entry->open_state);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
|
@ -534,26 +541,12 @@ NTSTATUS marshal_nfs41_unmount(nfs41_updowncall_entry *entry,
|
|||
ULONG *len)
|
||||
{
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
ULONG header_len = 0;
|
||||
unsigned char *tmp = buf;
|
||||
|
||||
DbgEn();
|
||||
|
||||
status = marshal_nfs41_header(entry, tmp, buf_len, len);
|
||||
status = marshal_nfs41_header(entry, buf, buf_len, len);
|
||||
if (status == STATUS_INSUFFICIENT_RESOURCES)
|
||||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
|
||||
|
||||
header_len = *len + sizeof(HANDLE);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x\n", entry->session);
|
||||
out:
|
||||
|
|
@ -578,7 +571,7 @@ NTSTATUS marshal_nfs41_open(nfs41_updowncall_entry *entry,
|
|||
else
|
||||
tmp += *len;
|
||||
header_len = *len + length_as_ansi(entry->u.Open.filename) +
|
||||
6 * sizeof(ULONG) + sizeof(HANDLE) + sizeof(DWORD);
|
||||
6 * sizeof(ULONG) + sizeof(DWORD);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
|
|
@ -595,8 +588,6 @@ NTSTATUS marshal_nfs41_open(nfs41_updowncall_entry *entry,
|
|||
tmp += sizeof(entry->u.Open.copts);
|
||||
RtlCopyMemory(tmp, &entry->u.Open.disp, sizeof(entry->u.Open.disp));
|
||||
tmp += sizeof(entry->u.Open.disp);
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Open.open_owner_id,
|
||||
sizeof(entry->u.Open.open_owner_id));
|
||||
tmp += sizeof(entry->u.Open.open_owner_id);
|
||||
|
|
@ -605,11 +596,10 @@ NTSTATUS marshal_nfs41_open(nfs41_updowncall_entry *entry,
|
|||
*len = header_len;
|
||||
|
||||
DbgP("mask=0x%x mode=0x%x attrs=0x%x opts=0x%x dispo=0x%x "
|
||||
"session=0x%x open_owner_id=0x%x mode=%o\n",
|
||||
entry->u.Open.access_mask, entry->u.Open.access_mode,
|
||||
entry->u.Open.attrs, entry->u.Open.copts, entry->u.Open.disp,
|
||||
entry->session, entry->u.Open.open_owner_id,
|
||||
entry->u.Open.mode);
|
||||
"open_owner_id=0x%x mode=%o\n", entry->u.Open.access_mask,
|
||||
entry->u.Open.access_mode, entry->u.Open.attrs,
|
||||
entry->u.Open.copts, entry->u.Open.disp,
|
||||
entry->u.Open.open_owner_id, entry->u.Open.mode);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -631,7 +621,7 @@ NTSTATUS marshal_nfs41_rw(nfs41_updowncall_entry *entry,
|
|||
else
|
||||
tmp += *len;
|
||||
header_len = *len + sizeof(entry->u.ReadWrite.len) +
|
||||
sizeof(entry->u.ReadWrite.offset) + 3 * sizeof(HANDLE);
|
||||
sizeof(entry->u.ReadWrite.offset) + sizeof(HANDLE);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
|
|
@ -660,16 +650,10 @@ NTSTATUS marshal_nfs41_rw(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
}
|
||||
RtlCopyMemory(tmp, &entry->u.ReadWrite.buf, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("len=%u offset=%lu session=0x%p open_state=0x%p\n",
|
||||
entry->u.ReadWrite.len, entry->u.ReadWrite.offset,
|
||||
entry->session, entry->open_state);
|
||||
DbgP("len=%u offset=%lu\n", entry->u.ReadWrite.len, entry->u.ReadWrite.offset);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -691,16 +675,11 @@ NTSTATUS marshal_nfs41_lock(nfs41_updowncall_entry *entry,
|
|||
else
|
||||
tmp += *len;
|
||||
|
||||
header_len = *len + 2 * sizeof(HANDLE) + 2 * sizeof(LONGLONG) +
|
||||
2 * sizeof(BOOLEAN);
|
||||
header_len = *len + 2 * sizeof(LONGLONG) + 2 * sizeof(BOOLEAN);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Lock.offset, sizeof(LONGLONG));
|
||||
tmp += sizeof(LONGLONG);
|
||||
RtlCopyMemory(tmp, &entry->u.Lock.length, sizeof(LONGLONG));
|
||||
|
|
@ -712,9 +691,7 @@ NTSTATUS marshal_nfs41_lock(nfs41_updowncall_entry *entry,
|
|||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=%p open_state=%p offset=%llx length=%llx "
|
||||
"exclusive=%u blocking=%u\n",
|
||||
entry->open_state, entry->session,
|
||||
DbgP("offset=%llx length=%llx exclusive=%u blocking=%u\n",
|
||||
entry->u.Lock.offset, entry->u.Lock.length,
|
||||
entry->u.Lock.exclusive, entry->u.Lock.blocking);
|
||||
out:
|
||||
|
|
@ -739,16 +716,12 @@ NTSTATUS marshal_nfs41_unlock(nfs41_updowncall_entry *entry,
|
|||
else
|
||||
tmp += *len;
|
||||
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(ULONG) +
|
||||
header_len = *len + sizeof(ULONG) +
|
||||
entry->u.Unlock.count * 2 * sizeof(LONGLONG);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Unlock.count, sizeof(ULONG));
|
||||
tmp += sizeof(ULONG);
|
||||
|
||||
|
|
@ -763,8 +736,7 @@ NTSTATUS marshal_nfs41_unlock(nfs41_updowncall_entry *entry,
|
|||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=%p open_state=%p count=%u\n", entry->open_state,
|
||||
entry->session, entry->u.Unlock.count);
|
||||
DbgP("count=%u\n", entry->u.Unlock.count);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -788,7 +760,7 @@ NTSTATUS marshal_nfs41_close(nfs41_updowncall_entry *entry,
|
|||
tmp += *len;
|
||||
|
||||
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(BOOLEAN);
|
||||
header_len = *len + sizeof(BOOLEAN);
|
||||
if (entry->u.Close.remove)
|
||||
header_len += length_as_ansi(entry->u.Close.filename) +
|
||||
sizeof(BOOLEAN);
|
||||
|
|
@ -797,10 +769,6 @@ NTSTATUS marshal_nfs41_close(nfs41_updowncall_entry *entry,
|
|||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Close.remove, sizeof(BOOLEAN));
|
||||
if (entry->u.Close.remove) {
|
||||
tmp += sizeof(BOOLEAN);
|
||||
|
|
@ -811,10 +779,8 @@ NTSTATUS marshal_nfs41_close(nfs41_updowncall_entry *entry,
|
|||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x open_state=0x%x remove=%d renamed=%d filename=%wZ\n",
|
||||
entry->session, entry->open_state,
|
||||
entry->u.Close.remove, entry->u.Close.renamed,
|
||||
entry->u.Close.filename);
|
||||
DbgP("remove=%d renamed=%d filename=%wZ\n", entry->u.Close.remove,
|
||||
entry->u.Close.renamed, entry->u.Close.filename);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -837,8 +803,7 @@ NTSTATUS marshal_nfs41_dirquery(nfs41_updowncall_entry *entry,
|
|||
tmp += *len;
|
||||
|
||||
header_len = *len + 2 * sizeof(ULONG) +
|
||||
length_as_ansi(entry->u.QueryFile.filter) +
|
||||
3 * sizeof(BOOLEAN) + 2 * sizeof(HANDLE);
|
||||
length_as_ansi(entry->u.QueryFile.filter) + 3 * sizeof(BOOLEAN);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
|
|
@ -855,18 +820,13 @@ NTSTATUS marshal_nfs41_dirquery(nfs41_updowncall_entry *entry,
|
|||
RtlCopyMemory(tmp, &entry->u.QueryFile.restart_scan, sizeof(BOOLEAN));
|
||||
tmp += sizeof(BOOLEAN);
|
||||
RtlCopyMemory(tmp, &entry->u.QueryFile.return_single, sizeof(BOOLEAN));
|
||||
tmp += sizeof(BOOLEAN);
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("filter='%wZ' class=%d\n\t1st\\restart\\single=%d\\%d\\%d "
|
||||
"session=0x%x open_state=0x%x\n",
|
||||
DbgP("filter='%wZ' class=%d\n\t1st\\restart\\single=%d\\%d\\%d\n",
|
||||
entry->u.QueryFile.filter, entry->u.QueryFile.InfoClass,
|
||||
entry->u.QueryFile.initial_query, entry->u.QueryFile.restart_scan,
|
||||
entry->u.QueryFile.return_single, entry->session, entry->open_state);
|
||||
entry->u.QueryFile.return_single);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -887,7 +847,7 @@ NTSTATUS marshal_nfs41_filequery(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
header_len = *len + 2 * sizeof(ULONG) + 2 * sizeof(HANDLE);
|
||||
header_len = *len + 2 * sizeof(ULONG);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
|
|
@ -902,8 +862,7 @@ NTSTATUS marshal_nfs41_filequery(nfs41_updowncall_entry *entry,
|
|||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("class=%d session=0x%x open_state=0x%x\n",
|
||||
entry->u.QueryFile.InfoClass, entry->session, entry->open_state);
|
||||
DbgP("class=%d\n", entry->u.QueryFile.InfoClass);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -925,7 +884,7 @@ NTSTATUS marshal_nfs41_fileset(nfs41_updowncall_entry *entry,
|
|||
else
|
||||
tmp += *len;
|
||||
header_len = *len + length_as_ansi(entry->u.SetFile.filename) +
|
||||
5 * sizeof(ULONG) + entry->u.SetFile.buf_len + 2 * sizeof(HANDLE);
|
||||
5 * sizeof(ULONG) + entry->u.SetFile.buf_len;
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
|
|
@ -938,10 +897,6 @@ NTSTATUS marshal_nfs41_fileset(nfs41_updowncall_entry *entry,
|
|||
tmp += sizeof(ULONG);
|
||||
RtlCopyMemory(tmp, entry->u.SetFile.buf, entry->u.SetFile.buf_len);
|
||||
tmp += entry->u.SetFile.buf_len;
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.SetFile.open_owner_id, sizeof(ULONG));
|
||||
tmp += sizeof(ULONG);
|
||||
RtlCopyMemory(tmp, &entry->u.SetFile.access_mask, sizeof(ULONG));
|
||||
|
|
@ -950,12 +905,10 @@ NTSTATUS marshal_nfs41_fileset(nfs41_updowncall_entry *entry,
|
|||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("filename='%wZ' class=%d session=0x%x open_state=0x%x "
|
||||
"open_owner_id=0x%x access_mask=0x%x access_mode=0x%x\n",
|
||||
entry->u.SetFile.filename, entry->u.SetFile.InfoClass,
|
||||
entry->session, entry->open_state,
|
||||
entry->u.SetFile.open_owner_id, entry->u.SetFile.access_mask,
|
||||
entry->u.SetFile.access_mode);
|
||||
DbgP("filename='%wZ' class=%d open_owner_id=0x%x access_mask=0x%x "
|
||||
"access_mode=0x%x\n", entry->u.SetFile.filename,
|
||||
entry->u.SetFile.InfoClass, entry->u.SetFile.open_owner_id,
|
||||
entry->u.SetFile.access_mask, entry->u.SetFile.access_mode);
|
||||
print_hexbuf(0, (unsigned char *)"setfile buffer", entry->u.SetFile.buf,
|
||||
entry->u.SetFile.buf_len);
|
||||
out:
|
||||
|
|
@ -978,22 +931,17 @@ NTSTATUS marshal_nfs41_easet(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(DWORD);
|
||||
header_len = *len + sizeof(DWORD);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.SetEa.mode, sizeof(DWORD));
|
||||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x open_state=0x%x mode=0x%x\n", entry->session,
|
||||
entry->open_state, entry->u.SetEa.mode);
|
||||
DbgP("mode=0x%x\n", entry->u.SetEa.mode);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -1014,7 +962,7 @@ NTSTATUS marshal_nfs41_symlink(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(BOOLEAN) +
|
||||
header_len = *len + sizeof(BOOLEAN) +
|
||||
length_as_ansi(entry->u.Symlink.filename);
|
||||
if (entry->u.Symlink.set)
|
||||
header_len += length_as_ansi(entry->u.Symlink.target);
|
||||
|
|
@ -1023,10 +971,6 @@ NTSTATUS marshal_nfs41_symlink(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
}
|
||||
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
marshall_unicode_as_ansi(&tmp, entry->u.Symlink.filename);
|
||||
RtlCopyMemory(tmp, &entry->u.Symlink.set, sizeof(BOOLEAN));
|
||||
tmp += sizeof(BOOLEAN);
|
||||
|
|
@ -1035,8 +979,7 @@ NTSTATUS marshal_nfs41_symlink(nfs41_updowncall_entry *entry,
|
|||
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x open_state=0x%x symlink name %wZ symlink target %wZ\n",
|
||||
entry->session, entry->open_state, entry->u.Symlink.filename,
|
||||
DbgP("symlink name %wZ symlink target %wZ\n", entry->u.Symlink.filename,
|
||||
entry->u.Symlink.set?entry->u.Symlink.target : NULL);
|
||||
out:
|
||||
DbgEx();
|
||||
|
|
@ -1058,21 +1001,16 @@ NTSTATUS marshal_nfs41_volume(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(FS_INFORMATION_CLASS);
|
||||
header_len = *len + sizeof(FS_INFORMATION_CLASS);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Volume.query, sizeof(FS_INFORMATION_CLASS));
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x open_state=0x%x qury=0x%x\n", entry->session,
|
||||
entry->open_state, entry->u.Volume.query);
|
||||
DbgP("query=0x%x\n", entry->u.Volume.query);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -1093,21 +1031,16 @@ NTSTATUS marshal_nfs41_getacl(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(SECURITY_INFORMATION);
|
||||
header_len = *len + sizeof(SECURITY_INFORMATION);
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Acl.query, sizeof(SECURITY_INFORMATION));
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x open_state=0x%x query=%d\n", entry->session,
|
||||
entry->open_state, entry->u.Acl.query);
|
||||
DbgP("query=%d\n", entry->u.Acl.query);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
@ -1128,17 +1061,13 @@ NTSTATUS marshal_nfs41_setacl(nfs41_updowncall_entry *entry,
|
|||
goto out;
|
||||
else
|
||||
tmp += *len;
|
||||
header_len = *len + 2 * sizeof(HANDLE) + sizeof(SECURITY_INFORMATION) +
|
||||
header_len = *len + sizeof(SECURITY_INFORMATION) +
|
||||
sizeof(ULONG) + entry->u.Acl.buf_len;
|
||||
if (header_len > buf_len) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
|
||||
tmp += sizeof(HANDLE);
|
||||
RtlCopyMemory(tmp, &entry->u.Acl.query, sizeof(SECURITY_INFORMATION));
|
||||
tmp += sizeof(SECURITY_INFORMATION);
|
||||
RtlCopyMemory(tmp, &entry->u.Acl.buf_len, sizeof(DWORD));
|
||||
|
|
@ -1146,9 +1075,7 @@ NTSTATUS marshal_nfs41_setacl(nfs41_updowncall_entry *entry,
|
|||
RtlCopyMemory(tmp, entry->u.Acl.buf, entry->u.Acl.buf_len);
|
||||
*len = header_len;
|
||||
|
||||
DbgP("session=0x%x open_state=0x%x query=%d sec_desc_len=%d\n",
|
||||
entry->session, entry->open_state,
|
||||
entry->u.Acl.query, entry->u.Acl.buf_len);
|
||||
DbgP("query=%d sec_desc_len=%d\n", entry->u.Acl.query, entry->u.Acl.buf_len);
|
||||
out:
|
||||
DbgEx();
|
||||
return status;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue