- From f37bbbcf729ecd30b9e385ce453dd9e7b4d0316d Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 7 Feb 2024 16:49:22 +0100
- Subject: [PATCH 1/4] sys: nfs41_driver.sys should propagate
- |ERROR_INTERNAL_ERROR| correctly
- nfs41_driver.sys should propagate |ERROR_INTERNAL_ERROR| correctly as
- |STATUS_INTERNAL_ERROR|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 48 +++++++++++++++++++++++++++++++++-------------
- 1 file changed, 35 insertions(+), 13 deletions(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index b3cf06c..d496497 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -2643,8 +2643,10 @@ NTSTATUS map_mount_errors(
- case ERROR_BAD_NET_RESP: return STATUS_UNEXPECTED_NETWORK_ERROR;
- case ERROR_BAD_NET_NAME: return STATUS_BAD_NETWORK_NAME;
- case ERROR_BAD_NETPATH: return STATUS_BAD_NETWORK_PATH;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_mount_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INSUFFICIENT_RESOURCES\n", status);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
- @@ -3604,8 +3606,9 @@ NTSTATUS map_open_errors(
- case ERROR_TOO_MANY_LINKS: return STATUS_TOO_MANY_LINKS;
- case ERROR_DIRECTORY: return STATUS_FILE_IS_A_DIRECTORY;
- case ERROR_BAD_FILE_TYPE: return STATUS_NOT_A_DIRECTORY;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("[ERROR] nfs41_Create: upcall returned %d returning "
- + print_error("[ERROR] nfs41_Create: upcall returned ERROR_%d returning "
- "STATUS_INSUFFICIENT_RESOURCES\n", status);
- case ERROR_OUTOFMEMORY: return STATUS_INSUFFICIENT_RESOURCES;
- }
- @@ -4215,9 +4218,10 @@ NTSTATUS map_close_errors(
- case ERROR_NOT_EMPTY: return STATUS_DIRECTORY_NOT_EMPTY;
- case ERROR_FILE_INVALID: return STATUS_FILE_INVALID;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_close_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INTERNAL_ERROR\n", status);
- - case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- }
- }
- @@ -4345,8 +4349,10 @@ NTSTATUS map_querydir_errors(
- case ERROR_NO_MORE_FILES: return STATUS_NO_MORE_FILES;
- case ERROR_OUTOFMEMORY: return STATUS_INSUFFICIENT_RESOURCES;
- case ERROR_FILENAME_EXCED_RANGE: return STATUS_NAME_TOO_LONG;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_querydir_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- @@ -4489,8 +4495,10 @@ NTSTATUS map_volume_errors(
- case ERROR_NETNAME_DELETED: return STATUS_NETWORK_NAME_DELETED;
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- case ERROR_OUTOFMEMORY: return STATUS_INSUFFICIENT_RESOURCES;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_volume_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- @@ -4769,8 +4777,10 @@ NTSTATUS map_setea_error(
- case ERROR_INVALID_EA_HANDLE: return STATUS_NONEXISTENT_EA_ENTRY;
- case ERROR_NO_MORE_FILES: return STATUS_NO_MORE_EAS;
- case ERROR_EA_FILE_CORRUPT: return STATUS_EA_CORRUPT_ERROR;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_setea_error: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_PARAMETER\n", error);
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- }
- @@ -5185,8 +5195,10 @@ NTSTATUS map_query_acl_error(
- case ERROR_ACCESS_DENIED: return STATUS_ACCESS_DENIED;
- case ERROR_FILE_NOT_FOUND: return STATUS_OBJECT_NAME_NOT_FOUND;
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_query_acl_error: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- @@ -5449,8 +5461,10 @@ NTSTATUS map_queryfile_error(
- case ERROR_ACCESS_DENIED: return STATUS_ACCESS_DENIED;
- case ERROR_NETNAME_DELETED: return STATUS_NETWORK_NAME_DELETED;
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_queryfile_error: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- @@ -5634,8 +5648,10 @@ NTSTATUS map_setfile_error(
- case ERROR_NETWORK_ACCESS_DENIED: return STATUS_NETWORK_ACCESS_DENIED;
- case ERROR_NETNAME_DELETED: return STATUS_NETWORK_NAME_DELETED;
- case ERROR_BUFFER_OVERFLOW: return STATUS_INSUFFICIENT_RESOURCES;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_setfile_error: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_PARAMETER\n", error);
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- }
- @@ -6022,8 +6038,10 @@ NTSTATUS map_readwrite_errors(
- case ERROR_LOCK_VIOLATION: return STATUS_FILE_LOCK_CONFLICT;
- case ERROR_NETWORK_ACCESS_DENIED: return STATUS_NETWORK_ACCESS_DENIED;
- case ERROR_NETNAME_DELETED: return STATUS_NETWORK_NAME_DELETED;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_readwrite_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_NET_WRITE_FAULT\n", status);
- case ERROR_NET_WRITE_FAULT: return STATUS_NET_WRITE_FAULT;
- }
- @@ -6301,8 +6319,10 @@ NTSTATUS map_lock_errors(
- /* if we return ERROR_INVALID_PARAMETER, Windows translates that to
- * success!! */
- case ERROR_INVALID_PARAMETER: return STATUS_LOCK_NOT_GRANTED;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_lock_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- @@ -6521,8 +6541,10 @@ NTSTATUS map_symlink_errors(
- case ERROR_INSUFFICIENT_BUFFER: return STATUS_BUFFER_TOO_SMALL;
- case STATUS_BUFFER_TOO_SMALL:
- case ERROR_BUFFER_OVERFLOW: return STATUS_BUFFER_OVERFLOW;
- + case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("failed to map windows error %d to NTSTATUS; "
- + print_error("map_symlink_errors: "
- + "failed to map windows ERROR_%d to NTSTATUS; "
- "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- --
- 2.43.0
- From 56bc55316547c655c201d92bc1151d5e620a0959 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 7 Feb 2024 16:51:18 +0100
- Subject: [PATCH 2/4] daemon: cp -p fails with "Function not implemented"
- instead of "Permission denied"
- cp -p with a source file uid/gid which is not the current users uid/gid
- should fail with "Permission denied", not "Function not implemented"
- Example:
- Current user "foobar", /cygdrive/c/Windows/System32/drivers/etc/hosts
- is owned by user "SYSTEM":
- $ cp -p /cygdrive/c/Windows/System32/drivers/etc/hosts foo3 #
- This should fail with "Permission denied".
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/acl.c | 37 ++++++++++++++++++++++++++++++++-----
- daemon/util.c | 1 +
- 2 files changed, 33 insertions(+), 5 deletions(-)
- diff --git a/daemon/acl.c b/daemon/acl.c
- index e4fb02e..7266a9d 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -287,6 +287,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- args->sec_desc_len = 0;
- status = MakeSelfRelativeSD(&sec_desc, args->sec_desc, &args->sec_desc_len);
- if (status) {
- + eprintf("handle_getacl: MakeSelfRelativeSD() failed.\n");
- status = ERROR_INTERNAL_ERROR;
- goto out;
- }
- @@ -462,6 +463,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- DWORD size = 0, tmp_size = 0;
- SID_NAME_USE sid_type;
- LPSTR tmp_buf = NULL, who = NULL;
- + LPSTR sidstr = NULL;
- /* for ace mapping, we want to map owner's sid into "owner@"
- * but for set_owner attribute we want to map owner into a user name
- @@ -492,13 +494,36 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- return ERROR_SUCCESS;
- }
- + if (!ConvertSidToStringSidA(sid, &sidstr)) {
- + status = GetLastError();
- + eprintf("map_nfs4ace_who: ConvertSidToStringSidA() failed, "
- + "error=%d\n", status);
- + goto out;
- + }
- +
- status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
- &tmp_size, &sid_type);
- - dprintf(ACLLVL, "map_nfs4ace_who: LookupAccountSid returned %d GetLastError "
- - "%d name len %d domain len %d\n", status, GetLastError(),
- - size, tmp_size);
- - if (status)
- - return ERROR_INTERNAL_ERROR;
- + dprintf(ACLLVL, "map_nfs4ace_who: "
- + "LookupAccountSid(sidtostr(sid)='%s', namelen=%d, domainlen=%d) "
- + "returned %d, GetLastError=%d\n",
- + sidstr, size, tmp_size, status, GetLastError());
- +
- + /*
- + * No SID to local account mapping. Can happen for some system
- + * SIDs, and Unix_User+<uid> or Unix_Group+<gid> SIDs
- + */
- + switch (status) {
- + /* This happens for Unix_User+<uid> or Unix_Group+<gid> SIDs */
- + case ERROR_NONE_MAPPED:
- + /* Catch other cases */
- + case ERROR_NO_SUCH_USER:
- + case ERROR_NO_SUCH_GROUP:
- + goto out;
- + default:
- + status = ERROR_INTERNAL_ERROR;
- + goto out;
- + }
- +
- status = GetLastError();
- if (status != ERROR_INSUFFICIENT_BUFFER)
- return ERROR_INTERNAL_ERROR;
- @@ -526,6 +551,8 @@ add_domain:
- if (who) free(who);
- status = ERROR_SUCCESS;
- out:
- + if (sidstr)
- + LocalFree(sidstr);
- return status;
- out_free_who:
- free(who);
- diff --git a/daemon/util.c b/daemon/util.c
- index 70383d7..3d366d2 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -279,6 +279,7 @@ int nfs_to_windows_error(int status, int default_error)
- case NFS4ERR_OPENMODE: return ERROR_ACCESS_DENIED;
- case NFS4ERR_LOCK_NOTSUPP: return ERROR_ATOMIC_LOCKS_NOT_SUPPORTED;
- + case NFS4ERR_BADOWNER: return ERROR_ACCESS_DENIED;
- case NFS4ERR_BADCHAR:
- case NFS4ERR_BADNAME: return ERROR_INVALID_NAME;
- --
- 2.43.0
- From dbd6aa3c999248cf92a9c94d1695fd5b2e2ef5f0 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 8 Feb 2024 12:37:37 +0100
- Subject: [PATCH 3/4] deamon: Replace |dprintf()| with |DPRINTF()| which tests
- debug level inline
- Replace the |dprintf()| function with a |DPRINTF()| macro which tests
- the debug level inline with the caller.
- This saves a whole function call if no debug output is made, plus
- parameter setup (which might include additional function calls,
- which are only needed for that debug message), and makes debugging or
- instrumentation (e.g. DrMemory) faster.
- Also, quote strings in debug output (change %s to '%s') and
- prefix pointers (change %p to 0x%p) for both |DPRINTF()| and
- |eprintf()|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/acl.c | 74 ++++++++++-----------
- daemon/callback_server.c | 56 ++++++++--------
- daemon/callback_xdr.c | 2 +-
- daemon/daemon_debug.c | 128 +++++++++++++++++------------------
- daemon/daemon_debug.h | 26 +++++---
- daemon/delegation.c | 34 +++++-----
- daemon/ea.c | 28 ++++----
- daemon/getattr.c | 12 ++--
- daemon/idmap.c | 122 ++++++++++++++++++----------------
- daemon/idmap_cygwin.c | 54 +++++++--------
- daemon/lock.c | 18 ++---
- daemon/lookup.c | 6 +-
- daemon/mount.c | 18 ++---
- daemon/name_cache.c | 126 ++++++++++++++++++-----------------
- daemon/namespace.c | 52 +++++++--------
- daemon/nfs41_client.c | 6 +-
- daemon/nfs41_compound.c | 14 ++--
- daemon/nfs41_daemon.c | 69 ++++++++++---------
- daemon/nfs41_ops.c | 19 +++---
- daemon/nfs41_rpc.c | 31 ++++-----
- daemon/nfs41_server.c | 64 +++++++++---------
- daemon/nfs41_session.c | 46 ++++++-------
- daemon/nfs41_superblock.c | 32 ++++-----
- daemon/nfs41_xdr.c | 12 ++--
- daemon/open.c | 136 ++++++++++++++++++++------------------
- daemon/pnfs_debug.c | 44 ++++++------
- daemon/pnfs_device.c | 66 +++++++++---------
- daemon/pnfs_io.c | 62 ++++++++---------
- daemon/pnfs_layout.c | 108 +++++++++++++++---------------
- daemon/readdir.c | 86 ++++++++++++------------
- daemon/readwrite.c | 20 +++---
- daemon/recovery.c | 10 +--
- daemon/setattr.c | 54 +++++++--------
- daemon/sid.c | 92 ++++++++++++++------------
- daemon/symlink.c | 28 ++++----
- daemon/upcall.c | 6 +-
- daemon/util.c | 34 +++++-----
- daemon/volume.c | 12 ++--
- 38 files changed, 929 insertions(+), 878 deletions(-)
- diff --git a/daemon/acl.c b/daemon/acl.c
- index 7266a9d..279f321 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -47,7 +47,7 @@ static int parse_getacl(unsigned char *buffer, uint32_t length,
- status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
- if (status) goto out;
- - dprintf(1, "parsing NFS41_ACL_QUERY: info_class=%d\n", args->query);
- + DPRINTF(1, ("parsing NFS41_ACL_QUERY: info_class=%d\n", args->query));
- out:
- return status;
- }
- @@ -113,8 +113,8 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
- }
- for (i = 0; i < acl->count; i++) {
- convert_nfs4name_2_user_domain(acl->aces[i].who, &domain);
- - dprintf(ACLLVL, "handle_getacl: for user=%s domain=%s\n",
- - acl->aces[i].who, domain?domain:"<null>");
- + DPRINTF(ACLLVL, ("handle_getacl: for user='%s' domain='%s'\n",
- + acl->aces[i].who, domain?domain:"<null>"));
- status = check_4_special_identifiers(acl->aces[i].who, &sids[i],
- &sid_len, &flag);
- if (status) {
- @@ -143,8 +143,8 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
- for (i = 0; i < acl->count; i++) {
- // nfs4 acemask should be exactly the same as file access mask
- mask = acl->aces[i].acemask;
- - dprintf(ACLLVL, "access mask %x ace type %s\n", mask,
- - acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE");
- + DPRINTF(ACLLVL, ("access mask %x ace type '%s'\n", mask,
- + acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE"));
- if (acl->aces[i].acetype == ACE4_ACCESS_ALLOWED_ACE_TYPE) {
- status = AddAccessAllowedAce(dacl, ACL_REVISION, mask, sids[i]);
- if (!status) {
- @@ -162,7 +162,7 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
- }
- else status = ERROR_SUCCESS;
- } else {
- - eprintf("convert_nfs4acl_2_dacl: unknown acetype %d\n",
- + eprintf("convert_nfs4acl_2_dacl: unknown acetype %d\n",
- acl->aces[i].acetype);
- status = ERROR_INTERNAL_ERROR;
- free(dacl);
- @@ -215,7 +215,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- info.owner_group = group;
- status = nfs41_getattr(state->session, &state->file, &attr_request, &info);
- if (status) {
- - eprintf("handle_getacl: nfs41_cached_getattr() failed with %d\n",
- + eprintf("handle_getacl: nfs41_cached_getattr() failed with %d\n",
- status);
- goto out;
- }
- @@ -224,7 +224,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- SECURITY_DESCRIPTOR_REVISION);
- if (!status) {
- status = GetLastError();
- - eprintf("handle_getacl: InitializeSecurityDescriptor failed with %d\n",
- + eprintf("handle_getacl: InitializeSecurityDescriptor failed with %d\n",
- status);
- goto out;
- }
- @@ -236,8 +236,8 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- if (args->query & OWNER_SECURITY_INFORMATION) {
- // parse user@domain. currently ignoring domain part XX
- convert_nfs4name_2_user_domain(info.owner, &domain);
- - dprintf(ACLLVL, "handle_getacl: OWNER_SECURITY_INFORMATION: for user=%s "
- - "domain=%s\n", info.owner, domain?domain:"<null>");
- + DPRINTF(ACLLVL, ("handle_getacl: OWNER_SECURITY_INFORMATION: for user='%s' "
- + "domain='%s'\n", info.owner, domain?domain:"<null>"));
- sid_len = 0;
- status = map_nfs4servername_2_sid(nfs41dg,
- OWNER_SECURITY_INFORMATION, &sid_len, &osid, info.owner);
- @@ -254,8 +254,8 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- if (args->query & GROUP_SECURITY_INFORMATION) {
- convert_nfs4name_2_user_domain(info.owner_group, &domain);
- - dprintf(ACLLVL, "handle_getacl: GROUP_SECURITY_INFORMATION: for %s "
- - "domain=%s\n", info.owner_group, domain?domain:"<null>");
- + DPRINTF(ACLLVL, ("handle_getacl: GROUP_SECURITY_INFORMATION: for '%s' "
- + "domain='%s'\n", info.owner_group, domain?domain:"<null>"));
- sid_len = 0;
- status = map_nfs4servername_2_sid(nfs41dg,
- GROUP_SECURITY_INFORMATION, &sid_len, &gsid, info.owner_group);
- @@ -270,7 +270,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
- }
- }
- if (args->query & DACL_SECURITY_INFORMATION) {
- - dprintf(ACLLVL, "handle_getacl: DACL_SECURITY_INFORMATION\n");
- + DPRINTF(ACLLVL, ("handle_getacl: DACL_SECURITY_INFORMATION\n"));
- status = convert_nfs4acl_2_dacl(nfs41dg,
- info.acl, state->type, &dacl, &sids);
- if (status)
- @@ -358,8 +358,8 @@ static int parse_setacl(unsigned char *buffer, uint32_t length,
- if (status) goto out;
- args->sec_desc = (PSECURITY_DESCRIPTOR)buffer;
- - dprintf(1, "parsing NFS41_ACL_SET: info_class=%d sec_desc_len=%d\n",
- - args->query, 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;
- }
- @@ -371,7 +371,7 @@ static int is_well_known_sid(PSID sid, char *who)
- status = IsWellKnownSid(sid, (WELL_KNOWN_SID_TYPE)i);
- if (!status) continue;
- else {
- - dprintf(ACLLVL, "WELL_KNOWN_SID_TYPE %d\n", i);
- + DPRINTF(ACLLVL, ("WELL_KNOWN_SID_TYPE %d\n", i));
- switch((WELL_KNOWN_SID_TYPE)i) {
- case WinCreatorOwnerSid:
- memcpy(who, ACE4_OWNER, strlen(ACE4_OWNER)+1);
- @@ -428,14 +428,14 @@ static void map_aceflags(BYTE win_aceflags, uint32_t *nfs4_aceflags)
- *nfs4_aceflags |= ACE4_INHERIT_ONLY_ACE;
- if (win_aceflags & INHERITED_ACE)
- *nfs4_aceflags |= ACE4_INHERITED_ACE;
- - dprintf(ACLLVL, "ACE FLAGS: %x nfs4 aceflags %x\n",
- - win_aceflags, *nfs4_aceflags);
- + DPRINTF(ACLLVL, ("ACE FLAGS: %x nfs4 aceflags %x\n",
- + win_aceflags, *nfs4_aceflags));
- }
- static void map_acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
- {
- - dprintf(ACLLVL, "ACE MASK: %x\n", mask);
- - print_windows_access_mask(0, mask);
- + DPRINTF(ACLLVL, ("ACE MASK: %x\n", mask));
- + print_windows_access_mask(ACLLVL, mask);
- /* check if any GENERIC bits set */
- if (mask & 0xf000000) {
- if (mask & GENERIC_ALL) {
- @@ -454,7 +454,7 @@ static void map_acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
- }
- else /* ignoring generic and reserved bits */
- *nfs4_mask = mask & 0x00ffffff;
- - print_nfs_access_mask(0, *nfs4_mask);
- + print_nfs_access_mask(ACLLVL, *nfs4_mask);
- }
- static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_out, char *domain)
- @@ -472,14 +472,14 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- status = 0;
- if (owner_sid) {
- if (EqualSid(sid, owner_sid)) {
- - dprintf(ACLLVL, "map_nfs4ace_who: this is owner's sid\n");
- + DPRINTF(ACLLVL, ("map_nfs4ace_who: this is owner's sid\n"));
- memcpy(who_out, ACE4_OWNER, strlen(ACE4_OWNER)+1);
- return ERROR_SUCCESS;
- }
- }
- if (group_sid) {
- if (EqualSid(sid, group_sid)) {
- - dprintf(ACLLVL, "map_nfs4ace_who: this is group's sid\n");
- + DPRINTF(ACLLVL, ("map_nfs4ace_who: this is group's sid\n"));
- memcpy(who_out, ACE4_GROUP, strlen(ACE4_GROUP)+1);
- return ERROR_SUCCESS;
- }
- @@ -503,10 +503,10 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
- &tmp_size, &sid_type);
- - dprintf(ACLLVL, "map_nfs4ace_who: "
- + DPRINTF(ACLLVL, ("map_nfs4ace_who: "
- "LookupAccountSid(sidtostr(sid)='%s', namelen=%d, domainlen=%d) "
- "returned %d, GetLastError=%d\n",
- - sidstr, size, tmp_size, status, GetLastError());
- + sidstr, size, tmp_size, status, GetLastError()));
- /*
- * No SID to local account mapping. Can happen for some system
- @@ -539,7 +539,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- &tmp_size, &sid_type);
- free(tmp_buf);
- if (!status) {
- - eprintf("map_nfs4ace_who: LookupAccountSid failed with %d\n",
- + eprintf("map_nfs4ace_who: LookupAccountSid failed with %d\n",
- GetLastError());
- goto out_free_who;
- }
- @@ -547,7 +547,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- add_domain:
- memcpy(who_out+size, "@", sizeof(char));
- memcpy(who_out+size+1, domain, strlen(domain)+1);
- - dprintf(ACLLVL, "map_nfs4ace_who: who=%s\n", who_out);
- + DPRINTF(ACLLVL, ("map_nfs4ace_who: who='%s'\n", who_out));
- if (who) free(who);
- status = ERROR_SUCCESS;
- out:
- @@ -564,7 +564,7 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
- {
- int status;
- if (acl == NULL) {
- - dprintf(ACLLVL, "this is a NULL dacl: all access to an object\n");
- + DPRINTF(ACLLVL, ("this is a NULL dacl: all access to an object\n"));
- nfs4_acl->count = 1;
- nfs4_acl->aces = calloc(1, sizeof(nfsace4));
- if (nfs4_acl->aces == NULL) {
- @@ -584,8 +584,8 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
- PACE_HEADER ace;
- PBYTE tmp_pointer;
- - dprintf(ACLLVL, "NON-NULL dacl with %d ACEs\n", acl->AceCount);
- - print_hexbuf_no_asci(3, (unsigned char *)"ACL\n",
- + DPRINTF(ACLLVL, ("NON-NULL dacl with %d ACEs\n", acl->AceCount));
- + print_hexbuf_no_asci(ACLLVL, (unsigned char *)"ACL\n",
- (unsigned char *)acl, acl->AclSize);
- nfs4_acl->count = acl->AceCount;
- nfs4_acl->aces = calloc(nfs4_acl->count, sizeof(nfsace4));
- @@ -602,9 +602,9 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
- goto out_free;
- }
- tmp_pointer = (PBYTE)ace;
- - print_hexbuf_no_asci(3, (unsigned char *)"ACE\n",
- + print_hexbuf_no_asci(ACLLVL, (unsigned char *)"ACE\n",
- (unsigned char *)ace, ace->AceSize);
- - dprintf(ACLLVL, "ACE TYPE: %x\n", ace->AceType);
- + DPRINTF(ACLLVL, ("ACE TYPE: %x\n", ace->AceType));
- if (ace->AceType == ACCESS_ALLOWED_ACE_TYPE)
- nfs4_acl->aces[i].acetype = ACE4_ACCESS_ALLOWED_ACE_TYPE;
- else if (ace->AceType == ACCESS_DENIED_ACE_TYPE)
- @@ -649,7 +649,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
- if (args->query & OWNER_SECURITY_INFORMATION) {
- char owner[NFS4_OPAQUE_LIMIT];
- - dprintf(ACLLVL, "handle_setacl: OWNER_SECURITY_INFORMATION\n");
- + DPRINTF(ACLLVL, ("handle_setacl: OWNER_SECURITY_INFORMATION\n"));
- status = GetSecurityDescriptorOwner(args->sec_desc, &sid, &sid_default);
- if (!status) {
- status = GetLastError();
- @@ -667,7 +667,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
- }
- if (args->query & GROUP_SECURITY_INFORMATION) {
- char group[NFS4_OPAQUE_LIMIT];
- - dprintf(ACLLVL, "handle_setacl: GROUP_SECURITY_INFORMATION\n");
- + DPRINTF(ACLLVL, ("handle_setacl: GROUP_SECURITY_INFORMATION\n"));
- status = GetSecurityDescriptorGroup(args->sec_desc, &sid, &sid_default);
- if (!status) {
- status = GetLastError();
- @@ -687,7 +687,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
- if (args->query & DACL_SECURITY_INFORMATION) {
- BOOL dacl_present, dacl_default;
- PACL acl;
- - dprintf(ACLLVL, "handle_setacl: DACL_SECURITY_INFORMATION\n");
- + DPRINTF(ACLLVL, ("handle_setacl: DACL_SECURITY_INFORMATION\n"));
- status = GetSecurityDescriptorDacl(args->sec_desc, &dacl_present,
- &acl, &dacl_default);
- if (!status) {
- @@ -726,8 +726,8 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
- nfs41_open_stateid_arg(state, &stateid);
- status = nfs41_setattr(state->session, &state->file, &stateid, &info);
- if (status) {
- - dprintf(ACLLVL, "handle_setacl: nfs41_setattr() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(ACLLVL, ("handle_setacl: nfs41_setattr() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
- }
- args->ctime = info.change;
- diff --git a/daemon/callback_server.c b/daemon/callback_server.c
- index f08d486..ca20fdd 100644
- --- a/daemon/callback_server.c
- +++ b/daemon/callback_server.c
- @@ -76,10 +76,10 @@ static enum_t handle_cb_layoutrecall(
- break;
- }
- - dprintf(CBSLVL, " OP_CB_LAYOUTRECALL { %s, %s, recall %u } %s\n",
- + DPRINTF(CBSLVL, (" OP_CB_LAYOUTRECALL { '%s', '%s', recall %u } '%s'\n",
- pnfs_layout_type_string(args->type),
- pnfs_iomode_string(args->iomode), args->recall.type,
- - nfs_error_string(res->status));
- + nfs_error_string(res->status)));
- return res->status;
- }
- @@ -92,8 +92,8 @@ static enum_t handle_cb_recall_slot(
- res->status = nfs41_session_recall_slot(rpc_clnt->client->session,
- args->target_highest_slotid);
- - dprintf(CBSLVL, " OP_CB_RECALL_SLOT { %u } %s\n",
- - args->target_highest_slotid, nfs_error_string(res->status));
- + DPRINTF(CBSLVL, (" OP_CB_RECALL_SLOT { %u } '%s'\n",
- + args->target_highest_slotid, nfs_error_string(res->status)));
- return res->status;
- }
- @@ -164,9 +164,9 @@ static enum_t handle_cb_sequence(
- res->ok.target_highest_slotid = args->highest_slotid;
- out:
- - dprintf(CBSLVL, " OP_CB_SEQUENCE { seqid %u, slot %u, cachethis %d } "
- + DPRINTF(CBSLVL, (" OP_CB_SEQUENCE { seqid %u, slot %u, cachethis %d } "
- "%s\n", args->sequenceid, args->slotid, args->cachethis,
- - nfs_error_string(res->status));
- + nfs_error_string(res->status)));
- return status;
- }
- @@ -338,7 +338,7 @@ static int replay_cache_read(
- xdr.x_op = XDR_FREE;
- proc_cb_compound_res(&xdr, res);
- - dprintf(2, "[cb] retry: returning cached response\n");
- + DPRINTF(2, ("[cb] retry: returning cached response\n"));
- *res_out = replay;
- out:
- @@ -362,7 +362,7 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
- bool_t cachethis = FALSE;
- uint32_t i, status = NFS4_OK;
- - dprintf(CBSLVL, "--> handle_cb_compound()\n");
- + DPRINTF(CBSLVL, ("--> handle_cb_compound()\n"));
- /* decode the arguments */
- if (!proc_cb_compound_args(xdr, &args)) {
- @@ -386,7 +386,7 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
- goto out;
- }
- - dprintf(CBSLVL, "CB_COMPOUND('%s', %u)\n", args.tag.str, args.argarray_count);
- + DPRINTF(CBSLVL, ("CB_COMPOUND('%s', %u)\n", args.tag.str, args.argarray_count));
- if (args.minorversion != 1) {
- res->status = NFS4ERR_MINOR_VERS_MISMATCH; //XXXXX
- eprintf("args.minorversion %u != 1\n", args.minorversion);
- @@ -421,17 +421,17 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
- switch (argop->opnum) {
- case OP_CB_LAYOUTRECALL:
- - dprintf(1, "OP_CB_LAYOUTRECALL\n");
- + DPRINTF(1, ("OP_CB_LAYOUTRECALL\n"));
- res->status = handle_cb_layoutrecall(rpc_clnt,
- &argop->args.layoutrecall, &resop->res.layoutrecall);
- break;
- case OP_CB_RECALL_SLOT:
- - dprintf(1, "OP_CB_RECALL_SLOT\n");
- + DPRINTF(1, ("OP_CB_RECALL_SLOT\n"));
- res->status = handle_cb_recall_slot(rpc_clnt,
- &argop->args.recall_slot, &resop->res.recall_slot);
- break;
- case OP_CB_SEQUENCE:
- - dprintf(1, "OP_CB_SEQUENCE\n");
- + DPRINTF(1, ("OP_CB_SEQUENCE\n"));
- status = handle_cb_sequence(rpc_clnt, &argop->args.sequence,
- &resop->res.sequence, &session, &cachethis);
- @@ -446,45 +446,45 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
- res->status = resop->res.sequence.status;
- break;
- case OP_CB_GETATTR:
- - dprintf(1, "OP_CB_GETATTR\n");
- + DPRINTF(1, ("OP_CB_GETATTR\n"));
- res->status = handle_cb_getattr(rpc_clnt,
- &argop->args.getattr, &resop->res.getattr);
- break;
- case OP_CB_RECALL:
- - dprintf(1, "OP_CB_RECALL\n");
- + DPRINTF(1, ("OP_CB_RECALL\n"));
- res->status = handle_cb_recall(rpc_clnt,
- &argop->args.recall, &resop->res.recall);
- break;
- case OP_CB_NOTIFY:
- - dprintf(1, "OP_CB_NOTIFY\n");
- + DPRINTF(1, ("OP_CB_NOTIFY\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- case OP_CB_PUSH_DELEG:
- - dprintf(1, "OP_CB_PUSH_DELEG\n");
- + DPRINTF(1, ("OP_CB_PUSH_DELEG\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- case OP_CB_RECALL_ANY:
- - dprintf(1, "OP_CB_RECALL_ANY\n");
- + DPRINTF(1, ("OP_CB_RECALL_ANY\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- case OP_CB_RECALLABLE_OBJ_AVAIL:
- - dprintf(1, "OP_CB_RECALLABLE_OBJ_AVAIL\n");
- + DPRINTF(1, ("OP_CB_RECALLABLE_OBJ_AVAIL\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- case OP_CB_WANTS_CANCELLED:
- - dprintf(1, "OP_CB_WANTS_CANCELLED\n");
- + DPRINTF(1, ("OP_CB_WANTS_CANCELLED\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- case OP_CB_NOTIFY_LOCK:
- - dprintf(1, "OP_CB_NOTIFY_LOCK\n");
- + DPRINTF(1, ("OP_CB_NOTIFY_LOCK\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- case OP_CB_NOTIFY_DEVICEID:
- - dprintf(1, "OP_CB_NOTIFY_DEVICEID\n");
- + DPRINTF(1, ("OP_CB_NOTIFY_DEVICEID\n"));
- res->status = NFS4_OK;
- break;
- case OP_CB_ILLEGAL:
- - dprintf(1, "OP_CB_ILLEGAL\n");
- + DPRINTF(1, ("OP_CB_ILLEGAL\n"));
- res->status = NFS4ERR_NOTSUPP;
- break;
- default:
- @@ -503,9 +503,9 @@ out:
- proc_cb_compound_args(xdr, &args);
- *reply = res;
- - dprintf(CBSLVL, "<-- handle_cb_compound() returning %s (%u results)\n",
- + DPRINTF(CBSLVL, ("<-- handle_cb_compound() returning '%s' (%u results)\n",
- nfs_error_string(res ? res->status : status),
- - res ? res->resarray_count : 0);
- + res ? res->resarray_count : 0));
- }
- int nfs41_handle_callback(void *rpc_clnt, void *cb, struct cb_compound_res **reply)
- @@ -514,7 +514,7 @@ int nfs41_handle_callback(void *rpc_clnt, void *cb, struct cb_compound_res **rep
- cb_req *request = (cb_req *)cb;
- uint32_t status = 0;
- - dprintf(1, "nfs41_handle_callback: received call\n");
- + DPRINTF(1, ("nfs41_handle_callback: received call\n"));
- if (request->rq_prog != NFS41_RPC_CBPROGRAM) {
- eprintf("invalid rpc program %u\n", request->rq_prog);
- status = 2;
- @@ -523,16 +523,16 @@ int nfs41_handle_callback(void *rpc_clnt, void *cb, struct cb_compound_res **rep
- switch (request->rq_proc) {
- case CB_NULL:
- - dprintf(1, "CB_NULL\n");
- + DPRINTF(1, ("CB_NULL\n"));
- break;
- case CB_COMPOUND:
- - dprintf(1, "CB_COMPOUND\n");
- + DPRINTF(1, ("CB_COMPOUND\n"));
- handle_cb_compound(rpc, request, reply);
- break;
- default:
- - dprintf(1, "invalid rpc procedure %u\n", request->rq_proc);
- + DPRINTF(1, ("invalid rpc procedure %u\n", request->rq_proc));
- status = 3;
- goto out;
- }
- diff --git a/daemon/callback_xdr.c b/daemon/callback_xdr.c
- index 364ca85..87ab622 100644
- --- a/daemon/callback_xdr.c
- +++ b/daemon/callback_xdr.c
- @@ -26,7 +26,7 @@
- #define CBXLVL 2 /* dprintf level for callback xdr logging */
- -#define CBX_ERR(msg) dprintf((CBXLVL), __FUNCTION__ ": failed at " msg "\n")
- +#define CBX_ERR(msg) DPRINTF((CBXLVL),( __FUNCTION__ ": failed at " msg "\n"))
- /* common types */
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index deb6405..c434b17 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -31,7 +31,7 @@
- #include "rpc/rpc.h"
- #include "rpc/auth_sspi.h"
- -static int g_debug_level = DEFAULT_DEBUG_LEVEL;
- +extern int g_debug_level = DEFAULT_DEBUG_LEVEL;
- void set_debug_level(int level) { g_debug_level = level; }
- @@ -71,11 +71,9 @@ void open_log_files()
- }
- #endif
- -void dprintf(int level, LPCSTR format, ...)
- -{
- - if (level > g_debug_level)
- - return;
- +void dprintf_out(LPCSTR format, ...)
- +{
- va_list args;
- va_start(args, format);
- (void)fprintf(dlog_file, "%04x: ", (int)GetCurrentThreadId());
- @@ -250,7 +248,7 @@ void print_file_id_both_dir_info(int level, FILE_ID_BOTH_DIR_INFO *pboth_dir_inf
- if (level > g_debug_level)
- return;
- - (void)fprintf(dlog_file, "FILE_ID_BOTH_DIR_INFO %p %zd\n",
- + (void)fprintf(dlog_file, "FILE_ID_BOTH_DIR_INFO 0x%p %zd\n",
- pboth_dir_info, sizeof(unsigned char *));
- (void)fprintf(dlog_file, "\tNextEntryOffset=%ld %zd %zd\n",
- pboth_dir_info->NextEntryOffset,
- @@ -294,16 +292,11 @@ void print_file_id_both_dir_info(int level, FILE_ID_BOTH_DIR_INFO *pboth_dir_inf
- (void)fprintf(dlog_file, "\tFileId=0x%llx %zd\n",
- (long long)pboth_dir_info->FileId.QuadPart,
- sizeof(pboth_dir_info->FileId));
- - (void)fprintf(dlog_file, "\tFileName='%S' %p\n",
- + (void)fprintf(dlog_file, "\tFileName='%S' 0x%p\n",
- pboth_dir_info->FileName,
- pboth_dir_info->FileName);
- }
- -void print_opcode(int level, DWORD opcode)
- -{
- - dprintf(level, (LPCSTR)opcode2string(opcode));
- -}
- -
- const char* opcode2string(DWORD opcode)
- {
- switch(opcode) {
- @@ -606,110 +599,117 @@ const char* secflavorop2name(DWORD sec_flavor)
- void print_windows_access_mask(int on, ACCESS_MASK m)
- {
- - if (!on) return;
- - dprintf(1, "--> print_windows_access_mask: %x\n", m);
- + if (!on)
- + return;
- + if (!DPRINTF_LEVEL_ENABLED(1))
- + return;
- +
- + dprintf_out("--> print_windows_access_mask: %x\n", m);
- if (m & GENERIC_READ)
- - dprintf(1, "\tGENERIC_READ\n");
- + dprintf_out("\tGENERIC_READ\n");
- if (m & GENERIC_WRITE)
- - dprintf(1, "\tGENERIC_WRITE\n");
- + dprintf_out("\tGENERIC_WRITE\n");
- if (m & GENERIC_EXECUTE)
- - dprintf(1, "\tGENERIC_EXECUTE\n");
- + dprintf_out("\tGENERIC_EXECUTE\n");
- if (m & GENERIC_ALL)
- - dprintf(1, "\tGENERIC_ALL\n");
- + dprintf_out("\tGENERIC_ALL\n");
- if (m & MAXIMUM_ALLOWED)
- - dprintf(1, "\tMAXIMUM_ALLOWED\n");
- + dprintf_out("\tMAXIMUM_ALLOWED\n");
- if (m & ACCESS_SYSTEM_SECURITY)
- - dprintf(1, "\tACCESS_SYSTEM_SECURITY\n");
- + dprintf_out("\tACCESS_SYSTEM_SECURITY\n");
- if ((m & SPECIFIC_RIGHTS_ALL) == SPECIFIC_RIGHTS_ALL)
- - dprintf(1, "\tSPECIFIC_RIGHTS_ALL\n");
- + dprintf_out("\tSPECIFIC_RIGHTS_ALL\n");
- if ((m & STANDARD_RIGHTS_ALL) == STANDARD_RIGHTS_ALL)
- - dprintf(1, "\tSTANDARD_RIGHTS_ALL\n");
- + dprintf_out("\tSTANDARD_RIGHTS_ALL\n");
- if ((m & STANDARD_RIGHTS_REQUIRED) == STANDARD_RIGHTS_REQUIRED)
- - dprintf(1, "\tSTANDARD_RIGHTS_REQUIRED\n");
- + dprintf_out("\tSTANDARD_RIGHTS_REQUIRED\n");
- if (m & SYNCHRONIZE)
- - dprintf(1, "\tSYNCHRONIZE\n");
- + dprintf_out("\tSYNCHRONIZE\n");
- if (m & WRITE_OWNER)
- - dprintf(1, "\tWRITE_OWNER\n");
- + dprintf_out("\tWRITE_OWNER\n");
- if (m & WRITE_DAC)
- - dprintf(1, "\tWRITE_DAC\n");
- + dprintf_out("\tWRITE_DAC\n");
- if (m & READ_CONTROL)
- - dprintf(1, "\tREAD_CONTROL\n");
- + dprintf_out("\tREAD_CONTROL\n");
- if (m & DELETE)
- - dprintf(1, "\tDELETE\n");
- + dprintf_out("\tDELETE\n");
- if (m & FILE_READ_DATA)
- - dprintf(1, "\tFILE_READ_DATA\n");
- + dprintf_out("\tFILE_READ_DATA\n");
- if (m & FILE_LIST_DIRECTORY)
- - dprintf(1, "\tFILE_LIST_DIRECTORY\n");
- + dprintf_out("\tFILE_LIST_DIRECTORY\n");
- if (m & FILE_WRITE_DATA)
- - dprintf(1, "\tFILE_WRITE_DATA\n");
- + dprintf_out("\tFILE_WRITE_DATA\n");
- if (m & FILE_ADD_FILE)
- - dprintf(1, "\tFILE_ADD_FILE\n");
- + dprintf_out("\tFILE_ADD_FILE\n");
- if (m & FILE_APPEND_DATA)
- - dprintf(1, "\tFILE_APPEND_DATA\n");
- + dprintf_out("\tFILE_APPEND_DATA\n");
- if (m & FILE_ADD_SUBDIRECTORY)
- - dprintf(1, "\tFILE_ADD_SUBDIRECTORY\n");
- + dprintf_out("\tFILE_ADD_SUBDIRECTORY\n");
- if (m & FILE_CREATE_PIPE_INSTANCE)
- - dprintf(1, "\tFILE_CREATE_PIPE_INSTANCE\n");
- + dprintf_out("\tFILE_CREATE_PIPE_INSTANCE\n");
- if (m & FILE_READ_EA)
- - dprintf(1, "\tFILE_READ_EA\n");
- + dprintf_out("\tFILE_READ_EA\n");
- if (m & FILE_WRITE_EA)
- - dprintf(1, "\tFILE_WRITE_EA\n");
- + dprintf_out("\tFILE_WRITE_EA\n");
- if (m & FILE_EXECUTE)
- - dprintf(1, "\tFILE_EXECUTE\n");
- + dprintf_out("\tFILE_EXECUTE\n");
- if (m & FILE_TRAVERSE)
- - dprintf(1, "\tFILE_TRAVERSE\n");
- + dprintf_out("\tFILE_TRAVERSE\n");
- if (m & FILE_DELETE_CHILD)
- - dprintf(1, "\tFILE_DELETE_CHILD\n");
- + dprintf_out("\tFILE_DELETE_CHILD\n");
- if (m & FILE_READ_ATTRIBUTES)
- - dprintf(1, "\tFILE_READ_ATTRIBUTES\n");
- + dprintf_out("\tFILE_READ_ATTRIBUTES\n");
- if (m & FILE_WRITE_ATTRIBUTES)
- - dprintf(1, "\tFILE_WRITE_ATTRIBUTES\n");
- + dprintf_out("\tFILE_WRITE_ATTRIBUTES\n");
- if ((m & FILE_ALL_ACCESS) == FILE_ALL_ACCESS)
- - dprintf(1, "\tFILE_ALL_ACCESS\n");
- + dprintf_out("\tFILE_ALL_ACCESS\n");
- if ((m & FILE_GENERIC_READ) == FILE_GENERIC_READ)
- - dprintf(1, "\tFILE_GENERIC_READ\n");
- + dprintf_out("\tFILE_GENERIC_READ\n");
- if ((m & FILE_GENERIC_WRITE) == FILE_GENERIC_WRITE)
- - dprintf(1, "\tFILE_GENERIC_WRITE\n");
- + dprintf_out("\tFILE_GENERIC_WRITE\n");
- if ((m & FILE_GENERIC_EXECUTE) == FILE_GENERIC_EXECUTE)
- - dprintf(1, "\tFILE_GENERIC_EXECUTE\n");
- + dprintf_out("\tFILE_GENERIC_EXECUTE\n");
- }
- void print_nfs_access_mask(int on, int m)
- {
- if (!on) return;
- - dprintf(1, "--> print_nfs_access_mask: %x\n", m);
- + if (!DPRINTF_LEVEL_ENABLED(1))
- + return;
- +
- + dprintf_out("--> print_nfs_access_mask: %x\n", m);
- if (m & ACE4_READ_DATA)
- - dprintf(1, "\tACE4_READ_DATA\n");
- + dprintf_out("\tACE4_READ_DATA\n");
- if (m & ACE4_LIST_DIRECTORY)
- - dprintf(1, "\tACE4_LIST_DIRECTORY\n");
- + dprintf_out("\tACE4_LIST_DIRECTORY\n");
- if (m & ACE4_WRITE_DATA)
- - dprintf(1, "\tACE4_WRITE_DATA\n");
- + dprintf_out("\tACE4_WRITE_DATA\n");
- if (m & ACE4_ADD_FILE)
- - dprintf(1, "\tACE4_ADD_FILE\n");
- + dprintf_out("\tACE4_ADD_FILE\n");
- if (m & ACE4_APPEND_DATA)
- - dprintf(1, "\tACE4_APPEND_DATA\n");
- + dprintf_out("\tACE4_APPEND_DATA\n");
- if (m & ACE4_ADD_SUBDIRECTORY)
- - dprintf(1, "\tACE4_ADD_SUBDIRECTORY\n");
- + dprintf_out("\tACE4_ADD_SUBDIRECTORY\n");
- if (m & ACE4_READ_NAMED_ATTRS)
- - dprintf(1, "\tACE4_READ_NAMED_ATTRS\n");
- + dprintf_out("\tACE4_READ_NAMED_ATTRS\n");
- if (m & ACE4_WRITE_NAMED_ATTRS)
- - dprintf(1, "\tACE4_WRITE_NAMED_ATTRS\n");
- + dprintf_out("\tACE4_WRITE_NAMED_ATTRS\n");
- if (m & ACE4_EXECUTE)
- - dprintf(1, "\tACE4_EXECUTE\n");
- + dprintf_out("\tACE4_EXECUTE\n");
- if (m & ACE4_DELETE_CHILD)
- - dprintf(1, "\tACE4_DELETE_CHILD\n");
- + dprintf_out("\tACE4_DELETE_CHILD\n");
- if (m & ACE4_READ_ATTRIBUTES)
- - dprintf(1, "\tACE4_READ_ATTRIBUTES\n");
- + dprintf_out("\tACE4_READ_ATTRIBUTES\n");
- if (m & ACE4_WRITE_ATTRIBUTES)
- - dprintf(1, "\tACE4_WRITE_ATTRIBUTES\n");
- + dprintf_out("\tACE4_WRITE_ATTRIBUTES\n");
- if (m & ACE4_DELETE)
- - dprintf(1, "\tACE4_DELETE\n");
- + dprintf_out("\tACE4_DELETE\n");
- if (m & ACE4_READ_ACL)
- - dprintf(1, "\tACE4_READ_ACL\n");
- + dprintf_out("\tACE4_READ_ACL\n");
- if (m & ACE4_WRITE_ACL)
- - dprintf(1, "\tACE4_WRITE_ACL\n");
- + dprintf_out("\tACE4_WRITE_ACL\n");
- if (m & ACE4_WRITE_OWNER)
- - dprintf(1, "\tACE4_WRITE_OWNER\n");
- + dprintf_out("\tACE4_WRITE_OWNER\n");
- if (m & ACE4_SYNCHRONIZE)
- - dprintf(1, "\tACE4_SYNCHRONIZE\n");
- + dprintf_out("\tACE4_SYNCHRONIZE\n");
- }
- diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
- index da9b98d..4465150 100644
- --- a/daemon/daemon_debug.h
- +++ b/daemon/daemon_debug.h
- @@ -48,27 +48,37 @@
- ""#exp"", __FILE__, (long)__LINE__); }
- #define DASSERT(exp, level) \
- if (!(exp)) { \
- - dprintf((level), "ASSERTION '%s' in '%s'/%ld failed.\n", \
- - ""#exp"", __FILE__, (long)__LINE__); }
- + DPRINTF((level), ("ASSERTION '%s' in '%s'/%ld failed.\n", \
- + ""#exp"", __FILE__, (long)__LINE__)); }
- #define DASSERT_IS_VALID_NON_NULL_PTR(exp, level) \
- if (!DEBUG_IS_VALID_NON_NULL_PTR(exp)) { \
- - dprintf((level), "ASSERTION " \
- - "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=%p) " \
- + DPRINTF((level), ("ASSERTION " \
- + "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=0x%p) " \
- "in '%s'/%ld failed.\n", \
- - ""#exp"", (void *)(exp), __FILE__, (long)__LINE__); }
- + ""#exp"", (void *)(exp), __FILE__, (long)__LINE__)); }
- #define EASSERT_IS_VALID_NON_NULL_PTR(exp) \
- if (!DEBUG_IS_VALID_NON_NULL_PTR(exp)) { \
- eprintf("ASSERTION " \
- - "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=%p) " \
- + "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=0x%p) " \
- "in '%s'/%ld failed.\n", \
- ""#exp"", (void *)(exp), __FILE__, (long)__LINE__); }
- +extern int g_debug_level;
- +
- +#define DPRINTF_LEVEL_ENABLED(level) ((level) <= g_debug_level)
- +#define DPRINTF(level, args) \
- + { \
- + if (DPRINTF_LEVEL_ENABLED(level)) { \
- + dprintf_out args; \
- + } \
- + }
- +
- /* daemon_debug.h */
- void set_debug_level(int level);
- void logprintf(LPCSTR format, ...);
- -void dprintf(int level, LPCSTR format, ...);
- +void dprintf_out(LPCSTR format, ...);
- void eprintf(LPCSTR format, ...);
- void print_windows_access_mask(int on, ACCESS_MASK m);
- @@ -80,7 +90,6 @@ void print_disposition(int level, DWORD disposition);
- void print_access_mask(int level, DWORD access_mask);
- void print_share_mode(int level, DWORD mode);
- void print_file_id_both_dir_info(int level, FILE_ID_BOTH_DIR_INFO *p);
- -void print_opcode(int level, DWORD opcode);
- const char* opcode2string(DWORD opcode);
- const char* nfs_opnum_to_string(int opnum);
- const char* nfs_error_string(int status);
- @@ -103,7 +112,6 @@ const char* pnfs_error_string(enum pnfs_status status);
- const char* pnfs_layout_type_string(enum pnfs_layout_type type);
- const char* pnfs_iomode_string(enum pnfs_iomode iomode);
- -void dprint_deviceid(int level, const char *title, const unsigned char *deviceid);
- void dprint_layout(int level, const struct __pnfs_file_layout *layout);
- void dprint_device(int level, const struct __pnfs_file_device *device);
- diff --git a/daemon/delegation.c b/daemon/delegation.c
- index a611129..676fda0 100644
- --- a/daemon/delegation.c
- +++ b/daemon/delegation.c
- @@ -72,16 +72,16 @@ void nfs41_delegation_ref(
- IN nfs41_delegation_state *state)
- {
- const LONG count = InterlockedIncrement(&state->ref_count);
- - dprintf(DGLVL, "nfs41_delegation_ref(%s) count %d\n",
- - state->path.path, count);
- + DPRINTF(DGLVL, ("nfs41_delegation_ref('%s') count %d\n",
- + state->path.path, count));
- }
- void nfs41_delegation_deref(
- IN nfs41_delegation_state *state)
- {
- const LONG count = InterlockedDecrement(&state->ref_count);
- - dprintf(DGLVL, "nfs41_delegation_deref(%s) count %d\n",
- - state->path.path, count);
- + DPRINTF(DGLVL, ("nfs41_delegation_deref('%s') count %d\n",
- + state->path.path, count));
- if (count == 0)
- free(state);
- }
- @@ -277,8 +277,8 @@ static int delegation_return(
- unsigned char inbuf[sizeof(HANDLE)], *buffer = inbuf;
- DWORD inbuf_len = sizeof(HANDLE), outbuf_len, dstatus;
- uint32_t length;
- - dprintf(1, "delegation_return: making a downcall for srv_open=%x\n",
- - deleg->srv_open);
- + DPRINTF(1, ("delegation_return: making a downcall for srv_open=%x\n",
- + deleg->srv_open));
- pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- if (pipe == INVALID_HANDLE_VALUE) {
- @@ -501,8 +501,8 @@ int nfs41_delegate_open(
- memcpy(&stateid.stateid, &deleg->state.stateid, sizeof(stateid4));
- }
- if (!status) {
- - dprintf(1, "nfs41_delegate_open: updating srv_open from %x to %x\n",
- - deleg->srv_open, state->srv_open);
- + DPRINTF(1, ("nfs41_delegate_open: updating srv_open from %x to %x\n",
- + deleg->srv_open, state->srv_open));
- deleg->srv_open = state->srv_open;
- }
- ReleaseSRWLockExclusive(&deleg->lock);
- @@ -602,7 +602,7 @@ int nfs41_delegation_to_open(
- out_unlock:
- ReleaseSRWLockExclusive(&open->lock);
- if (status)
- - eprintf("nfs41_delegation_to_open(%p) failed with %s\n",
- + eprintf("nfs41_delegation_to_open(0x%p) failed with '%s'\n",
- open, nfs_error_string(status));
- return status;
- }
- @@ -616,8 +616,8 @@ void nfs41_delegation_remove_srvopen(
- /* find a delegation for this file */
- if (delegation_find(session->client, &file->fh, deleg_file_cmp, &deleg))
- return;
- - dprintf(1, "nfs41_delegation_remove_srvopen: removing reference to "
- - "srv_open=%x\n", deleg->srv_open);
- + DPRINTF(1, ("nfs41_delegation_remove_srvopen: removing reference to "
- + "srv_open=%x\n", deleg->srv_open));
- AcquireSRWLockExclusive(&deleg->lock);
- deleg->srv_open = NULL;
- ReleaseSRWLockExclusive(&deleg->lock);
- @@ -706,7 +706,7 @@ int nfs41_delegation_recall(
- struct recall_thread_args *args;
- int status;
- - dprintf(2, "--> nfs41_delegation_recall()\n");
- + DPRINTF(2, ("--> nfs41_delegation_recall()\n"));
- /* search for the delegation by stateid instead of filehandle;
- * deleg_file_cmp() relies on a proper superblock and fileid,
- @@ -755,8 +755,8 @@ int nfs41_delegation_recall(
- }
- status = NFS4_OK;
- out:
- - dprintf(DGLVL, "<-- nfs41_delegation_recall() returning %s\n",
- - nfs_error_string(status));
- + DPRINTF(DGLVL, ("<-- nfs41_delegation_recall() returning '%s'\n",
- + nfs_error_string(status)));
- return status;
- out_args:
- @@ -786,7 +786,7 @@ int nfs41_delegation_getattr(
- uint64_t fileid;
- int status;
- - dprintf(2, "--> nfs41_delegation_getattr()\n");
- + DPRINTF(2, ("--> nfs41_delegation_getattr()\n"));
- /* search for a delegation on this file handle */
- status = delegation_find(client, fh, deleg_fh_cmp, &deleg);
- @@ -815,8 +815,8 @@ int nfs41_delegation_getattr(
- out_deleg:
- nfs41_delegation_deref(deleg);
- out:
- - dprintf(DGLVL, "<-- nfs41_delegation_getattr() returning %s\n",
- - nfs_error_string(status));
- + DPRINTF(DGLVL, ("<-- nfs41_delegation_getattr() returning '%s'\n",
- + nfs_error_string(status)));
- return status;
- }
- diff --git a/daemon/ea.c b/daemon/ea.c
- index 392b3cd..a065d3c 100644
- --- a/daemon/ea.c
- +++ b/daemon/ea.c
- @@ -81,7 +81,7 @@ static int set_ea_value(
- OPEN4_SHARE_DENY_BOTH, OPEN4_CREATE, UNCHECKED4,
- &createattrs, TRUE, &stateid.stateid, &delegation, NULL);
- if (status) {
- - eprintf("nfs41_open() failed with %s\n", nfs_error_string(status));
- + eprintf("nfs41_open() failed with '%s'\n", nfs_error_string(status));
- goto out;
- }
- @@ -90,7 +90,7 @@ static int set_ea_value(
- ea->EaValueLength, 0, FILE_SYNC4, &bytes_written,
- &verf, NULL);
- if (status) {
- - eprintf("nfs41_write() failed with %s\n", nfs_error_string(status));
- + eprintf("nfs41_write() failed with '%s'\n", nfs_error_string(status));
- goto out_close;
- }
- @@ -122,7 +122,7 @@ int nfs41_ea_set(
- status = nfs41_rpc_openattr(state->session, &state->file, TRUE, &attrdir.fh);
- if (status) {
- - eprintf("nfs41_rpc_openattr() failed with error %s\n",
- + eprintf("nfs41_rpc_openattr() failed with error '%s'\n",
- nfs_error_string(status));
- goto out;
- }
- @@ -154,7 +154,7 @@ static int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall
- if (status) goto out;
- args->buf = buffer;
- - dprintf(1, "parsing NFS41_EA_SET: mode=%o\n", args->mode);
- + DPRINTF(1, ("parsing NFS41_EA_SET: mode=%o\n", args->mode));
- out:
- return status;
- }
- @@ -185,8 +185,8 @@ static int handle_setexattr(void *daemon_context, nfs41_upcall *upcall)
- status = nfs41_setattr(state->session, &state->file, &stateid, &info);
- if (status) {
- - dprintf(1, "nfs41_setattr() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_setattr() failed with error '%s'.\n",
- + nfs_error_string(status)));
- goto out;
- }
- @@ -226,8 +226,8 @@ static int parse_getexattr(unsigned char *buffer, uint32_t length, nfs41_upcall
- if (status) goto out;
- args->ealist = args->ealist_len ? buffer : NULL;
- - dprintf(1, "parsing NFS41_EA_GET: buf_len=%d Index %d Restart %d "
- - "Single %d\n", args->buf_len,args->eaindex, args->restart, args->single);
- + DPRINTF(1, ("parsing NFS41_EA_GET: buf_len=%d Index %d Restart %d "
- + "Single %d\n", args->buf_len,args->eaindex, args->restart, args->single));
- out:
- return status;
- }
- @@ -441,7 +441,7 @@ static int get_ea_value(
- OPEN4_SHARE_DENY_WRITE, OPEN4_NOCREATE, UNCHECKED4, NULL, TRUE,
- &stateid.stateid, &delegation, &info);
- if (status) {
- - eprintf("nfs41_open() failed with %s\n", nfs_error_string(status));
- + eprintf("nfs41_open() failed with '%s'\n", nfs_error_string(status));
- if (status == NFS4ERR_NOENT)
- goto out_empty;
- goto out;
- @@ -470,7 +470,7 @@ static int get_ea_value(
- status = nfs41_read(session, &file, &stateid,
- 0, length - diff, buffer, &bytes_read, &eof);
- if (status) {
- - eprintf("nfs41_read() failed with %s\n", nfs_error_string(status));
- + eprintf("nfs41_read() failed with '%s'\n", nfs_error_string(status));
- goto out_close;
- }
- if (!eof) {
- @@ -539,13 +539,13 @@ static int handle_getexattr(void *daemon_context, nfs41_upcall *upcall)
- status = nfs41_rpc_openattr(state->session, &state->file, FALSE, &parent.fh);
- if (status == NFS4ERR_NOENT) { /* no named attribute directory */
- - dprintf(EALVL, "no named attribute directory for '%s'\n", args->path);
- + DPRINTF(EALVL, ("no named attribute directory for '%s'\n", args->path));
- if (query == NULL) {
- status = empty_ea_error(args->eaindex, args->restart);
- goto out;
- }
- } else if (status) {
- - eprintf("nfs41_rpc_openattr() failed with %s\n",
- + eprintf("nfs41_rpc_openattr() failed with '%s'\n",
- nfs_error_string(status));
- status = nfs_to_windows_error(status, ERROR_EAS_NOT_SUPPORTED);
- goto out;
- @@ -559,8 +559,8 @@ static int handle_getexattr(void *daemon_context, nfs41_upcall *upcall)
- goto out;
- if (query == NULL) { /* the file has no EAs */
- - dprintf(EALVL, "empty named attribute directory for '%s'\n",
- - args->path);
- + DPRINTF(EALVL, ("empty named attribute directory for '%s'\n",
- + args->path));
- status = empty_ea_error(args->eaindex, args->restart);
- goto out;
- }
- diff --git a/daemon/getattr.c b/daemon/getattr.c
- index f952a0d..4308beb 100644
- --- a/daemon/getattr.c
- +++ b/daemon/getattr.c
- @@ -48,7 +48,7 @@ int nfs41_cached_getattr(
- status = nfs41_getattr(session, file, &attr_request, info);
- if (status) {
- - eprintf("nfs41_getattr() failed with %s\n",
- + eprintf("nfs41_getattr() failed with '%s'\n",
- nfs_error_string(status));
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- }
- @@ -78,9 +78,9 @@ static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
- status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
- if (status) goto out;
- - dprintf(1, "parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d file=%.*s\n",
- + DPRINTF(1, ("parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d file='%.*s'\n",
- args->query_class, args->buf_len, upcall->state_ref->path.len,
- - upcall->state_ref->path.path);
- + upcall->state_ref->path.path));
- out:
- return status;
- }
- @@ -94,14 +94,14 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- #ifdef NFS41_DRIVER_STABILITY_HACKS
- if (!DEBUG_IS_VALID_NON_NULL_PTR(state->session)) {
- - eprintf("handle_getattr: Invalid session ptr=%p\n",
- + eprintf("handle_getattr: Invalid session ptr=0x%p\n",
- (void *)state->session);
- status = ERROR_INVALID_PARAMETER;
- goto out;
- }
- if (!DEBUG_IS_VALID_NON_NULL_PTR(state->file.fh.superblock)) {
- - eprintf("handle_getattr: Invalid state->file.fh.superblock ptr=%p\n",
- + eprintf("handle_getattr: Invalid state->file.fh.superblock ptr=0x%p\n",
- (void *)state->file.fh.superblock);
- /* gisburn: fixme: maybe this should be |ERROR_INTERNAL_ERROR| ? */
- status = ERROR_INVALID_PARAMETER;
- @@ -200,7 +200,7 @@ static int marshall_getattr(unsigned char *buffer, uint32_t *length, nfs41_upcal
- }
- status = safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
- if (status) goto out;
- - dprintf(1, "NFS41_FILE_QUERY: downcall changattr=%llu\n", args->ctime);
- + DPRINTF(1, ("NFS41_FILE_QUERY: downcall changattr=%llu\n", args->ctime));
- out:
- return status;
- }
- diff --git a/daemon/idmap.c b/daemon/idmap.c
- index 39de3df..8a33f5e 100644
- --- a/daemon/idmap.c
- +++ b/daemon/idmap.c
- @@ -251,14 +251,14 @@ static int config_defaults(
- if (option->type == TYPE_INT) {
- if (!parse_uint(option->def, (UINT*)dst)) {
- status = ERROR_INVALID_PARAMETER;
- - eprintf("failed to parse default value of %s=\"%s\": "
- + eprintf("failed to parse default value of '%s'=\"%s\": "
- "expected a number\n", option->key, option->def);
- break;
- }
- } else {
- if (FAILED(StringCchCopyA(dst, option->max_len, option->def))) {
- status = ERROR_BUFFER_OVERFLOW;
- - eprintf("failed to parse default value of %s=\"%s\": "
- + eprintf("failed to parse default value of '%s'=\"%s\": "
- "buffer overflow > %u\n", option->key, option->def,
- option->max_len);
- break;
- @@ -319,14 +319,14 @@ static int config_load(
- /* parse line into a key=value pair */
- status = config_parse_pair(buffer, &pair);
- if (status) {
- - eprintf("error on line %d: %s\n", line, buffer);
- + eprintf("error on line %d: '%s'\n", line, buffer);
- break;
- }
- /* find the config_option by key */
- status = config_find_option(&pair, &option);
- if (status) {
- - eprintf("unrecognized option '%s' on line %d: %s\n",
- + eprintf("unrecognized option '%s' on line %d: '%s'\n",
- pair.key, line, buffer);
- status = ERROR_INVALID_PARAMETER;
- break;
- @@ -335,7 +335,7 @@ static int config_load(
- if (option->type == TYPE_INT) {
- if (!parse_uint(pair.value, (UINT*)((char*)config + option->offset))) {
- status = ERROR_INVALID_PARAMETER;
- - eprintf("expected a number on line %d: %s=\"%s\"\n",
- + eprintf("expected a number on line %d: '%s'=\"%s\"\n",
- line, pair.key, pair.value);
- break;
- }
- @@ -343,7 +343,7 @@ static int config_load(
- if (FAILED(StringCchCopyNA((char*)config + option->offset,
- option->max_len, pair.value, pair.value_len))) {
- status = ERROR_BUFFER_OVERFLOW;
- - eprintf("overflow on line %d: %s=\"%s\"\n",
- + eprintf("overflow on line %d: '%s'=\"%s\"\n",
- line, pair.key, pair.value);
- break;
- }
- @@ -610,7 +610,7 @@ static int idmap_query_attrs(
- status = ldap_search_stA(context->ldap, config->base,
- LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, &res);
- if (status) {
- - eprintf("ldap search for '%s' failed with %d: %s\n",
- + eprintf("ldap search for '%s' failed with %d: '%s'\n",
- filter, status, ldap_err2stringA(status));
- status = LdapMapErrorToWin32(status);
- goto out;
- @@ -619,7 +619,7 @@ static int idmap_query_attrs(
- entry = ldap_first_entry(context->ldap, res);
- if (entry == NULL) {
- status = LDAP_NO_RESULTS_RETURNED;
- - eprintf("ldap search for '%s' failed with %d: %s\n",
- + eprintf("ldap search for '%s' failed with %d: '%s'\n",
- filter, status, ldap_err2stringA(status));
- status = LdapMapErrorToWin32(status);
- goto out;
- @@ -680,7 +680,7 @@ static int idmap_lookup_user(
- /* parse attributes */
- if (FAILED(StringCchCopyA(user->username, VAL_LEN,
- *values[ATTR_USER_NAME]))) {
- - eprintf("ldap attribute %s='%s' longer than %u characters\n",
- + eprintf("ldap attribute \"%s\"='%s' longer than %u characters\n",
- context->config.attributes[ATTR_USER_NAME],
- *values[ATTR_USER_NAME], VAL_LEN);
- status = ERROR_BUFFER_OVERFLOW;
- @@ -688,20 +688,20 @@ static int idmap_lookup_user(
- }
- if (FAILED(StringCchCopyA(user->principal, VAL_LEN,
- values[ATTR_PRINCIPAL] ? *values[ATTR_PRINCIPAL] : ""))) {
- - eprintf("ldap attribute %s='%s' longer than %u characters\n",
- + eprintf("ldap attribute \"%s\"='%s' longer than %u characters\n",
- context->config.attributes[ATTR_PRINCIPAL],
- values[ATTR_PRINCIPAL] ? *values[ATTR_PRINCIPAL] : "", VAL_LEN);
- status = ERROR_BUFFER_OVERFLOW;
- goto out_free_values;
- }
- if (!parse_uint(*values[ATTR_UID], &user->uid)) {
- - eprintf("failed to parse ldap attribute %s='%s'\n",
- + eprintf("failed to parse ldap attribute \"%s\"='%s'\n",
- context->config.attributes[ATTR_UID], *values[ATTR_UID]);
- status = ERROR_INVALID_PARAMETER;
- goto out_free_values;
- }
- if (!parse_uint(*values[ATTR_GID], &user->gid)) {
- - eprintf("failed to parse ldap attribute %s='%s'\n",
- + eprintf("failed to parse ldap attribute \"%s\"='%s'\n",
- context->config.attributes[ATTR_GID], *values[ATTR_GID]);
- status = ERROR_INVALID_PARAMETER;
- goto out_free_values;
- @@ -716,7 +716,9 @@ static int idmap_lookup_user(
- status = ERROR_NOT_FOUND;
- if (!cygwin_getent_passwd(lookup->value, NULL, &cy_uid, &cy_gid)) {
- - dprintf(CYGWINIDLVL, "# ATTR_USER_NAME: cygwin_getent_passwd: returned '%s', uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
- + DPRINTF(CYGWINIDLVL,
- + ("# ATTR_USER_NAME: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
- + lookup->value, (unsigned int)cy_uid, (unsigned int)cy_gid));
- (void)snprintf(principal_name, sizeof(principal_name),
- "%s@%s", (const char *)lookup->value, "GLOBAL.LOC");
- StringCchCopyA(user->username, VAL_LEN, lookup->value);
- @@ -744,7 +746,9 @@ static int idmap_lookup_user(
- *s = '\0';
- if (!cygwin_getent_passwd(search_name, NULL, &cy_uid, &cy_gid)) {
- - dprintf(CYGWINIDLVL, "# ATTR_PRINCIPAL: cygwin_getent_passwd: returned '%s', uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
- + DPRINTF(CYGWINIDLVL,
- + ("# ATTR_PRINCIPAL: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
- + lookup->value, (unsigned int)cy_uid, (unsigned int)cy_gid));
- (void)snprintf(principal_name, sizeof(principal_name),
- "%s@%s", (const char *)lookup->value, "GLOBAL.LOC");
- @@ -770,7 +774,9 @@ static int idmap_lookup_user(
- (void)snprintf(search_name, sizeof(search_name), "%lu", (unsigned long)search_uid);
- if (!cygwin_getent_passwd(search_name, res_username, &cy_uid, &cy_gid)) {
- - dprintf(CYGWINIDLVL, "# ATTR_UID: cygwin_getent_passwd: returned '%s', uid=%d, gid=%d\n", res_username, (int)cy_uid, (int)cy_gid);
- + DPRINTF(CYGWINIDLVL,
- + ("# ATTR_UID: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
- + res_username, (unsigned int)cy_uid, (unsigned int)cy_gid));
- (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", res_username, "GLOBAL.LOC");
- StringCchCopyA(user->username, VAL_LEN, res_username);
- @@ -787,12 +793,12 @@ static int idmap_lookup_user(
- if (status == 0) {
- user->last_updated = time(NULL);
- - dprintf(CYGWINIDLVL, "## idmap_lookup_user: "
- - "found username='%s', principal='%s', uid=%lu, gid=%lu\n",
- + DPRINTF(CYGWINIDLVL, ("## idmap_lookup_user: "
- + "found username='%s', principal='%s', uid=%u, gid=%u\n",
- user->username,
- user->principal,
- - (unsigned long)user->uid,
- - (unsigned long)user->gid);
- + (unsigned int)user->uid,
- + (unsigned int)user->gid));
- }
- #endif /* !NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- if (context->config.cache_ttl) {
- @@ -834,14 +840,14 @@ static int idmap_lookup_group(
- /* parse attributes */
- if (FAILED(StringCchCopyA(group->name, VAL_LEN,
- *values[ATTR_GROUP_NAME]))) {
- - eprintf("ldap attribute %s='%s' longer than %u characters\n",
- + eprintf("ldap attribute \"%s\"='%s' longer than %u characters\n",
- context->config.attributes[ATTR_GROUP_NAME],
- *values[ATTR_GROUP_NAME], VAL_LEN);
- status = ERROR_BUFFER_OVERFLOW;
- goto out_free_values;
- }
- if (!parse_uint(*values[ATTR_GID], &group->gid)) {
- - eprintf("failed to parse ldap attribute %s='%s'\n",
- + eprintf("failed to parse ldap attribute \"%s\"='%s'\n",
- context->config.attributes[ATTR_GID], *values[ATTR_GID]);
- status = ERROR_INVALID_PARAMETER;
- goto out_free_values;
- @@ -854,10 +860,10 @@ static int idmap_lookup_group(
- status = ERROR_NOT_FOUND;
- if (!cygwin_getent_group(lookup->value, NULL, &cy_gid)) {
- - dprintf(CYGWINIDLVL,
- - "# ATTR_GROUP_NAME: cygwin_getent_group: "
- - "returned '%s', gid=%d\n",
- - lookup->value, (int)cy_gid);
- + DPRINTF(CYGWINIDLVL,
- + ("# ATTR_GROUP_NAME: cygwin_getent_group: "
- + "returned '%s', gid=%u\n",
- + lookup->value, (unsigned int)cy_gid));
- StringCchCopyA(group->name, VAL_LEN, lookup->value);
- group->gid = cy_gid;
- status = 0;
- @@ -875,9 +881,9 @@ static int idmap_lookup_group(
- "%lu", (unsigned long)search_gid);
- if (!cygwin_getent_group(search_name, res_groupname, &cy_gid)) {
- - dprintf(CYGWINIDLVL,
- - "# ATTR_GID: cygwin_getent_group: returned '%s', gid=%d\n",
- - res_groupname, (int)cy_gid);
- + DPRINTF(CYGWINIDLVL,
- + ("# ATTR_GID: cygwin_getent_group: returned '%s', gid=%u\n",
- + res_groupname, (unsigned int)cy_gid));
- StringCchCopyA(group->name, VAL_LEN, res_groupname);
- group->gid = cy_gid;
- status = 0;
- @@ -890,10 +896,10 @@ static int idmap_lookup_group(
- if (status == 0) {
- group->last_updated = time(NULL);
- - dprintf(CYGWINIDLVL,
- - "## idmap_lookup_group: found name='%s', gid=%lu\n",
- + DPRINTF(CYGWINIDLVL,
- + ("## idmap_lookup_group: found name='%s', gid=%u\n",
- group->name,
- - (unsigned long)group->gid);
- + (unsigned int)group->gid));
- }
- #endif /* !NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- if (context->config.cache_ttl) {
- @@ -936,7 +942,7 @@ int nfs41_idmap_create(
- context->ldap = ldap_init(context->config.hostname, context->config.port);
- if (context->ldap == NULL) {
- status = LdapGetLastError();
- - eprintf("ldap_init(%s) failed with %d: %s\n",
- + eprintf("ldap_init(%s) failed with %d: '%s'\n",
- context->config.hostname, status, ldap_err2stringA(status));
- status = LdapMapErrorToWin32(status);
- goto out_err_free;
- @@ -962,7 +968,7 @@ int nfs41_idmap_create(
- }
- }
- #else
- - dprintf(CYGWINIDLVL, "nfs41_idmap_create: Force context->config.timeout = 6000;\n");
- + DPRINTF(CYGWINIDLVL, ("nfs41_idmap_create: Force context->config.timeout = 6000;\n"));
- context->config.timeout = 6000;
- #endif
- @@ -1012,22 +1018,22 @@ int nfs41_idmap_name_to_ids(
- if (context == NULL)
- return ERROR_FILE_NOT_FOUND;
- - dprintf(IDLVL, "--> nfs41_idmap_name_to_ids('%s')\n", username);
- + DPRINTF(IDLVL, ("--> nfs41_idmap_name_to_ids('%s')\n", username));
- lookup.value = username;
- /* look up the user entry */
- status = idmap_lookup_user(context, &lookup, &user);
- if (status) {
- - dprintf(IDLVL, "<-- nfs41_idmap_name_to_ids('%s') "
- - "failed with %d\n", username, status);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_name_to_ids('%s') "
- + "failed with %d\n", username, status));
- goto out;
- }
- *uid_out = user.uid;
- *gid_out = user.gid;
- - dprintf(IDLVL, "<-- nfs41_idmap_name_to_ids('%s') "
- - "returning uid=%u, gid=%u\n", username, user.uid, user.gid);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_name_to_ids('%s') "
- + "returning uid=%u, gid=%u\n", username, user.uid, user.gid));
- out:
- return status;
- }
- @@ -1052,15 +1058,15 @@ int nfs41_idmap_uid_to_name(
- struct idmap_user user;
- int status;
- - dprintf(IDLVL, "--> nfs41_idmap_uid_to_name(%u)\n", uid);
- + DPRINTF(IDLVL, ("--> nfs41_idmap_uid_to_name(%u)\n", (unsigned int)uid));
- lookup.value = (const void*)uidp;
- /* look up the user entry */
- status = idmap_lookup_user(context, &lookup, &user);
- if (status) {
- - dprintf(IDLVL, "<-- nfs41_idmap_uid_to_name(%u) "
- - "failed with %d\n", uid, status);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_uid_to_name(%u) "
- + "failed with %d\n", (unsigned int)uid, status));
- goto out;
- }
- @@ -1071,8 +1077,8 @@ int nfs41_idmap_uid_to_name(
- goto out;
- }
- - dprintf(IDLVL, "<-- nfs41_idmap_uid_to_name(%u) "
- - "returning '%s'\n", uid, name);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_uid_to_name(%u) "
- + "returning '%s'\n", uid, name));
- out:
- return status;
- }
- @@ -1097,22 +1103,22 @@ int nfs41_idmap_principal_to_ids(
- struct idmap_user user;
- int status;
- - dprintf(IDLVL, "--> nfs41_idmap_principal_to_ids('%s')\n", principal);
- + DPRINTF(IDLVL, ("--> nfs41_idmap_principal_to_ids('%s')\n", principal));
- lookup.value = principal;
- /* look up the user entry */
- status = idmap_lookup_user(context, &lookup, &user);
- if (status) {
- - dprintf(IDLVL, "<-- nfs41_idmap_principal_to_ids('%s') "
- - "failed with %d\n", principal, status);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_principal_to_ids('%s') "
- + "failed with %d\n", principal, status));
- goto out;
- }
- *uid_out = user.uid;
- *gid_out = user.gid;
- - dprintf(IDLVL, "<-- nfs41_idmap_principal_to_ids('%s') "
- - "returning uid=%u, gid=%u\n", principal, user.uid, user.gid);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_principal_to_ids('%s') "
- + "returning uid=%u, gid=%u\n", principal, user.uid, user.gid));
- out:
- return status;
- }
- @@ -1136,21 +1142,21 @@ int nfs41_idmap_group_to_gid(
- struct idmap_group group;
- int status;
- - dprintf(IDLVL, "--> nfs41_idmap_group_to_gid('%s')\n", name);
- + DPRINTF(IDLVL, ("--> nfs41_idmap_group_to_gid('%s')\n", name));
- lookup.value = name;
- /* look up the group entry */
- status = idmap_lookup_group(context, &lookup, &group);
- if (status) {
- - dprintf(IDLVL, "<-- nfs41_idmap_group_to_gid('%s') "
- - "failed with %d\n", name, status);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_group_to_gid('%s') "
- + "failed with %d\n", name, status));
- goto out;
- }
- *gid_out = group.gid;
- - dprintf(IDLVL, "<-- nfs41_idmap_group_to_gid('%s') "
- - "returning %u\n", name, group.gid);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_group_to_gid('%s') "
- + "returning %u\n", name, group.gid));
- out:
- return status;
- }
- @@ -1175,15 +1181,15 @@ int nfs41_idmap_gid_to_group(
- struct idmap_group group;
- int status;
- - dprintf(IDLVL, "--> nfs41_idmap_gid_to_group(%u)\n", gid);
- + DPRINTF(IDLVL, ("--> nfs41_idmap_gid_to_group(%u)\n", gid));
- lookup.value = (const void*)gidp;
- /* look up the group entry */
- status = idmap_lookup_group(context, &lookup, &group);
- if (status) {
- - dprintf(IDLVL, "<-- nfs41_idmap_gid_to_group(%u) "
- - "failed with %d\n", gid, status);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_gid_to_group(%u) "
- + "failed with %d\n", gid, status));
- goto out;
- }
- @@ -1194,8 +1200,8 @@ int nfs41_idmap_gid_to_group(
- goto out;
- }
- - dprintf(IDLVL, "<-- nfs41_idmap_gid_to_group(%u) "
- - "returning '%s'\n", gid, name);
- + DPRINTF(IDLVL, ("<-- nfs41_idmap_gid_to_group(%u) "
- + "returning '%s'\n", gid, name));
- out:
- return status;
- }
- diff --git a/daemon/idmap_cygwin.c b/daemon/idmap_cygwin.c
- index 41c2c67..766e784 100644
- --- a/daemon/idmap_cygwin.c
- +++ b/daemon/idmap_cygwin.c
- @@ -60,7 +60,7 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
- cpv_name_val *cnv_cur = NULL;
- const char *localaccoutname = NULL;
- - dprintf(CYGWINIDLVL, "--> cygwin_getent_passwd('%s')\n", name);
- + DPRINTF(CYGWINIDLVL, ("--> cygwin_getent_passwd('%s')\n", name));
- /* fixme: better quoting for |name| needed */
- (void)snprintf(cmdbuff, sizeof(cmdbuff),
- @@ -69,33 +69,33 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
- name);
- if ((script_pipe = subcmd_popen(cmdbuff)) == NULL) {
- int last_error = GetLastError();
- - dprintf(0, "cygwin_getent_passwd: '%s' failed, GetLastError()='%d'\n",
- + DPRINTF(0, ("cygwin_getent_passwd: '%s' failed, GetLastError()='%d'\n",
- cmdbuff,
- - last_error);
- + last_error));
- goto fail;
- }
- if (!subcmd_readcmdoutput(script_pipe,
- buff, sizeof(buff), &num_buff_read)) {
- - dprintf(0, "cygwin_getent_passwd: subcmd_readcmdoutput() failed\n");
- + DPRINTF(0, ("cygwin_getent_passwd: subcmd_readcmdoutput() failed\n"));
- goto fail;
- }
- buff[num_buff_read] = '\0';
- if (num_buff_read < 10) {
- - dprintf(0, "cygwin_getent_passwd: Could not read enough data, returned %d\n", (int)num_buff_read);
- + DPRINTF(0, ("cygwin_getent_passwd: Could not read enough data, returned %d\n", (int)num_buff_read));
- goto fail;
- }
- cpvp = cpv_create_parser(buff, 0/*CPVFLAG_DEBUG_OUTPUT*/);
- if (!cpvp) {
- - dprintf(0, "cygwin_getent_passwd: Could not create parser\n");
- + DPRINTF(0, ("cygwin_getent_passwd: Could not create parser\n"));
- goto fail;
- }
- if (cpv_read_cpv_header(cpvp)) {
- - dprintf(0, "cygwin_getent_passwd: cpv_read_cpv_header failed\n");
- + DPRINTF(0, ("cygwin_getent_passwd: cpv_read_cpv_header failed\n"));
- goto fail;
- }
- @@ -141,16 +141,16 @@ fail:
- cpv_free_parser(cpvp);
- if (res == 0) {
- - dprintf(CYGWINIDLVL, "<-- cygwin_getent_passwd('%s'): "
- - "returning res_uid=%lu, res_gid=%lu, res_loginname='%s'\n",
- + DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_passwd('%s'): "
- + "returning res_uid=%u, res_gid=%u, res_loginname='%s'\n",
- name,
- - (unsigned long)(*res_uid),
- - (unsigned long)(*res_gid),
- - res_loginname?res_loginname:"<NULL>");
- + (unsigned int)(*res_uid),
- + (unsigned int)(*res_gid),
- + res_loginname?res_loginname:"<NULL>"));
- }
- else {
- - dprintf(CYGWINIDLVL, "<-- cygwin_getent_passwd('%s'): no match found\n",
- - name);
- + DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_passwd('%s'): no match found\n",
- + name));
- }
- return res;
- @@ -172,7 +172,7 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
- const char *localgroupname = NULL;
- - dprintf(CYGWINIDLVL, "--> cygwin_getent_group('%s')\n", name);
- + DPRINTF(CYGWINIDLVL, ("--> cygwin_getent_group('%s')\n", name));
- /* fixme: better quoting for |name| needed */
- (void)snprintf(cmdbuff, sizeof(cmdbuff),
- @@ -181,33 +181,33 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
- name);
- if ((script_pipe = subcmd_popen(cmdbuff)) == NULL) {
- int last_error = GetLastError();
- - dprintf(0, "cygwin_getent_group: '%s' failed, GetLastError()='%d'\n",
- + DPRINTF(0, ("cygwin_getent_group: '%s' failed, GetLastError()='%d'\n",
- cmdbuff,
- - last_error);
- + last_error));
- goto fail;
- }
- if (!subcmd_readcmdoutput(script_pipe,
- buff, sizeof(buff), &num_buff_read)) {
- - dprintf(0, "cygwin_getent_group: subcmd_readcmdoutput() failed\n");
- + DPRINTF(0, ("cygwin_getent_group: subcmd_readcmdoutput() failed\n"));
- goto fail;
- }
- buff[num_buff_read] = '\0';
- if (num_buff_read < 10) {
- - dprintf(0, "cygwin_getent_group: Could not read enough data, returned %d\n", (int)num_buff_read);
- + DPRINTF(0, ("cygwin_getent_group: Could not read enough data, returned %d\n", (int)num_buff_read));
- goto fail;
- }
- cpvp = cpv_create_parser(buff, 0/*CPVFLAG_DEBUG_OUTPUT*/);
- if (!cpvp) {
- - dprintf(0, "cygwin_getent_group: Could not create parser\n");
- + DPRINTF(0, ("cygwin_getent_group: Could not create parser\n"));
- goto fail;
- }
- if (cpv_read_cpv_header(cpvp)) {
- - dprintf(0, "cygwin_getent_group: cpv_read_cpv_header failed\n");
- + DPRINTF(0, ("cygwin_getent_group: cpv_read_cpv_header failed\n"));
- goto fail;
- }
- @@ -246,15 +246,15 @@ fail:
- cpv_free_parser(cpvp);
- if (res == 0) {
- - dprintf(CYGWINIDLVL, "<-- cygwin_getent_group('%s'): "
- - "returning res_gid=%lu, res_group_name='%s'\n",
- + DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_group('%s'): "
- + "returning res_gid=%u, res_group_name='%s'\n",
- name,
- - (unsigned long)(*res_gid),
- - res_group_name?res_group_name:"<NULL>");
- + (unsigned int)(*res_gid),
- + res_group_name?res_group_name:"<NULL>"));
- }
- else {
- - dprintf(CYGWINIDLVL, "<-- cygwin_getent_group('%s'): no match found\n",
- - name);
- + DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_group('%s'): no match found\n",
- + name));
- }
- return res;
- diff --git a/daemon/lock.c b/daemon/lock.c
- index 9b9945f..bb7fee7 100644
- --- a/daemon/lock.c
- +++ b/daemon/lock.c
- @@ -180,9 +180,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: offset=0x%llx length=0x%llx exclusive=%u "
- + DPRINTF(1, ("parsing NFS41_LOCK: offset=0x%llx length=0x%llx exclusive=%u "
- "blocking=%u\n", args->offset, args->length, args->exclusive,
- - args->blocking);
- + args->blocking));
- out:
- return status;
- }
- @@ -222,8 +222,8 @@ static int handle_lock(void *deamon_context, nfs41_upcall *upcall)
- /* if we hold a write delegation, handle the lock locally */
- if (open_lock_delegate(state, lock)) {
- - dprintf(LKLVL, "delegated lock { %llu, %llu }\n",
- - lock->offset, lock->length);
- + DPRINTF(LKLVL, ("delegated lock { %llu, %llu }\n",
- + lock->offset, lock->length));
- args->acquired = TRUE; /* for cancel_lock() */
- goto out;
- }
- @@ -243,8 +243,8 @@ static int handle_lock(void *deamon_context, nfs41_upcall *upcall)
- status = nfs41_lock(state->session, &state->file, &state->owner,
- type, lock->offset, lock->length, FALSE, TRUE, &stateid);
- if (status) {
- - dprintf(LKLVL, "nfs41_lock failed with %s\n",
- - nfs_error_string(status));
- + DPRINTF(LKLVL, ("nfs41_lock failed with '%s'\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- LeaveCriticalSection(&state->locks.lock);
- goto out_free;
- @@ -271,7 +271,7 @@ static void cancel_lock(IN nfs41_upcall *upcall)
- nfs41_open_state *state = upcall->state_ref;
- int status = NO_ERROR;
- - dprintf(1, "--> cancel_lock()\n");
- + DPRINTF(1, ("--> cancel_lock()\n"));
- /* can't do 'if (upcall->status)' here, because a handle_lock() success
- * could be overwritten by upcall_marshall() or allocation failure */
- @@ -297,7 +297,7 @@ static void cancel_lock(IN nfs41_upcall *upcall)
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- out:
- - dprintf(1, "<-- cancel_lock() returning %d\n", status);
- + DPRINTF(1, ("<-- cancel_lock() returning %d\n", status));
- }
- @@ -313,7 +313,7 @@ static int parse_unlock(unsigned char *buffer, uint32_t length, nfs41_upcall *up
- args->buf = buffer;
- args->buf_len = length;
- - dprintf(1, "parsing NFS41_UNLOCK: count=%u\n", args->count);
- + DPRINTF(1, ("parsing NFS41_UNLOCK: count=%u\n", args->count));
- out:
- return status;
- }
- diff --git a/daemon/lookup.c b/daemon/lookup.c
- index 3c6bda8..7685188 100644
- --- a/daemon/lookup.c
- +++ b/daemon/lookup.c
- @@ -409,7 +409,7 @@ static int referral_resolve(
- status = nfs41_fs_locations(session_in, &referral->parent,
- &referral->name, &locations);
- if (status) {
- - eprintf("nfs41_fs_locations() failed with %s\n",
- + eprintf("nfs41_fs_locations() failed with '%s'\n",
- nfs_error_string(status));
- status = nfs_to_windows_error(status, ERROR_PATH_NOT_FOUND);
- goto out;
- @@ -473,7 +473,7 @@ int nfs41_lookup(
- path_pos = path.path;
- path_end = path.path + path.len;
- - dprintf(LULVL, "--> nfs41_lookup('%s')\n", path.path);
- + DPRINTF(LULVL, ("--> nfs41_lookup('%s')\n", path.path));
- if (parent_out == NULL) parent_out = &parent;
- if (target_out == NULL) target_out = ⌖
- @@ -525,6 +525,6 @@ int nfs41_lookup(
- parent_out, target_out, info_out, session_out);
- }
- out:
- - dprintf(LULVL, "<-- nfs41_lookup() returning %d\n", status);
- + DPRINTF(LULVL, ("<-- nfs41_lookup() returning %d\n", status));
- return status;
- }
- diff --git a/daemon/mount.c b/daemon/mount.c
- index d562753..5a071b9 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -46,13 +46,13 @@ static int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
- status = safe_read(&buffer, &length, &args->wsize, sizeof(DWORD));
- if (status) goto out;
- - dprintf(1, "parsing NFS41_MOUNT: hostport='%s' root='%s' "
- + DPRINTF(1, ("parsing NFS41_MOUNT: hostport='%s' root='%s' "
- "sec_flavor='%s' rsize=%d wsize=%d\n",
- args->hostport, args->path, secflavorop2name(args->sec_flavor),
- - args->rsize, args->wsize);
- + args->rsize, args->wsize));
- return status;
- out:
- - dprintf(1, "parsing NFS41_MOUNT: failed %d\n", status);
- + DPRINTF(1, ("parsing NFS41_MOUNT: failed %d\n", status));
- return status;
- }
- @@ -72,7 +72,7 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- EASSERT(args->hostport != NULL);
- if ((args->path == NULL) || (strlen(args->path) == 0)) {
- - dprintf(1, "handle_mount: empty mount root\n");
- + DPRINTF(1, ("handle_mount: empty mount root\n"));
- status = ERROR_BAD_NETPATH;
- goto out;
- }
- @@ -89,8 +89,8 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- goto out;
- }
- - dprintf(1, "handle_mount: hostname='%s', port=%d\n",
- - hostname, port);
- + DPRINTF(1, ("handle_mount: hostname='%s', port=%d\n",
- + hostname, port));
- } else {
- eprintf("handle_mount: port not specified in hostport '%s'\n",
- args->hostport);
- @@ -178,8 +178,8 @@ static int marshall_mount(unsigned char *buffer, uint32_t *length, nfs41_upcall
- {
- mount_upcall_args *args = &upcall->args.mount;
- int status;
- - dprintf(2, "NFS41_MOUNT: writing pointer to nfs41_root %p, version %d, "
- - "lease_time %d\n", upcall->root_ref, NFS41D_VERSION, args->lease_time);
- + DPRINTF(2, ("NFS41_MOUNT: writing pointer to nfs41_root 0x%p, version %d, "
- + "lease_time %d\n", upcall->root_ref, NFS41D_VERSION, args->lease_time));
- status = safe_write(&buffer, length, &upcall->root_ref, sizeof(HANDLE));
- if (status) goto out;
- status = safe_write(&buffer, length, &NFS41D_VERSION, sizeof(DWORD));
- @@ -208,7 +208,7 @@ const nfs41_upcall_op nfs41_op_mount = {
- /* NFS41_UNMOUNT */
- static int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
- {
- - dprintf(1, "parsing NFS41_UNMOUNT: root=%p\n", upcall->root_ref);
- + DPRINTF(1, ("parsing NFS41_UNMOUNT: root=0x%p\n", upcall->root_ref));
- return ERROR_SUCCESS;
- }
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index 43f35c9..56f450b 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -149,7 +149,7 @@ static __inline void attr_cache_entry_free(
- IN struct attr_cache *cache,
- IN struct attr_cache_entry *entry)
- {
- - dprintf(NCLVL1, "attr_cache_entry_free(%llu)\n", entry->fileid);
- + DPRINTF(NCLVL1, ("attr_cache_entry_free(%llu)\n", entry->fileid));
- RB_REMOVE(attr_tree, &cache->head, entry);
- /* add it back to free_entries */
- list_add_tail(&cache->free_entries, &entry->free_entry);
- @@ -160,8 +160,8 @@ static __inline void attr_cache_entry_ref(
- IN struct attr_cache_entry *entry)
- {
- const uint32_t previous = entry->ref_count++;
- - dprintf(NCLVL2, "attr_cache_entry_ref(%llu) %u -> %u\n",
- - entry->fileid, previous, entry->ref_count);
- + DPRINTF(NCLVL2, ("attr_cache_entry_ref(%llu) %u -> %u\n",
- + entry->fileid, previous, entry->ref_count));
- }
- static __inline void attr_cache_entry_deref(
- @@ -169,8 +169,8 @@ static __inline void attr_cache_entry_deref(
- IN struct attr_cache_entry *entry)
- {
- const uint32_t previous = entry->ref_count--;
- - dprintf(NCLVL2, "attr_cache_entry_deref(%llu) %u -> %u\n",
- - entry->fileid, previous, entry->ref_count);
- + DPRINTF(NCLVL2, ("attr_cache_entry_deref(%llu) %u -> %u\n",
- + entry->fileid, previous, entry->ref_count));
- if (entry->ref_count == 0)
- attr_cache_entry_free(cache, entry);
- @@ -233,12 +233,12 @@ static int attr_cache_insert(
- {
- int status = NO_ERROR;
- - dprintf(NCLVL2, "--> attr_cache_insert(%llu)\n", entry->fileid);
- + DPRINTF(NCLVL2, ("--> attr_cache_insert(%llu)\n", entry->fileid));
- if (RB_INSERT(attr_tree, &cache->head, entry))
- status = ERROR_FILE_EXISTS;
- - dprintf(NCLVL2, "<-- attr_cache_insert() returning %d\n", status);
- + DPRINTF(NCLVL2, ("<-- attr_cache_insert() returning %d\n", status));
- return status;
- }
- @@ -250,7 +250,7 @@ static int attr_cache_find_or_create(
- struct attr_cache_entry *entry;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "--> attr_cache_find_or_create(%llu)\n", fileid);
- + DPRINTF(NCLVL1, ("--> attr_cache_find_or_create(%llu)\n", fileid));
- /* look for an existing entry */
- entry = attr_cache_search(cache, fileid);
- @@ -270,8 +270,8 @@ static int attr_cache_find_or_create(
- out:
- *entry_out = entry;
- - dprintf(NCLVL1, "<-- attr_cache_find_or_create() returning %d\n",
- - status);
- + DPRINTF(NCLVL1, ("<-- attr_cache_find_or_create() returning %d\n",
- + status));
- return status;
- out_err_free:
- @@ -504,8 +504,8 @@ static int name_cache_entry_create(
- entry = name_entry(cache->exp_entries.prev);
- name_cache_unlink(cache, entry);
- - dprintf(NCLVL2, "name_cache_entry_create('%s') scavenged 0x%p\n",
- - component->name, entry);
- + DPRINTF(NCLVL2, ("name_cache_entry_create('%s') scavenged 0x%p\n",
- + component->name, entry));
- } else {
- /* take the next entry in the pool and add it to exp_entries */
- entry = &cache->pool[cache->entries++];
- @@ -603,14 +603,14 @@ static int name_cache_entry_changed(
- (cinfo->atomic && cinfo->before == entry->attributes->change)) {
- entry->attributes->change = cinfo->after;
- name_cache_entry_updated(cache, entry);
- - dprintf(NCLVL1, "name_cache_entry_changed('%s') has not changed. "
- + DPRINTF(NCLVL1, ("name_cache_entry_changed('%s') has not changed. "
- "updated change=%llu\n", entry->component,
- - entry->attributes->change);
- + entry->attributes->change));
- return FALSE;
- } else {
- - dprintf(NCLVL1, "name_cache_entry_changed('%s') has changed: was %llu, "
- + DPRINTF(NCLVL1, ("name_cache_entry_changed('%s') has changed: was %llu, "
- "got before=%llu\n", entry->component,
- - entry->attributes->change, cinfo->before);
- + entry->attributes->change, cinfo->before));
- return TRUE;
- }
- }
- @@ -619,7 +619,7 @@ static void name_cache_entry_invalidate(
- IN struct nfs41_name_cache *cache,
- IN struct name_cache_entry *entry)
- {
- - dprintf(NCLVL1, "name_cache_entry_invalidate('%s')\n", entry->component);
- + DPRINTF(NCLVL1, ("name_cache_entry_invalidate('%s')\n", entry->component));
- if (entry->attributes) {
- /* flag attributes so that entry_invis() will return true
- @@ -636,19 +636,21 @@ static struct name_cache_entry* name_cache_search(
- {
- struct name_cache_entry tmp, *entry;
- - dprintf(NCLVL2, "--> name_cache_search('%.*s' under '%s')\n",
- - component->len, component->name, parent->component);
- + DPRINTF(NCLVL2, ("--> name_cache_search('%.*s' under '%s')\n",
- + component->len, component->name, parent->component));
- StringCchCopyNA(tmp.component, NFS41_MAX_COMPONENT_LEN,
- component->name, component->len);
- tmp.component_len = component->len;
- entry = RB_FIND(name_tree, &parent->rbchildren, &tmp);
- - if (entry)
- - dprintf(NCLVL2, "<-- name_cache_search() "
- - "found existing entry 0x%p\n", entry);
- - else
- - dprintf(NCLVL2, "<-- name_cache_search() returning NULL\n");
- + if (entry) {
- + DPRINTF(NCLVL2, ("<-- name_cache_search() "
- + "found existing entry 0x%p\n", entry));
- + }
- + else {
- + DPRINTF(NCLVL2, ("<-- name_cache_search() returning NULL\n"));
- + }
- return entry;
- }
- @@ -658,19 +660,19 @@ static int entry_invis(
- {
- /* name entry timer expired? */
- if (!list_empty(&entry->exp_entry) && time(NULL) > entry->expiration) {
- - dprintf(NCLVL2, "name_entry_expired('%s')\n", entry->component);
- + DPRINTF(NCLVL2, ("name_entry_expired('%s')\n", entry->component));
- return 1;
- }
- /* negative lookup entry? */
- if (entry->attributes == NULL) {
- if (is_negative) *is_negative = 1;
- - dprintf(NCLVL2, "name_entry_negative('%s')\n", entry->component);
- + DPRINTF(NCLVL2, ("name_entry_negative('%s')\n", entry->component));
- return 1;
- }
- /* attribute entry expired? */
- if (attr_cache_entry_expired(entry->attributes)) {
- - dprintf(NCLVL2, "attr_entry_expired(%llu)\n",
- - entry->attributes->fileid);
- + DPRINTF(NCLVL2, ("attr_entry_expired(%llu)\n",
- + entry->attributes->fileid));
- return 1;
- }
- return 0;
- @@ -691,7 +693,7 @@ static int name_cache_lookup(
- const char *path_pos;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "--> name_cache_lookup('%s')\n", path);
- + DPRINTF(NCLVL1, ("--> name_cache_lookup('%s')\n", path));
- parent = NULL;
- target = cache->root;
- @@ -720,7 +722,7 @@ out:
- if (remaining_path_out) *remaining_path_out = component.name;
- if (parent_out) *parent_out = parent;
- if (target_out) *target_out = target;
- - dprintf(NCLVL1, "<-- name_cache_lookup() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- name_cache_lookup() returning %d\n", status));
- return status;
- }
- @@ -730,13 +732,13 @@ static int name_cache_insert(
- {
- int status = NO_ERROR;
- - dprintf(NCLVL2, "--> name_cache_insert('%s')\n", entry->component);
- + DPRINTF(NCLVL2, ("--> name_cache_insert('%s')\n", entry->component));
- if (RB_INSERT(name_tree, &parent->rbchildren, entry))
- status = ERROR_FILE_EXISTS;
- entry->parent = parent;
- - dprintf(NCLVL2, "<-- name_cache_insert() returning %u\n", status);
- + DPRINTF(NCLVL2, ("<-- name_cache_insert() returning %u\n", status));
- return status;
- }
- @@ -748,8 +750,8 @@ static int name_cache_find_or_create(
- {
- int status = NO_ERROR;
- - dprintf(NCLVL1, "--> name_cache_find_or_create('%.*s' under '%s')\n",
- - component->len, component->name, parent->component);
- + DPRINTF(NCLVL1, ("--> name_cache_find_or_create('%.*s' under '%s')\n",
- + component->len, component->name, parent->component));
- *target_out = name_cache_search(cache, parent, component);
- if (*target_out)
- @@ -764,8 +766,8 @@ static int name_cache_find_or_create(
- goto out_err;
- out:
- - dprintf(NCLVL1, "<-- name_cache_find_or_create() returning %d\n",
- - status);
- + DPRINTF(NCLVL1, ("<-- name_cache_find_or_create() returning %d\n",
- + status));
- return status;
- out_err:
- @@ -786,7 +788,7 @@ int nfs41_name_cache_create(
- struct nfs41_name_cache *cache;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "nfs41_name_cache_create()\n");
- + DPRINTF(NCLVL1, ("nfs41_name_cache_create()\n"));
- /* allocate the cache */
- cache = calloc(1, sizeof(struct nfs41_name_cache));
- @@ -830,7 +832,7 @@ int nfs41_name_cache_free(
- struct nfs41_name_cache *cache = *cache_out;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "nfs41_name_cache_free()\n");
- + DPRINTF(NCLVL1, ("nfs41_name_cache_free()\n"));
- /* free the attribute cache */
- attr_cache_free(&cache->attributes);
- @@ -895,7 +897,7 @@ int nfs41_attr_cache_lookup(
- struct attr_cache_entry *entry;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "--> nfs41_attr_cache_lookup(%llu)\n", fileid);
- + DPRINTF(NCLVL1, ("--> nfs41_attr_cache_lookup(%llu)\n", fileid));
- AcquireSRWLockShared(&cache->lock);
- @@ -915,7 +917,7 @@ int nfs41_attr_cache_lookup(
- out_unlock:
- ReleaseSRWLockShared(&cache->lock);
- - dprintf(NCLVL1, "<-- nfs41_attr_cache_lookup() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- nfs41_attr_cache_lookup() returning %d\n", status));
- return status;
- }
- @@ -927,7 +929,7 @@ int nfs41_attr_cache_update(
- struct attr_cache_entry *entry;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "--> nfs41_attr_cache_update(%llu)\n", fileid);
- + DPRINTF(NCLVL1, ("--> nfs41_attr_cache_update(%llu)\n", fileid));
- AcquireSRWLockExclusive(&cache->lock);
- @@ -947,7 +949,7 @@ int nfs41_attr_cache_update(
- out_unlock:
- ReleaseSRWLockExclusive(&cache->lock);
- - dprintf(NCLVL1, "<-- nfs41_attr_cache_update() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- nfs41_attr_cache_update() returning %d\n", status));
- return status;
- }
- @@ -963,8 +965,8 @@ int nfs41_name_cache_insert(
- struct name_cache_entry *parent, *target;
- int status;
- - dprintf(NCLVL1, "--> nfs41_name_cache_insert('%.*s')\n",
- - name->name + name->len - path, path);
- + DPRINTF(NCLVL1, ("--> nfs41_name_cache_insert('%.*s')\n",
- + name->name + name->len - path, path));
- AcquireSRWLockExclusive(&cache->lock);
- @@ -1015,8 +1017,8 @@ int nfs41_name_cache_insert(
- out_unlock:
- ReleaseSRWLockExclusive(&cache->lock);
- - dprintf(NCLVL1, "<-- nfs41_name_cache_insert() returning %d\n",
- - status);
- + DPRINTF(NCLVL1, ("<-- nfs41_name_cache_insert() returning %d\n",
- + status));
- return status;
- out_err_update:
- @@ -1050,8 +1052,8 @@ int nfs41_name_cache_delegreturn(
- struct attr_cache_entry *attributes;
- int status;
- - dprintf(NCLVL1, "--> nfs41_name_cache_delegreturn(%llu, '%s')\n",
- - fileid, path);
- + DPRINTF(NCLVL1, ("--> nfs41_name_cache_delegreturn(%llu, '%s')\n",
- + fileid, path));
- AcquireSRWLockExclusive(&cache->lock);
- @@ -1090,7 +1092,7 @@ int nfs41_name_cache_delegreturn(
- out_unlock:
- ReleaseSRWLockExclusive(&cache->lock);
- - dprintf(NCLVL1, "<-- nfs41_name_cache_delegreturn() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- nfs41_name_cache_delegreturn() returning %d\n", status));
- return status;
- }
- @@ -1105,7 +1107,7 @@ int nfs41_name_cache_remove(
- struct attr_cache_entry *attributes = NULL;
- int status;
- - dprintf(NCLVL1, "--> nfs41_name_cache_remove('%s')\n", path);
- + DPRINTF(NCLVL1, ("--> nfs41_name_cache_remove('%s')\n", path));
- AcquireSRWLockExclusive(&cache->lock);
- @@ -1137,13 +1139,13 @@ int nfs41_name_cache_remove(
- out_unlock:
- ReleaseSRWLockExclusive(&cache->lock);
- - dprintf(NCLVL1, "<-- nfs41_name_cache_remove() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- nfs41_name_cache_remove() returning %d\n", status));
- return status;
- out_attributes:
- /* in the presence of other links, we need to update numlinks
- * regardless of a failure to find the target entry */
- - dprintf(NCLVL1, "nfs41_name_cache_remove: need to find attributes for %s\n", path);
- + DPRINTF(NCLVL1, ("nfs41_name_cache_remove: need to find attributes for '%s'\n", path));
- attributes = attr_cache_search(&cache->attributes, fileid);
- if (attributes)
- attributes->numlinks--;
- @@ -1163,8 +1165,8 @@ int nfs41_name_cache_rename(
- struct name_cache_entry *dst_parent;
- int status = NO_ERROR;
- - dprintf(NCLVL1, "--> nfs41_name_cache_rename('%s' to '%s')\n",
- - src_path, dst_path);
- + DPRINTF(NCLVL1, ("--> nfs41_name_cache_rename('%s' to '%s')\n",
- + src_path, dst_path));
- AcquireSRWLockExclusive(&cache->lock);
- @@ -1179,8 +1181,8 @@ int nfs41_name_cache_rename(
- /* we can't create the dst entry without a parent */
- if (status || dst_parent->attributes == NULL) {
- /* if src exists, make it negative */
- - dprintf(NCLVL1, "nfs41_name_cache_rename: adding negative cache "
- - "entry for %.*s\n", src_name->len, src_name->name);
- + DPRINTF(NCLVL1, ("nfs41_name_cache_rename: adding negative cache "
- + "entry for '%.*s'\n", src_name->len, src_name->name));
- status = name_cache_lookup(cache, 0, src_path,
- src_name->name + src_name->len, NULL, NULL, &src, NULL);
- if (status == NO_ERROR) {
- @@ -1198,8 +1200,8 @@ int nfs41_name_cache_rename(
- if (status || src->attributes == NULL) {
- /* remove dst if it exists */
- struct name_cache_entry *dst;
- - dprintf(NCLVL1, "nfs41_name_cache_rename: removing negative cache "
- - "entry for %.*s\n", dst_name->len, dst_name->name);
- + DPRINTF(NCLVL1, ("nfs41_name_cache_rename: removing negative cache "
- + "entry for '%.*s'\n", dst_name->len, dst_name->name));
- dst = name_cache_search(cache, dst_parent, dst_name);
- if (dst) name_cache_unlink(cache, dst);
- goto out_unlock;
- @@ -1253,7 +1255,7 @@ int nfs41_name_cache_rename(
- out_unlock:
- ReleaseSRWLockExclusive(&cache->lock);
- - dprintf(NCLVL1, "<-- nfs41_name_cache_rename() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- nfs41_name_cache_rename() returning %d\n", status));
- return status;
- }
- @@ -1379,8 +1381,8 @@ static int delete_stale_component(
- struct name_cache_entry *target;
- int status;
- - dprintf(NCLVL1, "--> delete_stale_component('%s')\n",
- - component->name);
- + DPRINTF(NCLVL1, ("--> delete_stale_component('%s')\n",
- + component->name));
- AcquireSRWLockExclusive(&cache->lock);
- @@ -1391,7 +1393,7 @@ static int delete_stale_component(
- ReleaseSRWLockExclusive(&cache->lock);
- - dprintf(NCLVL1, "<-- delete_stale_component() returning %d\n", status);
- + DPRINTF(NCLVL1, ("<-- delete_stale_component() returning %d\n", status));
- return status;
- }
- diff --git a/daemon/namespace.c b/daemon/namespace.c
- index e3ea077..a7a52b3 100644
- --- a/daemon/namespace.c
- +++ b/daemon/namespace.c
- @@ -45,7 +45,7 @@ int nfs41_root_create(
- int status = NO_ERROR;
- nfs41_root *root;
- - dprintf(NSLVL, "--> nfs41_root_create(name=%s, port=%d)\n", name, port);
- + DPRINTF(NSLVL, ("--> nfs41_root_create(name='%s', port=%d)\n", name, port));
- root = calloc(1, sizeof(nfs41_root));
- if (root == NULL) {
- @@ -70,7 +70,7 @@ int nfs41_root_create(
- *root_out = root;
- out:
- - dprintf(NSLVL, "<-- nfs41_root_create() returning %d\n", status);
- + DPRINTF(NSLVL, ("<-- nfs41_root_create() returning %d\n", status));
- return status;
- }
- @@ -79,7 +79,7 @@ static void root_free(
- {
- struct list_entry *entry, *tmp;
- - dprintf(NSLVL, "--> nfs41_root_free()\n");
- + DPRINTF(NSLVL, ("--> nfs41_root_free()\n"));
- /* free clients */
- list_for_each_tmp(entry, tmp, &root->clients)
- @@ -87,7 +87,7 @@ static void root_free(
- DeleteCriticalSection(&root->lock);
- free(root);
- - dprintf(NSLVL, "<-- nfs41_root_free()\n");
- + DPRINTF(NSLVL, ("<-- nfs41_root_free()\n"));
- }
- void nfs41_root_ref(
- @@ -95,7 +95,7 @@ void nfs41_root_ref(
- {
- const LONG count = InterlockedIncrement(&root->ref_count);
- - dprintf(NSLVL, "nfs41_root_ref() count %d\n", count);
- + DPRINTF(NSLVL, ("nfs41_root_ref() count %d\n", count));
- }
- void nfs41_root_deref(
- @@ -103,7 +103,7 @@ void nfs41_root_deref(
- {
- const LONG count = InterlockedDecrement(&root->ref_count);
- - dprintf(NSLVL, "nfs41_root_deref() count %d\n", count);
- + DPRINTF(NSLVL, ("nfs41_root_deref() count %d\n", count));
- if (count == 0)
- root_free(root);
- }
- @@ -149,7 +149,7 @@ static int root_client_find_addrs(
- struct list_entry *entry;
- int status;
- - dprintf(NSLVL, "--> root_client_find_addrs()\n");
- + DPRINTF(NSLVL, ("--> root_client_find_addrs()\n"));
- info.addrs = addrs;
- info.roles = nfs41_exchange_id_flags(is_data) & EXCHGID4_FLAG_MASK_PNFS;
- @@ -158,12 +158,12 @@ static int root_client_find_addrs(
- if (entry) {
- *client_out = client_entry(entry);
- status = NO_ERROR;
- - dprintf(NSLVL, "<-- root_client_find_addrs() returning 0x%p\n",
- - *client_out);
- + DPRINTF(NSLVL, ("<-- root_client_find_addrs() returning 0x%p\n",
- + *client_out));
- } else {
- status = ERROR_FILE_NOT_FOUND;
- - dprintf(NSLVL, "<-- root_client_find_addrs() failed with %d\n",
- - status);
- + DPRINTF(NSLVL, ("<-- root_client_find_addrs() failed with %d\n",
- + status));
- }
- return status;
- }
- @@ -215,7 +215,7 @@ static int root_client_find(
- struct list_entry *entry;
- int status;
- - dprintf(NSLVL, "--> root_client_find()\n");
- + DPRINTF(NSLVL, ("--> root_client_find()\n"));
- info.exchangeid = exchangeid;
- info.roles = nfs41_exchange_id_flags(is_data) & EXCHGID4_FLAG_MASK_PNFS;
- @@ -224,12 +224,12 @@ static int root_client_find(
- if (entry) {
- *client_out = client_entry(entry);
- status = NO_ERROR;
- - dprintf(NSLVL, "<-- root_client_find() returning 0x%p\n",
- - *client_out);
- + DPRINTF(NSLVL, ("<-- root_client_find() returning 0x%p\n",
- + *client_out));
- } else {
- status = ERROR_FILE_NOT_FOUND;
- - dprintf(NSLVL, "<-- root_client_find() failed with %d\n",
- - status);
- + DPRINTF(NSLVL, ("<-- root_client_find() failed with %d\n",
- + status));
- }
- return status;
- }
- @@ -262,7 +262,7 @@ static int session_get_lease(
- status = nfs41_getattr(session, NULL, &attr_request, &info);
- if (status) {
- - eprintf("nfs41_getattr() failed with %s\n",
- + eprintf("nfs41_getattr() failed with '%s'\n",
- nfs_error_string(status));
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- goto out;
- @@ -312,7 +312,7 @@ static int root_client_create(
- /* send RECLAIM_COMPLETE, but don't fail on ERR_NOTSUPP */
- status = nfs41_reclaim_complete(session);
- if (status && status != NFS4ERR_NOTSUPP) {
- - eprintf("nfs41_reclaim_complete() failed with %s\n",
- + eprintf("nfs41_reclaim_complete() failed with '%s'\n",
- nfs_error_string(status));
- status = ERROR_BAD_NETPATH;
- goto out_err;
- @@ -345,7 +345,7 @@ int nfs41_root_mount_addrs(
- nfs41_client *client, *existing;
- int status;
- - dprintf(NSLVL, "--> nfs41_root_mount_addrs()\n");
- + DPRINTF(NSLVL, ("--> nfs41_root_mount_addrs()\n"));
- /* look for an existing client that matches the address and role */
- EnterCriticalSection(&root->lock);
- @@ -367,7 +367,7 @@ int nfs41_root_mount_addrs(
- status = nfs41_exchange_id(rpc, &root->client_owner,
- nfs41_exchange_id_flags(is_data), &exchangeid);
- if (status) {
- - eprintf("nfs41_exchange_id() failed %s\n", nfs_error_string(status));
- + eprintf("nfs41_exchange_id() failed '%s'\n", nfs_error_string(status));
- status = ERROR_BAD_NET_RESP;
- goto out_free_rpc;
- }
- @@ -397,14 +397,14 @@ int nfs41_root_mount_addrs(
- status = root_client_find(root, &exchangeid, is_data, &existing);
- if (status) {
- - dprintf(NSLVL, "caching new client 0x%p\n", client);
- + DPRINTF(NSLVL, ("caching new client 0x%p\n", client));
- /* the client is not a duplicate, so add it to the list */
- list_add_tail(&root->clients, &client->root_entry);
- status = NO_ERROR;
- } else {
- - dprintf(NSLVL, "created a duplicate client 0x%p! using "
- - "existing client 0x%p instead\n", client, existing);
- + DPRINTF(NSLVL, ("created a duplicate client 0x%p! using "
- + "existing client 0x%p instead\n", client, existing));
- /* a matching client has been created in parallel, so free
- * the one we created and use the existing client instead */
- @@ -416,7 +416,7 @@ int nfs41_root_mount_addrs(
- out:
- if (status == NO_ERROR)
- *client_out = client;
- - dprintf(NSLVL, "<-- nfs41_root_mount_addrs() returning %d\n", status);
- + DPRINTF(NSLVL, ("<-- nfs41_root_mount_addrs() returning %d\n", status));
- return status;
- out_free_rpc:
- @@ -444,7 +444,7 @@ static int referral_mount_location(
- int status = ERROR_BAD_NET_NAME;
- uint32_t i;
- - dprintf(NSLVL, "--> referral_mount_location()\n");
- + DPRINTF(NSLVL, ("--> referral_mount_location()\n"));
- /* create a client and session for the first available server */
- for (i = 0; i < loc->server_count; i++) {
- @@ -457,7 +457,7 @@ static int referral_mount_location(
- break;
- }
- - dprintf(NSLVL, "<-- referral_mount_location() returning %d\n", status);
- + DPRINTF(NSLVL, ("<-- referral_mount_location() returning %d\n", status));
- return status;
- }
- diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c
- index f5bac1d..91ca863 100644
- --- a/daemon/nfs41_client.c
- +++ b/daemon/nfs41_client.c
- @@ -159,10 +159,10 @@ static void dprint_roles(
- IN int level,
- IN uint32_t roles)
- {
- - dprintf(level, "roles: %s%s%s\n",
- + DPRINTF(level, ("roles: %s%s%s\n",
- (roles & EXCHGID4_FLAG_USE_NON_PNFS) ? "USE_NON_PNFS " : "",
- (roles & EXCHGID4_FLAG_USE_PNFS_MDS) ? "USE_PNFS_MDS " : "",
- - (roles & EXCHGID4_FLAG_USE_PNFS_DS) ? "USE_PNFS_DS" : "");
- + (roles & EXCHGID4_FLAG_USE_PNFS_DS) ? "USE_PNFS_DS" : ""));
- }
- int nfs41_client_renew(
- @@ -206,7 +206,7 @@ out:
- void nfs41_client_free(
- IN nfs41_client *client)
- {
- - dprintf(2, "nfs41_client_free(%llu)\n", client->clnt_id);
- + DPRINTF(2, ("nfs41_client_free(%llu)\n", client->clnt_id));
- nfs41_client_delegation_free(client);
- if (client->session) nfs41_session_free(client->session);
- nfs41_destroy_clientid(client->rpc, client->clnt_id);
- diff --git a/daemon/nfs41_compound.c b/daemon/nfs41_compound.c
- index 217900a..0c2c4ad 100644
- --- a/daemon/nfs41_compound.c
- +++ b/daemon/nfs41_compound.c
- @@ -34,7 +34,7 @@
- int compound_error(int status)
- {
- if (status != NFS4_OK)
- - dprintf(1, "COMPOUND failed with status %d.\n", status);
- + DPRINTF(1, ("COMPOUND failed with status %d.\n", status));
- return status;
- }
- @@ -197,8 +197,8 @@ retry:
- }
- if (compound->res.status != NFS4_OK)
- - dprintf(1, "\n################ %s ################\n\n",
- - nfs_error_string(compound->res.status));
- + DPRINTF(1, ("\n################ '%s' ################\n\n",
- + nfs_error_string(compound->res.status)));
- switch (compound->res.status) {
- case NFS4_OK:
- @@ -276,11 +276,11 @@ retry:
- delayby = 5000;
- else
- delayby = 500*retry_count;
- - dprintf(1, "Compound returned %s: sleeping for %ums..\n",
- + DPRINTF(1, ("Compound returned '%s': sleeping for %ums..\n",
- (compound->res.status==NFS4ERR_GRACE)?"NFS4ERR_GRACE":"NFS4ERR_DELAY",
- - delayby);
- + delayby));
- Sleep(delayby);
- - dprintf(1, "Attempting to resend compound.\n");
- + DPRINTF(1, ("Attempting to resend compound.\n"));
- goto do_retry;
- #ifndef RETRY_INDEFINITELY
- }
- @@ -351,7 +351,7 @@ retry:
- argarray[1].op == OP_PUTROOTFH) &&
- (argarray[2].op == OP_SECINFO_NO_NAME ||
- argarray[2].op == OP_SECINFO)) {
- - dprintf(1, "SECINFO: BROKEN SERVER\n");
- + DPRINTF(1, ("SECINFO: BROKEN SERVER\n"));
- goto out;
- }
- if (!try_recovery)
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index 47579d0..73d8b77 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -78,7 +78,7 @@ static int map_current_user_to_ids(nfs41_idmapper *idmapper, uid_t *uid, gid_t *
- eprintf("map_current_user_to_ids: GetUserName() failed with %d\n", status);
- goto out;
- }
- - dprintf(1, "map_current_user_to_ids: mapping user %s\n", username);
- + DPRINTF(1, ("map_current_user_to_ids: mapping user '%s'\n", username));
- if (nfs41_idmap_name_to_ids(idmapper, username, uid, gid)) {
- /* instead of failing for auth_sys, fall back to 'nobody' uid/gid */
- @@ -142,17 +142,17 @@ static unsigned int WINAPI thread_main(void *args)
- status = upcall_handle(&nfs41_dg, &upcall);
- write_downcall:
- - dprintf(1, "writing downcall: xid=%lld opcode=%s status=%d "
- + DPRINTF(1, ("writing downcall: xid=%lld opcode='%s' status=%d "
- "get_last_error=%d\n", upcall.xid, opcode2string(upcall.opcode),
- - upcall.status, upcall.last_error);
- + upcall.status, upcall.last_error));
- upcall_marshall(&upcall, inbuf, (uint32_t)inbuf_len, (uint32_t*)&outbuf_len);
- - dprintf(2, "making a downcall: outbuf_len %ld\n\n", outbuf_len);
- + DPRINTF(2, ("making a downcall: outbuf_len %ld\n\n", outbuf_len));
- status = DeviceIoControl(pipe, IOCTL_NFS41_WRITE,
- inbuf, inbuf_len, NULL, 0, (LPDWORD)&outbuf_len, NULL);
- if (!status) {
- - eprintf("IOCTL_NFS41_WRITE failed with %d xid=%lld opcode=%s\n",
- + eprintf("IOCTL_NFS41_WRITE failed with %d xid=%lld opcode='%s'\n",
- GetLastError(), upcall.xid, opcode2string(upcall.opcode));
- upcall_cancel(&upcall);
- }
- @@ -331,24 +331,26 @@ static void print_getaddrinfo(struct addrinfo *ptr)
- char ipstringbuffer[46];
- DWORD ipbufferlength = 46;
- - dprintf(1, "getaddrinfo response flags: 0x%x\n", ptr->ai_flags);
- + DPRINTF(1, ("getaddrinfo response flags: 0x%x\n", ptr->ai_flags));
- switch (ptr->ai_family) {
- - case AF_UNSPEC: dprintf(1, "Family: Unspecified\n"); break;
- + case AF_UNSPEC: DPRINTF(1, ("Family: Unspecified\n")); break;
- case AF_INET:
- - dprintf(1, "Family: AF_INET IPv4 address %s\n",
- - inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr));
- + DPRINTF(1, ("Family: AF_INET IPv4 address '%s'\n",
- + inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr)));
- break;
- case AF_INET6:
- if (WSAAddressToStringA((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
- - NULL, ipstringbuffer, &ipbufferlength))
- - dprintf(1, "WSAAddressToString failed with %u\n", WSAGetLastError());
- - else
- - dprintf(1, "Family: AF_INET6 IPv6 address %s\n", ipstringbuffer);
- + NULL, ipstringbuffer, &ipbufferlength)) {
- + DPRINTF(1, ("WSAAddressToString failed with %u\n", WSAGetLastError()));
- + }
- + else {
- + DPRINTF(1, ("Family: AF_INET6 IPv6 address '%s'\n", ipstringbuffer));
- + }
- break;
- - case AF_NETBIOS: dprintf(1, "AF_NETBIOS (NetBIOS)\n"); break;
- - default: dprintf(1, "Other %ld\n", ptr->ai_family); break;
- + case AF_NETBIOS: DPRINTF(1, ("AF_NETBIOS (NetBIOS)\n")); break;
- + default: DPRINTF(1, ("Other %ld\n", ptr->ai_family)); break;
- }
- - dprintf(1, "Canonical name: %s\n", ptr->ai_canonname);
- + DPRINTF(1, ("Canonical name: '%s'\n", ptr->ai_canonname));
- }
- static int getdomainname()
- @@ -397,12 +399,13 @@ static int getdomainname()
- status = getnameinfo((struct sockaddr *)ptr->ai_addr,
- (socklen_t)ptr->ai_addrlen, hostname, NI_MAXHOST,
- servInfo, NI_MAXSERV, NI_NAMEREQD);
- - if (status)
- - dprintf(1, "getnameinfo failed %d\n", WSAGetLastError());
- + if (status) {
- + DPRINTF(1, ("getnameinfo failed %d\n", WSAGetLastError()));
- + }
- else {
- size_t i, len = strlen(hostname);
- char *p = hostname;
- - dprintf(1, "getdomainname: hostname %s %d\n", hostname, len);
- + DPRINTF(1, ("getdomainname: hostname '%s' %d\n", hostname, len));
- for (i = 0; i < len; i++)
- if (p[i] == '.')
- break;
- @@ -410,8 +413,8 @@ static int getdomainname()
- break;
- flag = TRUE;
- memcpy(nfs41_dg.localdomain_name, &hostname[i+1], len-i);
- - dprintf(1, "getdomainname: domainname %s %d\n",
- - nfs41_dg.localdomain_name, strlen(nfs41_dg.localdomain_name));
- + DPRINTF(1, ("getdomainname: domainname '%s' %d\n",
- + nfs41_dg.localdomain_name, strlen(nfs41_dg.localdomain_name)));
- goto out_loop;
- }
- break;
- @@ -428,7 +431,7 @@ out_loop:
- }
- freeaddrinfo(result);
- } else {
- - dprintf(1, "domain name is %s\n", net_info->DomainName);
- + DPRINTF(1, ("domain name is '%s'\n", net_info->DomainName));
- memcpy(nfs41_dg.localdomain_name, net_info->DomainName,
- strlen(net_info->DomainName));
- nfs41_dg.localdomain_name[strlen(net_info->DomainName)] = '\0';
- @@ -450,7 +453,7 @@ void nfsd_crt_debug_init(void)
- int crtsetdbgflags = nfs41_dg.crtdbgmem_flags;
- if (crtsetdbgflags == NFS41D_GLOBALS_CRTDBGMEM_FLAGS_NOT_SET) {
- - dprintf(1, "crtsetdbgflags not set, using defaults\n");
- + DPRINTF(1, ("crtsetdbgflags not set, using defaults\n"));
- crtsetdbgflags = 0;
- crtsetdbgflags |= _CRTDBG_ALLOC_MEM_DF;
- @@ -472,12 +475,12 @@ void nfsd_crt_debug_init(void)
- */
- }
- - dprintf(0, "memory debug flags _CRTDBG_(=0x%x)"
- + DPRINTF(0, ("memory debug flags _CRTDBG_(=0x%x)"
- "{ ALLOC_MEM_DF=%d, LEAK_CHECK_DF=%d, DELAY_FREE_MEM_DF=%d }\n",
- crtsetdbgflags,
- ((crtsetdbgflags & _CRTDBG_ALLOC_MEM_DF)?1:0),
- ((crtsetdbgflags & _CRTDBG_LEAK_CHECK_DF)?1:0),
- - ((crtsetdbgflags & _CRTDBG_DELAY_FREE_MEM_DF)?1:0));
- + ((crtsetdbgflags & _CRTDBG_DELAY_FREE_MEM_DF)?1:0)));
- (void)_CrtSetDbgFlag(crtsetdbgflags);
- @@ -497,7 +500,7 @@ void nfsd_crt_debug_init(void)
- (void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
- if (crtsetdbgflags & _CRTDBG_LEAK_CHECK_DF) {
- - dprintf(1, "debug mode. dumping memory leaks to stderr on exit.\n");
- + DPRINTF(1, ("debug mode. dumping memory leaks to stderr on exit.\n"));
- }
- #endif /* _DEBUG */
- }
- @@ -537,7 +540,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- * inversion
- */
- if(SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) {
- - dprintf(1, "Running as HIGH_PRIORITY_CLASS\n");
- + DPRINTF(1, ("Running as HIGH_PRIORITY_CLASS\n"));
- }
- else {
- eprintf("Failed to enter HIGH_PRIORITY_CLASS mode\n");
- @@ -559,7 +562,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- }
- NFS41D_VERSION = GetTickCount();
- - dprintf(1, "NFS41 Daemon starting: version %d\n", NFS41D_VERSION);
- + DPRINTF(1, ("NFS41 Daemon starting: version %d\n", NFS41D_VERSION));
- pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- @@ -570,7 +573,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- goto out_idmap;
- }
- - dprintf(1, "starting nfs41 mini redirector\n");
- + DPRINTF(1, ("starting nfs41 mini redirector\n"));
- status = DeviceIoControl(pipe, IOCTL_NFS41_START,
- &NFS41D_VERSION, sizeof(DWORD), NULL, 0, (LPDWORD)&len, NULL);
- if (!status) {
- @@ -585,8 +588,8 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- goto out_pipe;
- #endif
- - dprintf(1, "Starting %d worker threads...\n",
- - (int)nfs41_dg.num_worker_threads);
- + DPRINTF(1, ("Starting %d worker threads...\n",
- + (int)nfs41_dg.num_worker_threads));
- for (i = 0; i < nfs41_dg.num_worker_threads; i++) {
- tids[i].handle = (HANDLE)_beginthreadex(NULL, 0, thread_main,
- &nfs41_dg, 0, &tids[i].tid);
- @@ -603,11 +606,11 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- WaitForSingleObject(stop_event, INFINITE);
- #else
- //This can be changed to waiting on an array of handles and using waitformultipleobjects
- - dprintf(1, "Parent waiting for children threads\n");
- + DPRINTF(1, ("Parent waiting for children threads\n"));
- for (i = 0; i < nfs41_dg.num_worker_threads; i++)
- WaitForSingleObject(tids[i].handle, INFINITE );
- #endif
- - dprintf(1, "Parent woke up!!!!\n");
- + DPRINTF(1, ("Parent woke up!!!!\n"));
- out_pipe:
- CloseHandle(pipe);
- diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
- index 5ae9d85..3c1303b 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -162,19 +162,20 @@ int nfs41_create_session(nfs41_client *clnt, nfs41_session *session, bool_t try_
- "server refused\n");
- session->flags = reply.csr_flags;
- }
- - else
- - dprintf(1, "session flags %x\n", reply.csr_flags);
- + else {
- + DPRINTF(1, ("session flags %x\n", reply.csr_flags));
- + }
- - dprintf(1, "session fore_chan_attrs:\n"
- + DPRINTF(1, ("session fore_chan_attrs:\n"
- " %-32s%d\n %-32s%d\n %-32s%d\n %-32s%d\n %-32s%d\n %-32s%d\n",
- "headerpadsize", session->fore_chan_attrs.ca_headerpadsize,
- "maxrequestsize", session->fore_chan_attrs.ca_maxrequestsize,
- "maxresponsesize", session->fore_chan_attrs.ca_maxresponsesize,
- "maxresponsesize_cached", session->fore_chan_attrs.ca_maxresponsesize_cached,
- "maxoperations", session->fore_chan_attrs.ca_maxoperations,
- - "maxrequests", session->fore_chan_attrs.ca_maxrequests);
- - dprintf(1, "client supports %d max rpc slots, but server has %d\n",
- - session->table.max_slots, session->fore_chan_attrs.ca_maxrequests);
- + "maxrequests", session->fore_chan_attrs.ca_maxrequests));
- + DPRINTF(1, ("client supports %d max rpc slots, but server has %d\n",
- + session->table.max_slots, session->fore_chan_attrs.ca_maxrequests));
- /* use the server's ca_maxrequests unless it's bigger than our array */
- session->table.max_slots = min(session->table.max_slots,
- session->fore_chan_attrs.ca_maxrequests);
- @@ -234,7 +235,7 @@ int nfs41_destroy_session(
- status = compound.res.status;
- if (status)
- - eprintf("%s failed with status %d.\n",
- + eprintf("'%s' failed with status %d.\n",
- nfs_opnum_to_string(OP_DESTROY_SESSION), status);
- out:
- return status;
- @@ -766,7 +767,7 @@ int nfs41_write(
- * send us into an infinite loop. return NFS4ERR_IO */
- if (!write_res.resok4.count) {
- status = NFS4ERR_IO;
- - eprintf("WRITE succeeded with count=0; returning %s\n",
- + eprintf("WRITE succeeded with count=0; returning '%s'\n",
- nfs_error_string(status));
- }
- @@ -827,7 +828,7 @@ int nfs41_read(
- * send us into an infinite loop. return NFS4ERR_IO */
- if (!read_res.resok4.data_len && !read_res.resok4.eof) {
- status = NFS4ERR_IO;
- - eprintf("READ succeeded with len=0 and eof=0; returning %s\n",
- + eprintf("READ succeeded with len=0 and eof=0; returning '%s'\n",
- nfs_error_string(status));
- }
- out:
- diff --git a/daemon/nfs41_rpc.c b/daemon/nfs41_rpc.c
- index 927dbe9..d48fc1d 100644
- --- a/daemon/nfs41_rpc.c
- +++ b/daemon/nfs41_rpc.c
- @@ -62,9 +62,9 @@ static int get_client_for_netaddr(
- if (server_name) {
- getnameinfo(addr->buf, addr->len, server_name, NI_MAXHOST, NULL, 0, 0);
- - dprintf(1, "servername is %s\n", server_name);
- + DPRINTF(1, ("servername is '%s'\n", server_name));
- }
- - dprintf(1, "callback function %p args %p\n", nfs41_handle_callback, rpc);
- + DPRINTF(1, ("callback function 0x%p args 0x%p\n", nfs41_handle_callback, rpc));
- client = clnt_tli_create(RPC_ANYFD, nconf, addr, NFS41_RPC_PROGRAM,
- NFS41_RPC_VERSION, wsize, rsize, rpc ? proc_cb_compound_res : NULL,
- rpc ? nfs41_handle_callback : NULL, rpc ? rpc : NULL);
- @@ -130,12 +130,13 @@ int create_rpcsec_auth_client(
- }
- if (client->cl_auth == NULL) {
- - eprintf("nfs41_rpc_clnt_create: failed to create %s\n",
- + eprintf("nfs41_rpc_clnt_create: failed to create '%s'\n",
- secflavorop2name(sec_flavor));
- goto out;
- - } else
- - dprintf(1, "nfs41_rpc_clnt_create: successfully created %s\n",
- - secflavorop2name(sec_flavor));
- + } else {
- + DPRINTF(1, ("nfs41_rpc_clnt_create: successfully created '%s'\n",
- + secflavorop2name(sec_flavor)));
- + }
- status = 0;
- out:
- return status;
- @@ -209,8 +210,8 @@ int nfs41_rpc_clnt_create(
- status = ERROR_NETWORK_UNREACHABLE;
- goto out_err_client;
- } else
- - dprintf(1, "nfs41_rpc_clnt_create: successfully created %s\n",
- - secflavorop2name(sec_flavor));
- + DPRINTF(1, ("nfs41_rpc_clnt_create: successfully created '%s'\n",
- + secflavorop2name(sec_flavor)));
- }
- rpc->rpc = client;
- @@ -254,13 +255,13 @@ static bool_t rpc_renew_in_progress(nfs41_rpc_clnt *rpc, int *value)
- bool_t status = FALSE;
- AcquireSRWLockExclusive(&rpc->lock);
- if (value) {
- - dprintf(1, "nfs41_rpc_renew_in_progress: setting value %d\n", *value);
- + DPRINTF(1, ("nfs41_rpc_renew_in_progress: setting value %d\n", *value));
- rpc->in_recovery = *value;
- if (!rpc->in_recovery)
- SetEvent(rpc->cond);
- } else {
- status = rpc->in_recovery;
- - dprintf(1, "nfs41_rpc_renew_in_progress: returning value %d\n", status);
- + DPRINTF(1, ("nfs41_rpc_renew_in_progress: returning value %d\n", status));
- }
- ReleaseSRWLockExclusive(&rpc->lock);
- return status;
- @@ -311,7 +312,7 @@ static int rpc_reconnect(
- rpc->rpc = client;
- rpc->addr_index = addr_index;
- rpc->version++;
- - dprintf(1, "nfs41_send_compound: reestablished RPC connection\n");
- + DPRINTF(1, ("nfs41_send_compound: reestablished RPC connection\n"));
- out_unlock:
- ReleaseSRWLockExclusive(&rpc->lock);
- @@ -323,7 +324,7 @@ out_unlock:
- status = nfs41_bind_conn_to_session(rpc,
- rpc->client->session->session_id, CDFC4_BACK_OR_BOTH);
- if (status)
- - eprintf("nfs41_bind_conn_to_session() failed with %s\n",
- + eprintf("nfs41_bind_conn_to_session() failed with '%s'\n",
- nfs_error_string(status));
- status = NFS4_OK;
- }
- @@ -354,7 +355,7 @@ int nfs41_send_compound(
- ReleaseSRWLockShared(&rpc->lock);
- if (rpc_status != RPC_SUCCESS) {
- - eprintf("clnt_call returned rpc_status = %s\n",
- + eprintf("clnt_call returned rpc_status = '%s'\n",
- rpc_error_string(rpc_status));
- switch(rpc_status) {
- case RPC_CANTRECV:
- @@ -370,8 +371,8 @@ int nfs41_send_compound(
- while (rpc_renew_in_progress(rpc, NULL)) {
- status = WaitForSingleObjectEx(rpc->cond, INFINITE, FALSE);
- if (status != WAIT_OBJECT_0) {
- - dprintf(0, "rpc_renew_in_progress: WaitForSingleObjectEx() failed\n");
- - print_condwait_status(1, status);
- + eprintf("rpc_renew_in_progress: WaitForSingleObjectEx() failed\n");
- + print_condwait_status(0, status);
- status = ERROR_LOCK_VIOLATION;
- goto out;
- }
- diff --git a/daemon/nfs41_server.c b/daemon/nfs41_server.c
- index b1be2d8..522105d 100644
- --- a/daemon/nfs41_server.c
- +++ b/daemon/nfs41_server.c
- @@ -101,7 +101,7 @@ static int server_create(
- server = calloc(1, sizeof(nfs41_server));
- if (server == NULL) {
- status = GetLastError();
- - eprintf("failed to allocate server %s\n", info->owner);
- + eprintf("failed to allocate server '%s'\n", info->owner);
- goto out;
- }
- @@ -128,7 +128,7 @@ out_free:
- static void server_free(
- IN nfs41_server *server)
- {
- - dprintf(SRVLVL, "server_free(%s)\n", server->owner);
- + DPRINTF(SRVLVL, ("server_free('%s')\n", server->owner));
- nfs41_superblock_list_free(&server->superblocks);
- nfs41_name_cache_free(&server->name_cache);
- free(server);
- @@ -138,8 +138,8 @@ static __inline void server_ref_locked(
- IN nfs41_server *server)
- {
- server->ref_count++;
- - dprintf(SRVLVL, "nfs41_server_ref(%s) count %d\n",
- - server->owner, server->ref_count);
- + DPRINTF(SRVLVL, ("nfs41_server_ref('%s') count %d\n",
- + server->owner, server->ref_count));
- }
- void nfs41_server_ref(
- @@ -158,8 +158,8 @@ void nfs41_server_deref(
- EnterCriticalSection(&g_server_list.lock);
- server->ref_count--;
- - dprintf(SRVLVL, "nfs41_server_deref(%s) count %d\n",
- - server->owner, server->ref_count);
- + DPRINTF(SRVLVL, ("nfs41_server_deref('%s') count %d\n",
- + server->owner, server->ref_count));
- if (server->ref_count == 0) {
- list_remove(&server->entry);
- server_free(server);
- @@ -179,8 +179,8 @@ static void server_addrs_add(
- AcquireSRWLockExclusive(&addrs->lock);
- if (multi_addr_find(&addrs->addrs, addr, NULL)) {
- - dprintf(SRVLVL, "server_addrs_add() found existing addr '%s'.\n",
- - addr->uaddr);
- + DPRINTF(SRVLVL, ("server_addrs_add() found existing addr '%s'.\n",
- + addr->uaddr));
- } else {
- /* overwrite the address at 'next_index' */
- StringCchCopyA(addrs->addrs.arr[addrs->next_index].netid,
- @@ -194,8 +194,8 @@ static void server_addrs_add(
- if (addrs->addrs.count < addrs->next_index)
- addrs->addrs.count = addrs->next_index;
- - dprintf(SRVLVL, "server_addrs_add() added new addr '%s'.\n",
- - addr->uaddr);
- + DPRINTF(SRVLVL, ("server_addrs_add() added new addr '%s'.\n",
- + addr->uaddr));
- }
- ReleaseSRWLockExclusive(&addrs->lock);
- }
- @@ -232,7 +232,7 @@ int nfs41_server_find_or_create(
- info.owner = server_owner_major_id;
- info.scope = server_scope;
- - dprintf(SRVLVL, "--> nfs41_server_find_or_create(%s)\n", info.owner);
- + DPRINTF(SRVLVL, ("--> nfs41_server_find_or_create('%s')\n", info.owner));
- EnterCriticalSection(&g_server_list.lock);
- @@ -246,18 +246,18 @@ int nfs41_server_find_or_create(
- list_add_tail(&g_server_list.head, &server->entry);
- *server_out = server;
- - dprintf(SRVLVL, "<-- nfs41_server_find_or_create() "
- - "returning new server %p\n", server);
- + DPRINTF(SRVLVL, ("<-- nfs41_server_find_or_create() "
- + "returning new server 0x%p\n", server));
- } else {
- - dprintf(SRVLVL, "<-- nfs41_server_find_or_create() "
- - "returning %d\n", status);
- + DPRINTF(SRVLVL, ("<-- nfs41_server_find_or_create() "
- + "returning %d\n", status));
- }
- } else {
- server = server_entry(entry);
- status = NO_ERROR;
- - dprintf(SRVLVL, "<-- nfs41_server_find_or_create() "
- - "returning existing server %p\n", server);
- + DPRINTF(SRVLVL, ("<-- nfs41_server_find_or_create() "
- + "returning existing server 0x%p\n", server));
- }
- if (server) {
- @@ -286,8 +286,8 @@ int nfs41_server_resolve(
- int wse; /* Windows Socket Error */
- int retry_getaddrinfoex_counter = 0;
- - dprintf(SRVLVL, "--> nfs41_server_resolve('%s':%u)\n",
- - hostname, port);
- + DPRINTF(SRVLVL, ("--> nfs41_server_resolve('%s':%u)\n",
- + hostname, port));
- addrs->count = 0;
- @@ -312,12 +312,12 @@ retry_getaddrinfoex:
- wse = GetAddrInfoExA(hostname, service, 0, NULL, &hints, &res,
- NULL, NULL, NULL, NULL);
- if (wse != 0) {
- - dprintf(SRVLVL, "GetAddrInfoExA() failed with wse=%d/'%s'\n",
- - wse, gai_strerrorA(wse));
- + DPRINTF(SRVLVL, ("GetAddrInfoExA() failed with wse=%d/'%s'\n",
- + wse, gai_strerrorA(wse)));
- if ((wse == WSATRY_AGAIN) && (retry_getaddrinfoex_counter < 4)) {
- - dprintf(SRVLVL, "GetAddrInfoExA() returned WSATRY_AGAIN, "
- + DPRINTF(SRVLVL, ("GetAddrInfoExA() returned WSATRY_AGAIN, "
- "retry %d with delay...\n",
- - retry_getaddrinfoex_counter);
- + retry_getaddrinfoex_counter));
- retry_getaddrinfoex_counter++;
- Sleep(500*retry_getaddrinfoex_counter);
- @@ -328,8 +328,8 @@ retry_getaddrinfoex:
- }
- for (info = res; info != NULL; info = info->ai_next) {
- - dprintf(SRVLVL, "GetAddrInfoExA() returned: info.{ai_family=%d}\n",
- - info->ai_family);
- + DPRINTF(SRVLVL, ("GetAddrInfoExA() returned: info.{ai_family=%d}\n",
- + info->ai_family));
- /* find the appropriate entry in /etc/netconfig */
- switch (info->ai_family) {
- @@ -340,7 +340,7 @@ retry_getaddrinfoex:
- nconf = getnetconfigent(netid);
- if (nconf == NULL) {
- - dprintf(SRVLVL, "getnetconfigent(netid='%s') failed.\n", netid);
- + DPRINTF(SRVLVL, ("getnetconfigent(netid='%s') failed.\n", netid));
- continue;
- }
- @@ -352,7 +352,7 @@ retry_getaddrinfoex:
- freenetconfigent(nconf);
- if (uaddr == NULL) {
- - dprintf(SRVLVL, "taddr2uaddr() failed.\n");
- + DPRINTF(SRVLVL, ("taddr2uaddr() failed.\n"));
- continue;
- }
- @@ -364,7 +364,7 @@ retry_getaddrinfoex:
- status = NO_ERROR;
- if (++addrs->count >= NFS41_ADDRS_PER_SERVER) {
- - dprintf(SRVLVL, "error: too many NFS41_ADDRS_PER_SERVER.\n");
- + DPRINTF(SRVLVL, ("error: too many NFS41_ADDRS_PER_SERVER.\n"));
- break;
- }
- }
- @@ -378,8 +378,8 @@ retry_getaddrinfoex:
- FreeAddrInfoEx(res);
- out:
- if (status) {
- - dprintf(SRVLVL, "<-- nfs41_server_resolve('%s':%u) returning "
- - "error %d\n", hostname, port, status);
- + DPRINTF(SRVLVL, ("<-- nfs41_server_resolve('%s':%u) returning "
- + "error %d\n", hostname, port, status));
- }
- else {
- unsigned int i;
- @@ -392,8 +392,8 @@ out:
- "'%s', ", addrs->arr[i].uaddr);
- }
- - dprintf(SRVLVL, "<-- nfs41_server_resolve('%s':%u) returning "
- - "OK { %s }\n", hostname, port, buff);
- + DPRINTF(SRVLVL, ("<-- nfs41_server_resolve('%s':%u) returning "
- + "OK { %s }\n", hostname, port, buff));
- }
- return status;
- }
- diff --git a/daemon/nfs41_session.c b/daemon/nfs41_session.c
- index 6411de2..7e54234 100644
- --- a/daemon/nfs41_session.c
- +++ b/daemon/nfs41_session.c
- @@ -69,8 +69,8 @@ static void resize_slot_table(
- target_highest_slotid = NFS41_MAX_NUM_SLOTS - 1;
- if (table->max_slots != target_highest_slotid + 1) {
- - dprintf(2, "updated max_slots %u to %u\n",
- - table->max_slots, target_highest_slotid + 1);
- + DPRINTF(2, ("updated max_slots %u to %u\n",
- + table->max_slots, target_highest_slotid + 1));
- table->max_slots = target_highest_slotid + 1;
- if (slot_table_avail(table))
- @@ -119,8 +119,8 @@ void nfs41_session_free_slot(
- while (table->highest_used && !table->used_slots[table->highest_used])
- table->highest_used--;
- }
- - dprintf(3, "freeing slot#=%d used=%d highest=%d\n",
- - slotid, table->num_used, table->highest_used);
- + DPRINTF(3, ("freeing slot#=%d used=%d highest=%d\n",
- + slotid, table->num_used, table->highest_used));
- /* wake any threads waiting on a slot */
- if (slot_table_avail(table))
- @@ -163,8 +163,8 @@ void nfs41_session_get_slot(
- LeaveCriticalSection(&table->lock);
- ReleaseSRWLockShared(&session->client->session_lock);
- - dprintf(2, "session %p: using slot#=%d with seq#=%d highest=%d\n",
- - session, *slot, *seqid, *highest);
- + DPRINTF(2, ("session 0x%p: using slot#=%d with seq#=%d highest=%d\n",
- + session, *slot, *seqid, *highest));
- }
- int nfs41_session_recall_slot(
- @@ -231,8 +231,8 @@ static unsigned int WINAPI renew_session_thread(void *args)
- int status = NO_ERROR;
- int event_status;
- - dprintf(1, "renew_session_thread(session=%p): started thread %p\n",
- - session, session->renew.thread_handle);
- + DPRINTF(1, ("renew_session_thread(session=0x%p): started thread 0x%p\n",
- + session, session->renew.thread_handle));
- /* sleep for 2/3 of lease_time */
- const uint32_t sleep_time = (2UL * session->lease_time*1000UL)/3UL;
- @@ -241,9 +241,9 @@ static unsigned int WINAPI renew_session_thread(void *args)
- EASSERT(sleep_time < (60*60*1000UL));
- while(1) {
- - dprintf(1, "renew_session_thread(session=%p): "
- + DPRINTF(1, ("renew_session_thread(session=0x%p): "
- "Going to sleep for %dmsecs\n",
- - session, (int)sleep_time);
- + session, (int)sleep_time));
- /*
- * sleep for |sleep_time| milliseconds, or until someone
- @@ -252,12 +252,12 @@ static unsigned int WINAPI renew_session_thread(void *args)
- event_status = WaitForSingleObjectEx(session->renew.cancel_event,
- sleep_time, FALSE);
- if (event_status == WAIT_TIMEOUT) {
- - dprintf(1, "renew_session_thread(session=%p): "
- + DPRINTF(1, ("renew_session_thread(session=0x%p): "
- "renewing session...\n",
- - session);
- + session));
- status = nfs41_send_sequence(session);
- if (status) {
- - eprintf("renew_session_thread(session=%p): "
- + eprintf("renew_session_thread(session=0x%p): "
- "nfs41_send_sequence() failed status=%d\n",
- session, status);
- }
- @@ -267,14 +267,14 @@ static unsigned int WINAPI renew_session_thread(void *args)
- break;
- }
- else {
- - eprintf("renew_session_thread(session=%p): "
- + eprintf("renew_session_thread(session=0x%p): "
- "unexpected event_status=0x%x\n",
- session, (int)event_status);
- }
- }
- - dprintf(1, "renew_session_thread(session=%p): thread %p exiting\n",
- - session, session->renew.thread_handle);
- + DPRINTF(1, ("renew_session_thread(session=0x%p): thread 0x%p exiting\n",
- + session, session->renew.thread_handle));
- return 0;
- }
- @@ -372,18 +372,18 @@ void cancel_renew_thread(
- {
- DWORD status;
- - dprintf(1, "cancel_renew_thread(session=%p): "
- - "signal thread to exit\n", session);
- + DPRINTF(1, ("cancel_renew_thread(session=0x%p): "
- + "signal thread to exit\n", session));
- (void)SetEvent(session->renew.cancel_event);
- - dprintf(1, "cancel_renew_thread(session=%p): "
- - "waiting for thread to exit\n", session);
- + DPRINTF(1, ("cancel_renew_thread(session=0x%p): "
- + "waiting for thread to exit\n", session));
- status = WaitForSingleObjectEx(session->renew.thread_handle,
- INFINITE, FALSE);
- EASSERT(status == WAIT_OBJECT_0);
- - dprintf(1, "cancel_renew_thread(session=%p): thread done\n",
- - session);
- + DPRINTF(1, ("cancel_renew_thread(session=0x%p): thread done\n",
- + session));
- (void)CloseHandle(session->renew.cancel_event);
- }
- @@ -432,7 +432,7 @@ void nfs41_session_free(
- {
- AcquireSRWLockExclusive(&session->client->session_lock);
- if (valid_handle(session->renew.thread_handle)) {
- - dprintf(1, "nfs41_session_free: terminating session renewal thread\n");
- + DPRINTF(1, ("nfs41_session_free: terminating session renewal thread\n"));
- cancel_renew_thread(session);
- }
- diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
- index 70c60b5..2b0bbc9 100644
- --- a/daemon/nfs41_superblock.c
- +++ b/daemon/nfs41_superblock.c
- @@ -52,8 +52,8 @@ static int superblock_create(
- int status = NO_ERROR;
- nfs41_superblock *superblock;
- - dprintf(SBLVL, "creating superblock for fsid(%llu,%llu)\n",
- - fsid->major, fsid->minor);
- + DPRINTF(SBLVL, ("creating superblock for fsid(%llu,%llu)\n",
- + fsid->major, fsid->minor));
- superblock = calloc(1, sizeof(nfs41_superblock));
- if (superblock == NULL) {
- @@ -146,7 +146,7 @@ static int get_superblock_attrs(
- nfs41_superblock_supported_attrs(superblock, &superblock->default_getattr);
- - dprintf(SBLVL, "attributes for fsid(%llu,%llu): "
- + DPRINTF(SBLVL, ("attributes for fsid(%llu,%llu): "
- "maxread=%llu, maxwrite=%llu, layout_types: 0x%X, "
- "cansettime=%u, time_delta={%llu,%u}, aclsupport=%u, "
- "link_support=%u, symlink_support=%u, case_preserving=%u, "
- @@ -157,7 +157,7 @@ static int get_superblock_attrs(
- superblock->time_delta.seconds, superblock->time_delta.nseconds,
- superblock->aclsupport, superblock->link_support,
- superblock->symlink_support, superblock->case_preserving,
- - superblock->case_insensitive);
- + superblock->case_insensitive));
- out:
- return status;
- }
- @@ -190,7 +190,7 @@ void nfs41_superblock_fs_attributes(
- /* let the driver fill in FileSystemName */
- FsAttrs->FileSystemNameLength = 0;
- - dprintf(SBLVL, "FileFsAttributeInformation: "
- + DPRINTF(SBLVL, ("FileFsAttributeInformation: "
- "link_support=%u, "
- "symlink_support=%u, "
- "ea_support=%u, "
- @@ -206,7 +206,7 @@ void nfs41_superblock_fs_attributes(
- superblock->case_insensitive,
- superblock->aclsupport,
- (unsigned int)FsAttrs->MaximumComponentNameLength,
- - (unsigned long)FsAttrs->FileSystemAttributes);
- + (unsigned long)FsAttrs->FileSystemAttributes));
- }
- @@ -242,7 +242,7 @@ void nfs41_superblock_list_free(
- {
- struct list_entry *entry, *tmp;
- - dprintf(SBLVL, "nfs41_superblock_list_free()\n");
- + DPRINTF(SBLVL, ("nfs41_superblock_list_free()\n"));
- list_for_each_tmp(entry, tmp, &superblocks->head)
- free(superblock_entry(entry));
- @@ -260,14 +260,14 @@ int nfs41_superblock_for_fh(
- nfs41_superblock_list *superblocks = &server->superblocks;
- nfs41_superblock *superblock;
- - dprintf(SBLVL, "--> nfs41_superblock_for_fh(fsid(%llu,%llu))\n",
- - fsid->major, fsid->minor);
- + DPRINTF(SBLVL, ("--> nfs41_superblock_for_fh(fsid(%llu,%llu)))\n",
- + fsid->major, fsid->minor));
- /* compare with the parent's fsid, and use that if it matches */
- if (parent && parent->superblock &&
- compare_fsid(fsid, &parent->superblock->fsid) == 0) {
- file->fh.superblock = parent->superblock;
- - dprintf(SBLVL, "using superblock from parent\n");
- + DPRINTF(SBLVL, ("using superblock from parent\n"));
- goto out;
- }
- @@ -277,16 +277,16 @@ int nfs41_superblock_for_fh(
- ReleaseSRWLockShared(&superblocks->lock);
- if (superblock) {
- - dprintf(SBLVL, "found existing superblock in server list "
- - "[shared lock]\n");
- + DPRINTF(SBLVL, ("found existing superblock in server list "
- + "[shared lock]\n"));
- } else {
- AcquireSRWLockExclusive(&superblocks->lock);
- /* must search again under an exclusive lock, in case another thread
- * created it after our first search */
- superblock = find_superblock(superblocks, fsid);
- if (superblock) {
- - dprintf(SBLVL, "found newly created superblock in server list "
- - "[exclusive lock]\n");
- + DPRINTF(SBLVL, ("found newly created superblock in server list "
- + "[exclusive lock]\n"));
- } else {
- /* create the superblock */
- status = superblock_create(fsid, &superblock);
- @@ -306,8 +306,8 @@ int nfs41_superblock_for_fh(
- file->fh.superblock = superblock;
- out:
- - dprintf(SBLVL, "<-- nfs41_superblock_for_fh() returning %p, status %d\n",
- - file->fh.superblock, status);
- + DPRINTF(SBLVL, ("<-- nfs41_superblock_for_fh() returning 0x%p, status %d\n",
- + file->fh.superblock, status));
- return status;
- }
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index e60684b..c08affa 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -38,7 +38,7 @@ static __inline int unexpected_op(uint32_t op, uint32_t expected)
- if (op == expected)
- return 0;
- - eprintf("Op table mismatch. Got %s (%d), expected %s (%d).\n",
- + eprintf("Op table mismatch. Got '%s' (%d), expected '%s' (%d).\n",
- nfs_opnum_to_string(op), op,
- nfs_opnum_to_string(expected), expected);
- return 1;
- @@ -765,7 +765,7 @@ static bool_t xdr_channel_attrs4(
- return TRUE;
- }
- else {
- - eprintf("%s: xdr->x_op %d not supported.\n",
- + eprintf("'%s': xdr->x_op %d not supported.\n",
- "xdr_channel_attrs4", xdr->x_op);
- return FALSE;
- }
- @@ -1445,7 +1445,7 @@ static bool_t xdr_locker4(
- locker4 *locker)
- {
- if (xdr->x_op != XDR_ENCODE) {
- - eprintf("%s: xdr->x_op %d is not supported!\n",
- + eprintf("'%s': xdr->x_op %d is not supported!\n",
- "xdr_locker4", xdr->x_op);
- return FALSE;
- }
- @@ -3402,7 +3402,7 @@ static bool_t decode_layout(
- return decode_file_layout(xdr, list, &layout);
- default:
- - eprintf("%s: received non-FILE layout type, %d\n",
- + eprintf("'%s': received non-FILE layout type, %d\n",
- "decode_file_layout", layout.type);
- }
- return FALSE;
- @@ -3489,7 +3489,7 @@ static bool_t encode_op_layoutreturn(
- return xdr_u_int32_t(xdr, &zero); /* size of lrf_body is 0 */
- } else {
- - eprintf("%s: layout type (%d) is not PNFS_RETURN_FILE!\n",
- + eprintf("'%s': layout type (%d) is not PNFS_RETURN_FILE!\n",
- "encode_op_layoutreturn", args->return_type);
- return FALSE;
- }
- @@ -3675,7 +3675,7 @@ bool_t nfs_decode_compound(
- /* validate each operation number against what we sent */
- if (res->resarray[i].op != expected_op) {
- - eprintf("reply with %s in operation %u, expected %s!\n",
- + eprintf("reply with '%s' in operation %u, expected '%s'!\n",
- nfs_opnum_to_string(res->resarray[i].op), i+1,
- nfs_opnum_to_string(expected_op));
- return FALSE;
- diff --git a/daemon/open.c b/daemon/open.c
- index e4f6063..1ea7eea 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -119,7 +119,7 @@ void nfs41_open_state_ref(
- const LONG count = InterlockedIncrement(&state->ref_count);
- - dprintf(2, "nfs41_open_state_ref(%s) count %d\n", state->path.path, count);
- + DPRINTF(2, ("nfs41_open_state_ref('%s') count %d\n", state->path.path, count));
- }
- void nfs41_open_state_deref(
- @@ -127,7 +127,7 @@ void nfs41_open_state_deref(
- {
- const LONG count = InterlockedDecrement(&state->ref_count);
- - dprintf(2, "nfs41_open_state_deref(%s) count %d\n", state->path.path, count);
- + DPRINTF(2, ("nfs41_open_state_deref('%s') count %d\n", state->path.path, count));
- if (count == 0)
- open_state_free(state);
- }
- @@ -164,7 +164,7 @@ void nfs41_open_stateid_arg(
- if (arg->type == STATEID_DELEG_FILE)
- goto out;
- - dprintf(2, "delegation recalled, waiting for open stateid..\n");
- + DPRINTF(2, ("delegation recalled, waiting for open stateid...\n"));
- /* wait for nfs41_delegation_to_open() to recover open stateid */
- while (!state->do_close)
- @@ -236,8 +236,8 @@ static int do_open(
- &state->file, &delegation, TRUE, &deleg_state);
- if (deleg_state) {
- deleg_state->srv_open = state->srv_open;
- - dprintf(1, "do_open: received delegation: saving srv_open = %x\n",
- - state->srv_open);
- + DPRINTF(1, ("do_open: received delegation: saving srv_open = %x\n",
- + state->srv_open));
- }
- AcquireSRWLockExclusive(&state->lock);
- @@ -329,24 +329,34 @@ static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
- status = safe_read(&buffer, &length, &args->ea, sizeof(HANDLE));
- if (status) goto out;
- - dprintf(1, "parsing NFS41_OPEN: filename='%s' access mask=%d "
- +#ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- + 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\topen_owner_id=%d mode=%o "
- -#ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- "owner_local_uid=%u owner_group_local_gid=%u "
- -#endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- - "srv_open=%p symlink=%s ea=%p\n", args->path, args->access_mask,
- + "srv_open=0x%p symlink=%s ea=0x%p\n", args->path, args->access_mask,
- args->access_mode, args->file_attrs, args->create_opts,
- args->disposition, args->open_owner_id, args->mode,
- -#ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
- (unsigned int)args->owner_local_uid, (unsigned int)args->owner_group_local_gid,
- -#endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- args->srv_open,
- - args->symlink.path, args->ea);
- - 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);
- + args->symlink.path, args->ea));
- +#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\topen_owner_id=%d mode=%o "
- + "srv_open=0x%p symlink=%s ea=0x%p\n", args->path, args->access_mask,
- + args->access_mode, args->file_attrs, args->create_opts,
- + args->disposition, args->open_owner_id, args->mode,
- + args->srv_open,
- + args->symlink.path, args->ea));
- +#endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- +
- + if (DPRINTF_LEVEL_ENABLED(2)) {
- + 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:
- return status;
- }
- @@ -359,10 +369,10 @@ static BOOLEAN open_for_attributes(uint32_t type, ULONG access_mask,
- (!status && (disposition == FILE_OPEN_IF ||
- disposition == FILE_OVERWRITE_IF ||
- disposition == FILE_SUPERSEDE))) {
- - dprintf(1, "Opening a directory\n");
- + DPRINTF(1, ("Opening a directory\n"));
- return TRUE;
- } else {
- - dprintf(1, "Creating a directory\n");
- + DPRINTF(1, ("Creating a directory\n"));
- return FALSE;
- }
- }
- @@ -378,7 +388,7 @@ static BOOLEAN open_for_attributes(uint32_t type, ULONG access_mask,
- disposition == FILE_OVERWRITE)
- return FALSE;
- else {
- - dprintf(1, "Open call that wants to manage attributes\n");
- + DPRINTF(1, ("Open call that wants to manage attributes\n"));
- return TRUE;
- }
- }
- @@ -411,11 +421,11 @@ static int map_disposition_2_nfsopen(ULONG disposition, int in_status, bool_t pe
- *create = OPEN4_NOCREATE;
- } else if (disposition == FILE_OPEN_IF) {
- if (in_status == NFS4ERR_NOENT) {
- - dprintf(1, "creating new file\n");
- + DPRINTF(1, ("creating new file\n"));
- *create = OPEN4_CREATE;
- *last_error = ERROR_FILE_NOT_FOUND;
- } else {
- - dprintf(1, "opening existing file\n");
- + DPRINTF(1, ("opening existing file\n"));
- *create = OPEN4_NOCREATE;
- }
- } else if (disposition == FILE_OVERWRITE) {
- @@ -481,7 +491,7 @@ static int check_execute_access(nfs41_open_state *state)
- int status = nfs41_access(state->session, &state->file,
- ACCESS4_EXECUTE | ACCESS4_READ, &supported, &access);
- if (status) {
- - eprintf("nfs41_access() failed with %s for %s\n",
- + eprintf("nfs41_access() failed with '%s' for '%s'\n",
- nfs_error_string(status), state->path.path);
- status = ERROR_ACCESS_DENIED;
- } else if ((supported & ACCESS4_EXECUTE) == 0) {
- @@ -493,11 +503,11 @@ static int check_execute_access(nfs41_open_state *state)
- status = ERROR_ACCESS_DENIED;
- }
- } else if ((access & ACCESS4_EXECUTE) == 0) {
- - dprintf(1, "user does not have execute access to file %s\n",
- - state->path.path);
- + DPRINTF(1, ("user does not have execute access to file '%s'\n",
- + state->path.path));
- status = ERROR_ACCESS_DENIED;
- } else
- - dprintf(2, "user has execute access to file\n");
- + DPRINTF(2, ("user has execute access to file\n"));
- return status;
- }
- @@ -572,23 +582,23 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- // now if file/dir exists, use type returned by lookup
- if (status == NO_ERROR) {
- if (info.type == NF4DIR) {
- - dprintf(2, "handle_nfs41_open: DIRECTORY\n");
- + DPRINTF(2, ("handle_nfs41_open: DIRECTORY\n"));
- if (args->create_opts & FILE_NON_DIRECTORY_FILE) {
- - dprintf(1, "trying to open directory '%s' as a file\n",
- - state->path.path);
- + DPRINTF(1, ("trying to open directory '%s' as a file\n",
- + state->path.path));
- status = ERROR_DIRECTORY;
- goto out_free_state;
- }
- } else if (info.type == NF4REG) {
- - dprintf(2, "handle nfs41_open: FILE\n");
- + DPRINTF(2, ("handle nfs41_open: FILE\n"));
- if (args->create_opts & FILE_DIRECTORY_FILE) {
- - dprintf(1, "trying to open file '%s' as a directory\n",
- - state->path.path);
- + DPRINTF(1, ("trying to open file '%s' as a directory\n",
- + state->path.path));
- status = ERROR_BAD_FILE_TYPE;
- goto out_free_state;
- }
- } else if (info.type == NF4LNK) {
- - dprintf(2, "handle nfs41_open: SYMLINK\n");
- + DPRINTF(2, ("handle nfs41_open: SYMLINK\n"));
- if (args->create_opts & FILE_OPEN_REPARSE_POINT) {
- /* continue and open the symlink itself, but we need to
- * know if the target is a regular file or directory */
- @@ -602,7 +612,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- status = nfs41_symlink_target(state->session,
- &state->file, &args->symlink);
- if (status) {
- - eprintf("nfs41_symlink_target() for %s failed with %d\n",
- + eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
- args->path, status);
- } else {
- /* tell the driver to call RxPrepareToReparseSymbolicLink() */
- @@ -612,7 +622,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- goto out_free_state;
- }
- } else
- - dprintf(2, "handle_open(): unsupported type=%d\n", info.type);
- + DPRINTF(2, ("handle_open(): unsupported type=%d\n", info.type));
- state->type = info.type;
- } else if (status != ERROR_FILE_NOT_FOUND)
- goto out_free_state;
- @@ -638,7 +648,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- }
- /* defer the call to CREATE until we get the symlink set upcall */
- - dprintf(1, "trying to create a symlink, deferring create\n");
- + DPRINTF(1, ("trying to create a symlink, deferring create\n"));
- /* because of WRITE_ATTR access, be prepared for a setattr upcall;
- * will crash if the superblock is null, so use the parent's */
- @@ -653,13 +663,13 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- createattrs.attrmask.arr[1] = FATTR4_WORD1_MODE;
- createattrs.mode = 0777;
- - dprintf(1, "creating cygwin symlink %s -> %s\n",
- - state->file.name.name, args->symlink.path);
- + DPRINTF(1, ("creating cygwin symlink '%s' -> '%s'\n",
- + state->file.name.name, args->symlink.path));
- status = nfs41_create(state->session, NF4LNK, &createattrs,
- args->symlink.path, &state->parent, &state->file, &info);
- if (status) {
- - eprintf("nfs41_create() for symlink=%s failed with %s\n",
- + eprintf("nfs41_create() for symlink='%s' failed with '%s'\n",
- args->symlink.path, nfs_error_string(status));
- status = map_symlink_errors(status);
- goto out_free_state;
- @@ -671,7 +681,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- } else if (open_for_attributes(state->type, args->access_mask,
- args->disposition, status)) {
- if (status) {
- - dprintf(1, "nfs41_lookup failed with %d\n", status);
- + DPRINTF(1, ("nfs41_lookup failed with %d\n", status));
- goto out_free_state;
- }
- @@ -781,10 +791,10 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- owner_group, args->owner_group_local_gid);
- }
- - dprintf(1, "handle_open('%s'): stat: owner=%u/'%s', owner_group=%u/'%s'\n",
- + DPRINTF(1, ("handle_open('%s'): stat: owner=%u/'%s', owner_group=%u/'%s'\n",
- state->path.path,
- (unsigned int)args->owner_local_uid, owner,
- - (unsigned int)args->owner_group_local_gid, owner_group);
- + (unsigned int)args->owner_group_local_gid, owner_group));
- #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- } else {
- nfs41_file_info createattrs = { 0 };
- @@ -831,7 +841,7 @@ supersede_retry:
- nfs41_delegation_return(state->session, &state->file,
- OPEN_DELEGATE_WRITE, TRUE);
- - dprintf(1, "open for FILE_SUPERSEDE removing %s first\n", name->name);
- + DPRINTF(1, ("open for FILE_SUPERSEDE removing '%s' first\n", name->name));
- status = nfs41_remove(state->session, &state->parent,
- name, state->file.fh.fileid);
- if (status)
- @@ -845,16 +855,16 @@ supersede_retry:
- } else {
- createattrs.attrmask.arr[0] |= FATTR4_WORD0_SIZE;
- createattrs.size = 0;
- - dprintf(1, "creating with mod %o\n", args->mode);
- + DPRINTF(1, ("creating with mod %o\n", args->mode));
- status = open_or_delegate(state, create, createhowmode, &createattrs,
- TRUE, &info);
- if (status == NFS4_OK && state->delegation.state)
- args->deleg_type = state->delegation.state->state.type;
- }
- if (status) {
- - dprintf(1, "%s failed with %s\n", (create == OPEN4_CREATE &&
- + DPRINTF(1, ("'%s' failed with '%s'\n", (create == OPEN4_CREATE &&
- (args->create_opts & FILE_DIRECTORY_FILE))?"nfs41_create":"nfs41_open",
- - nfs_error_string(status));
- + nfs_error_string(status)));
- if (args->disposition == FILE_SUPERSEDE && status == NFS4ERR_EXIST)
- goto supersede_retry;
- status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
- @@ -919,8 +929,8 @@ static int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *
- goto out;
- }
- }
- - dprintf(2, "NFS41_OPEN: downcall open_state=0x%p mode %o changeattr 0x%llu\n",
- - upcall->state_ref, args->mode, args->changeattr);
- + DPRINTF(2, ("NFS41_OPEN: downcall open_state=0x%p mode %o changeattr 0x%llu\n",
- + upcall->state_ref, args->mode, args->changeattr));
- out:
- return status;
- }
- @@ -931,7 +941,7 @@ static void cancel_open(IN nfs41_upcall *upcall)
- open_upcall_args *args = &upcall->args.open;
- nfs41_open_state *state = upcall->state_ref;
- - dprintf(1, "--> cancel_open('%s')\n", args->path);
- + DPRINTF(1, ("--> cancel_open('%s')\n", args->path));
- if (upcall->state_ref == NULL ||
- upcall->state_ref == INVALID_HANDLE_VALUE)
- @@ -945,10 +955,10 @@ static void cancel_open(IN nfs41_upcall *upcall)
- memcpy(&stateid.stateid, &state->stateid, sizeof(stateid4));
- status = nfs41_close(state->session, &state->file, &stateid);
- - if (status)
- - dprintf(1, "cancel_open: nfs41_close() failed with %s\n",
- - nfs_error_string(status));
- -
- + if (status) {
- + DPRINTF(1, ("cancel_open: nfs41_close() failed with '%s'\n",
- + nfs_error_string(status)));
- + }
- } else if (args->created) {
- const nfs41_component *name = &state->file.name;
- /* break any delegations and truncate before REMOVE */
- @@ -957,8 +967,8 @@ static void cancel_open(IN nfs41_upcall *upcall)
- status = nfs41_remove(state->session, &state->parent,
- name, state->file.fh.fileid);
- if (status)
- - dprintf(1, "cancel_open: nfs41_remove() failed with %s\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("cancel_open: nfs41_remove() failed with '%s'\n",
- + nfs_error_string(status)));
- }
- /* remove from the client's list of state for recovery */
- @@ -966,7 +976,7 @@ static void cancel_open(IN nfs41_upcall *upcall)
- nfs41_open_state_deref(state);
- out:
- status = nfs_to_windows_error(status, ERROR_INTERNAL_ERROR);
- - dprintf(1, "<-- cancel_open() returning %d\n", status);
- + DPRINTF(1, ("<-- cancel_open() returning %d\n", status));
- }
- @@ -987,9 +997,9 @@ static int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
- if (status) goto out;
- }
- - dprintf(1, "parsing NFS41_CLOSE: remove=%d srv_open=%x renamed=%d "
- + DPRINTF(1, ("parsing NFS41_CLOSE: remove=%d srv_open=%x renamed=%d "
- "filename='%s'\n", args->remove, args->srv_open, args->renamed,
- - args->remove ? args->path : "");
- + args->remove ? args->path : ""));
- out:
- return status;
- }
- @@ -1005,8 +1015,8 @@ static int do_nfs41_close(nfs41_open_state *state)
- status = nfs41_close(state->session, &state->file, &stateid);
- if (status) {
- - dprintf(1, "nfs41_close() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_close() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_INTERNAL_ERROR);
- }
- @@ -1030,7 +1040,7 @@ static int handle_close(void *deamon_context, nfs41_upcall *upcall)
- nfs41_component *name = &state->file.name;
- if (args->renamed) {
- - dprintf(1, "removing a renamed file %s\n", name->name);
- + DPRINTF(1, ("removing a renamed file '%s'\n", name->name));
- create_silly_rename(&state->path, &state->file.fh, name);
- status = do_nfs41_close(state);
- if (status)
- @@ -1043,7 +1053,7 @@ static int handle_close(void *deamon_context, nfs41_upcall *upcall)
- nfs41_delegation_return(state->session, &state->file,
- OPEN_DELEGATE_WRITE, TRUE);
- - dprintf(1, "calling nfs41_remove for %s\n", name->name);
- + DPRINTF(1, ("calling nfs41_remove for '%s'\n", name->name));
- retry_delete:
- rm_status = nfs41_remove(state->session, &state->parent,
- name, state->file.fh.fileid);
- @@ -1055,8 +1065,8 @@ retry_delete:
- goto retry_delete;
- } else goto out;
- }
- - dprintf(1, "nfs41_remove() failed with error %s.\n",
- - nfs_error_string(rm_status));
- + DPRINTF(1, ("nfs41_remove() failed with error '%s'.\n",
- + nfs_error_string(rm_status)));
- rm_status = nfs_to_windows_error(rm_status, ERROR_INTERNAL_ERROR);
- }
- }
- diff --git a/daemon/pnfs_debug.c b/daemon/pnfs_debug.c
- index fc55c34..cefff04 100644
- --- a/daemon/pnfs_debug.c
- +++ b/daemon/pnfs_debug.c
- @@ -65,14 +65,14 @@ const char* pnfs_iomode_string(enum pnfs_iomode iomode)
- }
- }
- +static
- void dprint_deviceid(
- - IN int level,
- IN const char *title,
- IN const unsigned char *deviceid)
- {
- /* deviceid is 16 bytes, so print it as 4 uints */
- uint32_t *p = (uint32_t*)deviceid;
- - dprintf(level, "%s%08X.%08X.%08X.%08X\n",
- + dprintf_out("%s%08X.%08X.%08X.%08X\n",
- title, htonl(p[0]), htonl(p[1]), htonl(p[2]), htonl(p[3]));
- }
- @@ -80,24 +80,26 @@ void dprint_layout(
- IN int level,
- IN const pnfs_file_layout *layout)
- {
- - dprintf(level, " type: %s\n", pnfs_layout_type_string(layout->layout.type));
- - dprintf(level, " iomode: %s\n", pnfs_iomode_string(layout->layout.iomode));
- - dprint_deviceid(level, " deviceid: ", layout->deviceid);
- - dprintf(level, " offset: %llu\n", layout->layout.offset);
- - dprintf(level, " length: %llu\n", layout->layout.length);
- - dprintf(level, " pattern_offset: %llu\n", layout->pattern_offset);
- - dprintf(level, " first_index: %u\n", layout->first_index);
- - dprintf(level, " dense: %u\n", is_dense(layout));
- - dprintf(level, " commit_to_mds: %u\n", should_commit_to_mds(layout));
- - dprintf(level, " stripe_unit_size: %u\n", layout_unit_size(layout));
- - dprintf(level, " file handles: %u\n", layout->filehandles.count);
- + if (!DPRINTF_LEVEL_ENABLED(level))
- + return;
- +
- + dprintf_out(" type: '%s'\n", pnfs_layout_type_string(layout->layout.type));
- + dprintf_out(" iomode: '%s'\n", pnfs_iomode_string(layout->layout.iomode));
- + dprint_deviceid(" deviceid: ", layout->deviceid);
- + dprintf_out(" offset: %llu\n", layout->layout.offset);
- + dprintf_out(" length: %llu\n", layout->layout.length);
- + dprintf_out(" pattern_offset: %llu\n", layout->pattern_offset);
- + dprintf_out(" first_index: %u\n", layout->first_index);
- + dprintf_out(" dense: %u\n", is_dense(layout));
- + dprintf_out(" commit_to_mds: %u\n", should_commit_to_mds(layout));
- + dprintf_out(" stripe_unit_size: %u\n", layout_unit_size(layout));
- + dprintf_out(" file handles: %u\n", layout->filehandles.count);
- }
- #define MULTI_ADDR_BUFFER_LEN \
- (NFS41_ADDRS_PER_SERVER*(NFS41_UNIVERSAL_ADDR_LEN+1)+1)
- static void dprint_multi_addr(
- - IN int level,
- IN uint32_t index,
- IN const multi_addr4 *addrs)
- {
- @@ -107,7 +109,7 @@ static void dprint_multi_addr(
- StringCchCatA(buffer, MULTI_ADDR_BUFFER_LEN, addrs->arr[i].uaddr);
- StringCchCatA(buffer, MULTI_ADDR_BUFFER_LEN, " ");
- }
- - dprintf(level, " servers[%d]: [ %s]\n", index, buffer);
- + dprintf_out(" servers[%d]: [ '%s']\n", index, buffer);
- }
- void dprint_device(
- @@ -115,9 +117,13 @@ void dprint_device(
- IN const pnfs_file_device *device)
- {
- uint32_t i;
- - dprint_deviceid(level, " deviceid: ", device->device.deviceid);
- - dprintf(level, " type: %s\n", pnfs_layout_type_string(device->device.type));
- - dprintf(level, " stripes: %u\n", device->stripes.count);
- +
- + if (!DPRINTF_LEVEL_ENABLED(level))
- + return;
- +
- + dprint_deviceid(" deviceid: ", device->device.deviceid);
- + dprintf_out(" type: '%s'\n", pnfs_layout_type_string(device->device.type));
- + dprintf_out(" stripes: %u\n", device->stripes.count);
- for (i = 0; i < device->servers.count; i++)
- - dprint_multi_addr(level, i, &device->servers.arr[i].addrs);
- + dprint_multi_addr(i, &device->servers.arr[i].addrs);
- }
- diff --git a/daemon/pnfs_device.c b/daemon/pnfs_device.c
- index 227c5a9..d16e3cb 100644
- --- a/daemon/pnfs_device.c
- +++ b/daemon/pnfs_device.c
- @@ -87,7 +87,7 @@ static enum pnfs_status file_device_find_or_create(
- struct list_entry *entry;
- enum pnfs_status status;
- - dprintf(FDLVL, "--> pnfs_file_device_find_or_create()\n");
- + DPRINTF(FDLVL, ("--> pnfs_file_device_find_or_create()\n"));
- EnterCriticalSection(&devices->lock);
- @@ -102,18 +102,18 @@ static enum pnfs_status file_device_find_or_create(
- list_add_tail(&devices->head, &device->entry);
- *device_out = device;
- - dprintf(FDLVL, "<-- pnfs_file_device_find_or_create() "
- - "returning new device %p\n", device);
- + DPRINTF(FDLVL, ("<-- pnfs_file_device_find_or_create() "
- + "returning new device 0x%p\n", device));
- } else {
- - dprintf(FDLVL, "<-- pnfs_file_device_find_or_create() "
- - "returning %s\n", pnfs_error_string(status));
- + DPRINTF(FDLVL, ("<-- pnfs_file_device_find_or_create() "
- + "returning '%s'\n", pnfs_error_string(status)));
- }
- } else {
- *device_out = device_entry(entry);
- status = PNFS_SUCCESS;
- - dprintf(FDLVL, "<-- pnfs_file_device_find_or_create() "
- - "returning existing device %p\n", *device_out);
- + DPRINTF(FDLVL, ("<-- pnfs_file_device_find_or_create() "
- + "returning existing device 0x%p\n", *device_out));
- }
- LeaveCriticalSection(&devices->lock);
- @@ -162,7 +162,7 @@ void pnfs_file_device_list_invalidate(
- struct list_entry *entry, *tmp;
- pnfs_file_device *device;
- - dprintf(FDLVL, "--> pnfs_file_device_list_invalidate()\n");
- + DPRINTF(FDLVL, ("--> pnfs_file_device_list_invalidate()\n"));
- EnterCriticalSection(&devices->lock);
- @@ -184,7 +184,7 @@ void pnfs_file_device_list_invalidate(
- LeaveCriticalSection(&devices->lock);
- - dprintf(FDLVL, "<-- pnfs_file_device_list_invalidate()\n");
- + DPRINTF(FDLVL, ("<-- pnfs_file_device_list_invalidate()\n"));
- }
- @@ -199,7 +199,7 @@ enum pnfs_status pnfs_file_device_get(
- enum pnfs_status status;
- enum nfsstat4 nfsstat;
- - dprintf(FDLVL, "--> pnfs_file_device_get()\n");
- + DPRINTF(FDLVL, ("--> pnfs_file_device_get()\n"));
- status = file_device_find_or_create(deviceid, devices, &device);
- if (status)
- @@ -218,27 +218,27 @@ enum pnfs_status pnfs_file_device_get(
- device->device.status = PNFS_DEVICE_GRANTED;
- status = PNFS_SUCCESS;
- - dprintf(FDLVL, "Received device info:\n");
- + DPRINTF(FDLVL, ("Received device info:\n"));
- dprint_device(FDLVL, device);
- } else {
- status = PNFSERR_NO_DEVICE;
- - eprintf("pnfs_rpc_getdeviceinfo() failed with %s\n",
- + eprintf("pnfs_rpc_getdeviceinfo() failed with '%s'\n",
- nfs_error_string(nfsstat));
- }
- }
- if (status == PNFS_SUCCESS) {
- device->device.layout_count++;
- - dprintf(FDLVL, "pnfs_file_device_get() -> %u\n",
- - device->device.layout_count);
- + DPRINTF(FDLVL, ("pnfs_file_device_get() -> %u\n",
- + device->device.layout_count));
- *device_out = device;
- }
- LeaveCriticalSection(&device->device.lock);
- out:
- - dprintf(FDLVL, "<-- pnfs_file_device_get() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FDLVL, ("<-- pnfs_file_device_get() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -248,7 +248,7 @@ void pnfs_file_device_put(
- uint32_t count;
- EnterCriticalSection(&device->device.lock);
- count = --device->device.layout_count;
- - dprintf(FDLVL, "pnfs_file_device_put() -> %u\n", count);
- + DPRINTF(FDLVL, ("pnfs_file_device_put() -> %u\n", count));
- /* if the device was revoked, remove/free the device on last reference */
- if (count == 0 && device->device.status & PNFS_DEVICE_REVOKED) {
- @@ -259,7 +259,7 @@ void pnfs_file_device_put(
- LeaveCriticalSection(&device->device.lock);
- file_device_free(device);
- - dprintf(FDLVL, "revoked file device freed after last reference\n");
- + DPRINTF(FDLVL, ("revoked file device freed after last reference\n"));
- } else {
- LeaveCriticalSection(&device->device.lock);
- }
- @@ -272,8 +272,8 @@ static enum pnfs_status data_client_status(
- enum pnfs_status status = PNFSERR_NOT_CONNECTED;
- if (server->client) {
- - dprintf(FDLVL, "pnfs_data_server_client() returning "
- - "existing client %llu\n", server->client->clnt_id);
- + DPRINTF(FDLVL, ("pnfs_data_server_client() returning "
- + "existing client %llu\n", server->client->clnt_id));
- *client_out = server->client;
- status = PNFS_SUCCESS;
- }
- @@ -289,8 +289,8 @@ enum pnfs_status pnfs_data_server_client(
- int status;
- enum pnfs_status pnfsstat;
- - dprintf(FDLVL, "--> pnfs_data_server_client('%s')\n",
- - server->addrs.arr[0].uaddr);
- + DPRINTF(FDLVL, ("--> pnfs_data_server_client('%s')\n",
- + server->addrs.arr[0].uaddr));
- /* if we've already created the client, return it */
- AcquireSRWLockShared(&server->lock);
- @@ -307,14 +307,14 @@ enum pnfs_status pnfs_data_server_client(
- status = nfs41_root_mount_addrs(root, &server->addrs, 1, default_lease,
- &server->client);
- if (status) {
- - dprintf(FDLVL, "data_client_create('%s') failed with %d\n",
- - server->addrs.arr[0].uaddr, status);
- + DPRINTF(FDLVL, ("data_client_create('%s') failed with %d\n",
- + server->addrs.arr[0].uaddr, status));
- } else {
- *client_out = server->client;
- pnfsstat = PNFS_SUCCESS;
- - dprintf(FDLVL, "pnfs_data_server_client() returning new client "
- - "%llu\n", server->client->clnt_id);
- + DPRINTF(FDLVL, ("pnfs_data_server_client() returning new client "
- + "%llu\n", server->client->clnt_id));
- }
- }
- @@ -332,8 +332,8 @@ enum pnfs_status pnfs_file_device_notify(
- struct list_entry *entry;
- enum pnfs_status status = PNFSERR_NO_DEVICE;
- - dprintf(FDLVL, "--> pnfs_file_device_notify(%u, %0llX:%0llX)\n",
- - change->type, change->deviceid);
- + DPRINTF(FDLVL, ("--> pnfs_file_device_notify(%u, %0llX:%0llX)\n",
- + change->type, change->deviceid));
- if (change->layouttype != PNFS_LAYOUTTYPE_FILE) {
- status = PNFSERR_NOT_SUPPORTED;
- @@ -344,22 +344,22 @@ enum pnfs_status pnfs_file_device_notify(
- entry = list_search(&devices->head, change->deviceid, deviceid_compare);
- if (entry) {
- - dprintf(FDLVL, "found file device %p\n", device_entry(entry));
- + DPRINTF(FDLVL, ("found file device 0x%p\n", device_entry(entry)));
- if (change->type == NOTIFY_DEVICEID4_CHANGE) {
- /* if (change->immediate) ... */
- - dprintf(FDLVL, "CHANGE (%u)\n", change->immediate);
- + DPRINTF(FDLVL, ("CHANGE (%u)\n", change->immediate));
- } else if (change->type == NOTIFY_DEVICEID4_DELETE) {
- /* This notification MUST NOT be sent if the client
- * has a layout that refers to the device ID. */
- - dprintf(FDLVL, "DELETE\n");
- + DPRINTF(FDLVL, ("DELETE\n"));
- }
- status = PNFS_SUCCESS;
- }
- LeaveCriticalSection(&devices->lock);
- out:
- - dprintf(FDLVL, "<-- pnfs_file_device_notify() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FDLVL, ("<-- pnfs_file_device_notify() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- diff --git a/daemon/pnfs_io.c b/daemon/pnfs_io.c
- index 5c4fd83..dd0737b 100644
- --- a/daemon/pnfs_io.c
- +++ b/daemon/pnfs_io.c
- @@ -421,7 +421,7 @@ static enum pnfs_status pattern_fork(
- /* wait on all threads to finish */
- status = pattern_join(threads, pattern->count);
- if (status) {
- - eprintf("pattern_join() failed with %s\n", pnfs_error_string(status));
- + eprintf("pattern_join() failed with '%s'\n", pnfs_error_string(status));
- goto out;
- }
- @@ -472,7 +472,7 @@ static enum pnfs_status map_ds_error(
- * attempting to READ or WRITE */
- case NFS4ERR_STALE:
- case NFS4ERR_PNFS_NO_LAYOUT:
- - dprintf(IOLVL, "data server fencing detected!\n");
- + DPRINTF(IOLVL, ("data server fencing detected!\n"));
- pnfs_layout_recall_fenced(state, &layout->layout);
- @@ -497,12 +497,12 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
- enum nfsstat4 nfsstat;
- bool_t eof;
- - dprintf(IOLVL, "--> file_layout_read_thread(%u)\n", thread->id);
- + DPRINTF(IOLVL, ("--> file_layout_read_thread(%u)\n", thread->id));
- /* get the data server for this thread */
- status = thread_data_server(thread, &server);
- if (status) {
- - eprintf("thread_data_server() failed with %s\n",
- + eprintf("thread_data_server() failed with '%s'\n",
- pnfs_error_string(status));
- goto out;
- }
- @@ -510,7 +510,7 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
- status = pnfs_data_server_client(pattern->root,
- server, pattern->default_lease, &client);
- if (status) {
- - eprintf("pnfs_data_server_client() failed with %s\n",
- + eprintf("pnfs_data_server_client() failed with '%s'\n",
- pnfs_error_string(status));
- goto out;
- }
- @@ -527,7 +527,7 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
- nfsstat = nfs41_read(client->session, thread->file, &stateid,
- io.offset, (uint32_t)io.length, io.buffer, &bytes_read, &eof);
- if (nfsstat) {
- - eprintf("nfs41_read() failed with %s\n",
- + eprintf("nfs41_read() failed with '%s'\n",
- nfs_error_string(nfsstat));
- status = map_ds_error(nfsstat, pattern->state, thread->layout);
- break;
- @@ -537,15 +537,15 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
- thread->offset += bytes_read;
- if (eof) {
- - dprintf(IOLVL, "read thread %u reached eof: offset %llu\n",
- - thread->id, thread->offset);
- + DPRINTF(IOLVL, ("read thread %u reached eof: offset %llu\n",
- + thread->id, thread->offset));
- status = total_read ? PNFS_SUCCESS : PNFS_READ_EOF;
- break;
- }
- }
- out:
- - dprintf(IOLVL, "<-- file_layout_read_thread(%u) returning %s\n",
- - thread->id, pnfs_error_string(status));
- + DPRINTF(IOLVL, ("<-- file_layout_read_thread(%u) returning '%s'\n",
- + thread->id, pnfs_error_string(status)));
- return status;
- }
- @@ -563,12 +563,12 @@ static uint32_t WINAPI file_layout_write_thread(void *args)
- enum pnfs_status status;
- enum nfsstat4 nfsstat;
- - dprintf(IOLVL, "--> file_layout_write_thread(%u)\n", thread->id);
- + DPRINTF(IOLVL, ("--> file_layout_write_thread(%u)\n", thread->id));
- /* get the data server for this thread */
- status = thread_data_server(thread, &server);
- if (status) {
- - eprintf("thread_data_server() failed with %s\n",
- + eprintf("thread_data_server() failed with '%s'\n",
- pnfs_error_string(status));
- goto out;
- }
- @@ -576,7 +576,7 @@ static uint32_t WINAPI file_layout_write_thread(void *args)
- status = pnfs_data_server_client(pattern->root,
- server, pattern->default_lease, &client);
- if (status) {
- - eprintf("pnfs_data_server_client() failed with %s\n",
- + eprintf("pnfs_data_server_client() failed with '%s'\n",
- pnfs_error_string(status));
- goto out;
- }
- @@ -601,7 +601,7 @@ retry_write:
- io.buffer, (uint32_t)io.length, io.offset, UNSTABLE4,
- &bytes_written, &thread->verf, NULL);
- if (nfsstat) {
- - eprintf("nfs41_write() failed with %s\n",
- + eprintf("nfs41_write() failed with '%s'\n",
- nfs_error_string(nfsstat));
- status = map_ds_error(nfsstat, pattern->state, thread->layout);
- break;
- @@ -632,8 +632,8 @@ retry_write:
- if (should_commit_to_mds(thread->layout))
- goto out;
- - dprintf(1, "sending COMMIT to data server for offset=%lld len=%lld\n",
- - commit_min, commit_max - commit_min);
- + DPRINTF(1, ("sending COMMIT to data server for offset=%lld len=%lld\n",
- + commit_min, commit_max - commit_min));
- nfsstat = nfs41_commit(client->session, thread->file,
- commit_min, (uint32_t)(commit_max - commit_min), 0, &thread->verf, NULL);
- @@ -650,8 +650,8 @@ retry_write:
- thread->stable = DATA_SYNC4;
- }
- out:
- - dprintf(IOLVL, "<-- file_layout_write_thread(%u) returning %s\n",
- - thread->id, pnfs_error_string(status));
- + DPRINTF(IOLVL, ("<-- file_layout_write_thread(%u) returning '%s'\n",
- + thread->id, pnfs_error_string(status)));
- return status;
- }
- @@ -669,7 +669,7 @@ enum pnfs_status pnfs_read(
- pnfs_io_pattern pattern;
- enum pnfs_status status;
- - dprintf(IOLVL, "--> pnfs_read(%llu, %llu)\n", offset, length);
- + DPRINTF(IOLVL, ("--> pnfs_read(%llu, %llu)\n", offset, length));
- *len_out = 0;
- @@ -688,7 +688,7 @@ enum pnfs_status pnfs_read(
- layout, buffer_out, PNFS_IOMODE_READ, offset, length,
- state->session->lease_time);
- if (status)
- - eprintf("pattern_init() failed with %s\n",
- + eprintf("pattern_init() failed with '%s'\n",
- pnfs_error_string(status));
- }
- @@ -706,8 +706,8 @@ enum pnfs_status pnfs_read(
- out_free_pattern:
- pattern_free(&pattern);
- out:
- - dprintf(IOLVL, "<-- pnfs_read() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(IOLVL, ("<-- pnfs_read() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -726,7 +726,7 @@ static enum pnfs_status mds_commit(
- nfsstat = nfs41_commit(state->session,
- &state->file, offset, length, 1, &verf, info);
- if (nfsstat) {
- - eprintf("nfs41_commit() to mds failed with %s\n",
- + eprintf("nfs41_commit() to mds failed with '%s'\n",
- nfs_error_string(nfsstat));
- status = PNFSERR_IO;
- goto out;
- @@ -786,13 +786,13 @@ static enum pnfs_status layout_commit(
- memcpy(&layout_stateid, &layout->stateid, sizeof(layout_stateid));
- ReleaseSRWLockShared(&layout->lock);
- - dprintf(1, "LAYOUTCOMMIT for offset=%lld len=%lld new_last_offset=%u\n",
- - offset, length, new_last_offset ? 1 : 0);
- + DPRINTF(1, ("LAYOUTCOMMIT for offset=%lld len=%lld new_last_offset=%u\n",
- + offset, length, new_last_offset ? 1 : 0));
- nfsstat = pnfs_rpc_layoutcommit(state->session, &state->file,
- &layout_stateid, offset, length, new_last_offset, NULL, info);
- if (nfsstat) {
- - dprintf(IOLVL, "pnfs_rpc_layoutcommit() failed with %s\n",
- - nfs_error_string(nfsstat));
- + DPRINTF(IOLVL, ("pnfs_rpc_layoutcommit() failed with '%s'\n",
- + nfs_error_string(nfsstat)));
- status = PNFSERR_IO;
- }
- return status;
- @@ -813,7 +813,7 @@ enum pnfs_status pnfs_write(
- enum stable_how4 stable;
- enum pnfs_status status;
- - dprintf(IOLVL, "--> pnfs_write(%llu, %llu)\n", offset, length);
- + DPRINTF(IOLVL, ("--> pnfs_write(%llu, %llu)\n", offset, length));
- *len_out = 0;
- @@ -832,7 +832,7 @@ enum pnfs_status pnfs_write(
- layout, buffer, PNFS_IOMODE_RW, offset, length,
- state->session->lease_time);
- if (status)
- - eprintf("pattern_init() failed with %s\n",
- + eprintf("pattern_init() failed with '%s'\n",
- pnfs_error_string(status));
- }
- @@ -865,7 +865,7 @@ enum pnfs_status pnfs_write(
- out_free_pattern:
- pattern_free(&pattern);
- out:
- - dprintf(IOLVL, "<-- pnfs_write() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(IOLVL, ("<-- pnfs_write() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- \ No newline at end of file
- diff --git a/daemon/pnfs_layout.c b/daemon/pnfs_layout.c
- index e3390f6..5e05b02 100644
- --- a/daemon/pnfs_layout.c
- +++ b/daemon/pnfs_layout.c
- @@ -159,7 +159,7 @@ static enum pnfs_status layout_state_find_or_create(
- struct list_entry *entry;
- enum pnfs_status status;
- - dprintf(FLLVL, "--> layout_state_find_or_create()\n");
- + DPRINTF(FLLVL, ("--> layout_state_find_or_create()\n"));
- EnterCriticalSection(&layouts->lock);
- @@ -174,17 +174,17 @@ static enum pnfs_status layout_state_find_or_create(
- list_add_head(&layouts->head, &layout->entry);
- *layout_out = layout;
- - dprintf(FLLVL, "<-- layout_state_find_or_create() "
- - "returning new layout %p\n", layout);
- + DPRINTF(FLLVL, ("<-- layout_state_find_or_create() "
- + "returning new layout 0x%p\n", layout));
- } else {
- - dprintf(FLLVL, "<-- layout_state_find_or_create() "
- - "returning %s\n", pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- layout_state_find_or_create() "
- + "returning '%s'\n", pnfs_error_string(status)));
- }
- } else {
- *layout_out = state_entry(entry);
- - dprintf(FLLVL, "<-- layout_state_find_or_create() "
- - "returning existing layout %p\n", *layout_out);
- + DPRINTF(FLLVL, ("<-- layout_state_find_or_create() "
- + "returning existing layout 0x%p\n", *layout_out));
- }
- LeaveCriticalSection(&layouts->lock);
- @@ -198,7 +198,7 @@ static enum pnfs_status layout_state_find_and_delete(
- struct list_entry *entry;
- enum pnfs_status status;
- - dprintf(FLLVL, "--> layout_state_find_and_delete()\n");
- + DPRINTF(FLLVL, ("--> layout_state_find_and_delete()\n"));
- EnterCriticalSection(&layouts->lock);
- @@ -210,8 +210,8 @@ static enum pnfs_status layout_state_find_and_delete(
- LeaveCriticalSection(&layouts->lock);
- - dprintf(FLLVL, "<-- layout_state_find_and_delete() "
- - "returning %s\n", pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- layout_state_find_and_delete() "
- + "returning '%s'\n", pnfs_error_string(status)));
- return status;
- }
- @@ -273,9 +273,9 @@ static bool_t layout_merge_segments(
- to->util != from->util)
- return FALSE;
- - dprintf(FLLVL, "merging layout range {%llu, %llu} with {%llu, %llu}\n",
- + DPRINTF(FLLVL, ("merging layout range {%llu, %llu} with {%llu, %llu}\n",
- to->layout.offset, to->layout.length,
- - from->layout.offset, from->layout.length);
- + from->layout.offset, from->layout.length));
- /* calculate the union of the two ranges */
- to->layout.offset = min(to->layout.offset, from->layout.offset);
- @@ -361,7 +361,7 @@ static enum pnfs_status layout_update_range(
- /* attempt to merge the range with existing segments */
- status = layout_state_merge(state, layout);
- if (status) {
- - dprintf(FLLVL, "saving new layout:\n");
- + DPRINTF(FLLVL, ("saving new layout:\n"));
- dprint_layout(FLLVL, layout);
- layout_ordered_insert(state, &layout->layout);
- @@ -429,8 +429,8 @@ static enum pnfs_status file_layout_fetch(
- enum pnfs_status pnfsstat = PNFS_SUCCESS;
- enum nfsstat4 nfsstat;
- - dprintf(FLLVL, "--> file_layout_fetch(%s, seqid=%u)\n",
- - pnfs_iomode_string(iomode), state->stateid.seqid);
- + DPRINTF(FLLVL, ("--> file_layout_fetch('%s', seqid=%u)\n",
- + pnfs_iomode_string(iomode), state->stateid.seqid));
- list_init(&layoutget_res.layouts);
- @@ -441,8 +441,8 @@ static enum pnfs_status file_layout_fetch(
- AcquireSRWLockExclusive(&state->lock);
- if (nfsstat) {
- - dprintf(FLLVL, "pnfs_rpc_layoutget() failed with %s\n",
- - nfs_error_string(nfsstat));
- + DPRINTF(FLLVL, ("pnfs_rpc_layoutget() failed with '%s'\n",
- + nfs_error_string(nfsstat)));
- pnfsstat = PNFSERR_NOT_SUPPORTED;
- }
- @@ -466,8 +466,8 @@ static enum pnfs_status file_layout_fetch(
- break;
- }
- - dprintf(FLLVL, "<-- file_layout_fetch() returning %s\n",
- - pnfs_error_string(pnfsstat));
- + DPRINTF(FLLVL, ("<-- file_layout_fetch() returning '%s'\n",
- + pnfs_error_string(pnfsstat)));
- return pnfsstat;
- }
- @@ -644,8 +644,8 @@ static enum pnfs_status open_state_layout_cached(
- status = PNFS_SUCCESS;
- *layout_out = state->layout;
- - dprintf(FLLVL, "pnfs_open_state_layout() found "
- - "cached layout %p\n", *layout_out);
- + DPRINTF(FLLVL, ("pnfs_open_state_layout() found "
- + "cached layout 0x%p\n", *layout_out));
- }
- return status;
- }
- @@ -659,7 +659,7 @@ enum pnfs_status pnfs_layout_state_open(
- pnfs_layout_state *layout;
- enum pnfs_status status;
- - dprintf(FLLVL, "--> pnfs_layout_state_open()\n");
- + DPRINTF(FLLVL, ("--> pnfs_layout_state_open()\n"));
- status = client_supports_pnfs(session->client);
- if (status)
- @@ -684,8 +684,8 @@ enum pnfs_status pnfs_layout_state_open(
- LONG open_count = InterlockedIncrement(&layout->open_count);
- state->layout = layout;
- - dprintf(FLLVL, "pnfs_layout_state_open() caching layout %p "
- - "(%u opens)\n", state->layout, open_count);
- + DPRINTF(FLLVL, ("pnfs_layout_state_open() caching layout 0x%p "
- + "(%u opens)\n", state->layout, open_count));
- }
- }
- @@ -697,8 +697,8 @@ enum pnfs_status pnfs_layout_state_open(
- *layout_out = layout;
- out:
- - dprintf(FLLVL, "<-- pnfs_layout_state_open() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- pnfs_layout_state_open() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -770,7 +770,7 @@ static enum pnfs_status file_layout_return(
- enum pnfs_status status;
- enum nfsstat4 nfsstat;
- - dprintf(FLLVL, "--> file_layout_return()\n");
- + DPRINTF(FLLVL, ("--> file_layout_return()\n"));
- /* under shared lock, determine whether we need to return the layout */
- AcquireSRWLockShared(&state->lock);
- @@ -801,7 +801,7 @@ static enum pnfs_status file_layout_return(
- AcquireSRWLockExclusive(&state->lock);
- if (nfsstat) {
- - eprintf("pnfs_rpc_layoutreturn() failed with %s\n",
- + eprintf("pnfs_rpc_layoutreturn() failed with '%s'\n",
- nfs_error_string(nfsstat));
- status = PNFSERR_NO_LAYOUT;
- } else {
- @@ -822,8 +822,8 @@ static enum pnfs_status file_layout_return(
- ReleaseSRWLockExclusive(&state->lock);
- out:
- - dprintf(FLLVL, "<-- file_layout_return() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- file_layout_return() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -852,7 +852,7 @@ void pnfs_layout_state_close(
- if (return_layout) {
- status = file_layout_return(session, &state->file, layout);
- if (status)
- - eprintf("file_layout_return() failed with %s\n",
- + eprintf("file_layout_return() failed with '%s'\n",
- pnfs_error_string(status));
- }
- }
- @@ -1010,8 +1010,8 @@ static enum pnfs_status layout_recall_merge(
- if (to->iomode != from->iomode || to->type != from->type)
- continue;
- - dprintf(FLLVL, "merging recalled range {%llu, %llu} with {%llu, %llu}\n",
- - to->offset, to->length, from->offset, from->length);
- + DPRINTF(FLLVL, ("merging recalled range {%llu, %llu} with {%llu, %llu}\n",
- + to->offset, to->length, from->offset, from->length));
- /* calculate the union of the two ranges */
- to->offset = min(to->offset, from->offset);
- @@ -1089,7 +1089,7 @@ static enum pnfs_status file_layout_recall_file(
- struct list_entry *entry;
- enum pnfs_status status;
- - dprintf(FLLVL, "--> file_layout_recall_file()\n");
- + DPRINTF(FLLVL, ("--> file_layout_recall_file()\n"));
- EnterCriticalSection(&client->layouts->lock);
- @@ -1099,8 +1099,8 @@ static enum pnfs_status file_layout_recall_file(
- LeaveCriticalSection(&client->layouts->lock);
- - dprintf(FLLVL, "<-- file_layout_recall_file() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- file_layout_recall_file() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -1120,8 +1120,8 @@ static enum pnfs_status file_layout_recall_fsid(
- nfs41_fh *fh;
- enum pnfs_status status = PNFSERR_NO_LAYOUT;
- - dprintf(FLLVL, "--> file_layout_recall_fsid(%llu, %llu)\n",
- - recall->recall.args.fsid.major, recall->recall.args.fsid.minor);
- + DPRINTF(FLLVL, ("--> file_layout_recall_fsid(%llu, %llu)\n",
- + recall->recall.args.fsid.major, recall->recall.args.fsid.minor));
- EnterCriticalSection(&client->layouts->lock);
- @@ -1139,8 +1139,8 @@ static enum pnfs_status file_layout_recall_fsid(
- /* bulk recalls require invalidation of cached device info */
- pnfs_file_device_list_invalidate(client->devices);
- - dprintf(FLLVL, "<-- file_layout_recall_fsid() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- file_layout_recall_fsid() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -1151,7 +1151,7 @@ static enum pnfs_status file_layout_recall_all(
- struct list_entry *entry;
- enum pnfs_status status = PNFSERR_NO_LAYOUT;
- - dprintf(FLLVL, "--> file_layout_recall_all()\n");
- + DPRINTF(FLLVL, ("--> file_layout_recall_all()\n"));
- EnterCriticalSection(&client->layouts->lock);
- @@ -1163,8 +1163,8 @@ static enum pnfs_status file_layout_recall_all(
- /* bulk recalls require invalidation of cached device info */
- pnfs_file_device_list_invalidate(client->devices);
- - dprintf(FLLVL, "<-- file_layout_recall_all() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- file_layout_recall_all() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -1174,13 +1174,13 @@ enum pnfs_status pnfs_file_layout_recall(
- {
- enum pnfs_status status = PNFS_SUCCESS;
- - dprintf(FLLVL, "--> pnfs_file_layout_recall(%u, %s, %u)\n",
- + DPRINTF(FLLVL, ("--> pnfs_file_layout_recall(%u, '%s', %u)\n",
- recall->recall.type, pnfs_iomode_string(recall->iomode),
- - recall->changed);
- + recall->changed));
- if (recall->type != PNFS_LAYOUTTYPE_FILE) {
- - dprintf(FLLVL, "invalid layout type %u (%s)!\n",
- - recall->type, pnfs_layout_type_string(recall->type));
- + DPRINTF(FLLVL, ("invalid layout type %u ('%s')!\n",
- + recall->type, pnfs_layout_type_string(recall->type)));
- status = PNFSERR_NOT_SUPPORTED;
- goto out;
- }
- @@ -1197,13 +1197,13 @@ enum pnfs_status pnfs_file_layout_recall(
- break;
- default:
- - dprintf(FLLVL, "invalid return type %u!\n", recall->recall);
- + DPRINTF(FLLVL, ("invalid return type %u!\n", recall->recall));
- status = PNFSERR_NOT_SUPPORTED;
- goto out;
- }
- out:
- - dprintf(FLLVL, "<-- pnfs_file_layout_recall() returning %s\n",
- - pnfs_error_string(status));
- + DPRINTF(FLLVL, ("<-- pnfs_file_layout_recall() returning '%s'\n",
- + pnfs_error_string(status)));
- return status;
- }
- @@ -1260,8 +1260,8 @@ void pnfs_layout_io_start(
- /* take a reference on the layout, so that it won't be recalled
- * until all io is finished */
- state->io_count++;
- - dprintf(FLLVL, "pnfs_layout_io_start(): count -> %u\n",
- - state->io_count);
- + DPRINTF(FLLVL, ("pnfs_layout_io_start(): count -> %u\n",
- + state->io_count));
- }
- void pnfs_layout_io_finished(
- @@ -1271,8 +1271,8 @@ void pnfs_layout_io_finished(
- /* return the reference to signify that an io request is finished */
- state->io_count--;
- - dprintf(FLLVL, "pnfs_layout_io_finished() count -> %u\n",
- - state->io_count);
- + DPRINTF(FLLVL, ("pnfs_layout_io_finished() count -> %u\n",
- + state->io_count));
- if (state->io_count > 0) /* more io pending */
- goto out_unlock;
- diff --git a/daemon/readdir.c b/daemon/readdir.c
- index 04b3289..6d813cf 100644
- --- a/daemon/readdir.c
- +++ b/daemon/readdir.c
- @@ -277,10 +277,10 @@ static int parse_readdir(unsigned char *buffer, uint32_t length, nfs41_upcall *u
- 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 buf=%p\n",
- + DPRINTF(1, ("parsing NFS41_DIR_QUERY: info_class=%d buf_len=%d "
- + "filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d buf=0x%p\n",
- args->query_class, args->buf_len, args->filter,
- - args->initial, args->restart, args->single, args->kbuf);
- + args->initial, args->restart, args->single, args->kbuf));
- out:
- return status;
- }
- @@ -563,8 +563,8 @@ static int readdir_add_dots(
- case 0:
- if (entry_buf_len < entry_len + 2) {
- status = ERROR_BUFFER_OVERFLOW;
- - dprintf(0, "readdir_add_dots: not enough room for '.' entry. received %d need %d\n",
- - entry_buf_len, entry_len + 2);
- + DPRINTF(0, ("readdir_add_dots: not enough room for '.' entry. received %d need %d\n",
- + entry_buf_len, entry_len + 2));
- args->query_reply_len = entry_len + 2;
- goto out;
- }
- @@ -575,7 +575,7 @@ static int readdir_add_dots(
- status = nfs41_cached_getattr(state->session,
- &state->file, &entry->attr_info);
- if (status) {
- - dprintf(0, "readdir_add_dots: failed to add '.' entry.\n");
- + DPRINTF(0, ("readdir_add_dots: failed to add '.' entry.\n"));
- goto out;
- }
- entry->cookie = COOKIE_DOT;
- @@ -593,8 +593,8 @@ static int readdir_add_dots(
- case COOKIE_DOT:
- if (entry_buf_len < entry_len + 3) {
- status = ERROR_BUFFER_OVERFLOW;
- - dprintf(0, "readdir_add_dots: not enough room for '..' entry. received %d need %d\n",
- - entry_buf_len, entry_len);
- + DPRINTF(0, ("readdir_add_dots: not enough room for '..' entry. received %d need %d\n",
- + entry_buf_len, entry_len));
- args->query_reply_len = entry_len + 2;
- goto out;
- }
- @@ -609,7 +609,7 @@ static int readdir_add_dots(
- &state->parent, &entry->attr_info);
- if (status) {
- status = ERROR_FILE_NOT_FOUND;
- - dprintf(0, "readdir_add_dots: failed to add '..' entry.\n");
- + DPRINTF(0, ("readdir_add_dots: failed to add '..' entry.\n"));
- goto out;
- }
- entry->cookie = COOKIE_DOTDOT;
- @@ -643,23 +643,26 @@ static int handle_readdir(void *deamon_context, nfs41_upcall *upcall)
- const uint32_t max_buf_len = max(args->buf_len,
- sizeof(nfs41_readdir_entry) + NFS41_MAX_COMPONENT_LEN);
- - dprintf(1, "-> handle_nfs41_dirquery(%s,%d,%d,%d)\n",
- - args->filter, args->initial, args->restart, args->single);
- + DPRINTF(1, ("-> handle_nfs41_dirquery('%s',%d,%d,%d)\n",
- + args->filter, args->initial, args->restart, args->single));
- args->query_reply_len = 0;
- if (args->initial || args->restart) {
- ZeroMemory(&state->cookie, sizeof(nfs41_readdir_cookie));
- - if (!state->cookie.cookie)
- - dprintf(1, "initializing the 1st readdir cookie\n");
- - else if (args->restart)
- - dprintf(1, "restarting; clearing previous cookie %llu\n",
- - state->cookie.cookie);
- - else if (args->initial)
- - dprintf(1, "*** initial; clearing previous cookie %llu!\n",
- - state->cookie.cookie);
- + if (!state->cookie.cookie) {
- + DPRINTF(1, ("initializing the 1st readdir cookie\n"));
- + }
- + else if (args->restart) {
- + DPRINTF(1, ("restarting; clearing previous cookie %llu\n",
- + state->cookie.cookie));
- + }
- + else if (args->initial) {
- + DPRINTF(1, ("*** initial; clearing previous cookie %llu!\n",
- + state->cookie.cookie));
- + }
- } else if (!state->cookie.cookie) {
- - dprintf(1, "handle_nfs41_readdir: EOF\n");
- + DPRINTF(1, ("handle_nfs41_readdir: EOF\n"));
- status = ERROR_NO_MORE_FILES;
- goto out;
- }
- @@ -694,19 +697,19 @@ fetch_entries:
- }
- if (dots_len && args->single) {
- - dprintf(2, "skipping nfs41_readdir because the single query "
- - "will use . or ..\n");
- + DPRINTF(2, ("skipping nfs41_readdir because the single query "
- + "will use . or ..\n"));
- entry_buf_len = 0;
- eof = 0;
- } else {
- - dprintf(2, "calling nfs41_readdir with cookie %llu\n",
- - state->cookie.cookie);
- + DPRINTF(2, ("calling nfs41_readdir with cookie %llu\n",
- + state->cookie.cookie));
- status = nfs41_readdir(state->session, &state->file,
- &attr_request, &state->cookie, entry_buf + dots_len,
- &entry_buf_len, &eof);
- if (status) {
- - dprintf(1, "nfs41_readdir failed with %s\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_readdir failed with '%s'\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- goto out_free_cookie;
- }
- @@ -726,7 +729,7 @@ fetch_entries:
- status = lookup_entry(upcall->root_ref,
- state->session, &state->file, entry);
- if (status) {
- - dprintf(1, "single_lookup failed with %d\n", status);
- + DPRINTF(1, ("single_lookup failed with %d\n", status));
- goto out_free_cookie;
- }
- entry_buf_len = entry->name_len +
- @@ -748,13 +751,13 @@ fetch_entries:
- entry = (nfs41_readdir_entry*)entry_pos;
- offset = (PULONG)dst_pos; /* ULONG NextEntryOffset */
- - dprintf(2, "filter %s looking at %s with cookie %d\n",
- - args->filter, entry->name, entry->cookie);
- + DPRINTF(2, ("filter '%s' looking at '%s' with cookie %d\n",
- + args->filter, entry->name, entry->cookie));
- if (readdir_filter((const char*)args->filter, entry->name)) {
- if (readdir_copy_entry(args, entry, &dst_pos, &dst_len)) {
- eof = 0;
- - dprintf(2, "not enough space to copy entry %s (cookie %d)\n",
- - entry->name, entry->cookie);
- + DPRINTF(2, ("not enough space to copy entry '%s' (cookie %d)\n",
- + entry->name, entry->cookie));
- break;
- }
- last_offset = offset;
- @@ -777,40 +780,41 @@ fetch_entries:
- if (last_offset) {
- *last_offset = 0;
- } else if (!eof) {
- - dprintf(1, "no entries matched; fetch more\n");
- + DPRINTF(1, ("no entries matched; fetch more\n"));
- goto fetch_entries;
- }
- }
- if (eof) {
- - dprintf(1, "we don't need to save a cookie\n");
- + DPRINTF(1, ("we don't need to save a cookie\n"));
- goto out_free_cookie;
- - } else
- - dprintf(1, "saving cookie %llu\n", state->cookie.cookie);
- + } else {
- + DPRINTF(1, ("saving cookie %llu\n", state->cookie.cookie));
- + }
- out_free_entry:
- free(entry_buf);
- out:
- - dprintf(1, "<- handle_nfs41_dirquery(%s,%d,%d,%d) returning ",
- - args->filter, args->initial, args->restart, args->single);
- + DPRINTF(1, ("<- handle_nfs41_dirquery('%s',%d,%d,%d) returning ",
- + args->filter, args->initial, args->restart, args->single));
- if (status) {
- switch (status) {
- case ERROR_FILE_NOT_FOUND:
- - dprintf(1, "ERROR_FILE_NOT_FOUND.\n");
- + DPRINTF(1, ("ERROR_FILE_NOT_FOUND.\n"));
- break;
- case ERROR_NO_MORE_FILES:
- - dprintf(1, "ERROR_NO_MORE_FILES.\n");
- + DPRINTF(1, ("ERROR_NO_MORE_FILES.\n"));
- break;
- case ERROR_BUFFER_OVERFLOW:
- upcall->last_error = status;
- status = ERROR_SUCCESS;
- break;
- default:
- - dprintf(1, "error code %d.\n", status);
- + DPRINTF(1, ("error code %d.\n", status));
- break;
- }
- } else {
- - dprintf(1, "success!\n");
- + DPRINTF(1, ("success!\n"));
- }
- return status;
- out_free_cookie:
- diff --git a/daemon/readwrite.c b/daemon/readwrite.c
- index 0f96c74..9730a69 100644
- --- a/daemon/readwrite.c
- +++ b/daemon/readwrite.c
- @@ -48,8 +48,8 @@ static int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall
- status = safe_read(&buffer, &length, &args->buffer, sizeof(args->buffer));
- if (status) goto out;
- - dprintf(1, "parsing %s len=%lu offset=%llu buf=%p\n",
- - opcode2string(upcall->opcode), args->len, args->offset, args->buffer);
- + DPRINTF(1, ("parsing '%s' len=%lu offset=%llu buf=0x%p\n",
- + opcode2string(upcall->opcode), args->len, args->offset, args->buffer));
- out:
- return status;
- }
- @@ -68,9 +68,10 @@ static int read_from_mds(
- ULONG to_rcv = args->len, reloffset = 0, len = 0;
- const uint32_t maxreadsize = max_read_size(session, &file->fh);
- - if (to_rcv > maxreadsize)
- - dprintf(1, "handle_nfs41_read: reading %d in chunks of %d\n",
- - to_rcv, maxreadsize);
- + if (to_rcv > maxreadsize) {
- + DPRINTF(1, ("handle_nfs41_read: reading %d in chunks of %d\n",
- + to_rcv, maxreadsize));
- + }
- while(to_rcv > 0) {
- uint32_t bytes_read = 0, chunk = min(to_rcv, maxreadsize);
- @@ -194,9 +195,10 @@ retry_write:
- stable = to_send <= maxwritesize ? FILE_SYNC4 : UNSTABLE4;
- committed = FILE_SYNC4;
- - if (to_send > maxwritesize)
- - dprintf(1, "handle_nfs41_write: writing %d in chunks of %d\n",
- - to_send, maxwritesize);
- + if (to_send > maxwritesize) {
- + DPRINTF(1, ("handle_nfs41_write: writing %d in chunks of %d\n",
- + to_send, maxwritesize));
- + }
- while(to_send > 0) {
- uint32_t bytes_written = 0, chunk = min(to_send, maxwritesize);
- @@ -219,7 +221,7 @@ retry_write:
- }
- }
- if (committed != FILE_SYNC4) {
- - dprintf(1, "sending COMMIT for offset=%d and len=%d\n", args->offset, len);
- + DPRINTF(1, ("sending COMMIT for offset=%d and len=%d\n", args->offset, len));
- status = nfs41_commit(session, file, args->offset, len, 1, &verf, &info);
- if (status)
- goto out;
- diff --git a/daemon/recovery.c b/daemon/recovery.c
- index 02cd209..7890c97 100644
- --- a/daemon/recovery.c
- +++ b/daemon/recovery.c
- @@ -39,15 +39,15 @@ bool_t nfs41_recovery_start_or_wait(
- EnterCriticalSection(&client->recovery.lock);
- if (!client->recovery.in_recovery) {
- - dprintf(1, "Entering recovery mode for client %llu\n", client->clnt_id);
- + DPRINTF(1, ("Entering recovery mode for client %llu\n", client->clnt_id));
- client->recovery.in_recovery = TRUE;
- } else {
- status = FALSE;
- - dprintf(1, "Waiting for recovery of client %llu\n", client->clnt_id);
- + DPRINTF(1, ("Waiting for recovery of client %llu\n", client->clnt_id));
- while (client->recovery.in_recovery)
- SleepConditionVariableCS(&client->recovery.cond,
- &client->recovery.lock, INFINITE);
- - dprintf(1, "Woke up after recovery of client %llu\n", client->clnt_id);
- + DPRINTF(1, ("Woke up after recovery of client %llu\n", client->clnt_id));
- }
- LeaveCriticalSection(&client->recovery.lock);
- @@ -58,7 +58,7 @@ void nfs41_recovery_finish(
- IN nfs41_client *client)
- {
- EnterCriticalSection(&client->recovery.lock);
- - dprintf(1, "Finished recovery for client %llu\n", client->clnt_id);
- + DPRINTF(1, ("Finished recovery for client %llu\n", client->clnt_id));
- client->recovery.in_recovery = FALSE;
- WakeAllConditionVariable(&client->recovery.cond);
- LeaveCriticalSection(&client->recovery.lock);
- @@ -847,7 +847,7 @@ bool_t nfs41_recover_stateid(
- return recover_stateid_delegation(argop, stateid);
- default:
- - eprintf("%s can't recover stateid type %u\n",
- + eprintf("'%s' can't recover stateid type %u\n",
- nfs_opnum_to_string(argop->op), stateid->type);
- break;
- }
- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index 369dd6f..1d3d85b 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -49,8 +49,8 @@ static int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
- args->root = upcall->root_ref;
- args->state = upcall->state_ref;
- - dprintf(1, "parsing NFS41_FILE_SET: filename='%s' info_class=%d "
- - "buf_len=%d\n", args->path, args->set_class, args->buf_len);
- + DPRINTF(1, ("parsing NFS41_FILE_SET: filename='%s' info_class=%d "
- + "buf_len=%d\n", args->path, args->set_class, args->buf_len));
- out:
- return status;
- }
- @@ -140,8 +140,8 @@ static int handle_nfs41_setattr(void *daemon_context, setattr_upcall_args *args)
- status = nfs41_setattr(state->session, &state->file, &stateid, &info);
- if (status) {
- - dprintf(1, "nfs41_setattr() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_setattr() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
- }
- args->ctime = info.change;
- @@ -160,9 +160,10 @@ static int handle_nfs41_remove(void *daemon_context, setattr_upcall_args *args)
- status = nfs41_remove(state->session, &state->parent,
- &state->file.name, state->file.fh.fileid);
- - if (status)
- - dprintf(1, "nfs41_remove() failed with error %s.\n",
- - nfs_error_string(status));
- + if (status) {
- + DPRINTF(1, ("nfs41_remove() failed with error '%s'.\n",
- + nfs_error_string(status)));
- + }
- return nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
- }
- @@ -232,7 +233,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- fh_copy(&dst_dir.fh, &state->parent.fh);
- create_silly_rename(&dst_path, &state->file.fh, &dst_name);
- - dprintf(1, "silly rename: %s -> %s\n", src_name->name, dst_name.name);
- + DPRINTF(1, ("silly rename: '%s' -> '%s'\n",
- + src_name->name, dst_name.name));
- /* break any delegations and truncate before silly rename */
- nfs41_delegation_return(state->session, &state->file,
- @@ -242,8 +244,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- &state->parent, src_name,
- &dst_dir, &dst_name);
- if (status) {
- - dprintf(1, "nfs41_rename() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_rename() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
- } else {
- /* rename state->path on success */
- @@ -276,7 +278,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- /* replace the path with the symlink target's */
- status = nfs41_symlink_target(dst_session, &dst_dir, &dst_path);
- if (status) {
- - eprintf("nfs41_symlink_target() for %s failed with %d\n",
- + eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
- dst_dir.path->path, status);
- goto out;
- }
- @@ -299,8 +301,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- nfs41_delegation_return(dst_session, &dst,
- OPEN_DELEGATE_WRITE, TRUE);
- } else if (status != ERROR_FILE_NOT_FOUND) {
- - dprintf(1, "nfs41_lookup('%s') failed to find destination "
- - "directory with %d\n", dst_path.path, status);
- + DPRINTF(1, ("nfs41_lookup('%s') failed to find destination "
- + "directory with %d\n", dst_path.path, status));
- goto out;
- }
- @@ -317,7 +319,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- /* AGLO: 03/21/2011: we can't handle rename of a file with a filename
- * that is currently opened by this client
- */
- - eprintf("handle_nfs41_rename: %s is opened\n", dst_path.path);
- + eprintf("handle_nfs41_rename: '%s' is opened\n", dst_path.path);
- status = ERROR_FILE_EXISTS;
- goto out;
- }
- @@ -330,8 +332,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
- &state->parent, src_name,
- &dst_dir, &dst_name);
- if (status) {
- - dprintf(1, "nfs41_rename() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_rename() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
- } else {
- /* rename state->path on success */
- @@ -361,11 +363,11 @@ static int handle_nfs41_set_size(void *daemon_context, setattr_upcall_args *args
- info.attrmask.count = 1;
- info.attrmask.arr[0] = FATTR4_WORD0_SIZE;
- - dprintf(2, "calling setattr() with size=%lld\n", info.size);
- + DPRINTF(2, ("calling setattr() with size=%lld\n", info.size));
- status = nfs41_setattr(state->session, &state->file, &stateid, &info);
- if (status) {
- - dprintf(1, "nfs41_setattr() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_setattr() failed with error '%s'.\n",
- + nfs_error_string(status)));
- goto out;
- }
- @@ -414,7 +416,7 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
- /* replace the path with the symlink target's */
- status = nfs41_symlink_target(dst_session, &dst_dir, &dst_path);
- if (status) {
- - eprintf("nfs41_symlink_target() for %s failed with %d\n",
- + eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
- dst_dir.path->path, status);
- goto out;
- }
- @@ -434,8 +436,8 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
- goto out;
- }
- } else if (status != ERROR_FILE_NOT_FOUND) {
- - dprintf(1, "nfs41_lookup('%s') failed to find destination "
- - "directory with %d\n", dst_path.path, status);
- + DPRINTF(1, ("nfs41_lookup('%s') failed to find destination "
- + "directory with %d\n", dst_path.path, status));
- goto out;
- }
- @@ -457,8 +459,8 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
- status = nfs41_remove(state->session,
- &dst_dir, &dst_name, dst.fh.fileid);
- if (status) {
- - dprintf(1, "nfs41_remove() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_remove() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = ERROR_FILE_EXISTS;
- goto out;
- }
- @@ -471,8 +473,8 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
- status = nfs41_link(state->session, &state->file, &dst_dir, &dst_name,
- &info);
- if (status) {
- - dprintf(1, "nfs41_link() failed with error %s.\n",
- - nfs_error_string(status));
- + DPRINTF(1, ("nfs41_link() failed with error '%s'.\n",
- + nfs_error_string(status)));
- status = nfs_to_windows_error(status, ERROR_INVALID_PARAMETER);
- }
- args->ctime = info.change;
- diff --git a/daemon/sid.c b/daemon/sid.c
- index 5326994..b522232 100644
- --- a/daemon/sid.c
- +++ b/daemon/sid.c
- @@ -48,10 +48,10 @@ int create_unknownsid(WELL_KNOWN_SID_TYPE type, PSID *sid, DWORD *sid_len)
- *sid = NULL;
- status = CreateWellKnownSid(type, NULL, *sid, sid_len);
- - dprintf(ACLLVL,
- - "create_unknownsid: CreateWellKnownSid(type=%d) returned %d "
- + DPRINTF(ACLLVL,
- + ("create_unknownsid: CreateWellKnownSid(type=%d) returned %d "
- "GetLastError %d sid len %d needed\n", (int)type, status,
- - GetLastError(), *sid_len);
- + GetLastError(), *sid_len));
- if (status) {
- status = ERROR_INTERNAL_ERROR;
- goto err;
- @@ -120,9 +120,9 @@ BOOL allocate_unixuser_sid(unsigned long uid, PSID *pSid)
- if (CopySid(sid_len, malloced_sid, sid)) {
- FreeSid(sid);
- *pSid = malloced_sid;
- - dprintf(ACLLVL, "allocate_unixuser_sid(): Allocated "
- + DPRINTF(ACLLVL, ("allocate_unixuser_sid(): Allocated "
- "Unix_User+%lu: success, len=%ld\n",
- - uid, (long)sid_len);
- + uid, (long)sid_len));
- return TRUE;
- }
- }
- @@ -130,9 +130,9 @@ BOOL allocate_unixuser_sid(unsigned long uid, PSID *pSid)
- FreeSid(sid);
- free(malloced_sid);
- - dprintf(ACLLVL, "allocate_unixuser_sid(): Failed to allocate "
- + DPRINTF(ACLLVL, ("allocate_unixuser_sid(): Failed to allocate "
- "SID for Unix_User+%lu: error code %d\n",
- - uid, GetLastError());
- + uid, GetLastError()));
- return FALSE;
- }
- @@ -158,9 +158,9 @@ BOOL allocate_unixgroup_sid(unsigned long gid, PSID *pSid)
- if (CopySid(sid_len, malloced_sid, sid)) {
- FreeSid(sid);
- *pSid = malloced_sid;
- - dprintf(ACLLVL, "allocate_unixgroup_sid(): Allocated "
- + DPRINTF(ACLLVL, ("allocate_unixgroup_sid(): Allocated "
- "Unix_Group+%lu: success, len=%ld\n",
- - gid, (long)sid_len);
- + gid, (long)sid_len));
- return TRUE;
- }
- }
- @@ -168,9 +168,9 @@ BOOL allocate_unixgroup_sid(unsigned long gid, PSID *pSid)
- FreeSid(sid);
- free(malloced_sid);
- - dprintf(ACLLVL, "allocate_unixgroup_sid(): Failed to allocate "
- + DPRINTF(ACLLVL, ("allocate_unixgroup_sid(): Failed to allocate "
- "SID for Unix_Group+%lu: error code %d\n",
- - gid, GetLastError());
- + gid, GetLastError()));
- return FALSE;
- }
- #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- @@ -205,7 +205,7 @@ sidcache user_sidcache = { 0 };
- void sidcache_init(void)
- {
- - dprintf(1, "SID cache init\n");
- + DPRINTF(1, ("SID cache init\n"));
- InitializeCriticalSection(&user_sidcache.lock);
- }
- @@ -331,7 +331,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- #ifdef USE_SID_CACHE
- if (*sid = sidcache_getcached(&user_sidcache, name)) {
- *sid_len = GetLengthSid(*sid);
- - dprintf(1, "map_nfs4servername_2_sid: returning cached sid for '%s'\n", name);
- + DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for '%s'\n", name));
- return 0;
- }
- #endif /* USE_SID_CACHE */
- @@ -341,10 +341,10 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- #endif /* !USE_SID_CACHE */
- if (!cygwin_getent_passwd(name, name_buff, &udummy, &gdummy)) {
- if (strcmp(name, name_buff)) {
- - dprintf(1,
- - "map_nfs4servername_2_sid: remap '%s' --> '%s'\n",
- + DPRINTF(1,
- + ("map_nfs4servername_2_sid: remap '%s' --> '%s'\n",
- name,
- - name_buff);
- + name_buff));
- name = name_buff;
- }
- }
- @@ -352,9 +352,10 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- status = LookupAccountNameA(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
- - dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): LookupAccountName returned %d "
- + DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- + "LookupAccountName returned %d "
- "GetLastError %d name len %d domain len %d\n",
- - query, name, status, GetLastError(), *sid_len, tmp);
- + query, name, status, GetLastError(), *sid_len, tmp));
- if (status)
- return ERROR_INTERNAL_ERROR;
- @@ -380,14 +381,17 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- #ifdef DEBUG_ACLS
- LPSTR ssid = NULL;
- if (IsValidSid(*sid))
- - if (ConvertSidToStringSidA(*sid, &ssid))
- - dprintf(1, "map_nfs4servername_2_sid: sid_type = %d SID '%s'\n",
- - sid_type, ssid);
- - else
- - dprintf(1, "map_nfs4servername_2_sid: ConvertSidToStringSidA failed "
- - "with %d\n", GetLastError());
- - else
- - dprintf(1, "map_nfs4servername_2_sid: Invalid Sid ?\n");
- + if (ConvertSidToStringSidA(*sid, &ssid)) {
- + DPRINTF(1, ("map_nfs4servername_2_sid: sid_type = %d SID '%s'\n",
- + sid_type, ssid));
- + }
- + else {
- + DPRINTF(1, ("map_nfs4servername_2_sid: ConvertSidToStringSidA failed "
- + "with %d\n", GetLastError()));
- + }
- + else {
- + DPRINTF(1, ("map_nfs4servername_2_sid: Invalid Sid ?\n"));
- + }
- if (ssid)
- LocalFree(ssid);
- #endif
- @@ -396,10 +400,10 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- break;
- case ERROR_NONE_MAPPED:
- #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
- - dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): "
- + DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- "none mapped, "
- "trying Unix_User+/Unix_Group+ mapping\n",
- - query, name);
- + query, name));
- if ((user_uid == -1) && (query & OWNER_SECURITY_INFORMATION)) {
- uid_t map_uid = -1;
- @@ -413,8 +417,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- user_uid = map_uid;
- }
- else {
- - dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_name_to_ids() failed\n",
- - query, name);
- + DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_name_to_ids() failed\n",
- + query, name));
- /* fixme: try harder here, "1234" should to to |atol()| */
- }
- }
- @@ -429,56 +433,56 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- group_gid = map_gid;
- }
- else {
- - dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_group_to_gid() failed\n",
- - query, name);
- + DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_group_to_gid() failed\n",
- + query, name));
- /* fixme: try harder here, "1234" should to to |atol()| */
- }
- }
- if (user_uid != -1) {
- if (allocate_unixuser_sid(user_uid, sid)) {
- - dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
- + DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- "allocate_unixuser_sid(uid=%ld) success\n",
- - query, name, user_uid);
- + query, name, user_uid));
- status = ERROR_SUCCESS;
- goto out;
- }
- status = GetLastError();
- - dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
- + DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- "allocate_unixuser_sid(uid=%ld) failed, error=%d\n",
- - query, name, user_uid, status);
- + query, name, user_uid, status));
- return status;
- }
- if (group_gid != -1) {
- if (allocate_unixgroup_sid(group_gid, sid)) {
- - dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
- + DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- "allocate_unixgroup_sid(gid=%ld) success\n",
- - query, name, group_gid);
- + query, name, group_gid));
- status = ERROR_SUCCESS;
- goto out;
- }
- status = GetLastError();
- - dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
- + DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
- "allocate_unixgroup_sid(gid=%ld) failed, error=%d\n",
- - query, name, group_gid, status);
- + query, name, group_gid, status));
- return status;
- }
- #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- - dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): none mapped, "
- + DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): none mapped, "
- "using WinNullSid mapping\n",
- - query, name);
- + query, name));
- status = create_unknownsid(WinNullSid, sid, sid_len);
- if (status)
- goto out_free_sid;
- break;
- default:
- - dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): error %d not handled\n",
- - query, name, GetLastError());
- + DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): error %d not handled\n",
- + query, name, GetLastError()));
- break;
- }
- out:
- diff --git a/daemon/symlink.c b/daemon/symlink.c
- index 285b60d..dd57072 100644
- --- a/daemon/symlink.c
- +++ b/daemon/symlink.c
- @@ -103,13 +103,13 @@ int nfs41_symlink_target(
- /* read the link */
- status = nfs41_readlink(session, file, NFS41_MAX_PATH_LEN, link, &link_len);
- if (status) {
- - eprintf("nfs41_readlink() for %s failed with %s\n", file->path->path,
- + eprintf("nfs41_readlink() for '%s' failed with '%s'\n", file->path->path,
- nfs_error_string(status));
- status = ERROR_PATH_NOT_FOUND;
- goto out;
- }
- - dprintf(2, "--> nfs41_symlink_target('%s', '%s')\n", path->path, link);
- + DPRINTF(2, ("--> nfs41_symlink_target('%s', '%s')\n", path->path, link));
- /* append any components after the symlink */
- if (FAILED(StringCchCatA(link, NFS41_MAX_PATH_LEN,
- @@ -133,13 +133,13 @@ int nfs41_symlink_target(
- }
- status = abs_path_link(target, target->path + path_offset, link, link_len);
- if (status) {
- - eprintf("abs_path_link() for path %s with link %s failed with %d\n",
- + eprintf("abs_path_link() for path '%s' with link '%s' failed with %d\n",
- target->path, link, status);
- goto out;
- }
- out:
- - dprintf(2, "<-- nfs41_symlink_target('%s') returning %d\n",
- - target->path, status);
- + DPRINTF(2, ("<-- nfs41_symlink_target('%s') returning %d\n",
- + target->path, status));
- return status;
- }
- @@ -157,7 +157,7 @@ int nfs41_symlink_follow(
- file.path = &path;
- InitializeSRWLock(&path.lock);
- - dprintf(2, "--> nfs41_symlink_follow('%s')\n", symlink->path->path);
- + DPRINTF(2, ("--> nfs41_symlink_follow('%s')\n", symlink->path->path));
- do {
- if (++depth > NFS41_MAX_SYMLINK_DEPTH) {
- @@ -169,7 +169,7 @@ int nfs41_symlink_follow(
- status = nfs41_symlink_target(session, symlink, &path);
- if (status) goto out;
- - dprintf(2, "looking up '%s'\n", path.path);
- + DPRINTF(2, ("looking up '%s'\n", path.path));
- last_component(path.path, path.path + path.len, &file.name);
- @@ -181,7 +181,7 @@ int nfs41_symlink_follow(
- symlink = &file;
- } while (info->type == NF4LNK);
- out:
- - dprintf(2, "<-- nfs41_symlink_follow() returning %d\n", status);
- + DPRINTF(2, ("<-- nfs41_symlink_follow() returning %d\n", status));
- return status;
- }
- @@ -202,8 +202,8 @@ static int parse_symlink(unsigned char *buffer, uint32_t length, nfs41_upcall *u
- else
- args->target_set = NULL;
- - dprintf(1, "parsing NFS41_SYMLINK: path='%s' set=%u target='%s'\n",
- - args->path, args->set, args->target_set);
- + DPRINTF(1, ("parsing NFS41_SYMLINK: path='%s' set=%u target='%s'\n",
- + args->path, args->set, args->target_set));
- out:
- return status;
- }
- @@ -230,7 +230,7 @@ static int handle_symlink(void *daemon_context, nfs41_upcall *upcall)
- status = nfs41_remove(state->session, &state->parent,
- &state->file.name, state->file.fh.fileid);
- if (status) {
- - eprintf("nfs41_remove() for symlink=%s failed with %s\n",
- + eprintf("nfs41_remove() for symlink='%s' failed with '%s'\n",
- args->target_set, nfs_error_string(status));
- status = map_symlink_errors(status);
- goto out;
- @@ -245,7 +245,7 @@ static int handle_symlink(void *daemon_context, nfs41_upcall *upcall)
- status = nfs41_create(state->session, NF4LNK, &createattrs,
- args->target_set, &state->parent, &state->file, &info);
- if (status) {
- - eprintf("nfs41_create() for symlink=%s failed with %s\n",
- + eprintf("nfs41_create() for symlink='%s' failed with '%s'\n",
- args->target_set, nfs_error_string(status));
- status = map_symlink_errors(status);
- goto out;
- @@ -257,13 +257,13 @@ static int handle_symlink(void *daemon_context, nfs41_upcall *upcall)
- status = nfs41_readlink(state->session, &state->file,
- NFS41_MAX_PATH_LEN, args->target_get.path, &len);
- if (status) {
- - eprintf("nfs41_readlink() for filename=%s failed with %s\n",
- + eprintf("nfs41_readlink() for filename='%s' failed with '%s'\n",
- state->file.path->path, nfs_error_string(status));
- status = map_symlink_errors(status);
- goto out;
- }
- args->target_get.len = (unsigned short)len;
- - dprintf(2, "returning symlink target '%s'\n", args->target_get.path);
- + DPRINTF(2, ("returning symlink target '%s'\n", args->target_get.path));
- }
- out:
- return status;
- diff --git a/daemon/upcall.c b/daemon/upcall.c
- index 0c07ccb..f183dc8 100644
- --- a/daemon/upcall.c
- +++ b/daemon/upcall.c
- @@ -87,7 +87,7 @@ int upcall_parse(
- goto out;
- }
- - dprintf(2, "received %d bytes upcall data: processing upcall\n", length);
- + DPRINTF(2, ("received %d bytes upcall data: processing upcall\n", length));
- print_hexbuf(4, (unsigned char *)"upcall buffer: ", buffer, length);
- /* parse common elements */
- @@ -102,9 +102,9 @@ int upcall_parse(
- status = safe_read(&buffer, &length, &upcall->state_ref, sizeof(HANDLE));
- if (status) goto out;
- - dprintf(2, "time=%ld version=%d xid=%d opcode=%s session=0x%x open_state=0x%x\n",
- + DPRINTF(2, ("time=%ld version=%d xid=%d opcode='%s' session=0x%x open_state=0x%x\n",
- time(NULL), version, upcall->xid, opcode2string(upcall->opcode), upcall->root_ref,
- - upcall->state_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;
- diff --git a/daemon/util.c b/daemon/util.c
- index 3d366d2..df06c80 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -104,23 +104,23 @@ bool_t verify_write(
- {
- if (verf->committed != UNSTABLE4) {
- *stable = verf->committed;
- - dprintf(3, "verify_write: committed to stable storage\n");
- + DPRINTF(3, ("verify_write: committed to stable storage\n"));
- return 1;
- }
- if (*stable != UNSTABLE4) {
- memcpy(verf->expected, verf->verf, NFS4_VERIFIER_SIZE);
- *stable = UNSTABLE4;
- - dprintf(3, "verify_write: first unstable write, saving verifier\n");
- + DPRINTF(3, ("verify_write: first unstable write, saving verifier\n"));
- return 1;
- }
- if (memcmp(verf->expected, verf->verf, NFS4_VERIFIER_SIZE) == 0) {
- - dprintf(3, "verify_write: verifier matches expected\n");
- + DPRINTF(3, ("verify_write: verifier matches expected\n"));
- return 1;
- }
- - dprintf(2, "verify_write: verifier changed; writes have been lost!\n");
- + DPRINTF(2, ("verify_write: verifier changed; writes have been lost!\n"));
- return 0;
- }
- @@ -128,10 +128,10 @@ bool_t verify_commit(
- IN nfs41_write_verf *verf)
- {
- if (memcmp(verf->expected, verf->verf, NFS4_VERIFIER_SIZE) == 0) {
- - dprintf(3, "verify_commit: verifier matches expected\n");
- + DPRINTF(3, ("verify_commit: verifier matches expected\n"));
- return 1;
- }
- - dprintf(2, "verify_commit: verifier changed; writes have been lost!\n");
- + DPRINTF(2, ("verify_commit: verifier changed; writes have been lost!\n"));
- return 0;
- }
- @@ -145,9 +145,11 @@ ULONG nfs_file_info_to_attributes(
- attrs |= FILE_ATTRIBUTE_REPARSE_POINT;
- if (info->symlink_dir)
- attrs |= FILE_ATTRIBUTE_DIRECTORY;
- - } else if (info->type != NF4REG)
- - dprintf(1, "unhandled file type %d, defaulting to NF4REG\n",
- - info->type);
- + }
- + else if (info->type != NF4REG) {
- + DPRINTF(1, ("unhandled file type %d, defaulting to NF4REG\n",
- + info->type));
- + }
- if (info->mode == 0444) /* XXX: 0444 for READONLY */
- attrs |= FILE_ATTRIBUTE_READONLY;
- @@ -297,9 +299,9 @@ int nfs_to_windows_error(int status, int default_error)
- case NFS4ERR_WRONGSEC: return ERROR_ACCESS_DENIED;
- default:
- - dprintf(1, "nfs error %s not mapped to windows error; "
- + DPRINTF(1, ("nfs error '%s' not mapped to windows error; "
- "returning default error %d\n",
- - nfs_error_string(status), default_error);
- + nfs_error_string(status), default_error));
- return default_error;
- }
- }
- @@ -510,14 +512,14 @@ subcmd_popen_context *subcmd_popen(const char *command)
- * processes
- */
- if (!CreatePipe(&pinfo->hReadPipe, &pinfo->hWritePipe, &sa, 0)) {
- - dprintf(0, "subcmd_popen: CreatePipe error, status=%d\n",
- - (int)GetLastError());
- + DPRINTF(0, ("subcmd_popen: CreatePipe error, status=%d\n",
- + (int)GetLastError()));
- goto fail;
- }
- /* Set the pipe handles to non-inheritable */
- if (!SetHandleInformation(pinfo->hReadPipe, HANDLE_FLAG_INHERIT, FALSE)) {
- - dprintf(0, "subcmd_popen: SetHandleInformation error\n");
- + DPRINTF(0, ("subcmd_popen: SetHandleInformation error\n"));
- goto fail;
- }
- @@ -531,7 +533,7 @@ subcmd_popen_context *subcmd_popen(const char *command)
- if (!CreateProcessA(NULL,
- (LPSTR)command, NULL, NULL, TRUE, 0, NULL, NULL, &si,
- &pinfo->pi)) {
- - dprintf(0, "subcmd_popen: cannot create process\n");
- + DPRINTF(0, ("subcmd_popen: cannot create process\n"));
- goto fail;
- }
- @@ -568,7 +570,7 @@ int subcmd_pclose(subcmd_popen_context *pinfo)
- CloseHandle(pinfo->pi.hThread);
- if (status != 0) {
- - (void)dprintf(0, "subcmd_pclose(): exit code=%d\n", (int)status);
- + DPRINTF(0, ("subcmd_pclose(): exit code=%d\n", (int)status));
- }
- free(pinfo);
- diff --git a/daemon/volume.c b/daemon/volume.c
- index 55aabd5..1157278 100644
- --- a/daemon/volume.c
- +++ b/daemon/volume.c
- @@ -51,7 +51,7 @@ static int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *up
- status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
- if (status) goto out;
- - dprintf(1, "parsing NFS41_VOLUME_QUERY: query=%d\n", args->query);
- + DPRINTF(1, ("parsing NFS41_VOLUME_QUERY: query=%d\n", args->query));
- out:
- return status;
- }
- @@ -75,8 +75,8 @@ static int get_volume_size_info(
- info.space_free = superblock->space_free;
- status = NO_ERROR;
- - dprintf(2, "%s cached: %llu user, %llu free of %llu total\n",
- - query, info.space_avail, info.space_free, info.space_total);
- + DPRINTF(2, ("'%s' cached: %llu user, %llu free of %llu total\n",
- + query, info.space_avail, info.space_free, info.space_total));
- }
- ReleaseSRWLockShared(&superblock->lock);
- @@ -88,7 +88,7 @@ static int get_volume_size_info(
- status = nfs41_getattr(state->session, &state->file,
- &attr_request, &info);
- if (status) {
- - eprintf("nfs41_getattr() failed with %s\n",
- + eprintf("get_volume_size_info: nfs41_getattr() failed with '%s'\n",
- nfs_error_string(status));
- status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
- goto out;
- @@ -101,8 +101,8 @@ static int get_volume_size_info(
- superblock->cache_expiration = time(NULL) + VOLUME_CACHE_EXPIRATION;
- ReleaseSRWLockExclusive(&superblock->lock);
- - dprintf(2, "%s: %llu user, %llu free of %llu total\n",
- - query, info.space_avail, info.space_free, info.space_total);
- + DPRINTF(2, ("'%s': %llu user, %llu free of %llu total\n",
- + query, info.space_avail, info.space_free, info.space_total));
- }
- if (total_out) *total_out = TO_UNITS(info.space_total);
- --
- 2.43.0
- From 9aa07132243c35176734c01446b5f99e37c9f3a9 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 8 Feb 2024 12:54:56 +0100
- Subject: [PATCH 4/4] daemon: cp -p fails with "Function not implemented"
- instead of "Permission denied" [refix]
- Fix handling of |LookupAccountSidA()| success.
- Testcase:
- $ ksh93 -c 'builtin id ; rm -f x ; touch x ; chown "$(id -u -n):$(id -g -n)" x && print OK'
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/acl.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
- diff --git a/daemon/acl.c b/daemon/acl.c
- index 279f321..8c1ad9f 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -513,6 +513,9 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- * SIDs, and Unix_User+<uid> or Unix_Group+<gid> SIDs
- */
- switch (status) {
- + /* |LookupAccountSidA()| success */
- + case 0:
- + break;
- /* This happens for Unix_User+<uid> or Unix_Group+<gid> SIDs */
- case ERROR_NONE_MAPPED:
- /* Catch other cases */
- @@ -520,6 +523,11 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- case ERROR_NO_SUCH_GROUP:
- goto out;
- default:
- + eprintf("map_nfs4ace_who: Internal error, "
- + "LookupAccountSidA() returned unexpected ERROR_%d "
- + "for sidstr='%s'\n",
- + status,
- + sidstr);
- status = ERROR_INTERNAL_ERROR;
- goto out;
- }
- --
- 2.43.0
msnfs41client: Patches for debug output overhead, cp -p permission issues and misc, 2024-02-08
Posted by Anonymous on Thu 8th Feb 2024 12:12
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.