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