diff --git a/daemon/getattr.c b/daemon/getattr.c index 8e99e85..f6e8ffb 100644 --- a/daemon/getattr.c +++ b/daemon/getattr.c @@ -69,13 +69,12 @@ int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE)); if (status) goto out; status = safe_read(&buffer, &length, &args->state, sizeof(args->state)); + if (status) goto out; + + 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); out: - if (status) - eprintf("parsing NFS41_FILE_QUERY failed with %d\n", status); - else - 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); return status; } diff --git a/daemon/lock.c b/daemon/lock.c index 52e8d76..3c8a16d 100644 --- a/daemon/lock.c +++ b/daemon/lock.c @@ -104,14 +104,12 @@ int parse_lock(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) if (status) goto out; 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); out: - if (status) - eprintf("parsing NFS41_LOCK failed with %d\n", status); - else - 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); return status; } @@ -196,12 +194,10 @@ int parse_unlock(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) 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); out: - if (status) - eprintf("parsing NFS41_UNLOCK failed with %d\n", status); - else - dprintf(1, "parsing NFS41_UNLOCK: state=%p root=%p count=%u\n", - args->state, args->root, args->count); return status; } diff --git a/daemon/mount.c b/daemon/mount.c index a0c7457..649ece6 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -39,12 +39,11 @@ int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) if(status) goto out; ZeroMemory(&args->path, sizeof(nfs41_abs_path)); status = get_abs_path(&buffer, &length, &args->path); + if(status) goto out; + + dprintf(1, "parsing NFS14_MOUNT: srv_name=%s root=%s\n", + args->srv_name, args->path.path); out: - if (status) - eprintf("parsing of NFS41_MOUNT failed with %d\n", status); - else - dprintf(1, "parsing NFS14_MOUNT: srv_name=%s root=%s\n", - args->srv_name, args->path.path); return status; } @@ -110,10 +109,10 @@ int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) unmount_upcall_args *args = &upcall->args.unmount; status = safe_read(&buffer, &length, &args->root, sizeof(nfs41_session *)); - if (status) - eprintf("parsing NFS41_UNMOUNT failed with %d\n", status); - else - dprintf(1, "parsing NFS41_UNMOUNT: unmount root=%p\n", args->root); + if (status) goto out; + + dprintf(1, "parsing NFS41_UNMOUNT: unmount root=%p\n", args->root); +out: return status; } diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c index c1b9651..85a8116 100644 --- a/daemon/nfs41_daemon.c +++ b/daemon/nfs41_daemon.c @@ -78,8 +78,10 @@ static unsigned int WINAPI thread_main(void *args) } status = upcall_parse(outbuf, (uint32_t)outbuf_len, &upcall); - if (status) + if (status) { + upcall.status = status; goto write_downcall; + } #if 1 //AGLO: this is just a placeholder for a real solution. I know this variable needs a lock in a //normal case. However, this does not prevent us from receiving an upcall for an old mount diff --git a/daemon/open.c b/daemon/open.c index 1d30a33..3fdd340 100644 --- a/daemon/open.c +++ b/daemon/open.c @@ -96,21 +96,19 @@ int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) status = safe_read(&buffer, &length, &args->open_owner_id, sizeof(ULONG)); if (status) goto out; status = safe_read(&buffer, &length, &args->mode, sizeof(DWORD)); + if (status) goto out; + + 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", + args->path.path, args->access_mask, args->access_mode, args->file_attrs, + args->create_opts, args->disposition, args->root, 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); + print_create_attributes(2, args->create_opts); out: - if (status) - eprintf("parsing NFS41_OPEN failed with %d\n", status); - else { - 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", - args->path.path, args->access_mask, args->access_mode, args->file_attrs, - args->create_opts, args->disposition, args->root, 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); - print_create_attributes(2, args->create_opts); - } return status; } @@ -513,15 +511,14 @@ int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) status = get_abs_path(&buffer, &length, &args->path); if (status) goto out; status = safe_read(&buffer, &length, &args->renamed, sizeof(BOOLEAN)); + 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.path : ""); out: - if (status) - eprintf("parsing NFS41_CLOSE failed with %d\n", status); - else - 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.path : ""); return status; } diff --git a/daemon/readdir.c b/daemon/readdir.c index fac88ad..e0e3e02 100644 --- a/daemon/readdir.c +++ b/daemon/readdir.c @@ -70,16 +70,13 @@ int parse_readdir(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) dprintf(1, "upcall passing empty cookie\n"); args->cookie = NULL; } + 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 cookie=0x%p\n", + args->query_class, args->buf_len, args->filter, + args->initial, args->restart, args->single, + args->root, args->state, args->cookie); out: - if (status) - eprintf("parsing NFS41_DIR_QUERY failed with %d\n", status); - else - 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 cookie=0x%p\n", - args->query_class, args->buf_len, args->filter, - args->initial, args->restart, args->single, - args->root, args->state, args->cookie); return status; } diff --git a/daemon/readwrite.c b/daemon/readwrite.c index 71cad66..e6db466 100644 --- a/daemon/readwrite.c +++ b/daemon/readwrite.c @@ -47,14 +47,12 @@ int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) status = safe_read(&buffer, &length, &args->root, sizeof(args->root)); if (status) goto out; status = safe_read(&buffer, &length, &args->state, sizeof(args->state)); + if (status) goto out; + + 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); out: - if (status) - eprintf("parsing %s failed with %d\n", - opcode2string(upcall->opcode), status); - else - 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); return status; } diff --git a/daemon/setattr.c b/daemon/setattr.c index 181d021..54dbe07 100644 --- a/daemon/setattr.c +++ b/daemon/setattr.c @@ -61,15 +61,14 @@ int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) 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; + + 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.path, args->set_class, + args->buf_len, args->root, args->state, args->open_owner_id, + args->access_mask, args->access_mode); out: - if (status) - eprintf("parsing NFS41_FILE_SET failed with %d\n", status); - else - 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.path, args->set_class, - args->buf_len, args->root, args->state, args->open_owner_id, - args->access_mask, args->access_mode); return status; out_free: free(args->buf); @@ -464,12 +463,11 @@ int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall status = safe_read(&buffer, &length, &args->state, sizeof(args->state)); if (status) goto out; 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); out: - if (status) - eprintf("parsing NFS41_EA_SET failed with %d\n", status); - else - dprintf(1, "parsing NFS41_EA_SET: root=%p open_state=%p mode=%o\n", - args->root, args->state, args->mode); return status; } diff --git a/daemon/volume.c b/daemon/volume.c index 20dbb02..a4b01ae 100644 --- a/daemon/volume.c +++ b/daemon/volume.c @@ -48,13 +48,11 @@ int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) status = safe_read(&buffer, &length, &args->root, sizeof(HANDLE)); if (status) goto out; 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); out: - if (status) - eprintf("parsing NFS41_VOLUME_QUERY failed with %d\n", - status); - else - dprintf(1, "parsing NFS41_VOLUME_QUERY: root=0x%p, query=%d\n", - args->root, args->query); return status; }