pastebin - collaborative debugging tool
rovema.kpaste.net RSS


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

  1. From f37bbbcf729ecd30b9e385ce453dd9e7b4d0316d Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 7 Feb 2024 16:49:22 +0100
  4. Subject: [PATCH 1/4] sys: nfs41_driver.sys should propagate
  5.  |ERROR_INTERNAL_ERROR| correctly
  6.  
  7. nfs41_driver.sys should propagate |ERROR_INTERNAL_ERROR| correctly as
  8. |STATUS_INTERNAL_ERROR|.
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12.  sys/nfs41_driver.c | 48 +++++++++++++++++++++++++++++++++-------------
  13.  1 file changed, 35 insertions(+), 13 deletions(-)
  14.  
  15. diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
  16. index b3cf06c..d496497 100644
  17. --- a/sys/nfs41_driver.c
  18. +++ b/sys/nfs41_driver.c
  19. @@ -2643,8 +2643,10 @@ NTSTATUS map_mount_errors(
  20.      case ERROR_BAD_NET_RESP:    return STATUS_UNEXPECTED_NETWORK_ERROR;
  21.      case ERROR_BAD_NET_NAME:    return STATUS_BAD_NETWORK_NAME;
  22.      case ERROR_BAD_NETPATH:     return STATUS_BAD_NETWORK_PATH;
  23. +    case ERROR_INTERNAL_ERROR:  return STATUS_INTERNAL_ERROR;
  24.      default:
  25. -        print_error("failed to map windows error %d to NTSTATUS; "
  26. +        print_error("map_mount_errors: "
  27. +            "failed to map windows ERROR_%d to NTSTATUS; "
  28.              "defaulting to STATUS_INSUFFICIENT_RESOURCES\n", status);
  29.          return STATUS_INSUFFICIENT_RESOURCES;
  30.      }
  31. @@ -3604,8 +3606,9 @@ NTSTATUS map_open_errors(
  32.      case ERROR_TOO_MANY_LINKS:          return STATUS_TOO_MANY_LINKS;
  33.      case ERROR_DIRECTORY:               return STATUS_FILE_IS_A_DIRECTORY;
  34.      case ERROR_BAD_FILE_TYPE:           return STATUS_NOT_A_DIRECTORY;
  35. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  36.      default:
  37. -        print_error("[ERROR] nfs41_Create: upcall returned %d returning "
  38. +        print_error("[ERROR] nfs41_Create: upcall returned ERROR_%d returning "
  39.              "STATUS_INSUFFICIENT_RESOURCES\n", status);
  40.      case ERROR_OUTOFMEMORY:             return STATUS_INSUFFICIENT_RESOURCES;
  41.      }
  42. @@ -4215,9 +4218,10 @@ NTSTATUS map_close_errors(
  43.      case ERROR_NOT_EMPTY:       return STATUS_DIRECTORY_NOT_EMPTY;
  44.      case ERROR_FILE_INVALID:    return STATUS_FILE_INVALID;
  45.      default:
  46. -        print_error("failed to map windows error %d to NTSTATUS; "
  47. +        print_error("map_close_errors: "
  48. +            "failed to map windows ERROR_%d to NTSTATUS; "
  49.              "defaulting to STATUS_INTERNAL_ERROR\n", status);
  50. -    case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
  51. +    case ERROR_INTERNAL_ERROR:  return STATUS_INTERNAL_ERROR;
  52.      }
  53.  }
  54.  
  55. @@ -4345,8 +4349,10 @@ NTSTATUS map_querydir_errors(
  56.      case ERROR_NO_MORE_FILES:       return STATUS_NO_MORE_FILES;
  57.      case ERROR_OUTOFMEMORY:         return STATUS_INSUFFICIENT_RESOURCES;
  58.      case ERROR_FILENAME_EXCED_RANGE: return STATUS_NAME_TOO_LONG;
  59. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  60.      default:
  61. -        print_error("failed to map windows error %d to NTSTATUS; "
  62. +        print_error("map_querydir_errors: "
  63. +            "failed to map windows ERROR_%d to NTSTATUS; "
  64.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  65.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  66.      }
  67. @@ -4489,8 +4495,10 @@ NTSTATUS map_volume_errors(
  68.      case ERROR_NETNAME_DELETED:     return STATUS_NETWORK_NAME_DELETED;
  69.      case ERROR_INVALID_PARAMETER:   return STATUS_INVALID_PARAMETER;
  70.      case ERROR_OUTOFMEMORY:         return STATUS_INSUFFICIENT_RESOURCES;
  71. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  72.      default:
  73. -        print_error("failed to map windows error %d to NTSTATUS; "
  74. +        print_error("map_volume_errors: "
  75. +            "failed to map windows ERROR_%d to NTSTATUS; "
  76.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  77.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  78.      }
  79. @@ -4769,8 +4777,10 @@ NTSTATUS map_setea_error(
  80.      case ERROR_INVALID_EA_HANDLE:       return STATUS_NONEXISTENT_EA_ENTRY;
  81.      case ERROR_NO_MORE_FILES:           return STATUS_NO_MORE_EAS;
  82.      case ERROR_EA_FILE_CORRUPT:         return STATUS_EA_CORRUPT_ERROR;
  83. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  84.      default:
  85. -        print_error("failed to map windows error %d to NTSTATUS; "
  86. +        print_error("map_setea_error: "
  87. +            "failed to map windows ERROR_%d to NTSTATUS; "
  88.              "defaulting to STATUS_INVALID_PARAMETER\n", error);
  89.      case ERROR_INVALID_PARAMETER:       return STATUS_INVALID_PARAMETER;
  90.      }
  91. @@ -5185,8 +5195,10 @@ NTSTATUS map_query_acl_error(
  92.      case ERROR_ACCESS_DENIED:       return STATUS_ACCESS_DENIED;
  93.      case ERROR_FILE_NOT_FOUND:      return STATUS_OBJECT_NAME_NOT_FOUND;
  94.      case ERROR_INVALID_PARAMETER:   return STATUS_INVALID_PARAMETER;
  95. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  96.      default:
  97. -        print_error("failed to map windows error %d to NTSTATUS; "
  98. +        print_error("map_query_acl_error: "
  99. +            "failed to map windows ERROR_%d to NTSTATUS; "
  100.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
  101.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  102.      }
  103. @@ -5449,8 +5461,10 @@ NTSTATUS map_queryfile_error(
  104.      case ERROR_ACCESS_DENIED:       return STATUS_ACCESS_DENIED;
  105.      case ERROR_NETNAME_DELETED:     return STATUS_NETWORK_NAME_DELETED;
  106.      case ERROR_INVALID_PARAMETER:   return STATUS_INVALID_PARAMETER;
  107. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  108.      default:
  109. -        print_error("failed to map windows error %d to NTSTATUS; "
  110. +        print_error("map_queryfile_error: "
  111. +            "failed to map windows ERROR_%d to NTSTATUS; "
  112.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
  113.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  114.      }
  115. @@ -5634,8 +5648,10 @@ NTSTATUS map_setfile_error(
  116.      case ERROR_NETWORK_ACCESS_DENIED:   return STATUS_NETWORK_ACCESS_DENIED;
  117.      case ERROR_NETNAME_DELETED:         return STATUS_NETWORK_NAME_DELETED;
  118.      case ERROR_BUFFER_OVERFLOW:         return STATUS_INSUFFICIENT_RESOURCES;
  119. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  120.      default:
  121. -        print_error("failed to map windows error %d to NTSTATUS; "
  122. +        print_error("map_setfile_error: "
  123. +            "failed to map windows ERROR_%d to NTSTATUS; "
  124.              "defaulting to STATUS_INVALID_PARAMETER\n", error);
  125.      case ERROR_INVALID_PARAMETER:       return STATUS_INVALID_PARAMETER;
  126.      }
  127. @@ -6022,8 +6038,10 @@ NTSTATUS map_readwrite_errors(
  128.      case ERROR_LOCK_VIOLATION:          return STATUS_FILE_LOCK_CONFLICT;
  129.      case ERROR_NETWORK_ACCESS_DENIED:   return STATUS_NETWORK_ACCESS_DENIED;
  130.      case ERROR_NETNAME_DELETED:         return STATUS_NETWORK_NAME_DELETED;
  131. +    case ERROR_INTERNAL_ERROR:          return STATUS_INTERNAL_ERROR;
  132.      default:
  133. -        print_error("failed to map windows error %d to NTSTATUS; "
  134. +        print_error("map_readwrite_errors: "
  135. +            "failed to map windows ERROR_%d to NTSTATUS; "
  136.              "defaulting to STATUS_NET_WRITE_FAULT\n", status);
  137.      case ERROR_NET_WRITE_FAULT:         return STATUS_NET_WRITE_FAULT;
  138.      }
  139. @@ -6301,8 +6319,10 @@ NTSTATUS map_lock_errors(
  140.      /* if we return ERROR_INVALID_PARAMETER, Windows translates that to
  141.       * success!! */
  142.      case ERROR_INVALID_PARAMETER:   return STATUS_LOCK_NOT_GRANTED;
  143. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  144.      default:
  145. -        print_error("failed to map windows error %d to NTSTATUS; "
  146. +        print_error("map_lock_errors: "
  147. +            "failed to map windows ERROR_%d to NTSTATUS; "
  148.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  149.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  150.      }
  151. @@ -6521,8 +6541,10 @@ NTSTATUS map_symlink_errors(
  152.      case ERROR_INSUFFICIENT_BUFFER: return STATUS_BUFFER_TOO_SMALL;
  153.      case STATUS_BUFFER_TOO_SMALL:
  154.      case ERROR_BUFFER_OVERFLOW:     return STATUS_BUFFER_OVERFLOW;
  155. +    case ERROR_INTERNAL_ERROR:      return STATUS_INTERNAL_ERROR;
  156.      default:
  157. -        print_error("failed to map windows error %d to NTSTATUS; "
  158. +        print_error("map_symlink_errors: "
  159. +            "failed to map windows ERROR_%d to NTSTATUS; "
  160.              "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
  161.      case ERROR_BAD_NET_RESP:        return STATUS_INVALID_NETWORK_RESPONSE;
  162.      }
  163. --
  164. 2.43.0
  165.  
  166. From 56bc55316547c655c201d92bc1151d5e620a0959 Mon Sep 17 00:00:00 2001
  167. From: Roland Mainz <roland.mainz@nrubsig.org>
  168. Date: Wed, 7 Feb 2024 16:51:18 +0100
  169. Subject: [PATCH 2/4] daemon: cp -p fails with "Function not implemented"
  170.  instead of "Permission denied"
  171.  
  172. cp -p with a source file uid/gid which is not the current users uid/gid
  173. should fail with "Permission denied", not "Function not implemented"
  174.  
  175. Example:
  176. Current user "foobar", /cygdrive/c/Windows/System32/drivers/etc/hosts
  177. is owned by user "SYSTEM":
  178. $ cp -p /cygdrive/c/Windows/System32/drivers/etc/hosts foo3 #
  179. This should fail with "Permission denied".
  180.  
  181. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  182. ---
  183.  daemon/acl.c  | 37 ++++++++++++++++++++++++++++++++-----
  184.  daemon/util.c |  1 +
  185.  2 files changed, 33 insertions(+), 5 deletions(-)
  186.  
  187. diff --git a/daemon/acl.c b/daemon/acl.c
  188. index e4fb02e..7266a9d 100644
  189. --- a/daemon/acl.c
  190. +++ b/daemon/acl.c
  191. @@ -287,6 +287,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  192.      args->sec_desc_len = 0;
  193.      status = MakeSelfRelativeSD(&sec_desc, args->sec_desc, &args->sec_desc_len);
  194.      if (status) {
  195. +        eprintf("handle_getacl: MakeSelfRelativeSD() failed.\n");
  196.          status = ERROR_INTERNAL_ERROR;
  197.          goto out;
  198.      }
  199. @@ -462,6 +463,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  200.      DWORD size = 0, tmp_size = 0;
  201.      SID_NAME_USE sid_type;
  202.      LPSTR tmp_buf = NULL, who = NULL;
  203. +    LPSTR sidstr = NULL;
  204.  
  205.      /* for ace mapping, we want to map owner's sid into "owner@"
  206.       * but for set_owner attribute we want to map owner into a user name
  207. @@ -492,13 +494,36 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  208.              return ERROR_SUCCESS;
  209.      }
  210.  
  211. +    if (!ConvertSidToStringSidA(sid, &sidstr)) {
  212. +        status = GetLastError();
  213. +        eprintf("map_nfs4ace_who: ConvertSidToStringSidA() failed, "
  214. +            "error=%d\n", status);
  215. +        goto out;
  216. +    }
  217. +
  218.      status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
  219.          &tmp_size, &sid_type);
  220. -    dprintf(ACLLVL, "map_nfs4ace_who: LookupAccountSid returned %d GetLastError "
  221. -            "%d name len %d domain len %d\n", status, GetLastError(),
  222. -            size, tmp_size);
  223. -    if (status)
  224. -        return ERROR_INTERNAL_ERROR;
  225. +    dprintf(ACLLVL, "map_nfs4ace_who: "
  226. +        "LookupAccountSid(sidtostr(sid)='%s', namelen=%d, domainlen=%d) "
  227. +        "returned %d, GetLastError=%d\n",
  228. +        sidstr, size, tmp_size, status, GetLastError());
  229. +
  230. +    /*
  231. +     * No SID to local account mapping. Can happen for some system
  232. +     * SIDs, and Unix_User+<uid> or Unix_Group+<gid> SIDs
  233. +     */
  234. +    switch (status) {
  235. +        /* This happens for Unix_User+<uid> or Unix_Group+<gid> SIDs */
  236. +        case ERROR_NONE_MAPPED:
  237. +        /* Catch other cases */
  238. +        case ERROR_NO_SUCH_USER:
  239. +        case ERROR_NO_SUCH_GROUP:
  240. +            goto out;
  241. +        default:
  242. +            status = ERROR_INTERNAL_ERROR;
  243. +            goto out;
  244. +    }
  245. +
  246.      status = GetLastError();
  247.      if (status != ERROR_INSUFFICIENT_BUFFER)
  248.          return ERROR_INTERNAL_ERROR;
  249. @@ -526,6 +551,8 @@ add_domain:
  250.      if (who) free(who);
  251.      status = ERROR_SUCCESS;
  252.  out:
  253. +    if (sidstr)
  254. +        LocalFree(sidstr);
  255.      return status;
  256.  out_free_who:
  257.      free(who);
  258. diff --git a/daemon/util.c b/daemon/util.c
  259. index 70383d7..3d366d2 100644
  260. --- a/daemon/util.c
  261. +++ b/daemon/util.c
  262. @@ -279,6 +279,7 @@ int nfs_to_windows_error(int status, int default_error)
  263.      case NFS4ERR_OPENMODE:      return ERROR_ACCESS_DENIED;
  264.      case NFS4ERR_LOCK_NOTSUPP:  return ERROR_ATOMIC_LOCKS_NOT_SUPPORTED;
  265.  
  266. +    case NFS4ERR_BADOWNER:      return ERROR_ACCESS_DENIED;
  267.      case NFS4ERR_BADCHAR:
  268.      case NFS4ERR_BADNAME:       return ERROR_INVALID_NAME;
  269.  
  270. --
  271. 2.43.0
  272.  
  273. From dbd6aa3c999248cf92a9c94d1695fd5b2e2ef5f0 Mon Sep 17 00:00:00 2001
  274. From: Roland Mainz <roland.mainz@nrubsig.org>
  275. Date: Thu, 8 Feb 2024 12:37:37 +0100
  276. Subject: [PATCH 3/4] deamon: Replace |dprintf()| with |DPRINTF()| which tests
  277.  debug level inline
  278.  
  279. Replace the |dprintf()| function with a |DPRINTF()| macro which tests
  280. the debug level inline with the caller.
  281. This saves a whole function call if no debug output is made, plus
  282. parameter setup (which might include additional function calls,
  283. which are only needed for that debug message), and makes debugging or
  284. instrumentation (e.g. DrMemory) faster.
  285.  
  286. Also, quote strings in debug output (change %s to '%s') and
  287. prefix pointers (change %p to 0x%p) for both |DPRINTF()| and
  288. |eprintf()|.
  289.  
  290. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  291. ---
  292.  daemon/acl.c              |  74 ++++++++++-----------
  293.  daemon/callback_server.c  |  56 ++++++++--------
  294.  daemon/callback_xdr.c     |   2 +-
  295.  daemon/daemon_debug.c     | 128 +++++++++++++++++------------------
  296.  daemon/daemon_debug.h     |  26 +++++---
  297.  daemon/delegation.c       |  34 +++++-----
  298.  daemon/ea.c               |  28 ++++----
  299.  daemon/getattr.c          |  12 ++--
  300.  daemon/idmap.c            | 122 ++++++++++++++++++----------------
  301.  daemon/idmap_cygwin.c     |  54 +++++++--------
  302.  daemon/lock.c             |  18 ++---
  303.  daemon/lookup.c           |   6 +-
  304.  daemon/mount.c            |  18 ++---
  305.  daemon/name_cache.c       | 126 ++++++++++++++++++-----------------
  306.  daemon/namespace.c        |  52 +++++++--------
  307.  daemon/nfs41_client.c     |   6 +-
  308.  daemon/nfs41_compound.c   |  14 ++--
  309.  daemon/nfs41_daemon.c     |  69 ++++++++++---------
  310.  daemon/nfs41_ops.c        |  19 +++---
  311.  daemon/nfs41_rpc.c        |  31 ++++-----
  312.  daemon/nfs41_server.c     |  64 +++++++++---------
  313.  daemon/nfs41_session.c    |  46 ++++++-------
  314.  daemon/nfs41_superblock.c |  32 ++++-----
  315.  daemon/nfs41_xdr.c        |  12 ++--
  316.  daemon/open.c             | 136 ++++++++++++++++++++------------------
  317.  daemon/pnfs_debug.c       |  44 ++++++------
  318.  daemon/pnfs_device.c      |  66 +++++++++---------
  319.  daemon/pnfs_io.c          |  62 ++++++++---------
  320.  daemon/pnfs_layout.c      | 108 +++++++++++++++---------------
  321.  daemon/readdir.c          |  86 ++++++++++++------------
  322.  daemon/readwrite.c        |  20 +++---
  323.  daemon/recovery.c         |  10 +--
  324.  daemon/setattr.c          |  54 +++++++--------
  325.  daemon/sid.c              |  92 ++++++++++++++------------
  326.  daemon/symlink.c          |  28 ++++----
  327.  daemon/upcall.c           |   6 +-
  328.  daemon/util.c             |  34 +++++-----
  329.  daemon/volume.c           |  12 ++--
  330.  38 files changed, 929 insertions(+), 878 deletions(-)
  331.  
  332. diff --git a/daemon/acl.c b/daemon/acl.c
  333. index 7266a9d..279f321 100644
  334. --- a/daemon/acl.c
  335. +++ b/daemon/acl.c
  336. @@ -47,7 +47,7 @@ static int parse_getacl(unsigned char *buffer, uint32_t length,
  337.      status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
  338.      if (status) goto out;
  339.  
  340. -    dprintf(1, "parsing NFS41_ACL_QUERY: info_class=%d\n", args->query);
  341. +    DPRINTF(1, ("parsing NFS41_ACL_QUERY: info_class=%d\n", args->query));
  342.  out:
  343.      return status;
  344.  }
  345. @@ -113,8 +113,8 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  346.      }
  347.      for (i = 0; i < acl->count; i++) {
  348.          convert_nfs4name_2_user_domain(acl->aces[i].who, &domain);
  349. -        dprintf(ACLLVL, "handle_getacl: for user=%s domain=%s\n",
  350. -                acl->aces[i].who, domain?domain:"<null>");
  351. +        DPRINTF(ACLLVL, ("handle_getacl: for user='%s' domain='%s'\n",
  352. +                acl->aces[i].who, domain?domain:"<null>"));
  353.          status = check_4_special_identifiers(acl->aces[i].who, &sids[i],
  354.                                               &sid_len, &flag);
  355.          if (status) {
  356. @@ -143,8 +143,8 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  357.          for (i = 0; i < acl->count; i++) {
  358.              // nfs4 acemask should be exactly the same as file access mask
  359.              mask = acl->aces[i].acemask;
  360. -            dprintf(ACLLVL, "access mask %x ace type %s\n", mask,
  361. -                acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE");
  362. +            DPRINTF(ACLLVL, ("access mask %x ace type '%s'\n", mask,
  363. +                acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE"));
  364.              if (acl->aces[i].acetype == ACE4_ACCESS_ALLOWED_ACE_TYPE) {
  365.                  status = AddAccessAllowedAce(dacl, ACL_REVISION, mask, sids[i]);
  366.                  if (!status) {
  367. @@ -162,7 +162,7 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  368.                  }
  369.                  else status = ERROR_SUCCESS;
  370.              } else {
  371. -                eprintf("convert_nfs4acl_2_dacl: unknown acetype %d\n",
  372. +                eprintf("convert_nfs4acl_2_dacl: unknown acetype %d\n",
  373.                          acl->aces[i].acetype);
  374.                  status = ERROR_INTERNAL_ERROR;
  375.                  free(dacl);
  376. @@ -215,7 +215,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  377.      info.owner_group = group;
  378.      status = nfs41_getattr(state->session, &state->file, &attr_request, &info);
  379.      if (status) {
  380. -        eprintf("handle_getacl: nfs41_cached_getattr() failed with %d\n",
  381. +        eprintf("handle_getacl: nfs41_cached_getattr() failed with %d\n",
  382.                  status);
  383.          goto out;
  384.      }
  385. @@ -224,7 +224,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  386.                                            SECURITY_DESCRIPTOR_REVISION);
  387.      if (!status) {
  388.          status = GetLastError();
  389. -        eprintf("handle_getacl: InitializeSecurityDescriptor failed with %d\n",
  390. +        eprintf("handle_getacl: InitializeSecurityDescriptor failed with %d\n",
  391.                  status);
  392.          goto out;
  393.      }
  394. @@ -236,8 +236,8 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  395.      if (args->query & OWNER_SECURITY_INFORMATION) {
  396.          // parse user@domain. currently ignoring domain part XX
  397.          convert_nfs4name_2_user_domain(info.owner, &domain);
  398. -        dprintf(ACLLVL, "handle_getacl: OWNER_SECURITY_INFORMATION: for user=%s "
  399. -                "domain=%s\n", info.owner, domain?domain:"<null>");
  400. +        DPRINTF(ACLLVL, ("handle_getacl: OWNER_SECURITY_INFORMATION: for user='%s' "
  401. +                "domain='%s'\n", info.owner, domain?domain:"<null>"));
  402.          sid_len = 0;
  403.          status = map_nfs4servername_2_sid(nfs41dg,
  404.              OWNER_SECURITY_INFORMATION, &sid_len, &osid, info.owner);
  405. @@ -254,8 +254,8 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  406.  
  407.      if (args->query & GROUP_SECURITY_INFORMATION) {
  408.          convert_nfs4name_2_user_domain(info.owner_group, &domain);
  409. -        dprintf(ACLLVL, "handle_getacl: GROUP_SECURITY_INFORMATION: for %s "
  410. -                "domain=%s\n", info.owner_group, domain?domain:"<null>");
  411. +        DPRINTF(ACLLVL, ("handle_getacl: GROUP_SECURITY_INFORMATION: for '%s' "
  412. +                "domain='%s'\n", info.owner_group, domain?domain:"<null>"));
  413.          sid_len = 0;
  414.          status = map_nfs4servername_2_sid(nfs41dg,
  415.              GROUP_SECURITY_INFORMATION, &sid_len, &gsid, info.owner_group);
  416. @@ -270,7 +270,7 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  417.          }
  418.      }
  419.      if (args->query & DACL_SECURITY_INFORMATION) {
  420. -        dprintf(ACLLVL, "handle_getacl: DACL_SECURITY_INFORMATION\n");
  421. +        DPRINTF(ACLLVL, ("handle_getacl: DACL_SECURITY_INFORMATION\n"));
  422.          status = convert_nfs4acl_2_dacl(nfs41dg,
  423.              info.acl, state->type, &dacl, &sids);
  424.          if (status)
  425. @@ -358,8 +358,8 @@ static int parse_setacl(unsigned char *buffer, uint32_t length,
  426.      if (status) goto out;
  427.      args->sec_desc = (PSECURITY_DESCRIPTOR)buffer;
  428.  
  429. -    dprintf(1, "parsing NFS41_ACL_SET: info_class=%d sec_desc_len=%d\n",
  430. -            args->query, sec_desc_len);
  431. +    DPRINTF(1, ("parsing NFS41_ACL_SET: info_class=%d sec_desc_len=%d\n",
  432. +            args->query, sec_desc_len));
  433.  out:
  434.      return status;
  435.  }
  436. @@ -371,7 +371,7 @@ static int is_well_known_sid(PSID sid, char *who)
  437.          status = IsWellKnownSid(sid, (WELL_KNOWN_SID_TYPE)i);
  438.          if (!status) continue;
  439.          else {
  440. -            dprintf(ACLLVL, "WELL_KNOWN_SID_TYPE %d\n", i);
  441. +            DPRINTF(ACLLVL, ("WELL_KNOWN_SID_TYPE %d\n", i));
  442.              switch((WELL_KNOWN_SID_TYPE)i) {
  443.              case WinCreatorOwnerSid:
  444.                  memcpy(who, ACE4_OWNER, strlen(ACE4_OWNER)+1);
  445. @@ -428,14 +428,14 @@ static void map_aceflags(BYTE win_aceflags, uint32_t *nfs4_aceflags)
  446.          *nfs4_aceflags |= ACE4_INHERIT_ONLY_ACE;
  447.      if (win_aceflags & INHERITED_ACE)
  448.          *nfs4_aceflags |= ACE4_INHERITED_ACE;
  449. -    dprintf(ACLLVL, "ACE FLAGS: %x nfs4 aceflags %x\n",
  450. -            win_aceflags, *nfs4_aceflags);
  451. +    DPRINTF(ACLLVL, ("ACE FLAGS: %x nfs4 aceflags %x\n",
  452. +            win_aceflags, *nfs4_aceflags));
  453.  }
  454.  
  455.  static void map_acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
  456.  {
  457. -    dprintf(ACLLVL, "ACE MASK: %x\n", mask);
  458. -    print_windows_access_mask(0, mask);
  459. +    DPRINTF(ACLLVL, ("ACE MASK: %x\n", mask));
  460. +    print_windows_access_mask(ACLLVL, mask);
  461.      /* check if any GENERIC bits set */
  462.      if (mask & 0xf000000) {
  463.          if (mask & GENERIC_ALL) {
  464. @@ -454,7 +454,7 @@ static void map_acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
  465.      }
  466.      else /* ignoring generic and reserved bits */
  467.          *nfs4_mask = mask & 0x00ffffff;
  468. -    print_nfs_access_mask(0, *nfs4_mask);
  469. +    print_nfs_access_mask(ACLLVL, *nfs4_mask);
  470.  }
  471.  
  472.  static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_out, char *domain)
  473. @@ -472,14 +472,14 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  474.      status = 0;
  475.      if (owner_sid) {
  476.          if (EqualSid(sid, owner_sid)) {
  477. -            dprintf(ACLLVL, "map_nfs4ace_who: this is owner's sid\n");
  478. +            DPRINTF(ACLLVL, ("map_nfs4ace_who: this is owner's sid\n"));
  479.              memcpy(who_out, ACE4_OWNER, strlen(ACE4_OWNER)+1);
  480.              return ERROR_SUCCESS;
  481.          }
  482.      }
  483.      if (group_sid) {
  484.          if (EqualSid(sid, group_sid)) {
  485. -            dprintf(ACLLVL, "map_nfs4ace_who: this is group's sid\n");
  486. +            DPRINTF(ACLLVL, ("map_nfs4ace_who: this is group's sid\n"));
  487.              memcpy(who_out, ACE4_GROUP, strlen(ACE4_GROUP)+1);
  488.              return ERROR_SUCCESS;
  489.          }
  490. @@ -503,10 +503,10 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  491.  
  492.      status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
  493.          &tmp_size, &sid_type);
  494. -    dprintf(ACLLVL, "map_nfs4ace_who: "
  495. +    DPRINTF(ACLLVL, ("map_nfs4ace_who: "
  496.          "LookupAccountSid(sidtostr(sid)='%s', namelen=%d, domainlen=%d) "
  497.          "returned %d, GetLastError=%d\n",
  498. -        sidstr, size, tmp_size, status, GetLastError());
  499. +        sidstr, size, tmp_size, status, GetLastError()));
  500.  
  501.      /*
  502.       * No SID to local account mapping. Can happen for some system
  503. @@ -539,7 +539,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  504.                                  &tmp_size, &sid_type);
  505.      free(tmp_buf);
  506.      if (!status) {
  507. -        eprintf("map_nfs4ace_who: LookupAccountSid failed with %d\n",
  508. +        eprintf("map_nfs4ace_who: LookupAccountSid failed with %d\n",
  509.                  GetLastError());
  510.          goto out_free_who;
  511.      }
  512. @@ -547,7 +547,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  513.  add_domain:
  514.      memcpy(who_out+size, "@", sizeof(char));
  515.      memcpy(who_out+size+1, domain, strlen(domain)+1);
  516. -    dprintf(ACLLVL, "map_nfs4ace_who: who=%s\n", who_out);
  517. +    DPRINTF(ACLLVL, ("map_nfs4ace_who: who='%s'\n", who_out));
  518.      if (who) free(who);
  519.      status = ERROR_SUCCESS;
  520.  out:
  521. @@ -564,7 +564,7 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  522.  {
  523.      int status;
  524.      if (acl == NULL) {
  525. -        dprintf(ACLLVL, "this is a NULL dacl: all access to an object\n");
  526. +        DPRINTF(ACLLVL, ("this is a NULL dacl: all access to an object\n"));
  527.          nfs4_acl->count = 1;
  528.          nfs4_acl->aces = calloc(1, sizeof(nfsace4));
  529.          if (nfs4_acl->aces == NULL) {
  530. @@ -584,8 +584,8 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  531.          PACE_HEADER ace;
  532.          PBYTE tmp_pointer;
  533.  
  534. -        dprintf(ACLLVL, "NON-NULL dacl with %d ACEs\n", acl->AceCount);
  535. -        print_hexbuf_no_asci(3, (unsigned char *)"ACL\n",
  536. +        DPRINTF(ACLLVL, ("NON-NULL dacl with %d ACEs\n", acl->AceCount));
  537. +        print_hexbuf_no_asci(ACLLVL, (unsigned char *)"ACL\n",
  538.                              (unsigned char *)acl, acl->AclSize);
  539.          nfs4_acl->count = acl->AceCount;
  540.          nfs4_acl->aces = calloc(nfs4_acl->count, sizeof(nfsace4));
  541. @@ -602,9 +602,9 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  542.                  goto out_free;
  543.              }
  544.              tmp_pointer = (PBYTE)ace;
  545. -            print_hexbuf_no_asci(3, (unsigned char *)"ACE\n",
  546. +            print_hexbuf_no_asci(ACLLVL, (unsigned char *)"ACE\n",
  547.                                      (unsigned char *)ace, ace->AceSize);
  548. -            dprintf(ACLLVL, "ACE TYPE: %x\n", ace->AceType);
  549. +            DPRINTF(ACLLVL, ("ACE TYPE: %x\n", ace->AceType));
  550.              if (ace->AceType == ACCESS_ALLOWED_ACE_TYPE)
  551.                  nfs4_acl->aces[i].acetype = ACE4_ACCESS_ALLOWED_ACE_TYPE;
  552.              else if (ace->AceType == ACCESS_DENIED_ACE_TYPE)
  553. @@ -649,7 +649,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  554.  
  555.      if (args->query & OWNER_SECURITY_INFORMATION) {
  556.          char owner[NFS4_OPAQUE_LIMIT];
  557. -        dprintf(ACLLVL, "handle_setacl: OWNER_SECURITY_INFORMATION\n");
  558. +        DPRINTF(ACLLVL, ("handle_setacl: OWNER_SECURITY_INFORMATION\n"));
  559.          status = GetSecurityDescriptorOwner(args->sec_desc, &sid, &sid_default);
  560.          if (!status) {
  561.              status = GetLastError();
  562. @@ -667,7 +667,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  563.      }
  564.      if (args->query & GROUP_SECURITY_INFORMATION) {
  565.          char group[NFS4_OPAQUE_LIMIT];
  566. -        dprintf(ACLLVL, "handle_setacl: GROUP_SECURITY_INFORMATION\n");
  567. +        DPRINTF(ACLLVL, ("handle_setacl: GROUP_SECURITY_INFORMATION\n"));
  568.          status = GetSecurityDescriptorGroup(args->sec_desc, &sid, &sid_default);
  569.          if (!status) {
  570.              status = GetLastError();
  571. @@ -687,7 +687,7 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  572.      if (args->query & DACL_SECURITY_INFORMATION) {
  573.          BOOL dacl_present, dacl_default;
  574.          PACL acl;
  575. -        dprintf(ACLLVL, "handle_setacl: DACL_SECURITY_INFORMATION\n");
  576. +        DPRINTF(ACLLVL, ("handle_setacl: DACL_SECURITY_INFORMATION\n"));
  577.          status = GetSecurityDescriptorDacl(args->sec_desc, &dacl_present,
  578.                                              &acl, &dacl_default);
  579.          if (!status) {
  580. @@ -726,8 +726,8 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  581.      nfs41_open_stateid_arg(state, &stateid);
  582.      status = nfs41_setattr(state->session, &state->file, &stateid, &info);
  583.      if (status) {
  584. -        dprintf(ACLLVL, "handle_setacl: nfs41_setattr() failed with error %s.\n",
  585. -                nfs_error_string(status));
  586. +        DPRINTF(ACLLVL, ("handle_setacl: nfs41_setattr() failed with error '%s'.\n",
  587. +                nfs_error_string(status)));
  588.          status = nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
  589.      }
  590.      args->ctime = info.change;
  591. diff --git a/daemon/callback_server.c b/daemon/callback_server.c
  592. index f08d486..ca20fdd 100644
  593. --- a/daemon/callback_server.c
  594. +++ b/daemon/callback_server.c
  595. @@ -76,10 +76,10 @@ static enum_t handle_cb_layoutrecall(
  596.          break;
  597.      }
  598.  
  599. -    dprintf(CBSLVL, "  OP_CB_LAYOUTRECALL { %s, %s, recall %u } %s\n",
  600. +    DPRINTF(CBSLVL, ("  OP_CB_LAYOUTRECALL { '%s', '%s', recall %u } '%s'\n",
  601.          pnfs_layout_type_string(args->type),
  602.          pnfs_iomode_string(args->iomode), args->recall.type,
  603. -        nfs_error_string(res->status));
  604. +        nfs_error_string(res->status)));
  605.      return res->status;
  606.  }
  607.  
  608. @@ -92,8 +92,8 @@ static enum_t handle_cb_recall_slot(
  609.      res->status = nfs41_session_recall_slot(rpc_clnt->client->session,
  610.          args->target_highest_slotid);
  611.  
  612. -    dprintf(CBSLVL, "  OP_CB_RECALL_SLOT { %u } %s\n",
  613. -        args->target_highest_slotid, nfs_error_string(res->status));
  614. +    DPRINTF(CBSLVL, ("  OP_CB_RECALL_SLOT { %u } '%s'\n",
  615. +        args->target_highest_slotid, nfs_error_string(res->status)));
  616.      return res->status;
  617.  }
  618.  
  619. @@ -164,9 +164,9 @@ static enum_t handle_cb_sequence(
  620.      res->ok.target_highest_slotid = args->highest_slotid;
  621.  
  622.  out:
  623. -    dprintf(CBSLVL, "  OP_CB_SEQUENCE { seqid %u, slot %u, cachethis %d } "
  624. +    DPRINTF(CBSLVL, ("  OP_CB_SEQUENCE { seqid %u, slot %u, cachethis %d } "
  625.          "%s\n", args->sequenceid, args->slotid, args->cachethis,
  626. -        nfs_error_string(res->status));
  627. +        nfs_error_string(res->status)));
  628.      return status;
  629.  }
  630.  
  631. @@ -338,7 +338,7 @@ static int replay_cache_read(
  632.      xdr.x_op = XDR_FREE;
  633.      proc_cb_compound_res(&xdr, res);
  634.  
  635. -    dprintf(2, "[cb] retry: returning cached response\n");
  636. +    DPRINTF(2, ("[cb] retry: returning cached response\n"));
  637.  
  638.      *res_out = replay;
  639.  out:
  640. @@ -362,7 +362,7 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
  641.      bool_t cachethis = FALSE;
  642.      uint32_t i, status = NFS4_OK;
  643.  
  644. -    dprintf(CBSLVL, "--> handle_cb_compound()\n");
  645. +    DPRINTF(CBSLVL, ("--> handle_cb_compound()\n"));
  646.  
  647.      /* decode the arguments */
  648.      if (!proc_cb_compound_args(xdr, &args)) {
  649. @@ -386,7 +386,7 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
  650.          goto out;
  651.      }
  652.  
  653. -    dprintf(CBSLVL, "CB_COMPOUND('%s', %u)\n", args.tag.str, args.argarray_count);
  654. +    DPRINTF(CBSLVL, ("CB_COMPOUND('%s', %u)\n", args.tag.str, args.argarray_count));
  655.      if (args.minorversion != 1) {
  656.          res->status = NFS4ERR_MINOR_VERS_MISMATCH; //XXXXX
  657.          eprintf("args.minorversion %u != 1\n", args.minorversion);
  658. @@ -421,17 +421,17 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
  659.  
  660.          switch (argop->opnum) {
  661.          case OP_CB_LAYOUTRECALL:
  662. -            dprintf(1, "OP_CB_LAYOUTRECALL\n");
  663. +            DPRINTF(1, ("OP_CB_LAYOUTRECALL\n"));
  664.              res->status = handle_cb_layoutrecall(rpc_clnt,
  665.                  &argop->args.layoutrecall, &resop->res.layoutrecall);
  666.              break;
  667.          case OP_CB_RECALL_SLOT:
  668. -            dprintf(1, "OP_CB_RECALL_SLOT\n");
  669. +            DPRINTF(1, ("OP_CB_RECALL_SLOT\n"));
  670.              res->status = handle_cb_recall_slot(rpc_clnt,
  671.                  &argop->args.recall_slot, &resop->res.recall_slot);
  672.              break;
  673.          case OP_CB_SEQUENCE:
  674. -            dprintf(1, "OP_CB_SEQUENCE\n");
  675. +            DPRINTF(1, ("OP_CB_SEQUENCE\n"));
  676.              status = handle_cb_sequence(rpc_clnt, &argop->args.sequence,
  677.                  &resop->res.sequence, &session, &cachethis);
  678.  
  679. @@ -446,45 +446,45 @@ static void handle_cb_compound(nfs41_rpc_clnt *rpc_clnt, cb_req *req, struct cb_
  680.                  res->status = resop->res.sequence.status;
  681.              break;
  682.          case OP_CB_GETATTR:
  683. -            dprintf(1, "OP_CB_GETATTR\n");
  684. +            DPRINTF(1, ("OP_CB_GETATTR\n"));
  685.              res->status = handle_cb_getattr(rpc_clnt,
  686.                  &argop->args.getattr, &resop->res.getattr);
  687.              break;
  688.          case OP_CB_RECALL:
  689. -            dprintf(1, "OP_CB_RECALL\n");
  690. +            DPRINTF(1, ("OP_CB_RECALL\n"));
  691.              res->status = handle_cb_recall(rpc_clnt,
  692.                  &argop->args.recall, &resop->res.recall);
  693.              break;
  694.          case OP_CB_NOTIFY:
  695. -            dprintf(1, "OP_CB_NOTIFY\n");
  696. +            DPRINTF(1, ("OP_CB_NOTIFY\n"));
  697.              res->status = NFS4ERR_NOTSUPP;
  698.              break;
  699.          case OP_CB_PUSH_DELEG:
  700. -            dprintf(1, "OP_CB_PUSH_DELEG\n");
  701. +            DPRINTF(1, ("OP_CB_PUSH_DELEG\n"));
  702.              res->status = NFS4ERR_NOTSUPP;
  703.              break;
  704.          case OP_CB_RECALL_ANY:
  705. -            dprintf(1, "OP_CB_RECALL_ANY\n");
  706. +            DPRINTF(1, ("OP_CB_RECALL_ANY\n"));
  707.              res->status = NFS4ERR_NOTSUPP;
  708.              break;
  709.          case OP_CB_RECALLABLE_OBJ_AVAIL:
  710. -            dprintf(1, "OP_CB_RECALLABLE_OBJ_AVAIL\n");
  711. +            DPRINTF(1, ("OP_CB_RECALLABLE_OBJ_AVAIL\n"));
  712.              res->status = NFS4ERR_NOTSUPP;
  713.              break;
  714.          case OP_CB_WANTS_CANCELLED:
  715. -            dprintf(1, "OP_CB_WANTS_CANCELLED\n");
  716. +            DPRINTF(1, ("OP_CB_WANTS_CANCELLED\n"));
  717.              res->status = NFS4ERR_NOTSUPP;
  718.              break;
  719.          case OP_CB_NOTIFY_LOCK:
  720. -            dprintf(1, "OP_CB_NOTIFY_LOCK\n");
  721. +            DPRINTF(1, ("OP_CB_NOTIFY_LOCK\n"));
  722.              res->status = NFS4ERR_NOTSUPP;
  723.              break;
  724.          case OP_CB_NOTIFY_DEVICEID:
  725. -            dprintf(1, "OP_CB_NOTIFY_DEVICEID\n");
  726. +            DPRINTF(1, ("OP_CB_NOTIFY_DEVICEID\n"));
  727.              res->status = NFS4_OK;
  728.              break;
  729.          case OP_CB_ILLEGAL:
  730. -            dprintf(1, "OP_CB_ILLEGAL\n");
  731. +            DPRINTF(1, ("OP_CB_ILLEGAL\n"));
  732.              res->status = NFS4ERR_NOTSUPP;
  733.              break;
  734.          default:
  735. @@ -503,9 +503,9 @@ out:
  736.      proc_cb_compound_args(xdr, &args);
  737.  
  738.      *reply = res;
  739. -    dprintf(CBSLVL, "<-- handle_cb_compound() returning %s (%u results)\n",
  740. +    DPRINTF(CBSLVL, ("<-- handle_cb_compound() returning '%s' (%u results)\n",
  741.          nfs_error_string(res ? res->status : status),
  742. -        res ? res->resarray_count : 0);
  743. +        res ? res->resarray_count : 0));
  744.  }
  745.  
  746.  int nfs41_handle_callback(void *rpc_clnt, void *cb, struct cb_compound_res **reply)
  747. @@ -514,7 +514,7 @@ int nfs41_handle_callback(void *rpc_clnt, void *cb, struct cb_compound_res **rep
  748.      cb_req *request = (cb_req *)cb;
  749.      uint32_t status = 0;
  750.  
  751. -    dprintf(1, "nfs41_handle_callback: received call\n");
  752. +    DPRINTF(1, ("nfs41_handle_callback: received call\n"));
  753.      if (request->rq_prog != NFS41_RPC_CBPROGRAM) {
  754.          eprintf("invalid rpc program %u\n", request->rq_prog);
  755.          status = 2;
  756. @@ -523,16 +523,16 @@ int nfs41_handle_callback(void *rpc_clnt, void *cb, struct cb_compound_res **rep
  757.  
  758.      switch (request->rq_proc) {
  759.      case CB_NULL:
  760. -        dprintf(1, "CB_NULL\n");
  761. +        DPRINTF(1, ("CB_NULL\n"));
  762.          break;
  763.  
  764.      case CB_COMPOUND:
  765. -        dprintf(1, "CB_COMPOUND\n");
  766. +        DPRINTF(1, ("CB_COMPOUND\n"));
  767.          handle_cb_compound(rpc, request, reply);
  768.          break;
  769.  
  770.      default:
  771. -        dprintf(1, "invalid rpc procedure %u\n", request->rq_proc);
  772. +        DPRINTF(1, ("invalid rpc procedure %u\n", request->rq_proc));
  773.          status = 3;
  774.          goto out;
  775.      }
  776. diff --git a/daemon/callback_xdr.c b/daemon/callback_xdr.c
  777. index 364ca85..87ab622 100644
  778. --- a/daemon/callback_xdr.c
  779. +++ b/daemon/callback_xdr.c
  780. @@ -26,7 +26,7 @@
  781.  
  782.  
  783.  #define CBXLVL 2 /* dprintf level for callback xdr logging */
  784. -#define CBX_ERR(msg) dprintf((CBXLVL), __FUNCTION__ ": failed at " msg "\n")
  785. +#define CBX_ERR(msg) DPRINTF((CBXLVL),( __FUNCTION__ ": failed at " msg "\n"))
  786.  
  787.  
  788.  /* common types */
  789. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  790. index deb6405..c434b17 100644
  791. --- a/daemon/daemon_debug.c
  792. +++ b/daemon/daemon_debug.c
  793. @@ -31,7 +31,7 @@
  794.  #include "rpc/rpc.h"
  795.  #include "rpc/auth_sspi.h"
  796.  
  797. -static int g_debug_level = DEFAULT_DEBUG_LEVEL;
  798. +extern int g_debug_level = DEFAULT_DEBUG_LEVEL;
  799.  
  800.  void set_debug_level(int level) { g_debug_level = level; }
  801.  
  802. @@ -71,11 +71,9 @@ void open_log_files()
  803.  }
  804.  #endif
  805.  
  806. -void dprintf(int level, LPCSTR format, ...)
  807. -{
  808. -    if (level > g_debug_level)
  809. -        return;
  810.  
  811. +void dprintf_out(LPCSTR format, ...)
  812. +{
  813.      va_list args;
  814.      va_start(args, format);
  815.      (void)fprintf(dlog_file, "%04x: ", (int)GetCurrentThreadId());
  816. @@ -250,7 +248,7 @@ void print_file_id_both_dir_info(int level, FILE_ID_BOTH_DIR_INFO *pboth_dir_inf
  817.  
  818.      if (level > g_debug_level)
  819.          return;
  820. -    (void)fprintf(dlog_file, "FILE_ID_BOTH_DIR_INFO %p %zd\n",
  821. +    (void)fprintf(dlog_file, "FILE_ID_BOTH_DIR_INFO 0x%p %zd\n",
  822.         pboth_dir_info, sizeof(unsigned char *));
  823.      (void)fprintf(dlog_file, "\tNextEntryOffset=%ld %zd %zd\n",
  824.          pboth_dir_info->NextEntryOffset,
  825. @@ -294,16 +292,11 @@ void print_file_id_both_dir_info(int level, FILE_ID_BOTH_DIR_INFO *pboth_dir_inf
  826.      (void)fprintf(dlog_file, "\tFileId=0x%llx %zd\n",
  827.          (long long)pboth_dir_info->FileId.QuadPart,
  828.          sizeof(pboth_dir_info->FileId));
  829. -    (void)fprintf(dlog_file, "\tFileName='%S' %p\n",
  830. +    (void)fprintf(dlog_file, "\tFileName='%S' 0x%p\n",
  831.          pboth_dir_info->FileName,
  832.          pboth_dir_info->FileName);
  833.  }
  834.  
  835. -void print_opcode(int level, DWORD opcode)
  836. -{
  837. -    dprintf(level, (LPCSTR)opcode2string(opcode));
  838. -}
  839. -
  840.  const char* opcode2string(DWORD opcode)
  841.  {
  842.      switch(opcode) {
  843. @@ -606,110 +599,117 @@ const char* secflavorop2name(DWORD sec_flavor)
  844.  
  845.  void print_windows_access_mask(int on, ACCESS_MASK m)
  846.  {
  847. -    if (!on) return;
  848. -    dprintf(1, "--> print_windows_access_mask: %x\n", m);
  849. +    if (!on)
  850. +        return;
  851. +    if (!DPRINTF_LEVEL_ENABLED(1))
  852. +        return;
  853. +
  854. +    dprintf_out("--> print_windows_access_mask: %x\n", m);
  855.      if (m & GENERIC_READ)
  856. -        dprintf(1, "\tGENERIC_READ\n");
  857. +        dprintf_out("\tGENERIC_READ\n");
  858.      if (m & GENERIC_WRITE)
  859. -        dprintf(1, "\tGENERIC_WRITE\n");
  860. +        dprintf_out("\tGENERIC_WRITE\n");
  861.      if (m & GENERIC_EXECUTE)
  862. -        dprintf(1, "\tGENERIC_EXECUTE\n");
  863. +        dprintf_out("\tGENERIC_EXECUTE\n");
  864.      if (m & GENERIC_ALL)
  865. -        dprintf(1, "\tGENERIC_ALL\n");
  866. +        dprintf_out("\tGENERIC_ALL\n");
  867.      if (m & MAXIMUM_ALLOWED)
  868. -        dprintf(1, "\tMAXIMUM_ALLOWED\n");
  869. +        dprintf_out("\tMAXIMUM_ALLOWED\n");
  870.      if (m & ACCESS_SYSTEM_SECURITY)
  871. -        dprintf(1, "\tACCESS_SYSTEM_SECURITY\n");
  872. +        dprintf_out("\tACCESS_SYSTEM_SECURITY\n");
  873.      if ((m & SPECIFIC_RIGHTS_ALL) == SPECIFIC_RIGHTS_ALL)
  874. -        dprintf(1, "\tSPECIFIC_RIGHTS_ALL\n");
  875. +        dprintf_out("\tSPECIFIC_RIGHTS_ALL\n");
  876.      if ((m & STANDARD_RIGHTS_ALL) == STANDARD_RIGHTS_ALL)
  877. -        dprintf(1, "\tSTANDARD_RIGHTS_ALL\n");
  878. +        dprintf_out("\tSTANDARD_RIGHTS_ALL\n");
  879.      if ((m & STANDARD_RIGHTS_REQUIRED) == STANDARD_RIGHTS_REQUIRED)
  880. -        dprintf(1, "\tSTANDARD_RIGHTS_REQUIRED\n");
  881. +        dprintf_out("\tSTANDARD_RIGHTS_REQUIRED\n");
  882.      if (m & SYNCHRONIZE)
  883. -        dprintf(1, "\tSYNCHRONIZE\n");
  884. +        dprintf_out("\tSYNCHRONIZE\n");
  885.      if (m & WRITE_OWNER)
  886. -        dprintf(1, "\tWRITE_OWNER\n");
  887. +        dprintf_out("\tWRITE_OWNER\n");
  888.      if (m & WRITE_DAC)
  889. -        dprintf(1, "\tWRITE_DAC\n");
  890. +        dprintf_out("\tWRITE_DAC\n");
  891.      if (m & READ_CONTROL)
  892. -        dprintf(1, "\tREAD_CONTROL\n");
  893. +        dprintf_out("\tREAD_CONTROL\n");
  894.      if (m & DELETE)
  895. -        dprintf(1, "\tDELETE\n");
  896. +        dprintf_out("\tDELETE\n");
  897.      if (m & FILE_READ_DATA)
  898. -        dprintf(1, "\tFILE_READ_DATA\n");
  899. +        dprintf_out("\tFILE_READ_DATA\n");
  900.      if (m & FILE_LIST_DIRECTORY)
  901. -        dprintf(1, "\tFILE_LIST_DIRECTORY\n");
  902. +        dprintf_out("\tFILE_LIST_DIRECTORY\n");
  903.      if (m & FILE_WRITE_DATA)
  904. -        dprintf(1, "\tFILE_WRITE_DATA\n");
  905. +        dprintf_out("\tFILE_WRITE_DATA\n");
  906.      if (m & FILE_ADD_FILE)
  907. -        dprintf(1, "\tFILE_ADD_FILE\n");
  908. +        dprintf_out("\tFILE_ADD_FILE\n");
  909.      if (m & FILE_APPEND_DATA)
  910. -        dprintf(1, "\tFILE_APPEND_DATA\n");
  911. +        dprintf_out("\tFILE_APPEND_DATA\n");
  912.      if (m & FILE_ADD_SUBDIRECTORY)
  913. -        dprintf(1, "\tFILE_ADD_SUBDIRECTORY\n");
  914. +        dprintf_out("\tFILE_ADD_SUBDIRECTORY\n");
  915.      if (m & FILE_CREATE_PIPE_INSTANCE)
  916. -        dprintf(1, "\tFILE_CREATE_PIPE_INSTANCE\n");
  917. +        dprintf_out("\tFILE_CREATE_PIPE_INSTANCE\n");
  918.      if (m & FILE_READ_EA)
  919. -        dprintf(1, "\tFILE_READ_EA\n");
  920. +        dprintf_out("\tFILE_READ_EA\n");
  921.      if (m & FILE_WRITE_EA)
  922. -        dprintf(1, "\tFILE_WRITE_EA\n");
  923. +        dprintf_out("\tFILE_WRITE_EA\n");
  924.      if (m & FILE_EXECUTE)
  925. -        dprintf(1, "\tFILE_EXECUTE\n");
  926. +        dprintf_out("\tFILE_EXECUTE\n");
  927.      if (m & FILE_TRAVERSE)
  928. -        dprintf(1, "\tFILE_TRAVERSE\n");
  929. +        dprintf_out("\tFILE_TRAVERSE\n");
  930.      if (m & FILE_DELETE_CHILD)
  931. -        dprintf(1, "\tFILE_DELETE_CHILD\n");
  932. +        dprintf_out("\tFILE_DELETE_CHILD\n");
  933.      if (m & FILE_READ_ATTRIBUTES)
  934. -        dprintf(1, "\tFILE_READ_ATTRIBUTES\n");
  935. +        dprintf_out("\tFILE_READ_ATTRIBUTES\n");
  936.      if (m & FILE_WRITE_ATTRIBUTES)
  937. -        dprintf(1, "\tFILE_WRITE_ATTRIBUTES\n");
  938. +        dprintf_out("\tFILE_WRITE_ATTRIBUTES\n");
  939.      if ((m & FILE_ALL_ACCESS) == FILE_ALL_ACCESS)
  940. -        dprintf(1, "\tFILE_ALL_ACCESS\n");
  941. +        dprintf_out("\tFILE_ALL_ACCESS\n");
  942.      if ((m & FILE_GENERIC_READ) == FILE_GENERIC_READ)
  943. -        dprintf(1, "\tFILE_GENERIC_READ\n");
  944. +        dprintf_out("\tFILE_GENERIC_READ\n");
  945.      if ((m & FILE_GENERIC_WRITE) == FILE_GENERIC_WRITE)
  946. -        dprintf(1, "\tFILE_GENERIC_WRITE\n");
  947. +        dprintf_out("\tFILE_GENERIC_WRITE\n");
  948.      if ((m & FILE_GENERIC_EXECUTE) == FILE_GENERIC_EXECUTE)
  949. -        dprintf(1, "\tFILE_GENERIC_EXECUTE\n");
  950. +        dprintf_out("\tFILE_GENERIC_EXECUTE\n");
  951.  }
  952.  
  953.  void print_nfs_access_mask(int on, int m)
  954.  {
  955.      if (!on) return;
  956. -    dprintf(1, "--> print_nfs_access_mask: %x\n", m);
  957. +    if (!DPRINTF_LEVEL_ENABLED(1))
  958. +        return;
  959. +
  960. +    dprintf_out("--> print_nfs_access_mask: %x\n", m);
  961.      if (m & ACE4_READ_DATA)
  962. -        dprintf(1, "\tACE4_READ_DATA\n");
  963. +        dprintf_out("\tACE4_READ_DATA\n");
  964.      if (m & ACE4_LIST_DIRECTORY)
  965. -        dprintf(1, "\tACE4_LIST_DIRECTORY\n");
  966. +        dprintf_out("\tACE4_LIST_DIRECTORY\n");
  967.      if (m & ACE4_WRITE_DATA)
  968. -        dprintf(1, "\tACE4_WRITE_DATA\n");
  969. +        dprintf_out("\tACE4_WRITE_DATA\n");
  970.      if (m & ACE4_ADD_FILE)
  971. -        dprintf(1, "\tACE4_ADD_FILE\n");
  972. +        dprintf_out("\tACE4_ADD_FILE\n");
  973.      if (m & ACE4_APPEND_DATA)
  974. -        dprintf(1, "\tACE4_APPEND_DATA\n");
  975. +        dprintf_out("\tACE4_APPEND_DATA\n");
  976.      if (m & ACE4_ADD_SUBDIRECTORY)
  977. -        dprintf(1, "\tACE4_ADD_SUBDIRECTORY\n");
  978. +        dprintf_out("\tACE4_ADD_SUBDIRECTORY\n");
  979.      if (m & ACE4_READ_NAMED_ATTRS)
  980. -        dprintf(1, "\tACE4_READ_NAMED_ATTRS\n");
  981. +        dprintf_out("\tACE4_READ_NAMED_ATTRS\n");
  982.      if (m & ACE4_WRITE_NAMED_ATTRS)
  983. -        dprintf(1, "\tACE4_WRITE_NAMED_ATTRS\n");
  984. +        dprintf_out("\tACE4_WRITE_NAMED_ATTRS\n");
  985.      if (m & ACE4_EXECUTE)
  986. -        dprintf(1, "\tACE4_EXECUTE\n");
  987. +        dprintf_out("\tACE4_EXECUTE\n");
  988.      if (m & ACE4_DELETE_CHILD)
  989. -        dprintf(1, "\tACE4_DELETE_CHILD\n");
  990. +        dprintf_out("\tACE4_DELETE_CHILD\n");
  991.      if (m & ACE4_READ_ATTRIBUTES)
  992. -        dprintf(1, "\tACE4_READ_ATTRIBUTES\n");
  993. +        dprintf_out("\tACE4_READ_ATTRIBUTES\n");
  994.      if (m & ACE4_WRITE_ATTRIBUTES)
  995. -        dprintf(1, "\tACE4_WRITE_ATTRIBUTES\n");
  996. +        dprintf_out("\tACE4_WRITE_ATTRIBUTES\n");
  997.      if (m & ACE4_DELETE)
  998. -        dprintf(1, "\tACE4_DELETE\n");
  999. +        dprintf_out("\tACE4_DELETE\n");
  1000.      if (m & ACE4_READ_ACL)
  1001. -        dprintf(1, "\tACE4_READ_ACL\n");
  1002. +        dprintf_out("\tACE4_READ_ACL\n");
  1003.      if (m & ACE4_WRITE_ACL)
  1004. -        dprintf(1, "\tACE4_WRITE_ACL\n");
  1005. +        dprintf_out("\tACE4_WRITE_ACL\n");
  1006.      if (m & ACE4_WRITE_OWNER)
  1007. -        dprintf(1, "\tACE4_WRITE_OWNER\n");
  1008. +        dprintf_out("\tACE4_WRITE_OWNER\n");
  1009.      if (m & ACE4_SYNCHRONIZE)
  1010. -        dprintf(1, "\tACE4_SYNCHRONIZE\n");
  1011. +        dprintf_out("\tACE4_SYNCHRONIZE\n");
  1012.  }
  1013. diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
  1014. index da9b98d..4465150 100644
  1015. --- a/daemon/daemon_debug.h
  1016. +++ b/daemon/daemon_debug.h
  1017. @@ -48,27 +48,37 @@
  1018.              ""#exp"", __FILE__, (long)__LINE__); }
  1019.  #define DASSERT(exp, level) \
  1020.      if (!(exp)) { \
  1021. -        dprintf((level), "ASSERTION '%s' in '%s'/%ld failed.\n", \
  1022. -            ""#exp"", __FILE__, (long)__LINE__); }
  1023. +        DPRINTF((level), ("ASSERTION '%s' in '%s'/%ld failed.\n", \
  1024. +            ""#exp"", __FILE__, (long)__LINE__)); }
  1025.  
  1026.  #define DASSERT_IS_VALID_NON_NULL_PTR(exp, level) \
  1027.      if (!DEBUG_IS_VALID_NON_NULL_PTR(exp)) { \
  1028. -        dprintf((level), "ASSERTION " \
  1029. -            "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=%p) " \
  1030. +        DPRINTF((level), ("ASSERTION " \
  1031. +            "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=0x%p) " \
  1032.              "in '%s'/%ld failed.\n", \
  1033. -            ""#exp"", (void *)(exp), __FILE__, (long)__LINE__); }
  1034. +            ""#exp"", (void *)(exp), __FILE__, (long)__LINE__)); }
  1035.  
  1036.  #define EASSERT_IS_VALID_NON_NULL_PTR(exp) \
  1037.      if (!DEBUG_IS_VALID_NON_NULL_PTR(exp)) { \
  1038.          eprintf("ASSERTION " \
  1039. -            "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=%p) " \
  1040. +            "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=0x%p) " \
  1041.              "in '%s'/%ld failed.\n", \
  1042.              ""#exp"", (void *)(exp), __FILE__, (long)__LINE__); }
  1043.  
  1044. +extern int g_debug_level;
  1045. +
  1046. +#define DPRINTF_LEVEL_ENABLED(level) ((level) <= g_debug_level)
  1047. +#define DPRINTF(level, args) \
  1048. +    { \
  1049. +        if (DPRINTF_LEVEL_ENABLED(level)) { \
  1050. +            dprintf_out args; \
  1051. +        } \
  1052. +    }
  1053. +
  1054.  /* daemon_debug.h */
  1055.  void set_debug_level(int level);
  1056.  void logprintf(LPCSTR format, ...);
  1057. -void dprintf(int level, LPCSTR format, ...);
  1058. +void dprintf_out(LPCSTR format, ...);
  1059.  void eprintf(LPCSTR format, ...);
  1060.  
  1061.  void print_windows_access_mask(int on, ACCESS_MASK m);
  1062. @@ -80,7 +90,6 @@ void print_disposition(int level, DWORD disposition);
  1063.  void print_access_mask(int level, DWORD access_mask);
  1064.  void print_share_mode(int level, DWORD mode);
  1065.  void print_file_id_both_dir_info(int level, FILE_ID_BOTH_DIR_INFO *p);
  1066. -void print_opcode(int level, DWORD opcode);
  1067.  const char* opcode2string(DWORD opcode);
  1068.  const char* nfs_opnum_to_string(int opnum);
  1069.  const char* nfs_error_string(int status);
  1070. @@ -103,7 +112,6 @@ const char* pnfs_error_string(enum pnfs_status status);
  1071.  const char* pnfs_layout_type_string(enum pnfs_layout_type type);
  1072.  const char* pnfs_iomode_string(enum pnfs_iomode iomode);
  1073.  
  1074. -void dprint_deviceid(int level, const char *title, const unsigned char *deviceid);
  1075.  void dprint_layout(int level, const struct __pnfs_file_layout *layout);
  1076.  void dprint_device(int level, const struct __pnfs_file_device *device);
  1077.  
  1078. diff --git a/daemon/delegation.c b/daemon/delegation.c
  1079. index a611129..676fda0 100644
  1080. --- a/daemon/delegation.c
  1081. +++ b/daemon/delegation.c
  1082. @@ -72,16 +72,16 @@ void nfs41_delegation_ref(
  1083.      IN nfs41_delegation_state *state)
  1084.  {
  1085.      const LONG count = InterlockedIncrement(&state->ref_count);
  1086. -    dprintf(DGLVL, "nfs41_delegation_ref(%s) count %d\n",
  1087. -        state->path.path, count);
  1088. +    DPRINTF(DGLVL, ("nfs41_delegation_ref('%s') count %d\n",
  1089. +        state->path.path, count));
  1090.  }
  1091.  
  1092.  void nfs41_delegation_deref(
  1093.      IN nfs41_delegation_state *state)
  1094.  {
  1095.      const LONG count = InterlockedDecrement(&state->ref_count);
  1096. -    dprintf(DGLVL, "nfs41_delegation_deref(%s) count %d\n",
  1097. -        state->path.path, count);
  1098. +    DPRINTF(DGLVL, ("nfs41_delegation_deref('%s') count %d\n",
  1099. +        state->path.path, count));
  1100.      if (count == 0)
  1101.          free(state);
  1102.  }
  1103. @@ -277,8 +277,8 @@ static int delegation_return(
  1104.          unsigned char inbuf[sizeof(HANDLE)], *buffer = inbuf;
  1105.          DWORD inbuf_len = sizeof(HANDLE), outbuf_len, dstatus;
  1106.          uint32_t length;
  1107. -        dprintf(1, "delegation_return: making a downcall for srv_open=%x\n",
  1108. -            deleg->srv_open);
  1109. +        DPRINTF(1, ("delegation_return: making a downcall for srv_open=%x\n",
  1110. +            deleg->srv_open));
  1111.          pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
  1112.                  FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
  1113.          if (pipe == INVALID_HANDLE_VALUE) {
  1114. @@ -501,8 +501,8 @@ int nfs41_delegate_open(
  1115.          memcpy(&stateid.stateid, &deleg->state.stateid, sizeof(stateid4));
  1116.      }
  1117.      if (!status) {
  1118. -        dprintf(1, "nfs41_delegate_open: updating srv_open from %x to %x\n",
  1119. -            deleg->srv_open, state->srv_open);
  1120. +        DPRINTF(1, ("nfs41_delegate_open: updating srv_open from %x to %x\n",
  1121. +            deleg->srv_open, state->srv_open));
  1122.          deleg->srv_open = state->srv_open;
  1123.      }
  1124.      ReleaseSRWLockExclusive(&deleg->lock);
  1125. @@ -602,7 +602,7 @@ int nfs41_delegation_to_open(
  1126.  out_unlock:
  1127.      ReleaseSRWLockExclusive(&open->lock);
  1128.      if (status)
  1129. -        eprintf("nfs41_delegation_to_open(%p) failed with %s\n",
  1130. +        eprintf("nfs41_delegation_to_open(0x%p) failed with '%s'\n",
  1131.              open, nfs_error_string(status));
  1132.      return status;
  1133.  }
  1134. @@ -616,8 +616,8 @@ void nfs41_delegation_remove_srvopen(
  1135.      /* find a delegation for this file */
  1136.      if (delegation_find(session->client, &file->fh, deleg_file_cmp, &deleg))
  1137.          return;
  1138. -    dprintf(1, "nfs41_delegation_remove_srvopen: removing reference to "
  1139. -        "srv_open=%x\n", deleg->srv_open);
  1140. +    DPRINTF(1, ("nfs41_delegation_remove_srvopen: removing reference to "
  1141. +        "srv_open=%x\n", deleg->srv_open));
  1142.      AcquireSRWLockExclusive(&deleg->lock);
  1143.      deleg->srv_open = NULL;
  1144.      ReleaseSRWLockExclusive(&deleg->lock);
  1145. @@ -706,7 +706,7 @@ int nfs41_delegation_recall(
  1146.      struct recall_thread_args *args;
  1147.      int status;
  1148.  
  1149. -    dprintf(2, "--> nfs41_delegation_recall()\n");
  1150. +    DPRINTF(2, ("--> nfs41_delegation_recall()\n"));
  1151.  
  1152.      /* search for the delegation by stateid instead of filehandle;
  1153.       * deleg_file_cmp() relies on a proper superblock and fileid,
  1154. @@ -755,8 +755,8 @@ int nfs41_delegation_recall(
  1155.      }
  1156.      status = NFS4_OK;
  1157.  out:
  1158. -    dprintf(DGLVL, "<-- nfs41_delegation_recall() returning %s\n",
  1159. -        nfs_error_string(status));
  1160. +    DPRINTF(DGLVL, ("<-- nfs41_delegation_recall() returning '%s'\n",
  1161. +        nfs_error_string(status)));
  1162.      return status;
  1163.  
  1164.  out_args:
  1165. @@ -786,7 +786,7 @@ int nfs41_delegation_getattr(
  1166.      uint64_t fileid;
  1167.      int status;
  1168.  
  1169. -    dprintf(2, "--> nfs41_delegation_getattr()\n");
  1170. +    DPRINTF(2, ("--> nfs41_delegation_getattr()\n"));
  1171.  
  1172.      /* search for a delegation on this file handle */
  1173.      status = delegation_find(client, fh, deleg_fh_cmp, &deleg);
  1174. @@ -815,8 +815,8 @@ int nfs41_delegation_getattr(
  1175.  out_deleg:
  1176.      nfs41_delegation_deref(deleg);
  1177.  out:
  1178. -    dprintf(DGLVL, "<-- nfs41_delegation_getattr() returning %s\n",
  1179. -        nfs_error_string(status));
  1180. +    DPRINTF(DGLVL, ("<-- nfs41_delegation_getattr() returning '%s'\n",
  1181. +        nfs_error_string(status)));
  1182.      return status;
  1183.  }
  1184.  
  1185. diff --git a/daemon/ea.c b/daemon/ea.c
  1186. index 392b3cd..a065d3c 100644
  1187. --- a/daemon/ea.c
  1188. +++ b/daemon/ea.c
  1189. @@ -81,7 +81,7 @@ static int set_ea_value(
  1190.          OPEN4_SHARE_DENY_BOTH, OPEN4_CREATE, UNCHECKED4,
  1191.          &createattrs, TRUE, &stateid.stateid, &delegation, NULL);
  1192.      if (status) {
  1193. -        eprintf("nfs41_open() failed with %s\n", nfs_error_string(status));
  1194. +        eprintf("nfs41_open() failed with '%s'\n", nfs_error_string(status));
  1195.          goto out;
  1196.      }
  1197.  
  1198. @@ -90,7 +90,7 @@ static int set_ea_value(
  1199.          ea->EaValueLength, 0, FILE_SYNC4, &bytes_written,
  1200.          &verf, NULL);
  1201.      if (status) {
  1202. -        eprintf("nfs41_write() failed with %s\n", nfs_error_string(status));
  1203. +        eprintf("nfs41_write() failed with '%s'\n", nfs_error_string(status));
  1204.          goto out_close;
  1205.      }
  1206.  
  1207. @@ -122,7 +122,7 @@ int nfs41_ea_set(
  1208.  
  1209.      status = nfs41_rpc_openattr(state->session, &state->file, TRUE, &attrdir.fh);
  1210.      if (status) {
  1211. -        eprintf("nfs41_rpc_openattr() failed with error %s\n",
  1212. +        eprintf("nfs41_rpc_openattr() failed with error '%s'\n",
  1213.              nfs_error_string(status));
  1214.          goto out;
  1215.      }
  1216. @@ -154,7 +154,7 @@ static int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall
  1217.      if (status) goto out;
  1218.      args->buf = buffer;
  1219.  
  1220. -    dprintf(1, "parsing NFS41_EA_SET: mode=%o\n", args->mode);
  1221. +    DPRINTF(1, ("parsing NFS41_EA_SET: mode=%o\n", args->mode));
  1222.  out:
  1223.      return status;
  1224.  }
  1225. @@ -185,8 +185,8 @@ static int handle_setexattr(void *daemon_context, nfs41_upcall *upcall)
  1226.  
  1227.          status = nfs41_setattr(state->session, &state->file, &stateid, &info);
  1228.          if (status) {
  1229. -            dprintf(1, "nfs41_setattr() failed with error %s.\n",
  1230. -                nfs_error_string(status));
  1231. +            DPRINTF(1, ("nfs41_setattr() failed with error '%s'.\n",
  1232. +                nfs_error_string(status)));
  1233.              goto out;
  1234.          }
  1235.  
  1236. @@ -226,8 +226,8 @@ static int parse_getexattr(unsigned char *buffer, uint32_t length, nfs41_upcall
  1237.      if (status) goto out;
  1238.      args->ealist = args->ealist_len ? buffer : NULL;
  1239.  
  1240. -    dprintf(1, "parsing NFS41_EA_GET: buf_len=%d Index %d Restart %d "
  1241. -        "Single %d\n", args->buf_len,args->eaindex, args->restart, args->single);
  1242. +    DPRINTF(1, ("parsing NFS41_EA_GET: buf_len=%d Index %d Restart %d "
  1243. +        "Single %d\n", args->buf_len,args->eaindex, args->restart, args->single));
  1244.  out:
  1245.      return status;
  1246.  }
  1247. @@ -441,7 +441,7 @@ static int get_ea_value(
  1248.          OPEN4_SHARE_DENY_WRITE, OPEN4_NOCREATE, UNCHECKED4, NULL, TRUE,
  1249.          &stateid.stateid, &delegation, &info);
  1250.      if (status) {
  1251. -        eprintf("nfs41_open() failed with %s\n", nfs_error_string(status));
  1252. +        eprintf("nfs41_open() failed with '%s'\n", nfs_error_string(status));
  1253.          if (status == NFS4ERR_NOENT)
  1254.              goto out_empty;
  1255.          goto out;
  1256. @@ -470,7 +470,7 @@ static int get_ea_value(
  1257.      status = nfs41_read(session, &file, &stateid,
  1258.          0, length - diff, buffer, &bytes_read, &eof);
  1259.      if (status) {
  1260. -        eprintf("nfs41_read() failed with %s\n", nfs_error_string(status));
  1261. +        eprintf("nfs41_read() failed with '%s'\n", nfs_error_string(status));
  1262.          goto out_close;
  1263.      }
  1264.      if (!eof) {
  1265. @@ -539,13 +539,13 @@ static int handle_getexattr(void *daemon_context, nfs41_upcall *upcall)
  1266.  
  1267.      status = nfs41_rpc_openattr(state->session, &state->file, FALSE, &parent.fh);
  1268.      if (status == NFS4ERR_NOENT) { /* no named attribute directory */
  1269. -        dprintf(EALVL, "no named attribute directory for '%s'\n", args->path);
  1270. +        DPRINTF(EALVL, ("no named attribute directory for '%s'\n", args->path));
  1271.          if (query == NULL) {
  1272.              status = empty_ea_error(args->eaindex, args->restart);
  1273.              goto out;
  1274.          }
  1275.      } else if (status) {
  1276. -        eprintf("nfs41_rpc_openattr() failed with %s\n",
  1277. +        eprintf("nfs41_rpc_openattr() failed with '%s'\n",
  1278.              nfs_error_string(status));
  1279.          status = nfs_to_windows_error(status, ERROR_EAS_NOT_SUPPORTED);
  1280.          goto out;
  1281. @@ -559,8 +559,8 @@ static int handle_getexattr(void *daemon_context, nfs41_upcall *upcall)
  1282.              goto out;
  1283.  
  1284.          if (query == NULL) { /* the file has no EAs */
  1285. -            dprintf(EALVL, "empty named attribute directory for '%s'\n",
  1286. -                args->path);
  1287. +            DPRINTF(EALVL, ("empty named attribute directory for '%s'\n",
  1288. +                args->path));
  1289.              status = empty_ea_error(args->eaindex, args->restart);
  1290.              goto out;
  1291.          }
  1292. diff --git a/daemon/getattr.c b/daemon/getattr.c
  1293. index f952a0d..4308beb 100644
  1294. --- a/daemon/getattr.c
  1295. +++ b/daemon/getattr.c
  1296. @@ -48,7 +48,7 @@ int nfs41_cached_getattr(
  1297.  
  1298.          status = nfs41_getattr(session, file, &attr_request, info);
  1299.          if (status) {
  1300. -            eprintf("nfs41_getattr() failed with %s\n",
  1301. +            eprintf("nfs41_getattr() failed with '%s'\n",
  1302.                  nfs_error_string(status));
  1303.              status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  1304.          }
  1305. @@ -78,9 +78,9 @@ static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
  1306.      status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
  1307.      if (status) goto out;
  1308.  
  1309. -    dprintf(1, "parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d file=%.*s\n",
  1310. +    DPRINTF(1, ("parsing NFS41_FILE_QUERY: info_class=%d buf_len=%d file='%.*s'\n",
  1311.          args->query_class, args->buf_len, upcall->state_ref->path.len,
  1312. -        upcall->state_ref->path.path);
  1313. +        upcall->state_ref->path.path));
  1314.  out:
  1315.      return status;
  1316.  }
  1317. @@ -94,14 +94,14 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  1318.  
  1319.  #ifdef NFS41_DRIVER_STABILITY_HACKS
  1320.      if (!DEBUG_IS_VALID_NON_NULL_PTR(state->session)) {
  1321. -        eprintf("handle_getattr: Invalid session ptr=%p\n",
  1322. +        eprintf("handle_getattr: Invalid session ptr=0x%p\n",
  1323.              (void *)state->session);
  1324.          status = ERROR_INVALID_PARAMETER;
  1325.          goto out;
  1326.      }
  1327.  
  1328.      if (!DEBUG_IS_VALID_NON_NULL_PTR(state->file.fh.superblock)) {
  1329. -        eprintf("handle_getattr: Invalid state->file.fh.superblock ptr=%p\n",
  1330. +        eprintf("handle_getattr: Invalid state->file.fh.superblock ptr=0x%p\n",
  1331.              (void *)state->file.fh.superblock);
  1332.          /* gisburn: fixme: maybe this should be |ERROR_INTERNAL_ERROR| ? */
  1333.          status = ERROR_INVALID_PARAMETER;
  1334. @@ -200,7 +200,7 @@ static int marshall_getattr(unsigned char *buffer, uint32_t *length, nfs41_upcal
  1335.      }
  1336.      status = safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
  1337.      if (status) goto out;
  1338. -    dprintf(1, "NFS41_FILE_QUERY: downcall changattr=%llu\n", args->ctime);
  1339. +    DPRINTF(1, ("NFS41_FILE_QUERY: downcall changattr=%llu\n", args->ctime));
  1340.  out:
  1341.      return status;
  1342.  }
  1343. diff --git a/daemon/idmap.c b/daemon/idmap.c
  1344. index 39de3df..8a33f5e 100644
  1345. --- a/daemon/idmap.c
  1346. +++ b/daemon/idmap.c
  1347. @@ -251,14 +251,14 @@ static int config_defaults(
  1348.          if (option->type == TYPE_INT) {
  1349.              if (!parse_uint(option->def, (UINT*)dst)) {
  1350.                  status = ERROR_INVALID_PARAMETER;
  1351. -                eprintf("failed to parse default value of %s=\"%s\": "
  1352. +                eprintf("failed to parse default value of '%s'=\"%s\": "
  1353.                      "expected a number\n", option->key, option->def);
  1354.                  break;
  1355.              }
  1356.          } else {
  1357.              if (FAILED(StringCchCopyA(dst, option->max_len, option->def))) {
  1358.                  status = ERROR_BUFFER_OVERFLOW;
  1359. -                eprintf("failed to parse default value of %s=\"%s\": "
  1360. +                eprintf("failed to parse default value of '%s'=\"%s\": "
  1361.                      "buffer overflow > %u\n", option->key, option->def,
  1362.                      option->max_len);
  1363.                  break;
  1364. @@ -319,14 +319,14 @@ static int config_load(
  1365.          /* parse line into a key=value pair */
  1366.          status = config_parse_pair(buffer, &pair);
  1367.          if (status) {
  1368. -            eprintf("error on line %d: %s\n", line, buffer);
  1369. +            eprintf("error on line %d: '%s'\n", line, buffer);
  1370.              break;
  1371.          }
  1372.  
  1373.          /* find the config_option by key */
  1374.          status = config_find_option(&pair, &option);
  1375.          if (status) {
  1376. -            eprintf("unrecognized option '%s' on line %d: %s\n",
  1377. +            eprintf("unrecognized option '%s' on line %d: '%s'\n",
  1378.                  pair.key, line, buffer);
  1379.              status = ERROR_INVALID_PARAMETER;
  1380.              break;
  1381. @@ -335,7 +335,7 @@ static int config_load(
  1382.          if (option->type == TYPE_INT) {
  1383.              if (!parse_uint(pair.value, (UINT*)((char*)config + option->offset))) {
  1384.                  status = ERROR_INVALID_PARAMETER;
  1385. -                eprintf("expected a number on line %d: %s=\"%s\"\n",
  1386. +                eprintf("expected a number on line %d: '%s'=\"%s\"\n",
  1387.                      line, pair.key, pair.value);
  1388.                  break;
  1389.              }
  1390. @@ -343,7 +343,7 @@ static int config_load(
  1391.              if (FAILED(StringCchCopyNA((char*)config + option->offset,
  1392.                      option->max_len, pair.value, pair.value_len))) {
  1393.                  status = ERROR_BUFFER_OVERFLOW;
  1394. -                eprintf("overflow on line %d: %s=\"%s\"\n",
  1395. +                eprintf("overflow on line %d: '%s'=\"%s\"\n",
  1396.                      line, pair.key, pair.value);
  1397.                  break;
  1398.              }
  1399. @@ -610,7 +610,7 @@ static int idmap_query_attrs(
  1400.      status = ldap_search_stA(context->ldap, config->base,
  1401.          LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, &res);
  1402.      if (status) {
  1403. -        eprintf("ldap search for '%s' failed with %d: %s\n",
  1404. +        eprintf("ldap search for '%s' failed with %d: '%s'\n",
  1405.              filter, status, ldap_err2stringA(status));
  1406.          status = LdapMapErrorToWin32(status);
  1407.          goto out;
  1408. @@ -619,7 +619,7 @@ static int idmap_query_attrs(
  1409.      entry = ldap_first_entry(context->ldap, res);
  1410.      if (entry == NULL) {
  1411.          status = LDAP_NO_RESULTS_RETURNED;
  1412. -        eprintf("ldap search for '%s' failed with %d: %s\n",
  1413. +        eprintf("ldap search for '%s' failed with %d: '%s'\n",
  1414.              filter, status, ldap_err2stringA(status));
  1415.          status = LdapMapErrorToWin32(status);
  1416.          goto out;
  1417. @@ -680,7 +680,7 @@ static int idmap_lookup_user(
  1418.      /* parse attributes */
  1419.      if (FAILED(StringCchCopyA(user->username, VAL_LEN,
  1420.              *values[ATTR_USER_NAME]))) {
  1421. -        eprintf("ldap attribute %s='%s' longer than %u characters\n",
  1422. +        eprintf("ldap attribute \"%s\"='%s' longer than %u characters\n",
  1423.              context->config.attributes[ATTR_USER_NAME],
  1424.              *values[ATTR_USER_NAME], VAL_LEN);
  1425.          status = ERROR_BUFFER_OVERFLOW;
  1426. @@ -688,20 +688,20 @@ static int idmap_lookup_user(
  1427.      }
  1428.      if (FAILED(StringCchCopyA(user->principal, VAL_LEN,
  1429.              values[ATTR_PRINCIPAL] ? *values[ATTR_PRINCIPAL] : ""))) {
  1430. -        eprintf("ldap attribute %s='%s' longer than %u characters\n",
  1431. +        eprintf("ldap attribute \"%s\"='%s' longer than %u characters\n",
  1432.              context->config.attributes[ATTR_PRINCIPAL],
  1433.              values[ATTR_PRINCIPAL] ? *values[ATTR_PRINCIPAL] : "", VAL_LEN);
  1434.          status = ERROR_BUFFER_OVERFLOW;
  1435.          goto out_free_values;
  1436.      }
  1437.      if (!parse_uint(*values[ATTR_UID], &user->uid)) {
  1438. -        eprintf("failed to parse ldap attribute %s='%s'\n",
  1439. +        eprintf("failed to parse ldap attribute \"%s\"='%s'\n",
  1440.              context->config.attributes[ATTR_UID], *values[ATTR_UID]);
  1441.          status = ERROR_INVALID_PARAMETER;
  1442.          goto out_free_values;
  1443.      }
  1444.      if (!parse_uint(*values[ATTR_GID], &user->gid)) {
  1445. -        eprintf("failed to parse ldap attribute %s='%s'\n",
  1446. +        eprintf("failed to parse ldap attribute \"%s\"='%s'\n",
  1447.              context->config.attributes[ATTR_GID], *values[ATTR_GID]);
  1448.          status = ERROR_INVALID_PARAMETER;
  1449.          goto out_free_values;
  1450. @@ -716,7 +716,9 @@ static int idmap_lookup_user(
  1451.          status = ERROR_NOT_FOUND;
  1452.  
  1453.          if (!cygwin_getent_passwd(lookup->value, NULL, &cy_uid, &cy_gid)) {
  1454. -            dprintf(CYGWINIDLVL, "# ATTR_USER_NAME: cygwin_getent_passwd: returned '%s', uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
  1455. +            DPRINTF(CYGWINIDLVL,
  1456. +                ("# ATTR_USER_NAME: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
  1457. +                lookup->value, (unsigned int)cy_uid, (unsigned int)cy_gid));
  1458.              (void)snprintf(principal_name, sizeof(principal_name),
  1459.                  "%s@%s", (const char *)lookup->value, "GLOBAL.LOC");
  1460.              StringCchCopyA(user->username, VAL_LEN, lookup->value);
  1461. @@ -744,7 +746,9 @@ static int idmap_lookup_user(
  1462.              *s = '\0';
  1463.  
  1464.          if (!cygwin_getent_passwd(search_name, NULL, &cy_uid, &cy_gid)) {
  1465. -            dprintf(CYGWINIDLVL, "# ATTR_PRINCIPAL: cygwin_getent_passwd: returned '%s', uid=%d, gid=%d\n", lookup->value, (int)cy_uid, (int)cy_gid);
  1466. +            DPRINTF(CYGWINIDLVL,
  1467. +                ("# ATTR_PRINCIPAL: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
  1468. +                lookup->value, (unsigned int)cy_uid, (unsigned int)cy_gid));
  1469.              (void)snprintf(principal_name, sizeof(principal_name),
  1470.                  "%s@%s", (const char *)lookup->value, "GLOBAL.LOC");
  1471.  
  1472. @@ -770,7 +774,9 @@ static int idmap_lookup_user(
  1473.          (void)snprintf(search_name, sizeof(search_name), "%lu", (unsigned long)search_uid);
  1474.  
  1475.          if (!cygwin_getent_passwd(search_name, res_username, &cy_uid, &cy_gid)) {
  1476. -            dprintf(CYGWINIDLVL, "# ATTR_UID: cygwin_getent_passwd: returned '%s', uid=%d, gid=%d\n", res_username, (int)cy_uid, (int)cy_gid);
  1477. +            DPRINTF(CYGWINIDLVL,
  1478. +                ("# ATTR_UID: cygwin_getent_passwd: returned '%s', uid=%u, gid=%u\n",
  1479. +                res_username, (unsigned int)cy_uid, (unsigned int)cy_gid));
  1480.              (void)snprintf(principal_name, sizeof(principal_name), "%s@%s", res_username, "GLOBAL.LOC");
  1481.  
  1482.              StringCchCopyA(user->username, VAL_LEN, res_username);
  1483. @@ -787,12 +793,12 @@ static int idmap_lookup_user(
  1484.  
  1485.      if (status == 0) {
  1486.          user->last_updated = time(NULL);
  1487. -        dprintf(CYGWINIDLVL, "## idmap_lookup_user: "
  1488. -            "found username='%s', principal='%s', uid=%lu, gid=%lu\n",
  1489. +        DPRINTF(CYGWINIDLVL, ("## idmap_lookup_user: "
  1490. +            "found username='%s', principal='%s', uid=%u, gid=%u\n",
  1491.              user->username,
  1492.              user->principal,
  1493. -            (unsigned long)user->uid,
  1494. -            (unsigned long)user->gid);
  1495. +            (unsigned int)user->uid,
  1496. +            (unsigned int)user->gid));
  1497.      }
  1498.  #endif /* !NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
  1499.      if (context->config.cache_ttl) {
  1500. @@ -834,14 +840,14 @@ static int idmap_lookup_group(
  1501.      /* parse attributes */
  1502.      if (FAILED(StringCchCopyA(group->name, VAL_LEN,
  1503.              *values[ATTR_GROUP_NAME]))) {
  1504. -        eprintf("ldap attribute %s='%s' longer than %u characters\n",
  1505. +        eprintf("ldap attribute \"%s\"='%s' longer than %u characters\n",
  1506.              context->config.attributes[ATTR_GROUP_NAME],
  1507.              *values[ATTR_GROUP_NAME], VAL_LEN);
  1508.          status = ERROR_BUFFER_OVERFLOW;
  1509.          goto out_free_values;
  1510.      }
  1511.      if (!parse_uint(*values[ATTR_GID], &group->gid)) {
  1512. -        eprintf("failed to parse ldap attribute %s='%s'\n",
  1513. +        eprintf("failed to parse ldap attribute \"%s\"='%s'\n",
  1514.              context->config.attributes[ATTR_GID], *values[ATTR_GID]);
  1515.          status = ERROR_INVALID_PARAMETER;
  1516.          goto out_free_values;
  1517. @@ -854,10 +860,10 @@ static int idmap_lookup_group(
  1518.          status = ERROR_NOT_FOUND;
  1519.  
  1520.          if (!cygwin_getent_group(lookup->value, NULL, &cy_gid)) {
  1521. -            dprintf(CYGWINIDLVL,
  1522. -                "# ATTR_GROUP_NAME: cygwin_getent_group: "
  1523. -                "returned '%s', gid=%d\n",
  1524. -                lookup->value, (int)cy_gid);
  1525. +            DPRINTF(CYGWINIDLVL,
  1526. +                ("# ATTR_GROUP_NAME: cygwin_getent_group: "
  1527. +                "returned '%s', gid=%u\n",
  1528. +                lookup->value, (unsigned int)cy_gid));
  1529.              StringCchCopyA(group->name, VAL_LEN, lookup->value);
  1530.              group->gid = cy_gid;
  1531.              status = 0;
  1532. @@ -875,9 +881,9 @@ static int idmap_lookup_group(
  1533.              "%lu", (unsigned long)search_gid);
  1534.  
  1535.          if (!cygwin_getent_group(search_name, res_groupname, &cy_gid)) {
  1536. -            dprintf(CYGWINIDLVL,
  1537. -                "# ATTR_GID: cygwin_getent_group: returned '%s', gid=%d\n",
  1538. -                res_groupname, (int)cy_gid);
  1539. +            DPRINTF(CYGWINIDLVL,
  1540. +                ("# ATTR_GID: cygwin_getent_group: returned '%s', gid=%u\n",
  1541. +                res_groupname, (unsigned int)cy_gid));
  1542.              StringCchCopyA(group->name, VAL_LEN, res_groupname);
  1543.              group->gid = cy_gid;
  1544.              status = 0;
  1545. @@ -890,10 +896,10 @@ static int idmap_lookup_group(
  1546.  
  1547.      if (status == 0) {
  1548.          group->last_updated = time(NULL);
  1549. -        dprintf(CYGWINIDLVL,
  1550. -            "## idmap_lookup_group: found name='%s', gid=%lu\n",
  1551. +        DPRINTF(CYGWINIDLVL,
  1552. +            ("## idmap_lookup_group: found name='%s', gid=%u\n",
  1553.              group->name,
  1554. -            (unsigned long)group->gid);
  1555. +            (unsigned int)group->gid));
  1556.      }
  1557.  #endif /* !NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
  1558.      if (context->config.cache_ttl) {
  1559. @@ -936,7 +942,7 @@ int nfs41_idmap_create(
  1560.      context->ldap = ldap_init(context->config.hostname, context->config.port);
  1561.      if (context->ldap == NULL) {
  1562.          status = LdapGetLastError();
  1563. -        eprintf("ldap_init(%s) failed with %d: %s\n",
  1564. +        eprintf("ldap_init(%s) failed with %d: '%s'\n",
  1565.              context->config.hostname, status, ldap_err2stringA(status));
  1566.          status = LdapMapErrorToWin32(status);
  1567.          goto out_err_free;
  1568. @@ -962,7 +968,7 @@ int nfs41_idmap_create(
  1569.          }
  1570.      }
  1571.  #else
  1572. -    dprintf(CYGWINIDLVL, "nfs41_idmap_create: Force context->config.timeout = 6000;\n");
  1573. +    DPRINTF(CYGWINIDLVL, ("nfs41_idmap_create: Force context->config.timeout = 6000;\n"));
  1574.      context->config.timeout = 6000;
  1575.  #endif
  1576.  
  1577. @@ -1012,22 +1018,22 @@ int nfs41_idmap_name_to_ids(
  1578.      if (context == NULL)
  1579.          return ERROR_FILE_NOT_FOUND;
  1580.  
  1581. -    dprintf(IDLVL, "--> nfs41_idmap_name_to_ids('%s')\n", username);
  1582. +    DPRINTF(IDLVL, ("--> nfs41_idmap_name_to_ids('%s')\n", username));
  1583.  
  1584.      lookup.value = username;
  1585.  
  1586.      /* look up the user entry */
  1587.      status = idmap_lookup_user(context, &lookup, &user);
  1588.      if (status) {
  1589. -        dprintf(IDLVL, "<-- nfs41_idmap_name_to_ids('%s') "
  1590. -            "failed with %d\n", username, status);
  1591. +        DPRINTF(IDLVL, ("<-- nfs41_idmap_name_to_ids('%s') "
  1592. +            "failed with %d\n", username, status));
  1593.          goto out;
  1594.      }
  1595.  
  1596.      *uid_out = user.uid;
  1597.      *gid_out = user.gid;
  1598. -    dprintf(IDLVL, "<-- nfs41_idmap_name_to_ids('%s') "
  1599. -        "returning uid=%u, gid=%u\n", username, user.uid, user.gid);
  1600. +    DPRINTF(IDLVL, ("<-- nfs41_idmap_name_to_ids('%s') "
  1601. +        "returning uid=%u, gid=%u\n", username, user.uid, user.gid));
  1602.  out:
  1603.      return status;
  1604.  }
  1605. @@ -1052,15 +1058,15 @@ int nfs41_idmap_uid_to_name(
  1606.      struct idmap_user user;
  1607.      int status;
  1608.  
  1609. -    dprintf(IDLVL, "--> nfs41_idmap_uid_to_name(%u)\n", uid);
  1610. +    DPRINTF(IDLVL, ("--> nfs41_idmap_uid_to_name(%u)\n", (unsigned int)uid));
  1611.  
  1612.      lookup.value = (const void*)uidp;
  1613.  
  1614.      /* look up the user entry */
  1615.      status = idmap_lookup_user(context, &lookup, &user);
  1616.      if (status) {
  1617. -        dprintf(IDLVL, "<-- nfs41_idmap_uid_to_name(%u) "
  1618. -            "failed with %d\n", uid, status);
  1619. +        DPRINTF(IDLVL, ("<-- nfs41_idmap_uid_to_name(%u) "
  1620. +            "failed with %d\n", (unsigned int)uid, status));
  1621.          goto out;
  1622.      }
  1623.  
  1624. @@ -1071,8 +1077,8 @@ int nfs41_idmap_uid_to_name(
  1625.          goto out;
  1626.      }
  1627.  
  1628. -    dprintf(IDLVL, "<-- nfs41_idmap_uid_to_name(%u) "
  1629. -        "returning '%s'\n", uid, name);
  1630. +    DPRINTF(IDLVL, ("<-- nfs41_idmap_uid_to_name(%u) "
  1631. +        "returning '%s'\n", uid, name));
  1632.  out:
  1633.      return status;
  1634.  }
  1635. @@ -1097,22 +1103,22 @@ int nfs41_idmap_principal_to_ids(
  1636.      struct idmap_user user;
  1637.      int status;
  1638.  
  1639. -    dprintf(IDLVL, "--> nfs41_idmap_principal_to_ids('%s')\n", principal);
  1640. +    DPRINTF(IDLVL, ("--> nfs41_idmap_principal_to_ids('%s')\n", principal));
  1641.  
  1642.      lookup.value = principal;
  1643.  
  1644.      /* look up the user entry */
  1645.      status = idmap_lookup_user(context, &lookup, &user);
  1646.      if (status) {
  1647. -        dprintf(IDLVL, "<-- nfs41_idmap_principal_to_ids('%s') "
  1648. -            "failed with %d\n", principal, status);
  1649. +        DPRINTF(IDLVL, ("<-- nfs41_idmap_principal_to_ids('%s') "
  1650. +            "failed with %d\n", principal, status));
  1651.          goto out;
  1652.      }
  1653.  
  1654.      *uid_out = user.uid;
  1655.      *gid_out = user.gid;
  1656. -    dprintf(IDLVL, "<-- nfs41_idmap_principal_to_ids('%s') "
  1657. -        "returning uid=%u, gid=%u\n", principal, user.uid, user.gid);
  1658. +    DPRINTF(IDLVL, ("<-- nfs41_idmap_principal_to_ids('%s') "
  1659. +        "returning uid=%u, gid=%u\n", principal, user.uid, user.gid));
  1660.  out:
  1661.      return status;
  1662.  }
  1663. @@ -1136,21 +1142,21 @@ int nfs41_idmap_group_to_gid(
  1664.      struct idmap_group group;
  1665.      int status;
  1666.  
  1667. -    dprintf(IDLVL, "--> nfs41_idmap_group_to_gid('%s')\n", name);
  1668. +    DPRINTF(IDLVL, ("--> nfs41_idmap_group_to_gid('%s')\n", name));
  1669.  
  1670.      lookup.value = name;
  1671.  
  1672.      /* look up the group entry */
  1673.      status = idmap_lookup_group(context, &lookup, &group);
  1674.      if (status) {
  1675. -        dprintf(IDLVL, "<-- nfs41_idmap_group_to_gid('%s') "
  1676. -            "failed with %d\n", name, status);
  1677. +        DPRINTF(IDLVL, ("<-- nfs41_idmap_group_to_gid('%s') "
  1678. +            "failed with %d\n", name, status));
  1679.          goto out;
  1680.      }
  1681.  
  1682.      *gid_out = group.gid;
  1683. -    dprintf(IDLVL, "<-- nfs41_idmap_group_to_gid('%s') "
  1684. -        "returning %u\n", name, group.gid);
  1685. +    DPRINTF(IDLVL, ("<-- nfs41_idmap_group_to_gid('%s') "
  1686. +        "returning %u\n", name, group.gid));
  1687.  out:
  1688.      return status;
  1689.  }
  1690. @@ -1175,15 +1181,15 @@ int nfs41_idmap_gid_to_group(
  1691.      struct idmap_group group;
  1692.      int status;
  1693.  
  1694. -    dprintf(IDLVL, "--> nfs41_idmap_gid_to_group(%u)\n", gid);
  1695. +    DPRINTF(IDLVL, ("--> nfs41_idmap_gid_to_group(%u)\n", gid));
  1696.  
  1697.      lookup.value = (const void*)gidp;
  1698.  
  1699.      /* look up the group entry */
  1700.      status = idmap_lookup_group(context, &lookup, &group);
  1701.      if (status) {
  1702. -        dprintf(IDLVL, "<-- nfs41_idmap_gid_to_group(%u) "
  1703. -            "failed with %d\n", gid, status);
  1704. +        DPRINTF(IDLVL, ("<-- nfs41_idmap_gid_to_group(%u) "
  1705. +            "failed with %d\n", gid, status));
  1706.          goto out;
  1707.      }
  1708.  
  1709. @@ -1194,8 +1200,8 @@ int nfs41_idmap_gid_to_group(
  1710.          goto out;
  1711.      }
  1712.  
  1713. -    dprintf(IDLVL, "<-- nfs41_idmap_gid_to_group(%u) "
  1714. -        "returning '%s'\n", gid, name);
  1715. +    DPRINTF(IDLVL, ("<-- nfs41_idmap_gid_to_group(%u) "
  1716. +        "returning '%s'\n", gid, name));
  1717.  out:
  1718.      return status;
  1719.  }
  1720. diff --git a/daemon/idmap_cygwin.c b/daemon/idmap_cygwin.c
  1721. index 41c2c67..766e784 100644
  1722. --- a/daemon/idmap_cygwin.c
  1723. +++ b/daemon/idmap_cygwin.c
  1724. @@ -60,7 +60,7 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
  1725.      cpv_name_val *cnv_cur = NULL;
  1726.      const char *localaccoutname = NULL;
  1727.  
  1728. -    dprintf(CYGWINIDLVL, "--> cygwin_getent_passwd('%s')\n", name);
  1729. +    DPRINTF(CYGWINIDLVL, ("--> cygwin_getent_passwd('%s')\n", name));
  1730.  
  1731.      /* fixme: better quoting for |name| needed */
  1732.      (void)snprintf(cmdbuff, sizeof(cmdbuff),
  1733. @@ -69,33 +69,33 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
  1734.          name);
  1735.      if ((script_pipe = subcmd_popen(cmdbuff)) == NULL) {
  1736.          int last_error = GetLastError();
  1737. -        dprintf(0, "cygwin_getent_passwd: '%s' failed, GetLastError()='%d'\n",
  1738. +        DPRINTF(0, ("cygwin_getent_passwd: '%s' failed, GetLastError()='%d'\n",
  1739.              cmdbuff,
  1740. -            last_error);
  1741. +            last_error));
  1742.          goto fail;
  1743.      }
  1744.  
  1745.      if (!subcmd_readcmdoutput(script_pipe,
  1746.          buff, sizeof(buff), &num_buff_read)) {
  1747. -        dprintf(0, "cygwin_getent_passwd: subcmd_readcmdoutput() failed\n");
  1748. +        DPRINTF(0, ("cygwin_getent_passwd: subcmd_readcmdoutput() failed\n"));
  1749.          goto fail;
  1750.      }
  1751.  
  1752.      buff[num_buff_read] = '\0';
  1753.  
  1754.      if (num_buff_read < 10) {
  1755. -        dprintf(0, "cygwin_getent_passwd: Could not read enough data, returned %d\n", (int)num_buff_read);
  1756. +        DPRINTF(0, ("cygwin_getent_passwd: Could not read enough data, returned %d\n", (int)num_buff_read));
  1757.          goto fail;
  1758.      }
  1759.  
  1760.      cpvp = cpv_create_parser(buff, 0/*CPVFLAG_DEBUG_OUTPUT*/);
  1761.      if (!cpvp) {
  1762. -        dprintf(0, "cygwin_getent_passwd: Could not create parser\n");
  1763. +        DPRINTF(0, ("cygwin_getent_passwd: Could not create parser\n"));
  1764.          goto fail;
  1765.      }
  1766.  
  1767.      if (cpv_read_cpv_header(cpvp)) {
  1768. -        dprintf(0, "cygwin_getent_passwd: cpv_read_cpv_header failed\n");
  1769. +        DPRINTF(0, ("cygwin_getent_passwd: cpv_read_cpv_header failed\n"));
  1770.          goto fail;
  1771.      }
  1772.  
  1773. @@ -141,16 +141,16 @@ fail:
  1774.      cpv_free_parser(cpvp);
  1775.  
  1776.      if (res == 0) {
  1777. -        dprintf(CYGWINIDLVL, "<-- cygwin_getent_passwd('%s'): "
  1778. -            "returning res_uid=%lu, res_gid=%lu, res_loginname='%s'\n",
  1779. +        DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_passwd('%s'): "
  1780. +            "returning res_uid=%u, res_gid=%u, res_loginname='%s'\n",
  1781.              name,
  1782. -            (unsigned long)(*res_uid),
  1783. -            (unsigned long)(*res_gid),
  1784. -            res_loginname?res_loginname:"<NULL>");
  1785. +            (unsigned int)(*res_uid),
  1786. +            (unsigned int)(*res_gid),
  1787. +            res_loginname?res_loginname:"<NULL>"));
  1788.      }
  1789.      else {
  1790. -        dprintf(CYGWINIDLVL, "<-- cygwin_getent_passwd('%s'): no match found\n",
  1791. -            name);
  1792. +        DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_passwd('%s'): no match found\n",
  1793. +            name));
  1794.      }
  1795.  
  1796.      return res;
  1797. @@ -172,7 +172,7 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
  1798.  
  1799.      const char *localgroupname = NULL;
  1800.  
  1801. -    dprintf(CYGWINIDLVL, "--> cygwin_getent_group('%s')\n", name);
  1802. +    DPRINTF(CYGWINIDLVL, ("--> cygwin_getent_group('%s')\n", name));
  1803.  
  1804.      /* fixme: better quoting for |name| needed */
  1805.      (void)snprintf(cmdbuff, sizeof(cmdbuff),
  1806. @@ -181,33 +181,33 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
  1807.          name);
  1808.      if ((script_pipe = subcmd_popen(cmdbuff)) == NULL) {
  1809.          int last_error = GetLastError();
  1810. -        dprintf(0, "cygwin_getent_group: '%s' failed, GetLastError()='%d'\n",
  1811. +        DPRINTF(0, ("cygwin_getent_group: '%s' failed, GetLastError()='%d'\n",
  1812.              cmdbuff,
  1813. -            last_error);
  1814. +            last_error));
  1815.          goto fail;
  1816.      }
  1817.  
  1818.      if (!subcmd_readcmdoutput(script_pipe,
  1819.          buff, sizeof(buff), &num_buff_read)) {
  1820. -        dprintf(0, "cygwin_getent_group: subcmd_readcmdoutput() failed\n");
  1821. +        DPRINTF(0, ("cygwin_getent_group: subcmd_readcmdoutput() failed\n"));
  1822.          goto fail;
  1823.      }
  1824.  
  1825.      buff[num_buff_read] = '\0';
  1826.  
  1827.      if (num_buff_read < 10) {
  1828. -        dprintf(0, "cygwin_getent_group: Could not read enough data, returned %d\n", (int)num_buff_read);
  1829. +        DPRINTF(0, ("cygwin_getent_group: Could not read enough data, returned %d\n", (int)num_buff_read));
  1830.          goto fail;
  1831.      }
  1832.  
  1833.      cpvp = cpv_create_parser(buff, 0/*CPVFLAG_DEBUG_OUTPUT*/);
  1834.      if (!cpvp) {
  1835. -        dprintf(0, "cygwin_getent_group: Could not create parser\n");
  1836. +        DPRINTF(0, ("cygwin_getent_group: Could not create parser\n"));
  1837.          goto fail;
  1838.      }
  1839.  
  1840.      if (cpv_read_cpv_header(cpvp)) {
  1841. -        dprintf(0, "cygwin_getent_group: cpv_read_cpv_header failed\n");
  1842. +        DPRINTF(0, ("cygwin_getent_group: cpv_read_cpv_header failed\n"));
  1843.          goto fail;
  1844.      }
  1845.  
  1846. @@ -246,15 +246,15 @@ fail:
  1847.      cpv_free_parser(cpvp);
  1848.  
  1849.      if (res == 0) {
  1850. -        dprintf(CYGWINIDLVL, "<-- cygwin_getent_group('%s'): "
  1851. -            "returning res_gid=%lu, res_group_name='%s'\n",
  1852. +        DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_group('%s'): "
  1853. +            "returning res_gid=%u, res_group_name='%s'\n",
  1854.              name,
  1855. -            (unsigned long)(*res_gid),
  1856. -            res_group_name?res_group_name:"<NULL>");
  1857. +            (unsigned int)(*res_gid),
  1858. +            res_group_name?res_group_name:"<NULL>"));
  1859.      }
  1860.      else {
  1861. -        dprintf(CYGWINIDLVL, "<-- cygwin_getent_group('%s'): no match found\n",
  1862. -            name);
  1863. +        DPRINTF(CYGWINIDLVL, ("<-- cygwin_getent_group('%s'): no match found\n",
  1864. +            name));
  1865.      }
  1866.  
  1867.      return res;
  1868. diff --git a/daemon/lock.c b/daemon/lock.c
  1869. index 9b9945f..bb7fee7 100644
  1870. --- a/daemon/lock.c
  1871. +++ b/daemon/lock.c
  1872. @@ -180,9 +180,9 @@ static int parse_lock(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
  1873.      status = safe_read(&buffer, &length, &args->blocking, sizeof(BOOLEAN));
  1874.      if (status) goto out;
  1875.  
  1876. -    dprintf(1, "parsing NFS41_LOCK: offset=0x%llx length=0x%llx exclusive=%u "
  1877. +    DPRINTF(1, ("parsing NFS41_LOCK: offset=0x%llx length=0x%llx exclusive=%u "
  1878.              "blocking=%u\n", args->offset, args->length, args->exclusive,
  1879. -            args->blocking);
  1880. +            args->blocking));
  1881.  out:
  1882.      return status;
  1883.  }
  1884. @@ -222,8 +222,8 @@ static int handle_lock(void *deamon_context, nfs41_upcall *upcall)
  1885.  
  1886.      /* if we hold a write delegation, handle the lock locally */
  1887.      if (open_lock_delegate(state, lock)) {
  1888. -        dprintf(LKLVL, "delegated lock { %llu, %llu }\n",
  1889. -            lock->offset, lock->length);
  1890. +        DPRINTF(LKLVL, ("delegated lock { %llu, %llu }\n",
  1891. +            lock->offset, lock->length));
  1892.          args->acquired = TRUE; /* for cancel_lock() */
  1893.          goto out;
  1894.      }
  1895. @@ -243,8 +243,8 @@ static int handle_lock(void *deamon_context, nfs41_upcall *upcall)
  1896.      status = nfs41_lock(state->session, &state->file, &state->owner,
  1897.          type, lock->offset, lock->length, FALSE, TRUE, &stateid);
  1898.      if (status) {
  1899. -        dprintf(LKLVL, "nfs41_lock failed with %s\n",
  1900. -            nfs_error_string(status));
  1901. +        DPRINTF(LKLVL, ("nfs41_lock failed with '%s'\n",
  1902. +            nfs_error_string(status)));
  1903.          status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  1904.          LeaveCriticalSection(&state->locks.lock);
  1905.          goto out_free;
  1906. @@ -271,7 +271,7 @@ static void cancel_lock(IN nfs41_upcall *upcall)
  1907.      nfs41_open_state *state = upcall->state_ref;
  1908.      int status = NO_ERROR;
  1909.  
  1910. -    dprintf(1, "--> cancel_lock()\n");
  1911. +    DPRINTF(1, ("--> cancel_lock()\n"));
  1912.  
  1913.      /* can't do 'if (upcall->status)' here, because a handle_lock() success
  1914.       * could be overwritten by upcall_marshall() or allocation failure */
  1915. @@ -297,7 +297,7 @@ static void cancel_lock(IN nfs41_upcall *upcall)
  1916.  
  1917.      status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  1918.  out:
  1919. -    dprintf(1, "<-- cancel_lock() returning %d\n", status);
  1920. +    DPRINTF(1, ("<-- cancel_lock() returning %d\n", status));
  1921.  }
  1922.  
  1923.  
  1924. @@ -313,7 +313,7 @@ static int parse_unlock(unsigned char *buffer, uint32_t length, nfs41_upcall *up
  1925.      args->buf = buffer;
  1926.      args->buf_len = length;
  1927.  
  1928. -    dprintf(1, "parsing NFS41_UNLOCK: count=%u\n", args->count);
  1929. +    DPRINTF(1, ("parsing NFS41_UNLOCK: count=%u\n", args->count));
  1930.  out:
  1931.      return status;
  1932.  }
  1933. diff --git a/daemon/lookup.c b/daemon/lookup.c
  1934. index 3c6bda8..7685188 100644
  1935. --- a/daemon/lookup.c
  1936. +++ b/daemon/lookup.c
  1937. @@ -409,7 +409,7 @@ static int referral_resolve(
  1938.      status = nfs41_fs_locations(session_in, &referral->parent,
  1939.          &referral->name, &locations);
  1940.      if (status) {
  1941. -        eprintf("nfs41_fs_locations() failed with %s\n",
  1942. +        eprintf("nfs41_fs_locations() failed with '%s'\n",
  1943.              nfs_error_string(status));
  1944.          status = nfs_to_windows_error(status, ERROR_PATH_NOT_FOUND);
  1945.          goto out;
  1946. @@ -473,7 +473,7 @@ int nfs41_lookup(
  1947.      path_pos = path.path;
  1948.      path_end = path.path + path.len;
  1949.  
  1950. -    dprintf(LULVL, "--> nfs41_lookup('%s')\n", path.path);
  1951. +    DPRINTF(LULVL, ("--> nfs41_lookup('%s')\n", path.path));
  1952.  
  1953.      if (parent_out == NULL) parent_out = &parent;
  1954.      if (target_out == NULL) target_out = &target;
  1955. @@ -525,6 +525,6 @@ int nfs41_lookup(
  1956.              parent_out, target_out, info_out, session_out);
  1957.      }
  1958.  out:
  1959. -    dprintf(LULVL, "<-- nfs41_lookup() returning %d\n", status);
  1960. +    DPRINTF(LULVL, ("<-- nfs41_lookup() returning %d\n", status));
  1961.      return status;
  1962.  }
  1963. diff --git a/daemon/mount.c b/daemon/mount.c
  1964. index d562753..5a071b9 100644
  1965. --- a/daemon/mount.c
  1966. +++ b/daemon/mount.c
  1967. @@ -46,13 +46,13 @@ static int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
  1968.      status = safe_read(&buffer, &length, &args->wsize, sizeof(DWORD));
  1969.      if (status) goto out;
  1970.  
  1971. -    dprintf(1, "parsing NFS41_MOUNT: hostport='%s' root='%s' "
  1972. +    DPRINTF(1, ("parsing NFS41_MOUNT: hostport='%s' root='%s' "
  1973.          "sec_flavor='%s' rsize=%d wsize=%d\n",
  1974.          args->hostport, args->path, secflavorop2name(args->sec_flavor),
  1975. -        args->rsize, args->wsize);
  1976. +        args->rsize, args->wsize));
  1977.      return status;
  1978.  out:
  1979. -    dprintf(1, "parsing NFS41_MOUNT: failed %d\n", status);
  1980. +    DPRINTF(1, ("parsing NFS41_MOUNT: failed %d\n", status));
  1981.      return status;
  1982.  }
  1983.  
  1984. @@ -72,7 +72,7 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  1985.      EASSERT(args->hostport != NULL);
  1986.  
  1987.      if ((args->path == NULL) || (strlen(args->path) == 0)) {
  1988. -        dprintf(1, "handle_mount: empty mount root\n");
  1989. +        DPRINTF(1, ("handle_mount: empty mount root\n"));
  1990.          status = ERROR_BAD_NETPATH;
  1991.          goto out;
  1992.      }
  1993. @@ -89,8 +89,8 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  1994.              goto out;
  1995.         }
  1996.  
  1997. -       dprintf(1, "handle_mount: hostname='%s', port=%d\n",
  1998. -            hostname, port);
  1999. +       DPRINTF(1, ("handle_mount: hostname='%s', port=%d\n",
  2000. +            hostname, port));
  2001.      } else {
  2002.          eprintf("handle_mount: port not specified in hostport '%s'\n",
  2003.              args->hostport);
  2004. @@ -178,8 +178,8 @@ static int marshall_mount(unsigned char *buffer, uint32_t *length, nfs41_upcall
  2005.  {
  2006.      mount_upcall_args *args = &upcall->args.mount;
  2007.      int status;
  2008. -    dprintf(2, "NFS41_MOUNT: writing pointer to nfs41_root %p, version %d, "
  2009. -        "lease_time %d\n", upcall->root_ref, NFS41D_VERSION, args->lease_time);
  2010. +    DPRINTF(2, ("NFS41_MOUNT: writing pointer to nfs41_root 0x%p, version %d, "
  2011. +        "lease_time %d\n", upcall->root_ref, NFS41D_VERSION, args->lease_time));
  2012.      status = safe_write(&buffer, length, &upcall->root_ref, sizeof(HANDLE));
  2013.      if (status) goto out;
  2014.      status = safe_write(&buffer, length, &NFS41D_VERSION, sizeof(DWORD));
  2015. @@ -208,7 +208,7 @@ const nfs41_upcall_op nfs41_op_mount = {
  2016.  /* NFS41_UNMOUNT */
  2017.  static int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  2018.  {
  2019. -    dprintf(1, "parsing NFS41_UNMOUNT: root=%p\n", upcall->root_ref);
  2020. +    DPRINTF(1, ("parsing NFS41_UNMOUNT: root=0x%p\n", upcall->root_ref));
  2021.      return ERROR_SUCCESS;
  2022.  }
  2023.  
  2024. diff --git a/daemon/name_cache.c b/daemon/name_cache.c
  2025. index 43f35c9..56f450b 100644
  2026. --- a/daemon/name_cache.c
  2027. +++ b/daemon/name_cache.c
  2028. @@ -149,7 +149,7 @@ static __inline void attr_cache_entry_free(
  2029.      IN struct attr_cache *cache,
  2030.      IN struct attr_cache_entry *entry)
  2031.  {
  2032. -    dprintf(NCLVL1, "attr_cache_entry_free(%llu)\n", entry->fileid);
  2033. +    DPRINTF(NCLVL1, ("attr_cache_entry_free(%llu)\n", entry->fileid));
  2034.      RB_REMOVE(attr_tree, &cache->head, entry);
  2035.      /* add it back to free_entries */
  2036.      list_add_tail(&cache->free_entries, &entry->free_entry);
  2037. @@ -160,8 +160,8 @@ static __inline void attr_cache_entry_ref(
  2038.      IN struct attr_cache_entry *entry)
  2039.  {
  2040.      const uint32_t previous = entry->ref_count++;
  2041. -    dprintf(NCLVL2, "attr_cache_entry_ref(%llu) %u -> %u\n",
  2042. -        entry->fileid, previous, entry->ref_count);
  2043. +    DPRINTF(NCLVL2, ("attr_cache_entry_ref(%llu) %u -> %u\n",
  2044. +        entry->fileid, previous, entry->ref_count));
  2045.  }
  2046.  
  2047.  static __inline void attr_cache_entry_deref(
  2048. @@ -169,8 +169,8 @@ static __inline void attr_cache_entry_deref(
  2049.      IN struct attr_cache_entry *entry)
  2050.  {
  2051.      const uint32_t previous = entry->ref_count--;
  2052. -    dprintf(NCLVL2, "attr_cache_entry_deref(%llu) %u -> %u\n",
  2053. -        entry->fileid, previous, entry->ref_count);
  2054. +    DPRINTF(NCLVL2, ("attr_cache_entry_deref(%llu) %u -> %u\n",
  2055. +        entry->fileid, previous, entry->ref_count));
  2056.  
  2057.      if (entry->ref_count == 0)
  2058.          attr_cache_entry_free(cache, entry);
  2059. @@ -233,12 +233,12 @@ static int attr_cache_insert(
  2060.  {
  2061.      int status = NO_ERROR;
  2062.  
  2063. -    dprintf(NCLVL2, "--> attr_cache_insert(%llu)\n", entry->fileid);
  2064. +    DPRINTF(NCLVL2, ("--> attr_cache_insert(%llu)\n", entry->fileid));
  2065.  
  2066.      if (RB_INSERT(attr_tree, &cache->head, entry))
  2067.          status = ERROR_FILE_EXISTS;
  2068.  
  2069. -    dprintf(NCLVL2, "<-- attr_cache_insert() returning %d\n", status);
  2070. +    DPRINTF(NCLVL2, ("<-- attr_cache_insert() returning %d\n", status));
  2071.      return status;
  2072.  }
  2073.  
  2074. @@ -250,7 +250,7 @@ static int attr_cache_find_or_create(
  2075.      struct attr_cache_entry *entry;
  2076.      int status = NO_ERROR;
  2077.  
  2078. -    dprintf(NCLVL1, "--> attr_cache_find_or_create(%llu)\n", fileid);
  2079. +    DPRINTF(NCLVL1, ("--> attr_cache_find_or_create(%llu)\n", fileid));
  2080.  
  2081.      /* look for an existing entry */
  2082.      entry = attr_cache_search(cache, fileid);
  2083. @@ -270,8 +270,8 @@ static int attr_cache_find_or_create(
  2084.  
  2085.  out:
  2086.      *entry_out = entry;
  2087. -    dprintf(NCLVL1, "<-- attr_cache_find_or_create() returning %d\n",
  2088. -        status);
  2089. +    DPRINTF(NCLVL1, ("<-- attr_cache_find_or_create() returning %d\n",
  2090. +        status));
  2091.      return status;
  2092.  
  2093.  out_err_free:
  2094. @@ -504,8 +504,8 @@ static int name_cache_entry_create(
  2095.          entry = name_entry(cache->exp_entries.prev);
  2096.          name_cache_unlink(cache, entry);
  2097.  
  2098. -        dprintf(NCLVL2, "name_cache_entry_create('%s') scavenged 0x%p\n",
  2099. -            component->name, entry);
  2100. +        DPRINTF(NCLVL2, ("name_cache_entry_create('%s') scavenged 0x%p\n",
  2101. +            component->name, entry));
  2102.      } else {
  2103.          /* take the next entry in the pool and add it to exp_entries */
  2104.          entry = &cache->pool[cache->entries++];
  2105. @@ -603,14 +603,14 @@ static int name_cache_entry_changed(
  2106.              (cinfo->atomic && cinfo->before == entry->attributes->change)) {
  2107.          entry->attributes->change = cinfo->after;
  2108.          name_cache_entry_updated(cache, entry);
  2109. -        dprintf(NCLVL1, "name_cache_entry_changed('%s') has not changed. "
  2110. +        DPRINTF(NCLVL1, ("name_cache_entry_changed('%s') has not changed. "
  2111.              "updated change=%llu\n", entry->component,
  2112. -            entry->attributes->change);
  2113. +            entry->attributes->change));
  2114.          return FALSE;
  2115.      } else {
  2116. -        dprintf(NCLVL1, "name_cache_entry_changed('%s') has changed: was %llu, "
  2117. +        DPRINTF(NCLVL1, ("name_cache_entry_changed('%s') has changed: was %llu, "
  2118.              "got before=%llu\n", entry->component,
  2119. -            entry->attributes->change, cinfo->before);
  2120. +            entry->attributes->change, cinfo->before));
  2121.          return TRUE;
  2122.      }
  2123.  }
  2124. @@ -619,7 +619,7 @@ static void name_cache_entry_invalidate(
  2125.      IN struct nfs41_name_cache *cache,
  2126.      IN struct name_cache_entry *entry)
  2127.  {
  2128. -    dprintf(NCLVL1, "name_cache_entry_invalidate('%s')\n", entry->component);
  2129. +    DPRINTF(NCLVL1, ("name_cache_entry_invalidate('%s')\n", entry->component));
  2130.  
  2131.      if (entry->attributes) {
  2132.          /* flag attributes so that entry_invis() will return true
  2133. @@ -636,19 +636,21 @@ static struct name_cache_entry* name_cache_search(
  2134.  {
  2135.      struct name_cache_entry tmp, *entry;
  2136.  
  2137. -    dprintf(NCLVL2, "--> name_cache_search('%.*s' under '%s')\n",
  2138. -        component->len, component->name, parent->component);
  2139. +    DPRINTF(NCLVL2, ("--> name_cache_search('%.*s' under '%s')\n",
  2140. +        component->len, component->name, parent->component));
  2141.  
  2142.      StringCchCopyNA(tmp.component, NFS41_MAX_COMPONENT_LEN,
  2143.          component->name, component->len);
  2144.      tmp.component_len = component->len;
  2145.  
  2146.      entry = RB_FIND(name_tree, &parent->rbchildren, &tmp);
  2147. -    if (entry)
  2148. -        dprintf(NCLVL2, "<-- name_cache_search() "
  2149. -            "found existing entry 0x%p\n", entry);
  2150. -    else
  2151. -        dprintf(NCLVL2, "<-- name_cache_search() returning NULL\n");
  2152. +    if (entry) {
  2153. +        DPRINTF(NCLVL2, ("<-- name_cache_search() "
  2154. +            "found existing entry 0x%p\n", entry));
  2155. +    }
  2156. +    else {
  2157. +        DPRINTF(NCLVL2, ("<-- name_cache_search() returning NULL\n"));
  2158. +    }
  2159.      return entry;
  2160.  }
  2161.  
  2162. @@ -658,19 +660,19 @@ static int entry_invis(
  2163.  {
  2164.      /* name entry timer expired? */
  2165.      if (!list_empty(&entry->exp_entry) && time(NULL) > entry->expiration) {
  2166. -        dprintf(NCLVL2, "name_entry_expired('%s')\n", entry->component);
  2167. +        DPRINTF(NCLVL2, ("name_entry_expired('%s')\n", entry->component));
  2168.          return 1;
  2169.      }
  2170.      /* negative lookup entry? */
  2171.      if (entry->attributes == NULL) {
  2172.          if (is_negative) *is_negative = 1;
  2173. -        dprintf(NCLVL2, "name_entry_negative('%s')\n", entry->component);
  2174. +        DPRINTF(NCLVL2, ("name_entry_negative('%s')\n", entry->component));
  2175.          return 1;
  2176.      }
  2177.      /* attribute entry expired? */
  2178.      if (attr_cache_entry_expired(entry->attributes)) {
  2179. -        dprintf(NCLVL2, "attr_entry_expired(%llu)\n",
  2180. -            entry->attributes->fileid);
  2181. +        DPRINTF(NCLVL2, ("attr_entry_expired(%llu)\n",
  2182. +            entry->attributes->fileid));
  2183.          return 1;
  2184.      }
  2185.      return 0;
  2186. @@ -691,7 +693,7 @@ static int name_cache_lookup(
  2187.      const char *path_pos;
  2188.      int status = NO_ERROR;
  2189.  
  2190. -    dprintf(NCLVL1, "--> name_cache_lookup('%s')\n", path);
  2191. +    DPRINTF(NCLVL1, ("--> name_cache_lookup('%s')\n", path));
  2192.  
  2193.      parent = NULL;
  2194.      target = cache->root;
  2195. @@ -720,7 +722,7 @@ out:
  2196.      if (remaining_path_out) *remaining_path_out = component.name;
  2197.      if (parent_out) *parent_out = parent;
  2198.      if (target_out) *target_out = target;
  2199. -    dprintf(NCLVL1, "<-- name_cache_lookup() returning %d\n", status);
  2200. +    DPRINTF(NCLVL1, ("<-- name_cache_lookup() returning %d\n", status));
  2201.      return status;
  2202.  }
  2203.  
  2204. @@ -730,13 +732,13 @@ static int name_cache_insert(
  2205.  {
  2206.      int status = NO_ERROR;
  2207.  
  2208. -    dprintf(NCLVL2, "--> name_cache_insert('%s')\n", entry->component);
  2209. +    DPRINTF(NCLVL2, ("--> name_cache_insert('%s')\n", entry->component));
  2210.  
  2211.      if (RB_INSERT(name_tree, &parent->rbchildren, entry))
  2212.          status = ERROR_FILE_EXISTS;
  2213.      entry->parent = parent;
  2214.  
  2215. -    dprintf(NCLVL2, "<-- name_cache_insert() returning %u\n", status);
  2216. +    DPRINTF(NCLVL2, ("<-- name_cache_insert() returning %u\n", status));
  2217.      return status;
  2218.  }
  2219.  
  2220. @@ -748,8 +750,8 @@ static int name_cache_find_or_create(
  2221.  {
  2222.      int status = NO_ERROR;
  2223.  
  2224. -    dprintf(NCLVL1, "--> name_cache_find_or_create('%.*s' under '%s')\n",
  2225. -        component->len, component->name, parent->component);
  2226. +    DPRINTF(NCLVL1, ("--> name_cache_find_or_create('%.*s' under '%s')\n",
  2227. +        component->len, component->name, parent->component));
  2228.  
  2229.      *target_out = name_cache_search(cache, parent, component);
  2230.      if (*target_out)
  2231. @@ -764,8 +766,8 @@ static int name_cache_find_or_create(
  2232.          goto out_err;
  2233.  
  2234.  out:
  2235. -    dprintf(NCLVL1, "<-- name_cache_find_or_create() returning %d\n",
  2236. -        status);
  2237. +    DPRINTF(NCLVL1, ("<-- name_cache_find_or_create() returning %d\n",
  2238. +        status));
  2239.      return status;
  2240.  
  2241.  out_err:
  2242. @@ -786,7 +788,7 @@ int nfs41_name_cache_create(
  2243.      struct nfs41_name_cache *cache;
  2244.      int status = NO_ERROR;
  2245.  
  2246. -    dprintf(NCLVL1, "nfs41_name_cache_create()\n");
  2247. +    DPRINTF(NCLVL1, ("nfs41_name_cache_create()\n"));
  2248.  
  2249.      /* allocate the cache */
  2250.      cache = calloc(1, sizeof(struct nfs41_name_cache));
  2251. @@ -830,7 +832,7 @@ int nfs41_name_cache_free(
  2252.      struct nfs41_name_cache *cache = *cache_out;
  2253.      int status = NO_ERROR;
  2254.  
  2255. -    dprintf(NCLVL1, "nfs41_name_cache_free()\n");
  2256. +    DPRINTF(NCLVL1, ("nfs41_name_cache_free()\n"));
  2257.  
  2258.      /* free the attribute cache */
  2259.      attr_cache_free(&cache->attributes);
  2260. @@ -895,7 +897,7 @@ int nfs41_attr_cache_lookup(
  2261.      struct attr_cache_entry *entry;
  2262.      int status = NO_ERROR;
  2263.  
  2264. -    dprintf(NCLVL1, "--> nfs41_attr_cache_lookup(%llu)\n", fileid);
  2265. +    DPRINTF(NCLVL1, ("--> nfs41_attr_cache_lookup(%llu)\n", fileid));
  2266.  
  2267.      AcquireSRWLockShared(&cache->lock);
  2268.  
  2269. @@ -915,7 +917,7 @@ int nfs41_attr_cache_lookup(
  2270.  out_unlock:
  2271.      ReleaseSRWLockShared(&cache->lock);
  2272.  
  2273. -    dprintf(NCLVL1, "<-- nfs41_attr_cache_lookup() returning %d\n", status);
  2274. +    DPRINTF(NCLVL1, ("<-- nfs41_attr_cache_lookup() returning %d\n", status));
  2275.      return status;
  2276.  }
  2277.  
  2278. @@ -927,7 +929,7 @@ int nfs41_attr_cache_update(
  2279.      struct attr_cache_entry *entry;
  2280.      int status = NO_ERROR;
  2281.  
  2282. -    dprintf(NCLVL1, "--> nfs41_attr_cache_update(%llu)\n", fileid);
  2283. +    DPRINTF(NCLVL1, ("--> nfs41_attr_cache_update(%llu)\n", fileid));
  2284.  
  2285.      AcquireSRWLockExclusive(&cache->lock);
  2286.  
  2287. @@ -947,7 +949,7 @@ int nfs41_attr_cache_update(
  2288.  out_unlock:
  2289.      ReleaseSRWLockExclusive(&cache->lock);
  2290.  
  2291. -    dprintf(NCLVL1, "<-- nfs41_attr_cache_update() returning %d\n", status);
  2292. +    DPRINTF(NCLVL1, ("<-- nfs41_attr_cache_update() returning %d\n", status));
  2293.      return status;
  2294.  }
  2295.  
  2296. @@ -963,8 +965,8 @@ int nfs41_name_cache_insert(
  2297.      struct name_cache_entry *parent, *target;
  2298.      int status;
  2299.  
  2300. -    dprintf(NCLVL1, "--> nfs41_name_cache_insert('%.*s')\n",
  2301. -        name->name + name->len - path, path);
  2302. +    DPRINTF(NCLVL1, ("--> nfs41_name_cache_insert('%.*s')\n",
  2303. +        name->name + name->len - path, path));
  2304.  
  2305.      AcquireSRWLockExclusive(&cache->lock);
  2306.  
  2307. @@ -1015,8 +1017,8 @@ int nfs41_name_cache_insert(
  2308.  out_unlock:
  2309.      ReleaseSRWLockExclusive(&cache->lock);
  2310.  
  2311. -    dprintf(NCLVL1, "<-- nfs41_name_cache_insert() returning %d\n",
  2312. -        status);
  2313. +    DPRINTF(NCLVL1, ("<-- nfs41_name_cache_insert() returning %d\n",
  2314. +        status));
  2315.      return status;
  2316.  
  2317.  out_err_update:
  2318. @@ -1050,8 +1052,8 @@ int nfs41_name_cache_delegreturn(
  2319.      struct attr_cache_entry *attributes;
  2320.      int status;
  2321.  
  2322. -    dprintf(NCLVL1, "--> nfs41_name_cache_delegreturn(%llu, '%s')\n",
  2323. -        fileid, path);
  2324. +    DPRINTF(NCLVL1, ("--> nfs41_name_cache_delegreturn(%llu, '%s')\n",
  2325. +        fileid, path));
  2326.  
  2327.      AcquireSRWLockExclusive(&cache->lock);
  2328.  
  2329. @@ -1090,7 +1092,7 @@ int nfs41_name_cache_delegreturn(
  2330.  out_unlock:
  2331.      ReleaseSRWLockExclusive(&cache->lock);
  2332.  
  2333. -    dprintf(NCLVL1, "<-- nfs41_name_cache_delegreturn() returning %d\n", status);
  2334. +    DPRINTF(NCLVL1, ("<-- nfs41_name_cache_delegreturn() returning %d\n", status));
  2335.      return status;
  2336.  }
  2337.  
  2338. @@ -1105,7 +1107,7 @@ int nfs41_name_cache_remove(
  2339.      struct attr_cache_entry *attributes = NULL;
  2340.      int status;
  2341.  
  2342. -    dprintf(NCLVL1, "--> nfs41_name_cache_remove('%s')\n", path);
  2343. +    DPRINTF(NCLVL1, ("--> nfs41_name_cache_remove('%s')\n", path));
  2344.  
  2345.      AcquireSRWLockExclusive(&cache->lock);
  2346.  
  2347. @@ -1137,13 +1139,13 @@ int nfs41_name_cache_remove(
  2348.  out_unlock:
  2349.      ReleaseSRWLockExclusive(&cache->lock);
  2350.  
  2351. -    dprintf(NCLVL1, "<-- nfs41_name_cache_remove() returning %d\n", status);
  2352. +    DPRINTF(NCLVL1, ("<-- nfs41_name_cache_remove() returning %d\n", status));
  2353.      return status;
  2354.  
  2355.  out_attributes:
  2356.      /* in the presence of other links, we need to update numlinks
  2357.       * regardless of a failure to find the target entry */
  2358. -    dprintf(NCLVL1, "nfs41_name_cache_remove: need to find attributes for %s\n", path);
  2359. +    DPRINTF(NCLVL1, ("nfs41_name_cache_remove: need to find attributes for '%s'\n", path));
  2360.      attributes = attr_cache_search(&cache->attributes, fileid);
  2361.      if (attributes)
  2362.          attributes->numlinks--;
  2363. @@ -1163,8 +1165,8 @@ int nfs41_name_cache_rename(
  2364.      struct name_cache_entry *dst_parent;
  2365.      int status = NO_ERROR;
  2366.  
  2367. -    dprintf(NCLVL1, "--> nfs41_name_cache_rename('%s' to '%s')\n",
  2368. -        src_path, dst_path);
  2369. +    DPRINTF(NCLVL1, ("--> nfs41_name_cache_rename('%s' to '%s')\n",
  2370. +        src_path, dst_path));
  2371.  
  2372.      AcquireSRWLockExclusive(&cache->lock);
  2373.  
  2374. @@ -1179,8 +1181,8 @@ int nfs41_name_cache_rename(
  2375.      /* we can't create the dst entry without a parent */
  2376.      if (status || dst_parent->attributes == NULL) {
  2377.          /* if src exists, make it negative */
  2378. -        dprintf(NCLVL1, "nfs41_name_cache_rename: adding negative cache "
  2379. -            "entry for %.*s\n", src_name->len, src_name->name);
  2380. +        DPRINTF(NCLVL1, ("nfs41_name_cache_rename: adding negative cache "
  2381. +            "entry for '%.*s'\n", src_name->len, src_name->name));
  2382.          status = name_cache_lookup(cache, 0, src_path,
  2383.              src_name->name + src_name->len, NULL, NULL, &src, NULL);
  2384.          if (status == NO_ERROR) {
  2385. @@ -1198,8 +1200,8 @@ int nfs41_name_cache_rename(
  2386.      if (status || src->attributes == NULL) {
  2387.          /* remove dst if it exists */
  2388.          struct name_cache_entry *dst;
  2389. -        dprintf(NCLVL1, "nfs41_name_cache_rename: removing negative cache "
  2390. -            "entry for %.*s\n", dst_name->len, dst_name->name);
  2391. +        DPRINTF(NCLVL1, ("nfs41_name_cache_rename: removing negative cache "
  2392. +            "entry for '%.*s'\n", dst_name->len, dst_name->name));
  2393.          dst = name_cache_search(cache, dst_parent, dst_name);
  2394.          if (dst) name_cache_unlink(cache, dst);
  2395.          goto out_unlock;
  2396. @@ -1253,7 +1255,7 @@ int nfs41_name_cache_rename(
  2397.  out_unlock:
  2398.      ReleaseSRWLockExclusive(&cache->lock);
  2399.  
  2400. -    dprintf(NCLVL1, "<-- nfs41_name_cache_rename() returning %d\n", status);
  2401. +    DPRINTF(NCLVL1, ("<-- nfs41_name_cache_rename() returning %d\n", status));
  2402.      return status;
  2403.  }
  2404.  
  2405. @@ -1379,8 +1381,8 @@ static int delete_stale_component(
  2406.      struct name_cache_entry *target;
  2407.      int status;
  2408.  
  2409. -    dprintf(NCLVL1, "--> delete_stale_component('%s')\n",
  2410. -        component->name);
  2411. +    DPRINTF(NCLVL1, ("--> delete_stale_component('%s')\n",
  2412. +        component->name));
  2413.  
  2414.      AcquireSRWLockExclusive(&cache->lock);
  2415.  
  2416. @@ -1391,7 +1393,7 @@ static int delete_stale_component(
  2417.  
  2418.      ReleaseSRWLockExclusive(&cache->lock);
  2419.  
  2420. -    dprintf(NCLVL1, "<-- delete_stale_component() returning %d\n", status);
  2421. +    DPRINTF(NCLVL1, ("<-- delete_stale_component() returning %d\n", status));
  2422.      return status;
  2423.  }
  2424.  
  2425. diff --git a/daemon/namespace.c b/daemon/namespace.c
  2426. index e3ea077..a7a52b3 100644
  2427. --- a/daemon/namespace.c
  2428. +++ b/daemon/namespace.c
  2429. @@ -45,7 +45,7 @@ int nfs41_root_create(
  2430.      int status = NO_ERROR;
  2431.      nfs41_root *root;
  2432.  
  2433. -    dprintf(NSLVL, "--> nfs41_root_create(name=%s, port=%d)\n", name, port);
  2434. +    DPRINTF(NSLVL, ("--> nfs41_root_create(name='%s', port=%d)\n", name, port));
  2435.  
  2436.      root = calloc(1, sizeof(nfs41_root));
  2437.      if (root == NULL) {
  2438. @@ -70,7 +70,7 @@ int nfs41_root_create(
  2439.  
  2440.      *root_out = root;
  2441.  out:
  2442. -    dprintf(NSLVL, "<-- nfs41_root_create() returning %d\n", status);
  2443. +    DPRINTF(NSLVL, ("<-- nfs41_root_create() returning %d\n", status));
  2444.      return status;
  2445.  }
  2446.  
  2447. @@ -79,7 +79,7 @@ static void root_free(
  2448.  {
  2449.      struct list_entry *entry, *tmp;
  2450.  
  2451. -    dprintf(NSLVL, "--> nfs41_root_free()\n");
  2452. +    DPRINTF(NSLVL, ("--> nfs41_root_free()\n"));
  2453.  
  2454.      /* free clients */
  2455.      list_for_each_tmp(entry, tmp, &root->clients)
  2456. @@ -87,7 +87,7 @@ static void root_free(
  2457.      DeleteCriticalSection(&root->lock);
  2458.      free(root);
  2459.  
  2460. -    dprintf(NSLVL, "<-- nfs41_root_free()\n");
  2461. +    DPRINTF(NSLVL, ("<-- nfs41_root_free()\n"));
  2462.  }
  2463.  
  2464.  void nfs41_root_ref(
  2465. @@ -95,7 +95,7 @@ void nfs41_root_ref(
  2466.  {
  2467.      const LONG count = InterlockedIncrement(&root->ref_count);
  2468.  
  2469. -    dprintf(NSLVL, "nfs41_root_ref() count %d\n", count);
  2470. +    DPRINTF(NSLVL, ("nfs41_root_ref() count %d\n", count));
  2471.  }
  2472.  
  2473.  void nfs41_root_deref(
  2474. @@ -103,7 +103,7 @@ void nfs41_root_deref(
  2475.  {
  2476.      const LONG count = InterlockedDecrement(&root->ref_count);
  2477.  
  2478. -    dprintf(NSLVL, "nfs41_root_deref() count %d\n", count);
  2479. +    DPRINTF(NSLVL, ("nfs41_root_deref() count %d\n", count));
  2480.      if (count == 0)
  2481.          root_free(root);
  2482.  }
  2483. @@ -149,7 +149,7 @@ static int root_client_find_addrs(
  2484.      struct list_entry *entry;
  2485.      int status;
  2486.  
  2487. -    dprintf(NSLVL, "--> root_client_find_addrs()\n");
  2488. +    DPRINTF(NSLVL, ("--> root_client_find_addrs()\n"));
  2489.  
  2490.      info.addrs = addrs;
  2491.      info.roles = nfs41_exchange_id_flags(is_data) & EXCHGID4_FLAG_MASK_PNFS;
  2492. @@ -158,12 +158,12 @@ static int root_client_find_addrs(
  2493.      if (entry) {
  2494.          *client_out = client_entry(entry);
  2495.          status = NO_ERROR;
  2496. -        dprintf(NSLVL, "<-- root_client_find_addrs() returning 0x%p\n",
  2497. -            *client_out);
  2498. +        DPRINTF(NSLVL, ("<-- root_client_find_addrs() returning 0x%p\n",
  2499. +            *client_out));
  2500.      } else {
  2501.          status = ERROR_FILE_NOT_FOUND;
  2502. -        dprintf(NSLVL, "<-- root_client_find_addrs() failed with %d\n",
  2503. -            status);
  2504. +        DPRINTF(NSLVL, ("<-- root_client_find_addrs() failed with %d\n",
  2505. +            status));
  2506.      }
  2507.      return status;
  2508.  }
  2509. @@ -215,7 +215,7 @@ static int root_client_find(
  2510.      struct list_entry *entry;
  2511.      int status;
  2512.  
  2513. -    dprintf(NSLVL, "--> root_client_find()\n");
  2514. +    DPRINTF(NSLVL, ("--> root_client_find()\n"));
  2515.  
  2516.      info.exchangeid = exchangeid;
  2517.      info.roles = nfs41_exchange_id_flags(is_data) & EXCHGID4_FLAG_MASK_PNFS;
  2518. @@ -224,12 +224,12 @@ static int root_client_find(
  2519.      if (entry) {
  2520.          *client_out = client_entry(entry);
  2521.          status = NO_ERROR;
  2522. -        dprintf(NSLVL, "<-- root_client_find() returning 0x%p\n",
  2523. -            *client_out);
  2524. +        DPRINTF(NSLVL, ("<-- root_client_find() returning 0x%p\n",
  2525. +            *client_out));
  2526.      } else {
  2527.          status = ERROR_FILE_NOT_FOUND;
  2528. -        dprintf(NSLVL, "<-- root_client_find() failed with %d\n",
  2529. -            status);
  2530. +        DPRINTF(NSLVL, ("<-- root_client_find() failed with %d\n",
  2531. +            status));
  2532.      }
  2533.      return status;
  2534.  }
  2535. @@ -262,7 +262,7 @@ static int session_get_lease(
  2536.  
  2537.          status = nfs41_getattr(session, NULL, &attr_request, &info);
  2538.          if (status) {
  2539. -            eprintf("nfs41_getattr() failed with %s\n",
  2540. +            eprintf("nfs41_getattr() failed with '%s'\n",
  2541.                  nfs_error_string(status));
  2542.              status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  2543.              goto out;
  2544. @@ -312,7 +312,7 @@ static int root_client_create(
  2545.          /* send RECLAIM_COMPLETE, but don't fail on ERR_NOTSUPP */
  2546.          status = nfs41_reclaim_complete(session);
  2547.          if (status && status != NFS4ERR_NOTSUPP) {
  2548. -            eprintf("nfs41_reclaim_complete() failed with %s\n",
  2549. +            eprintf("nfs41_reclaim_complete() failed with '%s'\n",
  2550.                  nfs_error_string(status));
  2551.              status = ERROR_BAD_NETPATH;
  2552.              goto out_err;
  2553. @@ -345,7 +345,7 @@ int nfs41_root_mount_addrs(
  2554.      nfs41_client *client, *existing;
  2555.      int status;
  2556.  
  2557. -    dprintf(NSLVL, "--> nfs41_root_mount_addrs()\n");
  2558. +    DPRINTF(NSLVL, ("--> nfs41_root_mount_addrs()\n"));
  2559.  
  2560.      /* look for an existing client that matches the address and role */
  2561.      EnterCriticalSection(&root->lock);
  2562. @@ -367,7 +367,7 @@ int nfs41_root_mount_addrs(
  2563.      status = nfs41_exchange_id(rpc, &root->client_owner,
  2564.          nfs41_exchange_id_flags(is_data), &exchangeid);
  2565.      if (status) {
  2566. -        eprintf("nfs41_exchange_id() failed %s\n", nfs_error_string(status));
  2567. +        eprintf("nfs41_exchange_id() failed '%s'\n", nfs_error_string(status));
  2568.          status = ERROR_BAD_NET_RESP;
  2569.          goto out_free_rpc;
  2570.      }
  2571. @@ -397,14 +397,14 @@ int nfs41_root_mount_addrs(
  2572.      status = root_client_find(root, &exchangeid, is_data, &existing);
  2573.  
  2574.      if (status) {
  2575. -        dprintf(NSLVL, "caching new client 0x%p\n", client);
  2576. +        DPRINTF(NSLVL, ("caching new client 0x%p\n", client));
  2577.  
  2578.          /* the client is not a duplicate, so add it to the list */
  2579.          list_add_tail(&root->clients, &client->root_entry);
  2580.          status = NO_ERROR;
  2581.      } else {
  2582. -        dprintf(NSLVL, "created a duplicate client 0x%p! using "
  2583. -            "existing client 0x%p instead\n", client, existing);
  2584. +        DPRINTF(NSLVL, ("created a duplicate client 0x%p! using "
  2585. +            "existing client 0x%p instead\n", client, existing));
  2586.  
  2587.          /* a matching client has been created in parallel, so free
  2588.           * the one we created and use the existing client instead */
  2589. @@ -416,7 +416,7 @@ int nfs41_root_mount_addrs(
  2590.  out:
  2591.      if (status == NO_ERROR)
  2592.          *client_out = client;
  2593. -    dprintf(NSLVL, "<-- nfs41_root_mount_addrs() returning %d\n", status);
  2594. +    DPRINTF(NSLVL, ("<-- nfs41_root_mount_addrs() returning %d\n", status));
  2595.      return status;
  2596.  
  2597.  out_free_rpc:
  2598. @@ -444,7 +444,7 @@ static int referral_mount_location(
  2599.      int status = ERROR_BAD_NET_NAME;
  2600.      uint32_t i;
  2601.  
  2602. -    dprintf(NSLVL, "--> referral_mount_location()\n");
  2603. +    DPRINTF(NSLVL, ("--> referral_mount_location()\n"));
  2604.  
  2605.      /* create a client and session for the first available server */
  2606.      for (i = 0; i < loc->server_count; i++) {
  2607. @@ -457,7 +457,7 @@ static int referral_mount_location(
  2608.              break;
  2609.      }
  2610.  
  2611. -    dprintf(NSLVL, "<-- referral_mount_location() returning %d\n", status);
  2612. +    DPRINTF(NSLVL, ("<-- referral_mount_location() returning %d\n", status));
  2613.  
  2614.      return status;
  2615.  }
  2616. diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c
  2617. index f5bac1d..91ca863 100644
  2618. --- a/daemon/nfs41_client.c
  2619. +++ b/daemon/nfs41_client.c
  2620. @@ -159,10 +159,10 @@ static void dprint_roles(
  2621.      IN int level,
  2622.      IN uint32_t roles)
  2623.  {
  2624. -    dprintf(level, "roles: %s%s%s\n",
  2625. +    DPRINTF(level, ("roles: %s%s%s\n",
  2626.          (roles & EXCHGID4_FLAG_USE_NON_PNFS) ? "USE_NON_PNFS " : "",
  2627.          (roles & EXCHGID4_FLAG_USE_PNFS_MDS) ? "USE_PNFS_MDS " : "",
  2628. -        (roles & EXCHGID4_FLAG_USE_PNFS_DS) ? "USE_PNFS_DS" : "");
  2629. +        (roles & EXCHGID4_FLAG_USE_PNFS_DS) ? "USE_PNFS_DS" : ""));
  2630.  }
  2631.  
  2632.  int nfs41_client_renew(
  2633. @@ -206,7 +206,7 @@ out:
  2634.  void nfs41_client_free(
  2635.      IN nfs41_client *client)
  2636.  {
  2637. -    dprintf(2, "nfs41_client_free(%llu)\n", client->clnt_id);
  2638. +    DPRINTF(2, ("nfs41_client_free(%llu)\n", client->clnt_id));
  2639.      nfs41_client_delegation_free(client);
  2640.      if (client->session) nfs41_session_free(client->session);
  2641.      nfs41_destroy_clientid(client->rpc, client->clnt_id);
  2642. diff --git a/daemon/nfs41_compound.c b/daemon/nfs41_compound.c
  2643. index 217900a..0c2c4ad 100644
  2644. --- a/daemon/nfs41_compound.c
  2645. +++ b/daemon/nfs41_compound.c
  2646. @@ -34,7 +34,7 @@
  2647.  int compound_error(int status)
  2648.  {
  2649.      if (status != NFS4_OK)
  2650. -        dprintf(1, "COMPOUND failed with status %d.\n", status);
  2651. +        DPRINTF(1, ("COMPOUND failed with status %d.\n", status));
  2652.      return status;
  2653.  }
  2654.  
  2655. @@ -197,8 +197,8 @@ retry:
  2656.      }
  2657.  
  2658.      if (compound->res.status != NFS4_OK)
  2659. -        dprintf(1, "\n################ %s ################\n\n",
  2660. -            nfs_error_string(compound->res.status));
  2661. +        DPRINTF(1, ("\n################ '%s' ################\n\n",
  2662. +            nfs_error_string(compound->res.status)));
  2663.  
  2664.      switch (compound->res.status) {
  2665.      case NFS4_OK:
  2666. @@ -276,11 +276,11 @@ retry:
  2667.                  delayby = 5000;
  2668.              else
  2669.                  delayby = 500*retry_count;
  2670. -            dprintf(1, "Compound returned %s: sleeping for %ums..\n",
  2671. +            DPRINTF(1, ("Compound returned '%s': sleeping for %ums..\n",
  2672.                  (compound->res.status==NFS4ERR_GRACE)?"NFS4ERR_GRACE":"NFS4ERR_DELAY",
  2673. -                delayby);
  2674. +                delayby));
  2675.              Sleep(delayby);
  2676. -            dprintf(1, "Attempting to resend compound.\n");
  2677. +            DPRINTF(1, ("Attempting to resend compound.\n"));
  2678.              goto do_retry;
  2679.  #ifndef RETRY_INDEFINITELY
  2680.          }
  2681. @@ -351,7 +351,7 @@ retry:
  2682.                          argarray[1].op == OP_PUTROOTFH) &&
  2683.                          (argarray[2].op == OP_SECINFO_NO_NAME ||
  2684.                          argarray[2].op == OP_SECINFO)) {
  2685. -                    dprintf(1, "SECINFO: BROKEN SERVER\n");
  2686. +                    DPRINTF(1, ("SECINFO: BROKEN SERVER\n"));
  2687.                      goto out;
  2688.                  }
  2689.                  if (!try_recovery)
  2690. diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
  2691. index 47579d0..73d8b77 100644
  2692. --- a/daemon/nfs41_daemon.c
  2693. +++ b/daemon/nfs41_daemon.c
  2694. @@ -78,7 +78,7 @@ static int map_current_user_to_ids(nfs41_idmapper *idmapper, uid_t *uid, gid_t *
  2695.          eprintf("map_current_user_to_ids: GetUserName() failed with %d\n", status);
  2696.          goto out;
  2697.      }
  2698. -    dprintf(1, "map_current_user_to_ids: mapping user %s\n", username);
  2699. +    DPRINTF(1, ("map_current_user_to_ids: mapping user '%s'\n", username));
  2700.  
  2701.      if (nfs41_idmap_name_to_ids(idmapper, username, uid, gid)) {
  2702.          /* instead of failing for auth_sys, fall back to 'nobody' uid/gid */
  2703. @@ -142,17 +142,17 @@ static unsigned int WINAPI thread_main(void *args)
  2704.          status = upcall_handle(&nfs41_dg, &upcall);
  2705.  
  2706.  write_downcall:
  2707. -        dprintf(1, "writing downcall: xid=%lld opcode=%s status=%d "
  2708. +        DPRINTF(1, ("writing downcall: xid=%lld opcode='%s' status=%d "
  2709.              "get_last_error=%d\n", upcall.xid, opcode2string(upcall.opcode),
  2710. -            upcall.status, upcall.last_error);
  2711. +            upcall.status, upcall.last_error));
  2712.  
  2713.          upcall_marshall(&upcall, inbuf, (uint32_t)inbuf_len, (uint32_t*)&outbuf_len);
  2714.  
  2715. -        dprintf(2, "making a downcall: outbuf_len %ld\n\n", outbuf_len);
  2716. +        DPRINTF(2, ("making a downcall: outbuf_len %ld\n\n", outbuf_len));
  2717.          status = DeviceIoControl(pipe, IOCTL_NFS41_WRITE,
  2718.              inbuf, inbuf_len, NULL, 0, (LPDWORD)&outbuf_len, NULL);
  2719.          if (!status) {
  2720. -            eprintf("IOCTL_NFS41_WRITE failed with %d xid=%lld opcode=%s\n",
  2721. +            eprintf("IOCTL_NFS41_WRITE failed with %d xid=%lld opcode='%s'\n",
  2722.                  GetLastError(), upcall.xid, opcode2string(upcall.opcode));
  2723.              upcall_cancel(&upcall);
  2724.          }
  2725. @@ -331,24 +331,26 @@ static void print_getaddrinfo(struct addrinfo *ptr)
  2726.      char ipstringbuffer[46];
  2727.      DWORD ipbufferlength = 46;
  2728.  
  2729. -    dprintf(1, "getaddrinfo response flags: 0x%x\n", ptr->ai_flags);
  2730. +    DPRINTF(1, ("getaddrinfo response flags: 0x%x\n", ptr->ai_flags));
  2731.      switch (ptr->ai_family) {
  2732. -    case AF_UNSPEC: dprintf(1, "Family: Unspecified\n"); break;
  2733. +    case AF_UNSPEC: DPRINTF(1, ("Family: Unspecified\n")); break;
  2734.      case AF_INET:
  2735. -        dprintf(1, "Family: AF_INET IPv4 address %s\n",
  2736. -            inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr));
  2737. +        DPRINTF(1, ("Family: AF_INET IPv4 address '%s'\n",
  2738. +            inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr)));
  2739.          break;
  2740.      case AF_INET6:
  2741.          if (WSAAddressToStringA((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
  2742. -                NULL, ipstringbuffer, &ipbufferlength))
  2743. -            dprintf(1, "WSAAddressToString failed with %u\n", WSAGetLastError());
  2744. -        else
  2745. -            dprintf(1, "Family: AF_INET6 IPv6 address %s\n", ipstringbuffer);
  2746. +                NULL, ipstringbuffer, &ipbufferlength)) {
  2747. +            DPRINTF(1, ("WSAAddressToString failed with %u\n", WSAGetLastError()));
  2748. +        }
  2749. +        else {
  2750. +            DPRINTF(1, ("Family: AF_INET6 IPv6 address '%s'\n", ipstringbuffer));
  2751. +        }
  2752.          break;
  2753. -    case AF_NETBIOS: dprintf(1, "AF_NETBIOS (NetBIOS)\n"); break;
  2754. -    default: dprintf(1, "Other %ld\n", ptr->ai_family); break;
  2755. +    case AF_NETBIOS: DPRINTF(1, ("AF_NETBIOS (NetBIOS)\n")); break;
  2756. +    default: DPRINTF(1, ("Other %ld\n", ptr->ai_family)); break;
  2757.      }
  2758. -    dprintf(1, "Canonical name: %s\n", ptr->ai_canonname);
  2759. +    DPRINTF(1, ("Canonical name: '%s'\n", ptr->ai_canonname));
  2760.  }
  2761.  
  2762.  static int getdomainname()
  2763. @@ -397,12 +399,13 @@ static int getdomainname()
  2764.                  status = getnameinfo((struct sockaddr *)ptr->ai_addr,
  2765.                              (socklen_t)ptr->ai_addrlen, hostname, NI_MAXHOST,
  2766.                              servInfo, NI_MAXSERV, NI_NAMEREQD);
  2767. -                if (status)
  2768. -                    dprintf(1, "getnameinfo failed %d\n", WSAGetLastError());
  2769. +                if (status) {
  2770. +                    DPRINTF(1, ("getnameinfo failed %d\n", WSAGetLastError()));
  2771. +                }
  2772.                  else {
  2773.                      size_t i, len = strlen(hostname);
  2774.                      char *p = hostname;
  2775. -                    dprintf(1, "getdomainname: hostname %s %d\n", hostname, len);
  2776. +                    DPRINTF(1, ("getdomainname: hostname '%s' %d\n", hostname, len));
  2777.                      for (i = 0; i < len; i++)
  2778.                          if (p[i] == '.')
  2779.                              break;
  2780. @@ -410,8 +413,8 @@ static int getdomainname()
  2781.                          break;
  2782.                      flag = TRUE;
  2783.                      memcpy(nfs41_dg.localdomain_name, &hostname[i+1], len-i);
  2784. -                    dprintf(1, "getdomainname: domainname %s %d\n",
  2785. -                            nfs41_dg.localdomain_name, strlen(nfs41_dg.localdomain_name));
  2786. +                    DPRINTF(1, ("getdomainname: domainname '%s' %d\n",
  2787. +                            nfs41_dg.localdomain_name, strlen(nfs41_dg.localdomain_name)));
  2788.                      goto out_loop;
  2789.                  }
  2790.                  break;
  2791. @@ -428,7 +431,7 @@ out_loop:
  2792.          }
  2793.          freeaddrinfo(result);
  2794.      } else {
  2795. -        dprintf(1, "domain name is %s\n", net_info->DomainName);
  2796. +        DPRINTF(1, ("domain name is '%s'\n", net_info->DomainName));
  2797.          memcpy(nfs41_dg.localdomain_name, net_info->DomainName,
  2798.                  strlen(net_info->DomainName));
  2799.          nfs41_dg.localdomain_name[strlen(net_info->DomainName)] = '\0';
  2800. @@ -450,7 +453,7 @@ void nfsd_crt_debug_init(void)
  2801.      int crtsetdbgflags = nfs41_dg.crtdbgmem_flags;
  2802.  
  2803.      if (crtsetdbgflags == NFS41D_GLOBALS_CRTDBGMEM_FLAGS_NOT_SET) {
  2804. -        dprintf(1, "crtsetdbgflags not set, using defaults\n");
  2805. +        DPRINTF(1, ("crtsetdbgflags not set, using defaults\n"));
  2806.          crtsetdbgflags = 0;
  2807.  
  2808.          crtsetdbgflags |= _CRTDBG_ALLOC_MEM_DF;
  2809. @@ -472,12 +475,12 @@ void nfsd_crt_debug_init(void)
  2810.           */
  2811.      }
  2812.  
  2813. -    dprintf(0, "memory debug flags _CRTDBG_(=0x%x)"
  2814. +    DPRINTF(0, ("memory debug flags _CRTDBG_(=0x%x)"
  2815.          "{ ALLOC_MEM_DF=%d, LEAK_CHECK_DF=%d, DELAY_FREE_MEM_DF=%d }\n",
  2816.          crtsetdbgflags,
  2817.          ((crtsetdbgflags & _CRTDBG_ALLOC_MEM_DF)?1:0),
  2818.          ((crtsetdbgflags & _CRTDBG_LEAK_CHECK_DF)?1:0),
  2819. -        ((crtsetdbgflags & _CRTDBG_DELAY_FREE_MEM_DF)?1:0));
  2820. +        ((crtsetdbgflags & _CRTDBG_DELAY_FREE_MEM_DF)?1:0)));
  2821.  
  2822.      (void)_CrtSetDbgFlag(crtsetdbgflags);
  2823.  
  2824. @@ -497,7 +500,7 @@ void nfsd_crt_debug_init(void)
  2825.      (void)_CrtSetReportFile(_CRT_ASSERT,  _CRTDBG_FILE_STDERR);
  2826.  
  2827.      if (crtsetdbgflags & _CRTDBG_LEAK_CHECK_DF) {
  2828. -        dprintf(1, "debug mode. dumping memory leaks to stderr on exit.\n");
  2829. +        DPRINTF(1, ("debug mode. dumping memory leaks to stderr on exit.\n"));
  2830.      }
  2831.  #endif /* _DEBUG */
  2832.  }
  2833. @@ -537,7 +540,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  2834.       * inversion
  2835.       */
  2836.      if(SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) {
  2837. -        dprintf(1, "Running as HIGH_PRIORITY_CLASS\n");
  2838. +        DPRINTF(1, ("Running as HIGH_PRIORITY_CLASS\n"));
  2839.      }
  2840.      else {
  2841.          eprintf("Failed to enter HIGH_PRIORITY_CLASS mode\n");
  2842. @@ -559,7 +562,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  2843.      }
  2844.  
  2845.      NFS41D_VERSION = GetTickCount();
  2846. -    dprintf(1, "NFS41 Daemon starting: version %d\n", NFS41D_VERSION);
  2847. +    DPRINTF(1, ("NFS41 Daemon starting: version %d\n", NFS41D_VERSION));
  2848.  
  2849.      pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  2850.          FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  2851. @@ -570,7 +573,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  2852.          goto out_idmap;
  2853.      }
  2854.  
  2855. -    dprintf(1, "starting nfs41 mini redirector\n");
  2856. +    DPRINTF(1, ("starting nfs41 mini redirector\n"));
  2857.      status = DeviceIoControl(pipe, IOCTL_NFS41_START,
  2858.          &NFS41D_VERSION, sizeof(DWORD), NULL, 0, (LPDWORD)&len, NULL);
  2859.      if (!status) {
  2860. @@ -585,8 +588,8 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  2861.        goto out_pipe;
  2862.  #endif
  2863.  
  2864. -    dprintf(1, "Starting %d worker threads...\n",
  2865. -        (int)nfs41_dg.num_worker_threads);
  2866. +    DPRINTF(1, ("Starting %d worker threads...\n",
  2867. +        (int)nfs41_dg.num_worker_threads));
  2868.      for (i = 0; i < nfs41_dg.num_worker_threads; i++) {
  2869.          tids[i].handle = (HANDLE)_beginthreadex(NULL, 0, thread_main,
  2870.                  &nfs41_dg, 0, &tids[i].tid);
  2871. @@ -603,11 +606,11 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  2872.      WaitForSingleObject(stop_event, INFINITE);
  2873.  #else
  2874.      //This can be changed to waiting on an array of handles and using waitformultipleobjects
  2875. -    dprintf(1, "Parent waiting for children threads\n");
  2876. +    DPRINTF(1, ("Parent waiting for children threads\n"));
  2877.      for (i = 0; i < nfs41_dg.num_worker_threads; i++)
  2878.          WaitForSingleObject(tids[i].handle, INFINITE );
  2879.  #endif
  2880. -    dprintf(1, "Parent woke up!!!!\n");
  2881. +    DPRINTF(1, ("Parent woke up!!!!\n"));
  2882.  
  2883.  out_pipe:
  2884.      CloseHandle(pipe);
  2885. diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
  2886. index 5ae9d85..3c1303b 100644
  2887. --- a/daemon/nfs41_ops.c
  2888. +++ b/daemon/nfs41_ops.c
  2889. @@ -162,19 +162,20 @@ int nfs41_create_session(nfs41_client *clnt, nfs41_session *session, bool_t try_
  2890.                      "server refused\n");
  2891.          session->flags = reply.csr_flags;
  2892.      }
  2893. -    else
  2894. -        dprintf(1, "session flags %x\n", reply.csr_flags);
  2895. +    else {
  2896. +        DPRINTF(1, ("session flags %x\n", reply.csr_flags));
  2897. +    }
  2898.  
  2899. -    dprintf(1, "session fore_chan_attrs:\n"
  2900. +    DPRINTF(1, ("session fore_chan_attrs:\n"
  2901.          "  %-32s%d\n  %-32s%d\n  %-32s%d\n  %-32s%d\n  %-32s%d\n  %-32s%d\n",
  2902.          "headerpadsize", session->fore_chan_attrs.ca_headerpadsize,
  2903.          "maxrequestsize", session->fore_chan_attrs.ca_maxrequestsize,
  2904.          "maxresponsesize", session->fore_chan_attrs.ca_maxresponsesize,
  2905.          "maxresponsesize_cached", session->fore_chan_attrs.ca_maxresponsesize_cached,
  2906.          "maxoperations", session->fore_chan_attrs.ca_maxoperations,
  2907. -        "maxrequests", session->fore_chan_attrs.ca_maxrequests);
  2908. -    dprintf(1, "client supports %d max rpc slots, but server has %d\n",
  2909. -        session->table.max_slots, session->fore_chan_attrs.ca_maxrequests);
  2910. +        "maxrequests", session->fore_chan_attrs.ca_maxrequests));
  2911. +    DPRINTF(1, ("client supports %d max rpc slots, but server has %d\n",
  2912. +        session->table.max_slots, session->fore_chan_attrs.ca_maxrequests));
  2913.      /* use the server's ca_maxrequests unless it's bigger than our array */
  2914.      session->table.max_slots = min(session->table.max_slots,
  2915.          session->fore_chan_attrs.ca_maxrequests);
  2916. @@ -234,7 +235,7 @@ int nfs41_destroy_session(
  2917.  
  2918.      status = compound.res.status;
  2919.      if (status)
  2920. -        eprintf("%s failed with status %d.\n",
  2921. +        eprintf("'%s' failed with status %d.\n",
  2922.              nfs_opnum_to_string(OP_DESTROY_SESSION), status);
  2923.  out:
  2924.      return status;
  2925. @@ -766,7 +767,7 @@ int nfs41_write(
  2926.       * send us into an infinite loop. return NFS4ERR_IO */
  2927.      if (!write_res.resok4.count) {
  2928.          status = NFS4ERR_IO;
  2929. -        eprintf("WRITE succeeded with count=0; returning %s\n",
  2930. +        eprintf("WRITE succeeded with count=0; returning '%s'\n",
  2931.              nfs_error_string(status));
  2932.      }
  2933.  
  2934. @@ -827,7 +828,7 @@ int nfs41_read(
  2935.       * send us into an infinite loop. return NFS4ERR_IO */
  2936.      if (!read_res.resok4.data_len && !read_res.resok4.eof) {
  2937.          status = NFS4ERR_IO;
  2938. -        eprintf("READ succeeded with len=0 and eof=0; returning %s\n",
  2939. +        eprintf("READ succeeded with len=0 and eof=0; returning '%s'\n",
  2940.              nfs_error_string(status));
  2941.      }
  2942.  out:
  2943. diff --git a/daemon/nfs41_rpc.c b/daemon/nfs41_rpc.c
  2944. index 927dbe9..d48fc1d 100644
  2945. --- a/daemon/nfs41_rpc.c
  2946. +++ b/daemon/nfs41_rpc.c
  2947. @@ -62,9 +62,9 @@ static int get_client_for_netaddr(
  2948.  
  2949.      if (server_name) {
  2950.          getnameinfo(addr->buf, addr->len, server_name, NI_MAXHOST, NULL, 0, 0);
  2951. -        dprintf(1, "servername is %s\n", server_name);
  2952. +        DPRINTF(1, ("servername is '%s'\n", server_name));
  2953.      }
  2954. -    dprintf(1, "callback function %p args %p\n", nfs41_handle_callback, rpc);
  2955. +    DPRINTF(1, ("callback function 0x%p args 0x%p\n", nfs41_handle_callback, rpc));
  2956.      client = clnt_tli_create(RPC_ANYFD, nconf, addr, NFS41_RPC_PROGRAM,
  2957.          NFS41_RPC_VERSION, wsize, rsize, rpc ? proc_cb_compound_res : NULL,
  2958.          rpc ? nfs41_handle_callback : NULL, rpc ? rpc : NULL);
  2959. @@ -130,12 +130,13 @@ int create_rpcsec_auth_client(
  2960.      }
  2961.  
  2962.      if (client->cl_auth == NULL) {
  2963. -        eprintf("nfs41_rpc_clnt_create: failed to create %s\n",
  2964. +        eprintf("nfs41_rpc_clnt_create: failed to create '%s'\n",
  2965.                  secflavorop2name(sec_flavor));
  2966.          goto out;
  2967. -    } else
  2968. -        dprintf(1, "nfs41_rpc_clnt_create: successfully created %s\n",
  2969. -            secflavorop2name(sec_flavor));
  2970. +    } else {
  2971. +        DPRINTF(1, ("nfs41_rpc_clnt_create: successfully created '%s'\n",
  2972. +            secflavorop2name(sec_flavor)));
  2973. +    }
  2974.      status = 0;
  2975.  out:
  2976.      return status;
  2977. @@ -209,8 +210,8 @@ int nfs41_rpc_clnt_create(
  2978.              status = ERROR_NETWORK_UNREACHABLE;
  2979.              goto out_err_client;
  2980.          } else
  2981. -            dprintf(1, "nfs41_rpc_clnt_create: successfully created %s\n",
  2982. -                secflavorop2name(sec_flavor));
  2983. +            DPRINTF(1, ("nfs41_rpc_clnt_create: successfully created '%s'\n",
  2984. +                secflavorop2name(sec_flavor)));
  2985.      }
  2986.      rpc->rpc = client;
  2987.  
  2988. @@ -254,13 +255,13 @@ static bool_t rpc_renew_in_progress(nfs41_rpc_clnt *rpc, int *value)
  2989.      bool_t status = FALSE;
  2990.      AcquireSRWLockExclusive(&rpc->lock);
  2991.      if (value) {
  2992. -        dprintf(1, "nfs41_rpc_renew_in_progress: setting value %d\n", *value);
  2993. +        DPRINTF(1, ("nfs41_rpc_renew_in_progress: setting value %d\n", *value));
  2994.          rpc->in_recovery = *value;
  2995.          if (!rpc->in_recovery)
  2996.              SetEvent(rpc->cond);
  2997.      } else {
  2998.          status = rpc->in_recovery;
  2999. -        dprintf(1, "nfs41_rpc_renew_in_progress: returning value %d\n", status);
  3000. +        DPRINTF(1, ("nfs41_rpc_renew_in_progress: returning value %d\n", status));
  3001.      }
  3002.      ReleaseSRWLockExclusive(&rpc->lock);
  3003.      return status;
  3004. @@ -311,7 +312,7 @@ static int rpc_reconnect(
  3005.      rpc->rpc = client;
  3006.      rpc->addr_index = addr_index;
  3007.      rpc->version++;
  3008. -    dprintf(1, "nfs41_send_compound: reestablished RPC connection\n");
  3009. +    DPRINTF(1, ("nfs41_send_compound: reestablished RPC connection\n"));
  3010.  
  3011.  out_unlock:
  3012.      ReleaseSRWLockExclusive(&rpc->lock);
  3013. @@ -323,7 +324,7 @@ out_unlock:
  3014.          status = nfs41_bind_conn_to_session(rpc,
  3015.              rpc->client->session->session_id, CDFC4_BACK_OR_BOTH);
  3016.          if (status)
  3017. -            eprintf("nfs41_bind_conn_to_session() failed with %s\n",
  3018. +            eprintf("nfs41_bind_conn_to_session() failed with '%s'\n",
  3019.                  nfs_error_string(status));
  3020.          status = NFS4_OK;
  3021.      }
  3022. @@ -354,7 +355,7 @@ int nfs41_send_compound(
  3023.      ReleaseSRWLockShared(&rpc->lock);
  3024.  
  3025.      if (rpc_status != RPC_SUCCESS) {
  3026. -        eprintf("clnt_call returned rpc_status = %s\n",
  3027. +        eprintf("clnt_call returned rpc_status = '%s'\n",
  3028.              rpc_error_string(rpc_status));
  3029.          switch(rpc_status) {
  3030.          case RPC_CANTRECV:
  3031. @@ -370,8 +371,8 @@ int nfs41_send_compound(
  3032.              while (rpc_renew_in_progress(rpc, NULL)) {
  3033.                  status = WaitForSingleObjectEx(rpc->cond, INFINITE, FALSE);
  3034.                  if (status != WAIT_OBJECT_0) {
  3035. -                    dprintf(0, "rpc_renew_in_progress: WaitForSingleObjectEx() failed\n");
  3036. -                    print_condwait_status(1, status);
  3037. +                    eprintf("rpc_renew_in_progress: WaitForSingleObjectEx() failed\n");
  3038. +                    print_condwait_status(0, status);
  3039.                      status = ERROR_LOCK_VIOLATION;
  3040.                      goto out;
  3041.                  }
  3042. diff --git a/daemon/nfs41_server.c b/daemon/nfs41_server.c
  3043. index b1be2d8..522105d 100644
  3044. --- a/daemon/nfs41_server.c
  3045. +++ b/daemon/nfs41_server.c
  3046. @@ -101,7 +101,7 @@ static int server_create(
  3047.      server = calloc(1, sizeof(nfs41_server));
  3048.      if (server == NULL) {
  3049.          status = GetLastError();
  3050. -        eprintf("failed to allocate server %s\n", info->owner);
  3051. +        eprintf("failed to allocate server '%s'\n", info->owner);
  3052.          goto out;
  3053.      }
  3054.  
  3055. @@ -128,7 +128,7 @@ out_free:
  3056.  static void server_free(
  3057.      IN nfs41_server *server)
  3058.  {
  3059. -    dprintf(SRVLVL, "server_free(%s)\n", server->owner);
  3060. +    DPRINTF(SRVLVL, ("server_free('%s')\n", server->owner));
  3061.      nfs41_superblock_list_free(&server->superblocks);
  3062.      nfs41_name_cache_free(&server->name_cache);
  3063.      free(server);
  3064. @@ -138,8 +138,8 @@ static __inline void server_ref_locked(
  3065.      IN nfs41_server *server)
  3066.  {
  3067.      server->ref_count++;
  3068. -    dprintf(SRVLVL, "nfs41_server_ref(%s) count %d\n",
  3069. -        server->owner, server->ref_count);
  3070. +    DPRINTF(SRVLVL, ("nfs41_server_ref('%s') count %d\n",
  3071. +        server->owner, server->ref_count));
  3072.  }
  3073.  
  3074.  void nfs41_server_ref(
  3075. @@ -158,8 +158,8 @@ void nfs41_server_deref(
  3076.      EnterCriticalSection(&g_server_list.lock);
  3077.  
  3078.      server->ref_count--;
  3079. -    dprintf(SRVLVL, "nfs41_server_deref(%s) count %d\n",
  3080. -        server->owner, server->ref_count);
  3081. +    DPRINTF(SRVLVL, ("nfs41_server_deref('%s') count %d\n",
  3082. +        server->owner, server->ref_count));
  3083.      if (server->ref_count == 0) {
  3084.          list_remove(&server->entry);
  3085.          server_free(server);
  3086. @@ -179,8 +179,8 @@ static void server_addrs_add(
  3087.      AcquireSRWLockExclusive(&addrs->lock);
  3088.  
  3089.      if (multi_addr_find(&addrs->addrs, addr, NULL)) {
  3090. -        dprintf(SRVLVL, "server_addrs_add() found existing addr '%s'.\n",
  3091. -            addr->uaddr);
  3092. +        DPRINTF(SRVLVL, ("server_addrs_add() found existing addr '%s'.\n",
  3093. +            addr->uaddr));
  3094.      } else {
  3095.          /* overwrite the address at 'next_index' */
  3096.          StringCchCopyA(addrs->addrs.arr[addrs->next_index].netid,
  3097. @@ -194,8 +194,8 @@ static void server_addrs_add(
  3098.          if (addrs->addrs.count < addrs->next_index)
  3099.              addrs->addrs.count = addrs->next_index;
  3100.  
  3101. -        dprintf(SRVLVL, "server_addrs_add() added new addr '%s'.\n",
  3102. -            addr->uaddr);
  3103. +        DPRINTF(SRVLVL, ("server_addrs_add() added new addr '%s'.\n",
  3104. +            addr->uaddr));
  3105.      }
  3106.      ReleaseSRWLockExclusive(&addrs->lock);
  3107.  }
  3108. @@ -232,7 +232,7 @@ int nfs41_server_find_or_create(
  3109.      info.owner = server_owner_major_id;
  3110.      info.scope = server_scope;
  3111.  
  3112. -    dprintf(SRVLVL, "--> nfs41_server_find_or_create(%s)\n", info.owner);
  3113. +    DPRINTF(SRVLVL, ("--> nfs41_server_find_or_create('%s')\n", info.owner));
  3114.  
  3115.      EnterCriticalSection(&g_server_list.lock);
  3116.  
  3117. @@ -246,18 +246,18 @@ int nfs41_server_find_or_create(
  3118.              list_add_tail(&g_server_list.head, &server->entry);
  3119.              *server_out = server;
  3120.  
  3121. -            dprintf(SRVLVL, "<-- nfs41_server_find_or_create() "
  3122. -                "returning new server %p\n", server);
  3123. +            DPRINTF(SRVLVL, ("<-- nfs41_server_find_or_create() "
  3124. +                "returning new server 0x%p\n", server));
  3125.          } else {
  3126. -            dprintf(SRVLVL, "<-- nfs41_server_find_or_create() "
  3127. -                "returning %d\n", status);
  3128. +            DPRINTF(SRVLVL, ("<-- nfs41_server_find_or_create() "
  3129. +                "returning %d\n", status));
  3130.          }
  3131.      } else {
  3132.          server = server_entry(entry);
  3133.          status = NO_ERROR;
  3134.  
  3135. -        dprintf(SRVLVL, "<-- nfs41_server_find_or_create() "
  3136. -            "returning existing server %p\n", server);
  3137. +        DPRINTF(SRVLVL, ("<-- nfs41_server_find_or_create() "
  3138. +            "returning existing server 0x%p\n", server));
  3139.      }
  3140.  
  3141.      if (server) {
  3142. @@ -286,8 +286,8 @@ int nfs41_server_resolve(
  3143.      int wse; /* Windows Socket Error */
  3144.      int retry_getaddrinfoex_counter = 0;
  3145.  
  3146. -    dprintf(SRVLVL, "--> nfs41_server_resolve('%s':%u)\n",
  3147. -        hostname, port);
  3148. +    DPRINTF(SRVLVL, ("--> nfs41_server_resolve('%s':%u)\n",
  3149. +        hostname, port));
  3150.  
  3151.      addrs->count = 0;
  3152.  
  3153. @@ -312,12 +312,12 @@ retry_getaddrinfoex:
  3154.      wse = GetAddrInfoExA(hostname, service, 0, NULL, &hints, &res,
  3155.          NULL, NULL, NULL, NULL);
  3156.      if (wse != 0) {
  3157. -        dprintf(SRVLVL, "GetAddrInfoExA() failed with wse=%d/'%s'\n",
  3158. -            wse, gai_strerrorA(wse));
  3159. +        DPRINTF(SRVLVL, ("GetAddrInfoExA() failed with wse=%d/'%s'\n",
  3160. +            wse, gai_strerrorA(wse)));
  3161.          if ((wse == WSATRY_AGAIN) && (retry_getaddrinfoex_counter < 4)) {
  3162. -            dprintf(SRVLVL, "GetAddrInfoExA() returned WSATRY_AGAIN, "
  3163. +            DPRINTF(SRVLVL, ("GetAddrInfoExA() returned WSATRY_AGAIN, "
  3164.                  "retry %d with delay...\n",
  3165. -                retry_getaddrinfoex_counter);
  3166. +                retry_getaddrinfoex_counter));
  3167.  
  3168.              retry_getaddrinfoex_counter++;
  3169.              Sleep(500*retry_getaddrinfoex_counter);
  3170. @@ -328,8 +328,8 @@ retry_getaddrinfoex:
  3171.      }
  3172.  
  3173.      for (info = res; info != NULL; info = info->ai_next) {
  3174. -        dprintf(SRVLVL, "GetAddrInfoExA() returned: info.{ai_family=%d}\n",
  3175. -            info->ai_family);
  3176. +        DPRINTF(SRVLVL, ("GetAddrInfoExA() returned: info.{ai_family=%d}\n",
  3177. +            info->ai_family));
  3178.  
  3179.          /* find the appropriate entry in /etc/netconfig */
  3180.          switch (info->ai_family) {
  3181. @@ -340,7 +340,7 @@ retry_getaddrinfoex:
  3182.  
  3183.          nconf = getnetconfigent(netid);
  3184.          if (nconf == NULL) {
  3185. -            dprintf(SRVLVL, "getnetconfigent(netid='%s') failed.\n", netid);
  3186. +            DPRINTF(SRVLVL, ("getnetconfigent(netid='%s') failed.\n", netid));
  3187.              continue;
  3188.          }
  3189.  
  3190. @@ -352,7 +352,7 @@ retry_getaddrinfoex:
  3191.          freenetconfigent(nconf);
  3192.  
  3193.          if (uaddr == NULL) {
  3194. -            dprintf(SRVLVL, "taddr2uaddr() failed.\n");
  3195. +            DPRINTF(SRVLVL, ("taddr2uaddr() failed.\n"));
  3196.              continue;
  3197.          }
  3198.  
  3199. @@ -364,7 +364,7 @@ retry_getaddrinfoex:
  3200.  
  3201.          status = NO_ERROR;
  3202.          if (++addrs->count >= NFS41_ADDRS_PER_SERVER) {
  3203. -            dprintf(SRVLVL, "error: too many NFS41_ADDRS_PER_SERVER.\n");
  3204. +            DPRINTF(SRVLVL, ("error: too many NFS41_ADDRS_PER_SERVER.\n"));
  3205.              break;
  3206.          }
  3207.      }
  3208. @@ -378,8 +378,8 @@ retry_getaddrinfoex:
  3209.      FreeAddrInfoEx(res);
  3210.  out:
  3211.      if (status) {
  3212. -        dprintf(SRVLVL, "<-- nfs41_server_resolve('%s':%u) returning "
  3213. -            "error %d\n", hostname, port, status);
  3214. +        DPRINTF(SRVLVL, ("<-- nfs41_server_resolve('%s':%u) returning "
  3215. +            "error %d\n", hostname, port, status));
  3216.      }
  3217.      else {
  3218.          unsigned int i;
  3219. @@ -392,8 +392,8 @@ out:
  3220.                  "'%s', ", addrs->arr[i].uaddr);
  3221.          }
  3222.  
  3223. -        dprintf(SRVLVL, "<-- nfs41_server_resolve('%s':%u) returning "
  3224. -            "OK { %s }\n", hostname, port, buff);
  3225. +        DPRINTF(SRVLVL, ("<-- nfs41_server_resolve('%s':%u) returning "
  3226. +            "OK { %s }\n", hostname, port, buff));
  3227.      }
  3228.      return status;
  3229.  }
  3230. diff --git a/daemon/nfs41_session.c b/daemon/nfs41_session.c
  3231. index 6411de2..7e54234 100644
  3232. --- a/daemon/nfs41_session.c
  3233. +++ b/daemon/nfs41_session.c
  3234. @@ -69,8 +69,8 @@ static void resize_slot_table(
  3235.          target_highest_slotid = NFS41_MAX_NUM_SLOTS - 1;
  3236.  
  3237.      if (table->max_slots != target_highest_slotid + 1) {
  3238. -        dprintf(2, "updated max_slots %u to %u\n",
  3239. -            table->max_slots, target_highest_slotid + 1);
  3240. +        DPRINTF(2, ("updated max_slots %u to %u\n",
  3241. +            table->max_slots, target_highest_slotid + 1));
  3242.          table->max_slots = target_highest_slotid + 1;
  3243.  
  3244.          if (slot_table_avail(table))
  3245. @@ -119,8 +119,8 @@ void nfs41_session_free_slot(
  3246.          while (table->highest_used && !table->used_slots[table->highest_used])
  3247.              table->highest_used--;
  3248.      }
  3249. -    dprintf(3, "freeing slot#=%d used=%d highest=%d\n",
  3250. -        slotid, table->num_used, table->highest_used);
  3251. +    DPRINTF(3, ("freeing slot#=%d used=%d highest=%d\n",
  3252. +        slotid, table->num_used, table->highest_used));
  3253.  
  3254.      /* wake any threads waiting on a slot */
  3255.      if (slot_table_avail(table))
  3256. @@ -163,8 +163,8 @@ void nfs41_session_get_slot(
  3257.      LeaveCriticalSection(&table->lock);
  3258.      ReleaseSRWLockShared(&session->client->session_lock);
  3259.  
  3260. -    dprintf(2, "session %p: using slot#=%d with seq#=%d highest=%d\n",
  3261. -        session, *slot, *seqid, *highest);
  3262. +    DPRINTF(2, ("session 0x%p: using slot#=%d with seq#=%d highest=%d\n",
  3263. +        session, *slot, *seqid, *highest));
  3264.  }
  3265.  
  3266.  int nfs41_session_recall_slot(
  3267. @@ -231,8 +231,8 @@ static unsigned int WINAPI renew_session_thread(void *args)
  3268.      int status = NO_ERROR;
  3269.      int event_status;
  3270.  
  3271. -    dprintf(1, "renew_session_thread(session=%p): started thread %p\n",
  3272. -        session, session->renew.thread_handle);
  3273. +    DPRINTF(1, ("renew_session_thread(session=0x%p): started thread 0x%p\n",
  3274. +        session, session->renew.thread_handle));
  3275.  
  3276.      /* sleep for 2/3 of lease_time */
  3277.      const uint32_t sleep_time = (2UL * session->lease_time*1000UL)/3UL;
  3278. @@ -241,9 +241,9 @@ static unsigned int WINAPI renew_session_thread(void *args)
  3279.      EASSERT(sleep_time < (60*60*1000UL));
  3280.  
  3281.      while(1) {
  3282. -        dprintf(1, "renew_session_thread(session=%p): "
  3283. +        DPRINTF(1, ("renew_session_thread(session=0x%p): "
  3284.              "Going to sleep for %dmsecs\n",
  3285. -            session, (int)sleep_time);
  3286. +            session, (int)sleep_time));
  3287.  
  3288.          /*
  3289.           * sleep for |sleep_time| milliseconds, or until someone
  3290. @@ -252,12 +252,12 @@ static unsigned int WINAPI renew_session_thread(void *args)
  3291.          event_status = WaitForSingleObjectEx(session->renew.cancel_event,
  3292.              sleep_time, FALSE);
  3293.          if (event_status == WAIT_TIMEOUT) {
  3294. -            dprintf(1, "renew_session_thread(session=%p): "
  3295. +            DPRINTF(1, ("renew_session_thread(session=0x%p): "
  3296.                  "renewing session...\n",
  3297. -                session);
  3298. +                session));
  3299.              status = nfs41_send_sequence(session);
  3300.              if (status) {
  3301. -                eprintf("renew_session_thread(session=%p): "
  3302. +                eprintf("renew_session_thread(session=0x%p): "
  3303.                      "nfs41_send_sequence() failed status=%d\n",
  3304.                      session, status);
  3305.              }
  3306. @@ -267,14 +267,14 @@ static unsigned int WINAPI renew_session_thread(void *args)
  3307.              break;
  3308.          }
  3309.          else {
  3310. -            eprintf("renew_session_thread(session=%p): "
  3311. +            eprintf("renew_session_thread(session=0x%p): "
  3312.                  "unexpected event_status=0x%x\n",
  3313.                  session, (int)event_status);
  3314.          }
  3315.      }
  3316.  
  3317. -    dprintf(1, "renew_session_thread(session=%p): thread %p exiting\n",
  3318. -        session, session->renew.thread_handle);
  3319. +    DPRINTF(1, ("renew_session_thread(session=0x%p): thread 0x%p exiting\n",
  3320. +        session, session->renew.thread_handle));
  3321.      return 0;
  3322.  }
  3323.  
  3324. @@ -372,18 +372,18 @@ void cancel_renew_thread(
  3325.  {
  3326.      DWORD status;
  3327.  
  3328. -    dprintf(1, "cancel_renew_thread(session=%p): "
  3329. -        "signal thread to exit\n", session);
  3330. +    DPRINTF(1, ("cancel_renew_thread(session=0x%p): "
  3331. +        "signal thread to exit\n", session));
  3332.      (void)SetEvent(session->renew.cancel_event);
  3333.  
  3334. -    dprintf(1, "cancel_renew_thread(session=%p): "
  3335. -        "waiting for thread to exit\n", session);
  3336. +    DPRINTF(1, ("cancel_renew_thread(session=0x%p): "
  3337. +        "waiting for thread to exit\n", session));
  3338.      status = WaitForSingleObjectEx(session->renew.thread_handle,
  3339.          INFINITE, FALSE);
  3340.      EASSERT(status == WAIT_OBJECT_0);
  3341.  
  3342. -    dprintf(1, "cancel_renew_thread(session=%p): thread done\n",
  3343. -        session);
  3344. +    DPRINTF(1, ("cancel_renew_thread(session=0x%p): thread done\n",
  3345. +        session));
  3346.      (void)CloseHandle(session->renew.cancel_event);
  3347.  }
  3348.  
  3349. @@ -432,7 +432,7 @@ void nfs41_session_free(
  3350.  {
  3351.      AcquireSRWLockExclusive(&session->client->session_lock);
  3352.      if (valid_handle(session->renew.thread_handle)) {
  3353. -        dprintf(1, "nfs41_session_free: terminating session renewal thread\n");
  3354. +        DPRINTF(1, ("nfs41_session_free: terminating session renewal thread\n"));
  3355.          cancel_renew_thread(session);
  3356.      }
  3357.  
  3358. diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
  3359. index 70c60b5..2b0bbc9 100644
  3360. --- a/daemon/nfs41_superblock.c
  3361. +++ b/daemon/nfs41_superblock.c
  3362. @@ -52,8 +52,8 @@ static int superblock_create(
  3363.      int status = NO_ERROR;
  3364.      nfs41_superblock *superblock;
  3365.  
  3366. -    dprintf(SBLVL, "creating superblock for fsid(%llu,%llu)\n",
  3367. -        fsid->major, fsid->minor);
  3368. +    DPRINTF(SBLVL, ("creating superblock for fsid(%llu,%llu)\n",
  3369. +        fsid->major, fsid->minor));
  3370.  
  3371.      superblock = calloc(1, sizeof(nfs41_superblock));
  3372.      if (superblock == NULL) {
  3373. @@ -146,7 +146,7 @@ static int get_superblock_attrs(
  3374.  
  3375.      nfs41_superblock_supported_attrs(superblock, &superblock->default_getattr);
  3376.  
  3377. -    dprintf(SBLVL, "attributes for fsid(%llu,%llu): "
  3378. +    DPRINTF(SBLVL, ("attributes for fsid(%llu,%llu): "
  3379.          "maxread=%llu, maxwrite=%llu, layout_types: 0x%X, "
  3380.          "cansettime=%u, time_delta={%llu,%u}, aclsupport=%u, "
  3381.          "link_support=%u, symlink_support=%u, case_preserving=%u, "
  3382. @@ -157,7 +157,7 @@ static int get_superblock_attrs(
  3383.          superblock->time_delta.seconds, superblock->time_delta.nseconds,
  3384.          superblock->aclsupport, superblock->link_support,
  3385.          superblock->symlink_support, superblock->case_preserving,
  3386. -        superblock->case_insensitive);
  3387. +        superblock->case_insensitive));
  3388.  out:
  3389.      return status;
  3390.  }
  3391. @@ -190,7 +190,7 @@ void nfs41_superblock_fs_attributes(
  3392.      /* let the driver fill in FileSystemName */
  3393.      FsAttrs->FileSystemNameLength = 0;
  3394.  
  3395. -    dprintf(SBLVL, "FileFsAttributeInformation: "
  3396. +    DPRINTF(SBLVL, ("FileFsAttributeInformation: "
  3397.          "link_support=%u, "
  3398.          "symlink_support=%u, "
  3399.          "ea_support=%u, "
  3400. @@ -206,7 +206,7 @@ void nfs41_superblock_fs_attributes(
  3401.          superblock->case_insensitive,
  3402.          superblock->aclsupport,
  3403.          (unsigned int)FsAttrs->MaximumComponentNameLength,
  3404. -        (unsigned long)FsAttrs->FileSystemAttributes);
  3405. +        (unsigned long)FsAttrs->FileSystemAttributes));
  3406.  }
  3407.  
  3408.  
  3409. @@ -242,7 +242,7 @@ void nfs41_superblock_list_free(
  3410.  {
  3411.      struct list_entry *entry, *tmp;
  3412.  
  3413. -    dprintf(SBLVL, "nfs41_superblock_list_free()\n");
  3414. +    DPRINTF(SBLVL, ("nfs41_superblock_list_free()\n"));
  3415.  
  3416.      list_for_each_tmp(entry, tmp, &superblocks->head)
  3417.          free(superblock_entry(entry));
  3418. @@ -260,14 +260,14 @@ int nfs41_superblock_for_fh(
  3419.      nfs41_superblock_list *superblocks = &server->superblocks;
  3420.      nfs41_superblock *superblock;
  3421.  
  3422. -    dprintf(SBLVL, "--> nfs41_superblock_for_fh(fsid(%llu,%llu))\n",
  3423. -        fsid->major, fsid->minor);
  3424. +    DPRINTF(SBLVL, ("--> nfs41_superblock_for_fh(fsid(%llu,%llu)))\n",
  3425. +        fsid->major, fsid->minor));
  3426.  
  3427.      /* compare with the parent's fsid, and use that if it matches */
  3428.      if (parent && parent->superblock &&
  3429.              compare_fsid(fsid, &parent->superblock->fsid) == 0) {
  3430.          file->fh.superblock = parent->superblock;
  3431. -        dprintf(SBLVL, "using superblock from parent\n");
  3432. +        DPRINTF(SBLVL, ("using superblock from parent\n"));
  3433.          goto out;
  3434.      }
  3435.  
  3436. @@ -277,16 +277,16 @@ int nfs41_superblock_for_fh(
  3437.      ReleaseSRWLockShared(&superblocks->lock);
  3438.  
  3439.      if (superblock) {
  3440. -        dprintf(SBLVL, "found existing superblock in server list "
  3441. -            "[shared lock]\n");
  3442. +        DPRINTF(SBLVL, ("found existing superblock in server list "
  3443. +            "[shared lock]\n"));
  3444.      } else {
  3445.          AcquireSRWLockExclusive(&superblocks->lock);
  3446.          /* must search again under an exclusive lock, in case another thread
  3447.           * created it after our first search */
  3448.          superblock = find_superblock(superblocks, fsid);
  3449.          if (superblock) {
  3450. -            dprintf(SBLVL, "found newly created superblock in server list "
  3451. -                "[exclusive lock]\n");
  3452. +            DPRINTF(SBLVL, ("found newly created superblock in server list "
  3453. +                "[exclusive lock]\n"));
  3454.          } else {
  3455.              /* create the superblock */
  3456.              status = superblock_create(fsid, &superblock);
  3457. @@ -306,8 +306,8 @@ int nfs41_superblock_for_fh(
  3458.  
  3459.      file->fh.superblock = superblock;
  3460.  out:
  3461. -    dprintf(SBLVL, "<-- nfs41_superblock_for_fh() returning %p, status %d\n",
  3462. -        file->fh.superblock, status);
  3463. +    DPRINTF(SBLVL, ("<-- nfs41_superblock_for_fh() returning 0x%p, status %d\n",
  3464. +        file->fh.superblock, status));
  3465.      return status;
  3466.  }
  3467.  
  3468. diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
  3469. index e60684b..c08affa 100644
  3470. --- a/daemon/nfs41_xdr.c
  3471. +++ b/daemon/nfs41_xdr.c
  3472. @@ -38,7 +38,7 @@ static __inline int unexpected_op(uint32_t op, uint32_t expected)
  3473.      if (op == expected)
  3474.          return 0;
  3475.  
  3476. -    eprintf("Op table mismatch. Got %s (%d), expected %s (%d).\n",
  3477. +    eprintf("Op table mismatch. Got '%s' (%d), expected '%s' (%d).\n",
  3478.          nfs_opnum_to_string(op), op,
  3479.          nfs_opnum_to_string(expected), expected);
  3480.      return 1;
  3481. @@ -765,7 +765,7 @@ static bool_t xdr_channel_attrs4(
  3482.              return TRUE;
  3483.      }
  3484.      else {
  3485. -        eprintf("%s: xdr->x_op %d not supported.\n",
  3486. +        eprintf("'%s': xdr->x_op %d not supported.\n",
  3487.              "xdr_channel_attrs4", xdr->x_op);
  3488.          return FALSE;
  3489.      }
  3490. @@ -1445,7 +1445,7 @@ static bool_t xdr_locker4(
  3491.      locker4 *locker)
  3492.  {
  3493.      if (xdr->x_op != XDR_ENCODE) {
  3494. -        eprintf("%s: xdr->x_op %d is not supported!\n",
  3495. +        eprintf("'%s': xdr->x_op %d is not supported!\n",
  3496.              "xdr_locker4", xdr->x_op);
  3497.          return FALSE;
  3498.      }
  3499. @@ -3402,7 +3402,7 @@ static bool_t decode_layout(
  3500.          return decode_file_layout(xdr, list, &layout);
  3501.  
  3502.      default:
  3503. -        eprintf("%s: received non-FILE layout type, %d\n",
  3504. +        eprintf("'%s': received non-FILE layout type, %d\n",
  3505.              "decode_file_layout", layout.type);
  3506.      }
  3507.      return FALSE;
  3508. @@ -3489,7 +3489,7 @@ static bool_t encode_op_layoutreturn(
  3509.  
  3510.          return xdr_u_int32_t(xdr, &zero); /* size of lrf_body is 0 */
  3511.      } else {
  3512. -        eprintf("%s: layout type (%d) is not PNFS_RETURN_FILE!\n",
  3513. +        eprintf("'%s': layout type (%d) is not PNFS_RETURN_FILE!\n",
  3514.              "encode_op_layoutreturn", args->return_type);
  3515.          return FALSE;
  3516.      }
  3517. @@ -3675,7 +3675,7 @@ bool_t nfs_decode_compound(
  3518.  
  3519.          /* validate each operation number against what we sent */
  3520.          if (res->resarray[i].op != expected_op) {
  3521. -            eprintf("reply with %s in operation %u, expected %s!\n",
  3522. +            eprintf("reply with '%s' in operation %u, expected '%s'!\n",
  3523.                  nfs_opnum_to_string(res->resarray[i].op), i+1,
  3524.                  nfs_opnum_to_string(expected_op));
  3525.              return FALSE;
  3526. diff --git a/daemon/open.c b/daemon/open.c
  3527. index e4f6063..1ea7eea 100644
  3528. --- a/daemon/open.c
  3529. +++ b/daemon/open.c
  3530. @@ -119,7 +119,7 @@ void nfs41_open_state_ref(
  3531.  
  3532.      const LONG count = InterlockedIncrement(&state->ref_count);
  3533.  
  3534. -    dprintf(2, "nfs41_open_state_ref(%s) count %d\n", state->path.path, count);
  3535. +    DPRINTF(2, ("nfs41_open_state_ref('%s') count %d\n", state->path.path, count));
  3536.  }
  3537.  
  3538.  void nfs41_open_state_deref(
  3539. @@ -127,7 +127,7 @@ void nfs41_open_state_deref(
  3540.  {
  3541.      const LONG count = InterlockedDecrement(&state->ref_count);
  3542.  
  3543. -    dprintf(2, "nfs41_open_state_deref(%s) count %d\n", state->path.path, count);
  3544. +    DPRINTF(2, ("nfs41_open_state_deref('%s') count %d\n", state->path.path, count));
  3545.      if (count == 0)
  3546.          open_state_free(state);
  3547.  }
  3548. @@ -164,7 +164,7 @@ void nfs41_open_stateid_arg(
  3549.          if (arg->type == STATEID_DELEG_FILE)
  3550.              goto out;
  3551.  
  3552. -        dprintf(2, "delegation recalled, waiting for open stateid..\n");
  3553. +        DPRINTF(2, ("delegation recalled, waiting for open stateid...\n"));
  3554.  
  3555.          /* wait for nfs41_delegation_to_open() to recover open stateid */
  3556.          while (!state->do_close)
  3557. @@ -236,8 +236,8 @@ static int do_open(
  3558.          &state->file, &delegation, TRUE, &deleg_state);
  3559.      if (deleg_state) {
  3560.          deleg_state->srv_open = state->srv_open;
  3561. -        dprintf(1, "do_open: received delegation: saving srv_open = %x\n",
  3562. -            state->srv_open);
  3563. +        DPRINTF(1, ("do_open: received delegation: saving srv_open = %x\n",
  3564. +            state->srv_open));
  3565.      }
  3566.  
  3567.      AcquireSRWLockExclusive(&state->lock);
  3568. @@ -329,24 +329,34 @@ static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upca
  3569.      status = safe_read(&buffer, &length, &args->ea, sizeof(HANDLE));
  3570.      if (status) goto out;
  3571.  
  3572. -    dprintf(1, "parsing NFS41_OPEN: filename='%s' access mask=%d "
  3573. +#ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
  3574. +    DPRINTF(1, ("parsing NFS41_OPEN: filename='%s' access mask=%d "
  3575.          "access mode=%d\n\tfile attrs=0x%x create attrs=0x%x "
  3576.          "(kernel) disposition=%d\n\topen_owner_id=%d mode=%o "
  3577. -#ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
  3578.          "owner_local_uid=%u owner_group_local_gid=%u "
  3579. -#endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
  3580. -        "srv_open=%p symlink=%s ea=%p\n", args->path, args->access_mask,
  3581. +        "srv_open=0x%p symlink=%s ea=0x%p\n", args->path, args->access_mask,
  3582.          args->access_mode, args->file_attrs, args->create_opts,
  3583.          args->disposition, args->open_owner_id, args->mode,
  3584. -#ifdef NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES
  3585.          (unsigned int)args->owner_local_uid, (unsigned int)args->owner_group_local_gid,
  3586. -#endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
  3587.          args->srv_open,
  3588. -        args->symlink.path, args->ea);
  3589. -    print_disposition(2, args->disposition);
  3590. -    print_access_mask(2, args->access_mask);
  3591. -    print_share_mode(2, args->access_mode);
  3592. -    print_create_attributes(2, args->create_opts);
  3593. +        args->symlink.path, args->ea));
  3594. +#else
  3595. +    DPRINTF(1, ("parsing NFS41_OPEN: filename='%s' access mask=%d "
  3596. +        "access mode=%d\n\tfile attrs=0x%x create attrs=0x%x "
  3597. +        "(kernel) disposition=%d\n\topen_owner_id=%d mode=%o "
  3598. +        "srv_open=0x%p symlink=%s ea=0x%p\n", args->path, args->access_mask,
  3599. +        args->access_mode, args->file_attrs, args->create_opts,
  3600. +        args->disposition, args->open_owner_id, args->mode,
  3601. +        args->srv_open,
  3602. +        args->symlink.path, args->ea));
  3603. +#endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
  3604. +
  3605. +    if (DPRINTF_LEVEL_ENABLED(2)) {
  3606. +        print_disposition(2, args->disposition);
  3607. +        print_access_mask(2, args->access_mask);
  3608. +        print_share_mode(2, args->access_mode);
  3609. +        print_create_attributes(2, args->create_opts);
  3610. +    }
  3611.  out:
  3612.      return status;
  3613.  }
  3614. @@ -359,10 +369,10 @@ static BOOLEAN open_for_attributes(uint32_t type, ULONG access_mask,
  3615.                  (!status && (disposition == FILE_OPEN_IF ||
  3616.                      disposition == FILE_OVERWRITE_IF ||
  3617.                      disposition == FILE_SUPERSEDE))) {
  3618. -            dprintf(1, "Opening a directory\n");
  3619. +            DPRINTF(1, ("Opening a directory\n"));
  3620.              return TRUE;
  3621.          } else {
  3622. -            dprintf(1, "Creating a directory\n");
  3623. +            DPRINTF(1, ("Creating a directory\n"));
  3624.              return FALSE;
  3625.          }
  3626.      }
  3627. @@ -378,7 +388,7 @@ static BOOLEAN open_for_attributes(uint32_t type, ULONG access_mask,
  3628.              disposition == FILE_OVERWRITE)
  3629.          return FALSE;
  3630.      else {
  3631. -        dprintf(1, "Open call that wants to manage attributes\n");
  3632. +        DPRINTF(1, ("Open call that wants to manage attributes\n"));
  3633.          return TRUE;
  3634.      }
  3635.  }
  3636. @@ -411,11 +421,11 @@ static int map_disposition_2_nfsopen(ULONG disposition, int in_status, bool_t pe
  3637.              *create = OPEN4_NOCREATE;
  3638.      } else if (disposition == FILE_OPEN_IF) {
  3639.          if (in_status == NFS4ERR_NOENT) {
  3640. -            dprintf(1, "creating new file\n");
  3641. +            DPRINTF(1, ("creating new file\n"));
  3642.              *create = OPEN4_CREATE;
  3643.              *last_error = ERROR_FILE_NOT_FOUND;
  3644.          } else {
  3645. -            dprintf(1, "opening existing file\n");
  3646. +            DPRINTF(1, ("opening existing file\n"));
  3647.              *create = OPEN4_NOCREATE;
  3648.          }
  3649.      } else if (disposition == FILE_OVERWRITE) {
  3650. @@ -481,7 +491,7 @@ static int check_execute_access(nfs41_open_state *state)
  3651.      int status = nfs41_access(state->session, &state->file,
  3652.          ACCESS4_EXECUTE | ACCESS4_READ, &supported, &access);
  3653.      if (status) {
  3654. -        eprintf("nfs41_access() failed with %s for %s\n",
  3655. +        eprintf("nfs41_access() failed with '%s' for '%s'\n",
  3656.              nfs_error_string(status), state->path.path);
  3657.          status = ERROR_ACCESS_DENIED;
  3658.      } else if ((supported & ACCESS4_EXECUTE) == 0) {
  3659. @@ -493,11 +503,11 @@ static int check_execute_access(nfs41_open_state *state)
  3660.              status = ERROR_ACCESS_DENIED;
  3661.          }
  3662.      } else if ((access & ACCESS4_EXECUTE) == 0) {
  3663. -        dprintf(1, "user does not have execute access to file %s\n",
  3664. -            state->path.path);
  3665. +        DPRINTF(1, ("user does not have execute access to file '%s'\n",
  3666. +            state->path.path));
  3667.          status = ERROR_ACCESS_DENIED;
  3668.      } else
  3669. -        dprintf(2, "user has execute access to file\n");
  3670. +        DPRINTF(2, ("user has execute access to file\n"));
  3671.      return status;
  3672.  }
  3673.  
  3674. @@ -572,23 +582,23 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3675.      // now if file/dir exists, use type returned by lookup
  3676.      if (status == NO_ERROR) {
  3677.          if (info.type == NF4DIR) {
  3678. -            dprintf(2, "handle_nfs41_open: DIRECTORY\n");
  3679. +            DPRINTF(2, ("handle_nfs41_open: DIRECTORY\n"));
  3680.              if (args->create_opts & FILE_NON_DIRECTORY_FILE) {
  3681. -                dprintf(1, "trying to open directory '%s' as a file\n",
  3682. -                    state->path.path);
  3683. +                DPRINTF(1, ("trying to open directory '%s' as a file\n",
  3684. +                    state->path.path));
  3685.                  status = ERROR_DIRECTORY;
  3686.                  goto out_free_state;
  3687.              }
  3688.          } else if (info.type == NF4REG) {
  3689. -            dprintf(2, "handle nfs41_open: FILE\n");
  3690. +            DPRINTF(2, ("handle nfs41_open: FILE\n"));
  3691.              if (args->create_opts & FILE_DIRECTORY_FILE) {
  3692. -                dprintf(1, "trying to open file '%s' as a directory\n",
  3693. -                    state->path.path);
  3694. +                DPRINTF(1, ("trying to open file '%s' as a directory\n",
  3695. +                    state->path.path));
  3696.                  status = ERROR_BAD_FILE_TYPE;
  3697.                  goto out_free_state;
  3698.              }
  3699.          } else if (info.type == NF4LNK) {
  3700. -            dprintf(2, "handle nfs41_open: SYMLINK\n");
  3701. +            DPRINTF(2, ("handle nfs41_open: SYMLINK\n"));
  3702.              if (args->create_opts & FILE_OPEN_REPARSE_POINT) {
  3703.                  /* continue and open the symlink itself, but we need to
  3704.                   * know if the target is a regular file or directory */
  3705. @@ -602,7 +612,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3706.                  status = nfs41_symlink_target(state->session,
  3707.                      &state->file, &args->symlink);
  3708.                  if (status) {
  3709. -                    eprintf("nfs41_symlink_target() for %s failed with %d\n",
  3710. +                    eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
  3711.                          args->path, status);
  3712.                  } else {
  3713.                      /* tell the driver to call RxPrepareToReparseSymbolicLink() */
  3714. @@ -612,7 +622,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3715.                  goto out_free_state;
  3716.              }
  3717.          } else
  3718. -            dprintf(2, "handle_open(): unsupported type=%d\n", info.type);
  3719. +            DPRINTF(2, ("handle_open(): unsupported type=%d\n", info.type));
  3720.          state->type = info.type;
  3721.      } else if (status != ERROR_FILE_NOT_FOUND)
  3722.          goto out_free_state;
  3723. @@ -638,7 +648,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3724.          }
  3725.  
  3726.          /* defer the call to CREATE until we get the symlink set upcall */
  3727. -        dprintf(1, "trying to create a symlink, deferring create\n");
  3728. +        DPRINTF(1, ("trying to create a symlink, deferring create\n"));
  3729.  
  3730.          /* because of WRITE_ATTR access, be prepared for a setattr upcall;
  3731.           * will crash if the superblock is null, so use the parent's */
  3732. @@ -653,13 +663,13 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3733.          createattrs.attrmask.arr[1] = FATTR4_WORD1_MODE;
  3734.          createattrs.mode = 0777;
  3735.  
  3736. -        dprintf(1, "creating cygwin symlink %s -> %s\n",
  3737. -            state->file.name.name, args->symlink.path);
  3738. +        DPRINTF(1, ("creating cygwin symlink '%s' -> '%s'\n",
  3739. +            state->file.name.name, args->symlink.path));
  3740.  
  3741.          status = nfs41_create(state->session, NF4LNK, &createattrs,
  3742.              args->symlink.path, &state->parent, &state->file, &info);
  3743.          if (status) {
  3744. -            eprintf("nfs41_create() for symlink=%s failed with %s\n",
  3745. +            eprintf("nfs41_create() for symlink='%s' failed with '%s'\n",
  3746.                  args->symlink.path, nfs_error_string(status));
  3747.              status = map_symlink_errors(status);
  3748.              goto out_free_state;
  3749. @@ -671,7 +681,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3750.      } else if (open_for_attributes(state->type, args->access_mask,
  3751.                  args->disposition, status)) {
  3752.          if (status) {
  3753. -            dprintf(1, "nfs41_lookup failed with %d\n", status);
  3754. +            DPRINTF(1, ("nfs41_lookup failed with %d\n", status));
  3755.              goto out_free_state;
  3756.          }
  3757.  
  3758. @@ -781,10 +791,10 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  3759.                  owner_group, args->owner_group_local_gid);
  3760.          }
  3761.  
  3762. -        dprintf(1, "handle_open('%s'): stat: owner=%u/'%s', owner_group=%u/'%s'\n",
  3763. +        DPRINTF(1, ("handle_open('%s'): stat: owner=%u/'%s', owner_group=%u/'%s'\n",
  3764.              state->path.path,
  3765.              (unsigned int)args->owner_local_uid, owner,
  3766. -            (unsigned int)args->owner_group_local_gid, owner_group);
  3767. +            (unsigned int)args->owner_group_local_gid, owner_group));
  3768.  #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
  3769.      } else {
  3770.          nfs41_file_info createattrs = { 0 };
  3771. @@ -831,7 +841,7 @@ supersede_retry:
  3772.                  nfs41_delegation_return(state->session, &state->file,
  3773.                      OPEN_DELEGATE_WRITE, TRUE);
  3774.  
  3775. -            dprintf(1, "open for FILE_SUPERSEDE removing %s first\n", name->name);
  3776. +            DPRINTF(1, ("open for FILE_SUPERSEDE removing '%s' first\n", name->name));
  3777.              status = nfs41_remove(state->session, &state->parent,
  3778.                  name, state->file.fh.fileid);
  3779.              if (status)
  3780. @@ -845,16 +855,16 @@ supersede_retry:
  3781.          } else {
  3782.              createattrs.attrmask.arr[0] |= FATTR4_WORD0_SIZE;
  3783.              createattrs.size = 0;
  3784. -            dprintf(1, "creating with mod %o\n", args->mode);
  3785. +            DPRINTF(1, ("creating with mod %o\n", args->mode));
  3786.              status = open_or_delegate(state, create, createhowmode, &createattrs,
  3787.                  TRUE, &info);
  3788.              if (status == NFS4_OK && state->delegation.state)
  3789.                      args->deleg_type = state->delegation.state->state.type;
  3790.          }
  3791.          if (status) {
  3792. -            dprintf(1, "%s failed with %s\n", (create == OPEN4_CREATE &&
  3793. +            DPRINTF(1, ("'%s' failed with '%s'\n", (create == OPEN4_CREATE &&
  3794.                  (args->create_opts & FILE_DIRECTORY_FILE))?"nfs41_create":"nfs41_open",
  3795. -                nfs_error_string(status));
  3796. +                nfs_error_string(status)));
  3797.              if (args->disposition == FILE_SUPERSEDE && status == NFS4ERR_EXIST)
  3798.                  goto supersede_retry;
  3799.              status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
  3800. @@ -919,8 +929,8 @@ static int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *
  3801.              goto out;
  3802.          }
  3803.      }
  3804. -    dprintf(2, "NFS41_OPEN: downcall open_state=0x%p mode %o changeattr 0x%llu\n",
  3805. -        upcall->state_ref, args->mode, args->changeattr);
  3806. +    DPRINTF(2, ("NFS41_OPEN: downcall open_state=0x%p mode %o changeattr 0x%llu\n",
  3807. +        upcall->state_ref, args->mode, args->changeattr));
  3808.  out:
  3809.      return status;
  3810.  }
  3811. @@ -931,7 +941,7 @@ static void cancel_open(IN nfs41_upcall *upcall)
  3812.      open_upcall_args *args = &upcall->args.open;
  3813.      nfs41_open_state *state = upcall->state_ref;
  3814.  
  3815. -    dprintf(1, "--> cancel_open('%s')\n", args->path);
  3816. +    DPRINTF(1, ("--> cancel_open('%s')\n", args->path));
  3817.  
  3818.      if (upcall->state_ref == NULL ||
  3819.              upcall->state_ref == INVALID_HANDLE_VALUE)
  3820. @@ -945,10 +955,10 @@ static void cancel_open(IN nfs41_upcall *upcall)
  3821.          memcpy(&stateid.stateid, &state->stateid, sizeof(stateid4));
  3822.  
  3823.          status = nfs41_close(state->session, &state->file, &stateid);
  3824. -        if (status)
  3825. -            dprintf(1, "cancel_open: nfs41_close() failed with %s\n",
  3826. -                nfs_error_string(status));
  3827. -
  3828. +        if (status) {
  3829. +            DPRINTF(1, ("cancel_open: nfs41_close() failed with '%s'\n",
  3830. +                nfs_error_string(status)));
  3831. +        }
  3832.      } else if (args->created) {
  3833.          const nfs41_component *name = &state->file.name;
  3834.          /* break any delegations and truncate before REMOVE */
  3835. @@ -957,8 +967,8 @@ static void cancel_open(IN nfs41_upcall *upcall)
  3836.          status = nfs41_remove(state->session, &state->parent,
  3837.              name, state->file.fh.fileid);
  3838.          if (status)
  3839. -            dprintf(1, "cancel_open: nfs41_remove() failed with %s\n",
  3840. -                nfs_error_string(status));
  3841. +            DPRINTF(1, ("cancel_open: nfs41_remove() failed with '%s'\n",
  3842. +                nfs_error_string(status)));
  3843.      }
  3844.  
  3845.      /* remove from the client's list of state for recovery */
  3846. @@ -966,7 +976,7 @@ static void cancel_open(IN nfs41_upcall *upcall)
  3847.      nfs41_open_state_deref(state);
  3848.  out:
  3849.      status = nfs_to_windows_error(status, ERROR_INTERNAL_ERROR);
  3850. -    dprintf(1, "<-- cancel_open() returning %d\n", status);
  3851. +    DPRINTF(1, ("<-- cancel_open() returning %d\n", status));
  3852.  }
  3853.  
  3854.  
  3855. @@ -987,9 +997,9 @@ static int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upc
  3856.          if (status) goto out;
  3857.      }
  3858.  
  3859. -    dprintf(1, "parsing NFS41_CLOSE: remove=%d srv_open=%x renamed=%d "
  3860. +    DPRINTF(1, ("parsing NFS41_CLOSE: remove=%d srv_open=%x renamed=%d "
  3861.          "filename='%s'\n", args->remove, args->srv_open, args->renamed,
  3862. -        args->remove ? args->path : "");
  3863. +        args->remove ? args->path : ""));
  3864.  out:
  3865.      return status;
  3866.  }
  3867. @@ -1005,8 +1015,8 @@ static int do_nfs41_close(nfs41_open_state *state)
  3868.  
  3869.      status = nfs41_close(state->session, &state->file, &stateid);
  3870.      if (status) {
  3871. -        dprintf(1, "nfs41_close() failed with error %s.\n",
  3872. -            nfs_error_string(status));
  3873. +        DPRINTF(1, ("nfs41_close() failed with error '%s'.\n",
  3874. +            nfs_error_string(status)));
  3875.          status = nfs_to_windows_error(status, ERROR_INTERNAL_ERROR);
  3876.      }
  3877.  
  3878. @@ -1030,7 +1040,7 @@ static int handle_close(void *deamon_context, nfs41_upcall *upcall)
  3879.          nfs41_component *name = &state->file.name;
  3880.  
  3881.          if (args->renamed) {
  3882. -            dprintf(1, "removing a renamed file %s\n", name->name);
  3883. +            DPRINTF(1, ("removing a renamed file '%s'\n", name->name));
  3884.              create_silly_rename(&state->path, &state->file.fh, name);
  3885.              status = do_nfs41_close(state);
  3886.              if (status)
  3887. @@ -1043,7 +1053,7 @@ static int handle_close(void *deamon_context, nfs41_upcall *upcall)
  3888.          nfs41_delegation_return(state->session, &state->file,
  3889.              OPEN_DELEGATE_WRITE, TRUE);
  3890.  
  3891. -               dprintf(1, "calling nfs41_remove for %s\n", name->name);
  3892. +        DPRINTF(1, ("calling nfs41_remove for '%s'\n", name->name));
  3893.  retry_delete:
  3894.          rm_status = nfs41_remove(state->session, &state->parent,
  3895.              name, state->file.fh.fileid);
  3896. @@ -1055,8 +1065,8 @@ retry_delete:
  3897.                                         goto retry_delete;
  3898.                                 }  else goto out;
  3899.                         }
  3900. -            dprintf(1, "nfs41_remove() failed with error %s.\n",
  3901. -                nfs_error_string(rm_status));
  3902. +            DPRINTF(1, ("nfs41_remove() failed with error '%s'.\n",
  3903. +                nfs_error_string(rm_status)));
  3904.              rm_status = nfs_to_windows_error(rm_status, ERROR_INTERNAL_ERROR);
  3905.          }
  3906.      }
  3907. diff --git a/daemon/pnfs_debug.c b/daemon/pnfs_debug.c
  3908. index fc55c34..cefff04 100644
  3909. --- a/daemon/pnfs_debug.c
  3910. +++ b/daemon/pnfs_debug.c
  3911. @@ -65,14 +65,14 @@ const char* pnfs_iomode_string(enum pnfs_iomode iomode)
  3912.      }
  3913.  }
  3914.  
  3915. +static
  3916.  void dprint_deviceid(
  3917. -    IN int level,
  3918.      IN const char *title,
  3919.      IN const unsigned char *deviceid)
  3920.  {
  3921.      /* deviceid is 16 bytes, so print it as 4 uints */
  3922.      uint32_t *p = (uint32_t*)deviceid;
  3923. -    dprintf(level, "%s%08X.%08X.%08X.%08X\n",
  3924. +    dprintf_out("%s%08X.%08X.%08X.%08X\n",
  3925.          title, htonl(p[0]), htonl(p[1]), htonl(p[2]), htonl(p[3]));
  3926.  }
  3927.  
  3928. @@ -80,24 +80,26 @@ void dprint_layout(
  3929.      IN int level,
  3930.      IN const pnfs_file_layout *layout)
  3931.  {
  3932. -    dprintf(level, "  type:             %s\n", pnfs_layout_type_string(layout->layout.type));
  3933. -    dprintf(level, "  iomode:           %s\n", pnfs_iomode_string(layout->layout.iomode));
  3934. -    dprint_deviceid(level, "  deviceid:         ", layout->deviceid);
  3935. -    dprintf(level, "  offset:           %llu\n", layout->layout.offset);
  3936. -    dprintf(level, "  length:           %llu\n", layout->layout.length);
  3937. -    dprintf(level, "  pattern_offset:   %llu\n", layout->pattern_offset);
  3938. -    dprintf(level, "  first_index:      %u\n", layout->first_index);
  3939. -    dprintf(level, "  dense:            %u\n", is_dense(layout));
  3940. -    dprintf(level, "  commit_to_mds:    %u\n", should_commit_to_mds(layout));
  3941. -    dprintf(level, "  stripe_unit_size: %u\n", layout_unit_size(layout));
  3942. -    dprintf(level, "  file handles:     %u\n", layout->filehandles.count);
  3943. +    if (!DPRINTF_LEVEL_ENABLED(level))
  3944. +        return;
  3945. +
  3946. +    dprintf_out("  type:             '%s'\n", pnfs_layout_type_string(layout->layout.type));
  3947. +    dprintf_out("  iomode:           '%s'\n", pnfs_iomode_string(layout->layout.iomode));
  3948. +    dprint_deviceid("  deviceid:         ", layout->deviceid);
  3949. +    dprintf_out("  offset:           %llu\n", layout->layout.offset);
  3950. +    dprintf_out("  length:           %llu\n", layout->layout.length);
  3951. +    dprintf_out("  pattern_offset:   %llu\n", layout->pattern_offset);
  3952. +    dprintf_out("  first_index:      %u\n", layout->first_index);
  3953. +    dprintf_out("  dense:            %u\n", is_dense(layout));
  3954. +    dprintf_out("  commit_to_mds:    %u\n", should_commit_to_mds(layout));
  3955. +    dprintf_out("  stripe_unit_size: %u\n", layout_unit_size(layout));
  3956. +    dprintf_out("  file handles:     %u\n", layout->filehandles.count);
  3957.  }
  3958.  
  3959.  #define MULTI_ADDR_BUFFER_LEN \
  3960.      (NFS41_ADDRS_PER_SERVER*(NFS41_UNIVERSAL_ADDR_LEN+1)+1)
  3961.  
  3962.  static void dprint_multi_addr(
  3963. -    IN int level,
  3964.      IN uint32_t index,
  3965.      IN const multi_addr4 *addrs)
  3966.  {
  3967. @@ -107,7 +109,7 @@ static void dprint_multi_addr(
  3968.          StringCchCatA(buffer, MULTI_ADDR_BUFFER_LEN, addrs->arr[i].uaddr);
  3969.          StringCchCatA(buffer, MULTI_ADDR_BUFFER_LEN, " ");
  3970.      }
  3971. -    dprintf(level, "  servers[%d]:       [ %s]\n", index, buffer);
  3972. +    dprintf_out("  servers[%d]:       [ '%s']\n", index, buffer);
  3973.  }
  3974.  
  3975.  void dprint_device(
  3976. @@ -115,9 +117,13 @@ void dprint_device(
  3977.      IN const pnfs_file_device *device)
  3978.  {
  3979.      uint32_t i;
  3980. -    dprint_deviceid(level, "  deviceid:         ", device->device.deviceid);
  3981. -    dprintf(level, "  type:             %s\n", pnfs_layout_type_string(device->device.type));
  3982. -    dprintf(level, "  stripes:          %u\n", device->stripes.count);
  3983. +
  3984. +    if (!DPRINTF_LEVEL_ENABLED(level))
  3985. +        return;
  3986. +
  3987. +    dprint_deviceid("  deviceid:         ", device->device.deviceid);
  3988. +    dprintf_out("  type:             '%s'\n", pnfs_layout_type_string(device->device.type));
  3989. +    dprintf_out("  stripes:          %u\n", device->stripes.count);
  3990.      for (i = 0; i < device->servers.count; i++)
  3991. -        dprint_multi_addr(level, i, &device->servers.arr[i].addrs);
  3992. +        dprint_multi_addr(i, &device->servers.arr[i].addrs);
  3993.  }
  3994. diff --git a/daemon/pnfs_device.c b/daemon/pnfs_device.c
  3995. index 227c5a9..d16e3cb 100644
  3996. --- a/daemon/pnfs_device.c
  3997. +++ b/daemon/pnfs_device.c
  3998. @@ -87,7 +87,7 @@ static enum pnfs_status file_device_find_or_create(
  3999.      struct list_entry *entry;
  4000.      enum pnfs_status status;
  4001.  
  4002. -    dprintf(FDLVL, "--> pnfs_file_device_find_or_create()\n");
  4003. +    DPRINTF(FDLVL, ("--> pnfs_file_device_find_or_create()\n"));
  4004.  
  4005.      EnterCriticalSection(&devices->lock);
  4006.  
  4007. @@ -102,18 +102,18 @@ static enum pnfs_status file_device_find_or_create(
  4008.              list_add_tail(&devices->head, &device->entry);
  4009.              *device_out = device;
  4010.  
  4011. -            dprintf(FDLVL, "<-- pnfs_file_device_find_or_create() "
  4012. -                "returning new device %p\n", device);
  4013. +            DPRINTF(FDLVL, ("<-- pnfs_file_device_find_or_create() "
  4014. +                "returning new device 0x%p\n", device));
  4015.          } else {
  4016. -            dprintf(FDLVL, "<-- pnfs_file_device_find_or_create() "
  4017. -                "returning %s\n", pnfs_error_string(status));
  4018. +            DPRINTF(FDLVL, ("<-- pnfs_file_device_find_or_create() "
  4019. +                "returning '%s'\n", pnfs_error_string(status)));
  4020.          }
  4021.      } else {
  4022.          *device_out = device_entry(entry);
  4023.          status = PNFS_SUCCESS;
  4024.  
  4025. -        dprintf(FDLVL, "<-- pnfs_file_device_find_or_create() "
  4026. -            "returning existing device %p\n", *device_out);
  4027. +        DPRINTF(FDLVL, ("<-- pnfs_file_device_find_or_create() "
  4028. +            "returning existing device 0x%p\n", *device_out));
  4029.      }
  4030.  
  4031.      LeaveCriticalSection(&devices->lock);
  4032. @@ -162,7 +162,7 @@ void pnfs_file_device_list_invalidate(
  4033.      struct list_entry *entry, *tmp;
  4034.      pnfs_file_device *device;
  4035.  
  4036. -    dprintf(FDLVL, "--> pnfs_file_device_list_invalidate()\n");
  4037. +    DPRINTF(FDLVL, ("--> pnfs_file_device_list_invalidate()\n"));
  4038.  
  4039.      EnterCriticalSection(&devices->lock);
  4040.  
  4041. @@ -184,7 +184,7 @@ void pnfs_file_device_list_invalidate(
  4042.  
  4043.      LeaveCriticalSection(&devices->lock);
  4044.  
  4045. -    dprintf(FDLVL, "<-- pnfs_file_device_list_invalidate()\n");
  4046. +    DPRINTF(FDLVL, ("<-- pnfs_file_device_list_invalidate()\n"));
  4047.  }
  4048.  
  4049.  
  4050. @@ -199,7 +199,7 @@ enum pnfs_status pnfs_file_device_get(
  4051.      enum pnfs_status status;
  4052.      enum nfsstat4 nfsstat;
  4053.  
  4054. -    dprintf(FDLVL, "--> pnfs_file_device_get()\n");
  4055. +    DPRINTF(FDLVL, ("--> pnfs_file_device_get()\n"));
  4056.  
  4057.      status = file_device_find_or_create(deviceid, devices, &device);
  4058.      if (status)
  4059. @@ -218,27 +218,27 @@ enum pnfs_status pnfs_file_device_get(
  4060.              device->device.status = PNFS_DEVICE_GRANTED;
  4061.              status = PNFS_SUCCESS;
  4062.  
  4063. -            dprintf(FDLVL, "Received device info:\n");
  4064. +            DPRINTF(FDLVL, ("Received device info:\n"));
  4065.              dprint_device(FDLVL, device);
  4066.          } else {
  4067.              status = PNFSERR_NO_DEVICE;
  4068.  
  4069. -            eprintf("pnfs_rpc_getdeviceinfo() failed with %s\n",
  4070. +            eprintf("pnfs_rpc_getdeviceinfo() failed with '%s'\n",
  4071.                  nfs_error_string(nfsstat));
  4072.          }
  4073.      }
  4074.  
  4075.      if (status == PNFS_SUCCESS) {
  4076.          device->device.layout_count++;
  4077. -        dprintf(FDLVL, "pnfs_file_device_get() -> %u\n",
  4078. -            device->device.layout_count);
  4079. +        DPRINTF(FDLVL, ("pnfs_file_device_get() -> %u\n",
  4080. +            device->device.layout_count));
  4081.          *device_out = device;
  4082.      }
  4083.  
  4084.      LeaveCriticalSection(&device->device.lock);
  4085.  out:
  4086. -    dprintf(FDLVL, "<-- pnfs_file_device_get() returning %s\n",
  4087. -        pnfs_error_string(status));
  4088. +    DPRINTF(FDLVL, ("<-- pnfs_file_device_get() returning '%s'\n",
  4089. +        pnfs_error_string(status)));
  4090.      return status;
  4091.  }
  4092.  
  4093. @@ -248,7 +248,7 @@ void pnfs_file_device_put(
  4094.      uint32_t count;
  4095.      EnterCriticalSection(&device->device.lock);
  4096.      count = --device->device.layout_count;
  4097. -    dprintf(FDLVL, "pnfs_file_device_put() -> %u\n", count);
  4098. +    DPRINTF(FDLVL, ("pnfs_file_device_put() -> %u\n", count));
  4099.  
  4100.      /* if the device was revoked, remove/free the device on last reference */
  4101.      if (count == 0 && device->device.status & PNFS_DEVICE_REVOKED) {
  4102. @@ -259,7 +259,7 @@ void pnfs_file_device_put(
  4103.          LeaveCriticalSection(&device->device.lock);
  4104.  
  4105.          file_device_free(device);
  4106. -        dprintf(FDLVL, "revoked file device freed after last reference\n");
  4107. +        DPRINTF(FDLVL, ("revoked file device freed after last reference\n"));
  4108.      } else {
  4109.          LeaveCriticalSection(&device->device.lock);
  4110.      }
  4111. @@ -272,8 +272,8 @@ static enum pnfs_status data_client_status(
  4112.      enum pnfs_status status = PNFSERR_NOT_CONNECTED;
  4113.  
  4114.      if (server->client) {
  4115. -        dprintf(FDLVL, "pnfs_data_server_client() returning "
  4116. -            "existing client %llu\n", server->client->clnt_id);
  4117. +        DPRINTF(FDLVL, ("pnfs_data_server_client() returning "
  4118. +            "existing client %llu\n", server->client->clnt_id));
  4119.          *client_out = server->client;
  4120.          status = PNFS_SUCCESS;
  4121.      }
  4122. @@ -289,8 +289,8 @@ enum pnfs_status pnfs_data_server_client(
  4123.      int status;
  4124.      enum pnfs_status pnfsstat;
  4125.  
  4126. -    dprintf(FDLVL, "--> pnfs_data_server_client('%s')\n",
  4127. -        server->addrs.arr[0].uaddr);
  4128. +    DPRINTF(FDLVL, ("--> pnfs_data_server_client('%s')\n",
  4129. +        server->addrs.arr[0].uaddr));
  4130.  
  4131.      /* if we've already created the client, return it */
  4132.      AcquireSRWLockShared(&server->lock);
  4133. @@ -307,14 +307,14 @@ enum pnfs_status pnfs_data_server_client(
  4134.          status = nfs41_root_mount_addrs(root, &server->addrs, 1, default_lease,
  4135.              &server->client);
  4136.          if (status) {
  4137. -            dprintf(FDLVL, "data_client_create('%s') failed with %d\n",
  4138. -                server->addrs.arr[0].uaddr, status);
  4139. +            DPRINTF(FDLVL, ("data_client_create('%s') failed with %d\n",
  4140. +                server->addrs.arr[0].uaddr, status));
  4141.          } else {
  4142.              *client_out = server->client;
  4143.              pnfsstat = PNFS_SUCCESS;
  4144.  
  4145. -            dprintf(FDLVL, "pnfs_data_server_client() returning new client "
  4146. -                "%llu\n", server->client->clnt_id);
  4147. +            DPRINTF(FDLVL, ("pnfs_data_server_client() returning new client "
  4148. +                "%llu\n", server->client->clnt_id));
  4149.          }
  4150.      }
  4151.  
  4152. @@ -332,8 +332,8 @@ enum pnfs_status pnfs_file_device_notify(
  4153.      struct list_entry *entry;
  4154.      enum pnfs_status status = PNFSERR_NO_DEVICE;
  4155.  
  4156. -    dprintf(FDLVL, "--> pnfs_file_device_notify(%u, %0llX:%0llX)\n",
  4157. -        change->type, change->deviceid);
  4158. +    DPRINTF(FDLVL, ("--> pnfs_file_device_notify(%u, %0llX:%0llX)\n",
  4159. +        change->type, change->deviceid));
  4160.  
  4161.      if (change->layouttype != PNFS_LAYOUTTYPE_FILE) {
  4162.          status = PNFSERR_NOT_SUPPORTED;
  4163. @@ -344,22 +344,22 @@ enum pnfs_status pnfs_file_device_notify(
  4164.  
  4165.      entry = list_search(&devices->head, change->deviceid, deviceid_compare);
  4166.      if (entry) {
  4167. -        dprintf(FDLVL, "found file device %p\n", device_entry(entry));
  4168. +        DPRINTF(FDLVL, ("found file device 0x%p\n", device_entry(entry)));
  4169.  
  4170.          if (change->type == NOTIFY_DEVICEID4_CHANGE) {
  4171.              /* if (change->immediate) ... */
  4172. -            dprintf(FDLVL, "CHANGE (%u)\n", change->immediate);
  4173. +            DPRINTF(FDLVL, ("CHANGE (%u)\n", change->immediate));
  4174.          } else if (change->type == NOTIFY_DEVICEID4_DELETE) {
  4175.              /* This notification MUST NOT be sent if the client
  4176.               * has a layout that refers to the device ID. */
  4177. -            dprintf(FDLVL, "DELETE\n");
  4178. +            DPRINTF(FDLVL, ("DELETE\n"));
  4179.          }
  4180.          status = PNFS_SUCCESS;
  4181.      }
  4182.  
  4183.      LeaveCriticalSection(&devices->lock);
  4184.  out:
  4185. -    dprintf(FDLVL, "<-- pnfs_file_device_notify() returning %s\n",
  4186. -        pnfs_error_string(status));
  4187. +    DPRINTF(FDLVL, ("<-- pnfs_file_device_notify() returning '%s'\n",
  4188. +        pnfs_error_string(status)));
  4189.      return status;
  4190.  }
  4191. diff --git a/daemon/pnfs_io.c b/daemon/pnfs_io.c
  4192. index 5c4fd83..dd0737b 100644
  4193. --- a/daemon/pnfs_io.c
  4194. +++ b/daemon/pnfs_io.c
  4195. @@ -421,7 +421,7 @@ static enum pnfs_status pattern_fork(
  4196.      /* wait on all threads to finish */
  4197.      status = pattern_join(threads, pattern->count);
  4198.      if (status) {
  4199. -        eprintf("pattern_join() failed with %s\n", pnfs_error_string(status));
  4200. +        eprintf("pattern_join() failed with '%s'\n", pnfs_error_string(status));
  4201.          goto out;
  4202.      }
  4203.  
  4204. @@ -472,7 +472,7 @@ static enum pnfs_status map_ds_error(
  4205.       * attempting to READ or WRITE */
  4206.      case NFS4ERR_STALE:
  4207.      case NFS4ERR_PNFS_NO_LAYOUT:
  4208. -        dprintf(IOLVL, "data server fencing detected!\n");
  4209. +        DPRINTF(IOLVL, ("data server fencing detected!\n"));
  4210.  
  4211.          pnfs_layout_recall_fenced(state, &layout->layout);
  4212.  
  4213. @@ -497,12 +497,12 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
  4214.      enum nfsstat4 nfsstat;
  4215.      bool_t eof;
  4216.  
  4217. -    dprintf(IOLVL, "--> file_layout_read_thread(%u)\n", thread->id);
  4218. +    DPRINTF(IOLVL, ("--> file_layout_read_thread(%u)\n", thread->id));
  4219.  
  4220.      /* get the data server for this thread */
  4221.      status = thread_data_server(thread, &server);
  4222.      if (status) {
  4223. -        eprintf("thread_data_server() failed with %s\n",
  4224. +        eprintf("thread_data_server() failed with '%s'\n",
  4225.              pnfs_error_string(status));
  4226.          goto out;
  4227.      }
  4228. @@ -510,7 +510,7 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
  4229.      status = pnfs_data_server_client(pattern->root,
  4230.          server, pattern->default_lease, &client);
  4231.      if (status) {
  4232. -        eprintf("pnfs_data_server_client() failed with %s\n",
  4233. +        eprintf("pnfs_data_server_client() failed with '%s'\n",
  4234.              pnfs_error_string(status));
  4235.          goto out;
  4236.      }
  4237. @@ -527,7 +527,7 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
  4238.          nfsstat = nfs41_read(client->session, thread->file, &stateid,
  4239.              io.offset, (uint32_t)io.length, io.buffer, &bytes_read, &eof);
  4240.          if (nfsstat) {
  4241. -            eprintf("nfs41_read() failed with %s\n",
  4242. +            eprintf("nfs41_read() failed with '%s'\n",
  4243.                  nfs_error_string(nfsstat));
  4244.              status = map_ds_error(nfsstat, pattern->state, thread->layout);
  4245.              break;
  4246. @@ -537,15 +537,15 @@ static uint32_t WINAPI file_layout_read_thread(void *args)
  4247.          thread->offset += bytes_read;
  4248.  
  4249.          if (eof) {
  4250. -            dprintf(IOLVL, "read thread %u reached eof: offset %llu\n",
  4251. -                thread->id, thread->offset);
  4252. +            DPRINTF(IOLVL, ("read thread %u reached eof: offset %llu\n",
  4253. +                thread->id, thread->offset));
  4254.              status = total_read ? PNFS_SUCCESS : PNFS_READ_EOF;
  4255.              break;
  4256.          }
  4257.      }
  4258.  out:
  4259. -    dprintf(IOLVL, "<-- file_layout_read_thread(%u) returning %s\n",
  4260. -        thread->id, pnfs_error_string(status));
  4261. +    DPRINTF(IOLVL, ("<-- file_layout_read_thread(%u) returning '%s'\n",
  4262. +        thread->id, pnfs_error_string(status)));
  4263.      return status;
  4264.  }
  4265.  
  4266. @@ -563,12 +563,12 @@ static uint32_t WINAPI file_layout_write_thread(void *args)
  4267.      enum pnfs_status status;
  4268.      enum nfsstat4 nfsstat;
  4269.  
  4270. -    dprintf(IOLVL, "--> file_layout_write_thread(%u)\n", thread->id);
  4271. +    DPRINTF(IOLVL, ("--> file_layout_write_thread(%u)\n", thread->id));
  4272.  
  4273.      /* get the data server for this thread */
  4274.      status = thread_data_server(thread, &server);
  4275.      if (status) {
  4276. -        eprintf("thread_data_server() failed with %s\n",
  4277. +        eprintf("thread_data_server() failed with '%s'\n",
  4278.              pnfs_error_string(status));
  4279.          goto out;
  4280.      }
  4281. @@ -576,7 +576,7 @@ static uint32_t WINAPI file_layout_write_thread(void *args)
  4282.      status = pnfs_data_server_client(pattern->root,
  4283.          server, pattern->default_lease, &client);
  4284.      if (status) {
  4285. -        eprintf("pnfs_data_server_client() failed with %s\n",
  4286. +        eprintf("pnfs_data_server_client() failed with '%s'\n",
  4287.              pnfs_error_string(status));
  4288.          goto out;
  4289.      }
  4290. @@ -601,7 +601,7 @@ retry_write:
  4291.              io.buffer, (uint32_t)io.length, io.offset, UNSTABLE4,
  4292.              &bytes_written, &thread->verf, NULL);
  4293.          if (nfsstat) {
  4294. -            eprintf("nfs41_write() failed with %s\n",
  4295. +            eprintf("nfs41_write() failed with '%s'\n",
  4296.                  nfs_error_string(nfsstat));
  4297.              status = map_ds_error(nfsstat, pattern->state, thread->layout);
  4298.              break;
  4299. @@ -632,8 +632,8 @@ retry_write:
  4300.      if (should_commit_to_mds(thread->layout))
  4301.          goto out;
  4302.  
  4303. -    dprintf(1, "sending COMMIT to data server for offset=%lld len=%lld\n",
  4304. -        commit_min, commit_max - commit_min);
  4305. +    DPRINTF(1, ("sending COMMIT to data server for offset=%lld len=%lld\n",
  4306. +        commit_min, commit_max - commit_min));
  4307.      nfsstat = nfs41_commit(client->session, thread->file,
  4308.          commit_min, (uint32_t)(commit_max - commit_min), 0, &thread->verf, NULL);
  4309.  
  4310. @@ -650,8 +650,8 @@ retry_write:
  4311.          thread->stable = DATA_SYNC4;
  4312.      }
  4313.  out:
  4314. -    dprintf(IOLVL, "<-- file_layout_write_thread(%u) returning %s\n",
  4315. -        thread->id, pnfs_error_string(status));
  4316. +    DPRINTF(IOLVL, ("<-- file_layout_write_thread(%u) returning '%s'\n",
  4317. +        thread->id, pnfs_error_string(status)));
  4318.      return status;
  4319.  }
  4320.  
  4321. @@ -669,7 +669,7 @@ enum pnfs_status pnfs_read(
  4322.      pnfs_io_pattern pattern;
  4323.      enum pnfs_status status;
  4324.  
  4325. -    dprintf(IOLVL, "--> pnfs_read(%llu, %llu)\n", offset, length);
  4326. +    DPRINTF(IOLVL, ("--> pnfs_read(%llu, %llu)\n", offset, length));
  4327.  
  4328.      *len_out = 0;
  4329.  
  4330. @@ -688,7 +688,7 @@ enum pnfs_status pnfs_read(
  4331.              layout, buffer_out, PNFS_IOMODE_READ, offset, length,
  4332.              state->session->lease_time);
  4333.          if (status)
  4334. -            eprintf("pattern_init() failed with %s\n",
  4335. +            eprintf("pattern_init() failed with '%s'\n",
  4336.                  pnfs_error_string(status));
  4337.      }
  4338.  
  4339. @@ -706,8 +706,8 @@ enum pnfs_status pnfs_read(
  4340.  out_free_pattern:
  4341.      pattern_free(&pattern);
  4342.  out:
  4343. -    dprintf(IOLVL, "<-- pnfs_read() returning %s\n",
  4344. -        pnfs_error_string(status));
  4345. +    DPRINTF(IOLVL, ("<-- pnfs_read() returning '%s'\n",
  4346. +        pnfs_error_string(status)));
  4347.      return status;
  4348.  }
  4349.  
  4350. @@ -726,7 +726,7 @@ static enum pnfs_status mds_commit(
  4351.      nfsstat = nfs41_commit(state->session,
  4352.          &state->file, offset, length, 1, &verf, info);
  4353.      if (nfsstat) {
  4354. -        eprintf("nfs41_commit() to mds failed with %s\n",
  4355. +        eprintf("nfs41_commit() to mds failed with '%s'\n",
  4356.              nfs_error_string(nfsstat));
  4357.          status = PNFSERR_IO;
  4358.          goto out;
  4359. @@ -786,13 +786,13 @@ static enum pnfs_status layout_commit(
  4360.      memcpy(&layout_stateid, &layout->stateid, sizeof(layout_stateid));
  4361.      ReleaseSRWLockShared(&layout->lock);
  4362.  
  4363. -    dprintf(1, "LAYOUTCOMMIT for offset=%lld len=%lld new_last_offset=%u\n",
  4364. -        offset, length, new_last_offset ? 1 : 0);
  4365. +    DPRINTF(1, ("LAYOUTCOMMIT for offset=%lld len=%lld new_last_offset=%u\n",
  4366. +        offset, length, new_last_offset ? 1 : 0));
  4367.      nfsstat = pnfs_rpc_layoutcommit(state->session, &state->file,
  4368.          &layout_stateid, offset, length, new_last_offset, NULL, info);
  4369.      if (nfsstat) {
  4370. -        dprintf(IOLVL, "pnfs_rpc_layoutcommit() failed with %s\n",
  4371. -            nfs_error_string(nfsstat));
  4372. +        DPRINTF(IOLVL, ("pnfs_rpc_layoutcommit() failed with '%s'\n",
  4373. +            nfs_error_string(nfsstat)));
  4374.          status = PNFSERR_IO;
  4375.      }
  4376.      return status;
  4377. @@ -813,7 +813,7 @@ enum pnfs_status pnfs_write(
  4378.      enum stable_how4 stable;
  4379.      enum pnfs_status status;
  4380.  
  4381. -    dprintf(IOLVL, "--> pnfs_write(%llu, %llu)\n", offset, length);
  4382. +    DPRINTF(IOLVL, ("--> pnfs_write(%llu, %llu)\n", offset, length));
  4383.  
  4384.      *len_out = 0;
  4385.  
  4386. @@ -832,7 +832,7 @@ enum pnfs_status pnfs_write(
  4387.              layout, buffer, PNFS_IOMODE_RW, offset, length,
  4388.              state->session->lease_time);
  4389.          if (status)
  4390. -            eprintf("pattern_init() failed with %s\n",
  4391. +            eprintf("pattern_init() failed with '%s'\n",
  4392.                  pnfs_error_string(status));
  4393.      }
  4394.  
  4395. @@ -865,7 +865,7 @@ enum pnfs_status pnfs_write(
  4396.  out_free_pattern:
  4397.      pattern_free(&pattern);
  4398.  out:
  4399. -    dprintf(IOLVL, "<-- pnfs_write() returning %s\n",
  4400. -        pnfs_error_string(status));
  4401. +    DPRINTF(IOLVL, ("<-- pnfs_write() returning '%s'\n",
  4402. +        pnfs_error_string(status)));
  4403.      return status;
  4404.  }
  4405. \ No newline at end of file
  4406. diff --git a/daemon/pnfs_layout.c b/daemon/pnfs_layout.c
  4407. index e3390f6..5e05b02 100644
  4408. --- a/daemon/pnfs_layout.c
  4409. +++ b/daemon/pnfs_layout.c
  4410. @@ -159,7 +159,7 @@ static enum pnfs_status layout_state_find_or_create(
  4411.      struct list_entry *entry;
  4412.      enum pnfs_status status;
  4413.  
  4414. -    dprintf(FLLVL, "--> layout_state_find_or_create()\n");
  4415. +    DPRINTF(FLLVL, ("--> layout_state_find_or_create()\n"));
  4416.  
  4417.      EnterCriticalSection(&layouts->lock);
  4418.  
  4419. @@ -174,17 +174,17 @@ static enum pnfs_status layout_state_find_or_create(
  4420.              list_add_head(&layouts->head, &layout->entry);
  4421.              *layout_out = layout;
  4422.  
  4423. -            dprintf(FLLVL, "<-- layout_state_find_or_create() "
  4424. -                "returning new layout %p\n", layout);
  4425. +            DPRINTF(FLLVL, ("<-- layout_state_find_or_create() "
  4426. +                "returning new layout 0x%p\n", layout));
  4427.          } else {
  4428. -            dprintf(FLLVL, "<-- layout_state_find_or_create() "
  4429. -                "returning %s\n", pnfs_error_string(status));
  4430. +            DPRINTF(FLLVL, ("<-- layout_state_find_or_create() "
  4431. +                "returning '%s'\n", pnfs_error_string(status)));
  4432.          }
  4433.      } else {
  4434.          *layout_out = state_entry(entry);
  4435.  
  4436. -        dprintf(FLLVL, "<-- layout_state_find_or_create() "
  4437. -            "returning existing layout %p\n", *layout_out);
  4438. +        DPRINTF(FLLVL, ("<-- layout_state_find_or_create() "
  4439. +            "returning existing layout 0x%p\n", *layout_out));
  4440.      }
  4441.  
  4442.      LeaveCriticalSection(&layouts->lock);
  4443. @@ -198,7 +198,7 @@ static enum pnfs_status layout_state_find_and_delete(
  4444.      struct list_entry *entry;
  4445.      enum pnfs_status status;
  4446.  
  4447. -    dprintf(FLLVL, "--> layout_state_find_and_delete()\n");
  4448. +    DPRINTF(FLLVL, ("--> layout_state_find_and_delete()\n"));
  4449.  
  4450.      EnterCriticalSection(&layouts->lock);
  4451.  
  4452. @@ -210,8 +210,8 @@ static enum pnfs_status layout_state_find_and_delete(
  4453.  
  4454.      LeaveCriticalSection(&layouts->lock);
  4455.  
  4456. -    dprintf(FLLVL, "<-- layout_state_find_and_delete() "
  4457. -        "returning %s\n", pnfs_error_string(status));
  4458. +    DPRINTF(FLLVL, ("<-- layout_state_find_and_delete() "
  4459. +        "returning '%s'\n", pnfs_error_string(status)));
  4460.      return status;
  4461.  }
  4462.  
  4463. @@ -273,9 +273,9 @@ static bool_t layout_merge_segments(
  4464.          to->util != from->util)
  4465.          return FALSE;
  4466.  
  4467. -    dprintf(FLLVL, "merging layout range {%llu, %llu} with {%llu, %llu}\n",
  4468. +    DPRINTF(FLLVL, ("merging layout range {%llu, %llu} with {%llu, %llu}\n",
  4469.          to->layout.offset, to->layout.length,
  4470. -        from->layout.offset, from->layout.length);
  4471. +        from->layout.offset, from->layout.length));
  4472.  
  4473.      /* calculate the union of the two ranges */
  4474.      to->layout.offset = min(to->layout.offset, from->layout.offset);
  4475. @@ -361,7 +361,7 @@ static enum pnfs_status layout_update_range(
  4476.          /* attempt to merge the range with existing segments */
  4477.          status = layout_state_merge(state, layout);
  4478.          if (status) {
  4479. -            dprintf(FLLVL, "saving new layout:\n");
  4480. +            DPRINTF(FLLVL, ("saving new layout:\n"));
  4481.              dprint_layout(FLLVL, layout);
  4482.  
  4483.              layout_ordered_insert(state, &layout->layout);
  4484. @@ -429,8 +429,8 @@ static enum pnfs_status file_layout_fetch(
  4485.      enum pnfs_status pnfsstat = PNFS_SUCCESS;
  4486.      enum nfsstat4 nfsstat;
  4487.  
  4488. -    dprintf(FLLVL, "--> file_layout_fetch(%s, seqid=%u)\n",
  4489. -        pnfs_iomode_string(iomode), state->stateid.seqid);
  4490. +    DPRINTF(FLLVL, ("--> file_layout_fetch('%s', seqid=%u)\n",
  4491. +        pnfs_iomode_string(iomode), state->stateid.seqid));
  4492.  
  4493.      list_init(&layoutget_res.layouts);
  4494.  
  4495. @@ -441,8 +441,8 @@ static enum pnfs_status file_layout_fetch(
  4496.      AcquireSRWLockExclusive(&state->lock);
  4497.  
  4498.      if (nfsstat) {
  4499. -        dprintf(FLLVL, "pnfs_rpc_layoutget() failed with %s\n",
  4500. -            nfs_error_string(nfsstat));
  4501. +        DPRINTF(FLLVL, ("pnfs_rpc_layoutget() failed with '%s'\n",
  4502. +            nfs_error_string(nfsstat)));
  4503.          pnfsstat = PNFSERR_NOT_SUPPORTED;
  4504.      }
  4505.  
  4506. @@ -466,8 +466,8 @@ static enum pnfs_status file_layout_fetch(
  4507.          break;
  4508.      }
  4509.  
  4510. -    dprintf(FLLVL, "<-- file_layout_fetch() returning %s\n",
  4511. -        pnfs_error_string(pnfsstat));
  4512. +    DPRINTF(FLLVL, ("<-- file_layout_fetch() returning '%s'\n",
  4513. +        pnfs_error_string(pnfsstat)));
  4514.      return pnfsstat;
  4515.  }
  4516.  
  4517. @@ -644,8 +644,8 @@ static enum pnfs_status open_state_layout_cached(
  4518.          status = PNFS_SUCCESS;
  4519.          *layout_out = state->layout;
  4520.  
  4521. -        dprintf(FLLVL, "pnfs_open_state_layout() found "
  4522. -            "cached layout %p\n", *layout_out);
  4523. +        DPRINTF(FLLVL, ("pnfs_open_state_layout() found "
  4524. +            "cached layout 0x%p\n", *layout_out));
  4525.      }
  4526.      return status;
  4527.  }
  4528. @@ -659,7 +659,7 @@ enum pnfs_status pnfs_layout_state_open(
  4529.      pnfs_layout_state *layout;
  4530.      enum pnfs_status status;
  4531.  
  4532. -    dprintf(FLLVL, "--> pnfs_layout_state_open()\n");
  4533. +    DPRINTF(FLLVL, ("--> pnfs_layout_state_open()\n"));
  4534.  
  4535.      status = client_supports_pnfs(session->client);
  4536.      if (status)
  4537. @@ -684,8 +684,8 @@ enum pnfs_status pnfs_layout_state_open(
  4538.                  LONG open_count = InterlockedIncrement(&layout->open_count);
  4539.                  state->layout = layout;
  4540.  
  4541. -                dprintf(FLLVL, "pnfs_layout_state_open() caching layout %p "
  4542. -                    "(%u opens)\n", state->layout, open_count);
  4543. +                DPRINTF(FLLVL, ("pnfs_layout_state_open() caching layout 0x%p "
  4544. +                    "(%u opens)\n", state->layout, open_count));
  4545.              }
  4546.          }
  4547.  
  4548. @@ -697,8 +697,8 @@ enum pnfs_status pnfs_layout_state_open(
  4549.  
  4550.      *layout_out = layout;
  4551.  out:
  4552. -    dprintf(FLLVL, "<-- pnfs_layout_state_open() returning %s\n",
  4553. -        pnfs_error_string(status));
  4554. +    DPRINTF(FLLVL, ("<-- pnfs_layout_state_open() returning '%s'\n",
  4555. +        pnfs_error_string(status)));
  4556.      return status;
  4557.  }
  4558.  
  4559. @@ -770,7 +770,7 @@ static enum pnfs_status file_layout_return(
  4560.      enum pnfs_status status;
  4561.      enum nfsstat4 nfsstat;
  4562.  
  4563. -    dprintf(FLLVL, "--> file_layout_return()\n");
  4564. +    DPRINTF(FLLVL, ("--> file_layout_return()\n"));
  4565.  
  4566.      /* under shared lock, determine whether we need to return the layout */
  4567.      AcquireSRWLockShared(&state->lock);
  4568. @@ -801,7 +801,7 @@ static enum pnfs_status file_layout_return(
  4569.          AcquireSRWLockExclusive(&state->lock);
  4570.  
  4571.          if (nfsstat) {
  4572. -            eprintf("pnfs_rpc_layoutreturn() failed with %s\n",
  4573. +            eprintf("pnfs_rpc_layoutreturn() failed with '%s'\n",
  4574.                  nfs_error_string(nfsstat));
  4575.              status = PNFSERR_NO_LAYOUT;
  4576.          } else {
  4577. @@ -822,8 +822,8 @@ static enum pnfs_status file_layout_return(
  4578.      ReleaseSRWLockExclusive(&state->lock);
  4579.  
  4580.  out:
  4581. -    dprintf(FLLVL, "<-- file_layout_return() returning %s\n",
  4582. -        pnfs_error_string(status));
  4583. +    DPRINTF(FLLVL, ("<-- file_layout_return() returning '%s'\n",
  4584. +        pnfs_error_string(status)));
  4585.      return status;
  4586.  }
  4587.  
  4588. @@ -852,7 +852,7 @@ void pnfs_layout_state_close(
  4589.          if (return_layout) {
  4590.              status = file_layout_return(session, &state->file, layout);
  4591.              if (status)
  4592. -                eprintf("file_layout_return() failed with %s\n",
  4593. +                eprintf("file_layout_return() failed with '%s'\n",
  4594.                      pnfs_error_string(status));
  4595.          }
  4596.      }
  4597. @@ -1010,8 +1010,8 @@ static enum pnfs_status layout_recall_merge(
  4598.          if (to->iomode != from->iomode || to->type != from->type)
  4599.              continue;
  4600.  
  4601. -        dprintf(FLLVL, "merging recalled range {%llu, %llu} with {%llu, %llu}\n",
  4602. -            to->offset, to->length, from->offset, from->length);
  4603. +        DPRINTF(FLLVL, ("merging recalled range {%llu, %llu} with {%llu, %llu}\n",
  4604. +            to->offset, to->length, from->offset, from->length));
  4605.  
  4606.          /* calculate the union of the two ranges */
  4607.          to->offset = min(to->offset, from->offset);
  4608. @@ -1089,7 +1089,7 @@ static enum pnfs_status file_layout_recall_file(
  4609.      struct list_entry *entry;
  4610.      enum pnfs_status status;
  4611.  
  4612. -    dprintf(FLLVL, "--> file_layout_recall_file()\n");
  4613. +    DPRINTF(FLLVL, ("--> file_layout_recall_file()\n"));
  4614.  
  4615.      EnterCriticalSection(&client->layouts->lock);
  4616.  
  4617. @@ -1099,8 +1099,8 @@ static enum pnfs_status file_layout_recall_file(
  4618.  
  4619.      LeaveCriticalSection(&client->layouts->lock);
  4620.  
  4621. -    dprintf(FLLVL, "<-- file_layout_recall_file() returning %s\n",
  4622. -        pnfs_error_string(status));
  4623. +    DPRINTF(FLLVL, ("<-- file_layout_recall_file() returning '%s'\n",
  4624. +        pnfs_error_string(status)));
  4625.      return status;
  4626.  }
  4627.  
  4628. @@ -1120,8 +1120,8 @@ static enum pnfs_status file_layout_recall_fsid(
  4629.      nfs41_fh *fh;
  4630.      enum pnfs_status status = PNFSERR_NO_LAYOUT;
  4631.  
  4632. -    dprintf(FLLVL, "--> file_layout_recall_fsid(%llu, %llu)\n",
  4633. -        recall->recall.args.fsid.major, recall->recall.args.fsid.minor);
  4634. +    DPRINTF(FLLVL, ("--> file_layout_recall_fsid(%llu, %llu)\n",
  4635. +        recall->recall.args.fsid.major, recall->recall.args.fsid.minor));
  4636.  
  4637.      EnterCriticalSection(&client->layouts->lock);
  4638.  
  4639. @@ -1139,8 +1139,8 @@ static enum pnfs_status file_layout_recall_fsid(
  4640.      /* bulk recalls require invalidation of cached device info */
  4641.      pnfs_file_device_list_invalidate(client->devices);
  4642.  
  4643. -    dprintf(FLLVL, "<-- file_layout_recall_fsid() returning %s\n",
  4644. -        pnfs_error_string(status));
  4645. +    DPRINTF(FLLVL, ("<-- file_layout_recall_fsid() returning '%s'\n",
  4646. +        pnfs_error_string(status)));
  4647.      return status;
  4648.  }
  4649.  
  4650. @@ -1151,7 +1151,7 @@ static enum pnfs_status file_layout_recall_all(
  4651.      struct list_entry *entry;
  4652.      enum pnfs_status status = PNFSERR_NO_LAYOUT;
  4653.  
  4654. -    dprintf(FLLVL, "--> file_layout_recall_all()\n");
  4655. +    DPRINTF(FLLVL, ("--> file_layout_recall_all()\n"));
  4656.  
  4657.      EnterCriticalSection(&client->layouts->lock);
  4658.  
  4659. @@ -1163,8 +1163,8 @@ static enum pnfs_status file_layout_recall_all(
  4660.      /* bulk recalls require invalidation of cached device info */
  4661.      pnfs_file_device_list_invalidate(client->devices);
  4662.  
  4663. -    dprintf(FLLVL, "<-- file_layout_recall_all() returning %s\n",
  4664. -        pnfs_error_string(status));
  4665. +    DPRINTF(FLLVL, ("<-- file_layout_recall_all() returning '%s'\n",
  4666. +        pnfs_error_string(status)));
  4667.      return status;
  4668.  }
  4669.  
  4670. @@ -1174,13 +1174,13 @@ enum pnfs_status pnfs_file_layout_recall(
  4671.  {
  4672.      enum pnfs_status status = PNFS_SUCCESS;
  4673.  
  4674. -    dprintf(FLLVL, "--> pnfs_file_layout_recall(%u, %s, %u)\n",
  4675. +    DPRINTF(FLLVL, ("--> pnfs_file_layout_recall(%u, '%s', %u)\n",
  4676.          recall->recall.type, pnfs_iomode_string(recall->iomode),
  4677. -        recall->changed);
  4678. +        recall->changed));
  4679.  
  4680.      if (recall->type != PNFS_LAYOUTTYPE_FILE) {
  4681. -        dprintf(FLLVL, "invalid layout type %u (%s)!\n",
  4682. -            recall->type, pnfs_layout_type_string(recall->type));
  4683. +        DPRINTF(FLLVL, ("invalid layout type %u ('%s')!\n",
  4684. +            recall->type, pnfs_layout_type_string(recall->type)));
  4685.          status = PNFSERR_NOT_SUPPORTED;
  4686.          goto out;
  4687.      }
  4688. @@ -1197,13 +1197,13 @@ enum pnfs_status pnfs_file_layout_recall(
  4689.          break;
  4690.  
  4691.      default:
  4692. -        dprintf(FLLVL, "invalid return type %u!\n", recall->recall);
  4693. +        DPRINTF(FLLVL, ("invalid return type %u!\n", recall->recall));
  4694.          status = PNFSERR_NOT_SUPPORTED;
  4695.          goto out;
  4696.      }
  4697.  out:
  4698. -    dprintf(FLLVL, "<-- pnfs_file_layout_recall() returning %s\n",
  4699. -        pnfs_error_string(status));
  4700. +    DPRINTF(FLLVL, ("<-- pnfs_file_layout_recall() returning '%s'\n",
  4701. +        pnfs_error_string(status)));
  4702.      return status;
  4703.  }
  4704.  
  4705. @@ -1260,8 +1260,8 @@ void pnfs_layout_io_start(
  4706.      /* take a reference on the layout, so that it won't be recalled
  4707.       * until all io is finished */
  4708.      state->io_count++;
  4709. -    dprintf(FLLVL, "pnfs_layout_io_start(): count -> %u\n",
  4710. -        state->io_count);
  4711. +    DPRINTF(FLLVL, ("pnfs_layout_io_start(): count -> %u\n",
  4712. +        state->io_count));
  4713.  }
  4714.  
  4715.  void pnfs_layout_io_finished(
  4716. @@ -1271,8 +1271,8 @@ void pnfs_layout_io_finished(
  4717.  
  4718.      /* return the reference to signify that an io request is finished */
  4719.      state->io_count--;
  4720. -    dprintf(FLLVL, "pnfs_layout_io_finished() count -> %u\n",
  4721. -        state->io_count);
  4722. +    DPRINTF(FLLVL, ("pnfs_layout_io_finished() count -> %u\n",
  4723. +        state->io_count));
  4724.  
  4725.      if (state->io_count > 0) /* more io pending */
  4726.          goto out_unlock;
  4727. diff --git a/daemon/readdir.c b/daemon/readdir.c
  4728. index 04b3289..6d813cf 100644
  4729. --- a/daemon/readdir.c
  4730. +++ b/daemon/readdir.c
  4731. @@ -277,10 +277,10 @@ static int parse_readdir(unsigned char *buffer, uint32_t length, nfs41_upcall *u
  4732.      args->root = upcall->root_ref;
  4733.      args->state = upcall->state_ref;
  4734.  
  4735. -    dprintf(1, "parsing NFS41_DIR_QUERY: info_class=%d buf_len=%d "
  4736. -        "filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d buf=%p\n",
  4737. +    DPRINTF(1, ("parsing NFS41_DIR_QUERY: info_class=%d buf_len=%d "
  4738. +        "filter='%s'\n\tInitial\\Restart\\Single %d\\%d\\%d buf=0x%p\n",
  4739.          args->query_class, args->buf_len, args->filter,
  4740. -        args->initial, args->restart, args->single, args->kbuf);
  4741. +        args->initial, args->restart, args->single, args->kbuf));
  4742.  out:
  4743.      return status;
  4744.  }
  4745. @@ -563,8 +563,8 @@ static int readdir_add_dots(
  4746.      case 0:
  4747.          if (entry_buf_len < entry_len + 2) {
  4748.              status = ERROR_BUFFER_OVERFLOW;
  4749. -            dprintf(0, "readdir_add_dots: not enough room for '.' entry. received %d need %d\n",
  4750. -                    entry_buf_len, entry_len + 2);
  4751. +            DPRINTF(0, ("readdir_add_dots: not enough room for '.' entry. received %d need %d\n",
  4752. +                    entry_buf_len, entry_len + 2));
  4753.              args->query_reply_len = entry_len + 2;
  4754.              goto out;
  4755.          }
  4756. @@ -575,7 +575,7 @@ static int readdir_add_dots(
  4757.          status = nfs41_cached_getattr(state->session,
  4758.              &state->file, &entry->attr_info);
  4759.          if (status) {
  4760. -            dprintf(0, "readdir_add_dots: failed to add '.' entry.\n");
  4761. +            DPRINTF(0, ("readdir_add_dots: failed to add '.' entry.\n"));
  4762.              goto out;
  4763.          }
  4764.          entry->cookie = COOKIE_DOT;
  4765. @@ -593,8 +593,8 @@ static int readdir_add_dots(
  4766.      case COOKIE_DOT:
  4767.          if (entry_buf_len < entry_len + 3) {
  4768.              status = ERROR_BUFFER_OVERFLOW;
  4769. -            dprintf(0, "readdir_add_dots: not enough room for '..' entry. received %d need %d\n",
  4770. -                    entry_buf_len, entry_len);
  4771. +            DPRINTF(0, ("readdir_add_dots: not enough room for '..' entry. received %d need %d\n",
  4772. +                    entry_buf_len, entry_len));
  4773.              args->query_reply_len = entry_len + 2;
  4774.              goto out;
  4775.          }
  4776. @@ -609,7 +609,7 @@ static int readdir_add_dots(
  4777.              &state->parent, &entry->attr_info);
  4778.          if (status) {
  4779.              status = ERROR_FILE_NOT_FOUND;
  4780. -            dprintf(0, "readdir_add_dots: failed to add '..' entry.\n");
  4781. +            DPRINTF(0, ("readdir_add_dots: failed to add '..' entry.\n"));
  4782.              goto out;
  4783.          }
  4784.          entry->cookie = COOKIE_DOTDOT;
  4785. @@ -643,23 +643,26 @@ static int handle_readdir(void *deamon_context, nfs41_upcall *upcall)
  4786.      const uint32_t max_buf_len = max(args->buf_len,
  4787.          sizeof(nfs41_readdir_entry) + NFS41_MAX_COMPONENT_LEN);
  4788.  
  4789. -    dprintf(1, "-> handle_nfs41_dirquery(%s,%d,%d,%d)\n",
  4790. -        args->filter, args->initial, args->restart, args->single);
  4791. +    DPRINTF(1, ("-> handle_nfs41_dirquery('%s',%d,%d,%d)\n",
  4792. +        args->filter, args->initial, args->restart, args->single));
  4793.  
  4794.      args->query_reply_len = 0;
  4795.  
  4796.      if (args->initial || args->restart) {
  4797.          ZeroMemory(&state->cookie, sizeof(nfs41_readdir_cookie));
  4798. -        if (!state->cookie.cookie)
  4799. -            dprintf(1, "initializing the 1st readdir cookie\n");
  4800. -        else if (args->restart)
  4801. -            dprintf(1, "restarting; clearing previous cookie %llu\n",
  4802. -                state->cookie.cookie);
  4803. -        else if (args->initial)
  4804. -            dprintf(1, "*** initial; clearing previous cookie %llu!\n",
  4805. -                state->cookie.cookie);
  4806. +        if (!state->cookie.cookie) {
  4807. +            DPRINTF(1, ("initializing the 1st readdir cookie\n"));
  4808. +        }
  4809. +        else if (args->restart) {
  4810. +            DPRINTF(1, ("restarting; clearing previous cookie %llu\n",
  4811. +                state->cookie.cookie));
  4812. +        }
  4813. +        else if (args->initial) {
  4814. +            DPRINTF(1, ("*** initial; clearing previous cookie %llu!\n",
  4815. +                state->cookie.cookie));
  4816. +        }
  4817.      } else if (!state->cookie.cookie) {
  4818. -        dprintf(1, "handle_nfs41_readdir: EOF\n");
  4819. +        DPRINTF(1, ("handle_nfs41_readdir: EOF\n"));
  4820.          status = ERROR_NO_MORE_FILES;
  4821.          goto out;
  4822.      }
  4823. @@ -694,19 +697,19 @@ fetch_entries:
  4824.          }
  4825.  
  4826.          if (dots_len && args->single) {
  4827. -            dprintf(2, "skipping nfs41_readdir because the single query "
  4828. -                "will use . or ..\n");
  4829. +            DPRINTF(2, ("skipping nfs41_readdir because the single query "
  4830. +                "will use . or ..\n"));
  4831.              entry_buf_len = 0;
  4832.              eof = 0;
  4833.          } else {
  4834. -            dprintf(2, "calling nfs41_readdir with cookie %llu\n",
  4835. -                state->cookie.cookie);
  4836. +            DPRINTF(2, ("calling nfs41_readdir with cookie %llu\n",
  4837. +                state->cookie.cookie));
  4838.              status = nfs41_readdir(state->session, &state->file,
  4839.                  &attr_request, &state->cookie, entry_buf + dots_len,
  4840.                  &entry_buf_len, &eof);
  4841.              if (status) {
  4842. -                dprintf(1, "nfs41_readdir failed with %s\n",
  4843. -                    nfs_error_string(status));
  4844. +                DPRINTF(1, ("nfs41_readdir failed with '%s'\n",
  4845. +                    nfs_error_string(status)));
  4846.                  status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  4847.                  goto out_free_cookie;
  4848.              }
  4849. @@ -726,7 +729,7 @@ fetch_entries:
  4850.          status = lookup_entry(upcall->root_ref,
  4851.               state->session, &state->file, entry);
  4852.          if (status) {
  4853. -            dprintf(1, "single_lookup failed with %d\n", status);
  4854. +            DPRINTF(1, ("single_lookup failed with %d\n", status));
  4855.              goto out_free_cookie;
  4856.          }
  4857.          entry_buf_len = entry->name_len +
  4858. @@ -748,13 +751,13 @@ fetch_entries:
  4859.              entry = (nfs41_readdir_entry*)entry_pos;
  4860.              offset = (PULONG)dst_pos; /* ULONG NextEntryOffset */
  4861.  
  4862. -            dprintf(2, "filter %s looking at %s with cookie %d\n",
  4863. -                args->filter, entry->name, entry->cookie);
  4864. +            DPRINTF(2, ("filter '%s' looking at '%s' with cookie %d\n",
  4865. +                args->filter, entry->name, entry->cookie));
  4866.              if (readdir_filter((const char*)args->filter, entry->name)) {
  4867.                  if (readdir_copy_entry(args, entry, &dst_pos, &dst_len)) {
  4868.                      eof = 0;
  4869. -                    dprintf(2, "not enough space to copy entry %s (cookie %d)\n",
  4870. -                        entry->name, entry->cookie);
  4871. +                    DPRINTF(2, ("not enough space to copy entry '%s' (cookie %d)\n",
  4872. +                        entry->name, entry->cookie));
  4873.                      break;
  4874.                  }
  4875.                  last_offset = offset;
  4876. @@ -777,40 +780,41 @@ fetch_entries:
  4877.          if (last_offset) {
  4878.              *last_offset = 0;
  4879.          } else if (!eof) {
  4880. -            dprintf(1, "no entries matched; fetch more\n");
  4881. +            DPRINTF(1, ("no entries matched; fetch more\n"));
  4882.              goto fetch_entries;
  4883.          }
  4884.      }
  4885.  
  4886.      if (eof) {
  4887. -        dprintf(1, "we don't need to save a cookie\n");
  4888. +        DPRINTF(1, ("we don't need to save a cookie\n"));
  4889.          goto out_free_cookie;
  4890. -    } else
  4891. -        dprintf(1, "saving cookie %llu\n", state->cookie.cookie);
  4892. +    } else {
  4893. +        DPRINTF(1, ("saving cookie %llu\n", state->cookie.cookie));
  4894. +    }
  4895.  
  4896.  out_free_entry:
  4897.      free(entry_buf);
  4898.  out:
  4899. -    dprintf(1, "<- handle_nfs41_dirquery(%s,%d,%d,%d) returning ",
  4900. -        args->filter, args->initial, args->restart, args->single);
  4901. +    DPRINTF(1, ("<- handle_nfs41_dirquery('%s',%d,%d,%d) returning ",
  4902. +        args->filter, args->initial, args->restart, args->single));
  4903.      if (status) {
  4904.          switch (status) {
  4905.          case ERROR_FILE_NOT_FOUND:
  4906. -            dprintf(1, "ERROR_FILE_NOT_FOUND.\n");
  4907. +            DPRINTF(1, ("ERROR_FILE_NOT_FOUND.\n"));
  4908.              break;
  4909.          case ERROR_NO_MORE_FILES:
  4910. -            dprintf(1, "ERROR_NO_MORE_FILES.\n");
  4911. +            DPRINTF(1, ("ERROR_NO_MORE_FILES.\n"));
  4912.              break;
  4913.          case ERROR_BUFFER_OVERFLOW:
  4914.              upcall->last_error = status;
  4915.              status = ERROR_SUCCESS;
  4916.              break;
  4917.          default:
  4918. -            dprintf(1, "error code %d.\n", status);
  4919. +            DPRINTF(1, ("error code %d.\n", status));
  4920.              break;
  4921.          }
  4922.      } else {
  4923. -        dprintf(1, "success!\n");
  4924. +        DPRINTF(1, ("success!\n"));
  4925.      }
  4926.      return status;
  4927.  out_free_cookie:
  4928. diff --git a/daemon/readwrite.c b/daemon/readwrite.c
  4929. index 0f96c74..9730a69 100644
  4930. --- a/daemon/readwrite.c
  4931. +++ b/daemon/readwrite.c
  4932. @@ -48,8 +48,8 @@ static int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall
  4933.      status = safe_read(&buffer, &length, &args->buffer, sizeof(args->buffer));
  4934.      if (status) goto out;
  4935.  
  4936. -    dprintf(1, "parsing %s len=%lu offset=%llu buf=%p\n",
  4937. -            opcode2string(upcall->opcode), args->len, args->offset, args->buffer);
  4938. +    DPRINTF(1, ("parsing '%s' len=%lu offset=%llu buf=0x%p\n",
  4939. +            opcode2string(upcall->opcode), args->len, args->offset, args->buffer));
  4940.  out:
  4941.      return status;
  4942.  }
  4943. @@ -68,9 +68,10 @@ static int read_from_mds(
  4944.      ULONG to_rcv = args->len, reloffset = 0, len = 0;
  4945.      const uint32_t maxreadsize = max_read_size(session, &file->fh);
  4946.  
  4947. -    if (to_rcv > maxreadsize)
  4948. -        dprintf(1, "handle_nfs41_read: reading %d in chunks of %d\n",
  4949. -            to_rcv, maxreadsize);
  4950. +    if (to_rcv > maxreadsize) {
  4951. +        DPRINTF(1, ("handle_nfs41_read: reading %d in chunks of %d\n",
  4952. +            to_rcv, maxreadsize));
  4953. +    }
  4954.  
  4955.      while(to_rcv > 0) {
  4956.          uint32_t bytes_read = 0, chunk = min(to_rcv, maxreadsize);
  4957. @@ -194,9 +195,10 @@ retry_write:
  4958.      stable = to_send <= maxwritesize ? FILE_SYNC4 : UNSTABLE4;
  4959.      committed = FILE_SYNC4;
  4960.  
  4961. -    if (to_send > maxwritesize)
  4962. -        dprintf(1, "handle_nfs41_write: writing %d in chunks of %d\n",
  4963. -            to_send, maxwritesize);
  4964. +    if (to_send > maxwritesize) {
  4965. +        DPRINTF(1, ("handle_nfs41_write: writing %d in chunks of %d\n",
  4966. +            to_send, maxwritesize));
  4967. +    }
  4968.  
  4969.      while(to_send > 0) {
  4970.          uint32_t bytes_written = 0, chunk = min(to_send, maxwritesize);
  4971. @@ -219,7 +221,7 @@ retry_write:
  4972.          }
  4973.      }
  4974.      if (committed != FILE_SYNC4) {
  4975. -        dprintf(1, "sending COMMIT for offset=%d and len=%d\n", args->offset, len);
  4976. +        DPRINTF(1, ("sending COMMIT for offset=%d and len=%d\n", args->offset, len));
  4977.          status = nfs41_commit(session, file, args->offset, len, 1, &verf, &info);
  4978.          if (status)
  4979.              goto out;
  4980. diff --git a/daemon/recovery.c b/daemon/recovery.c
  4981. index 02cd209..7890c97 100644
  4982. --- a/daemon/recovery.c
  4983. +++ b/daemon/recovery.c
  4984. @@ -39,15 +39,15 @@ bool_t nfs41_recovery_start_or_wait(
  4985.      EnterCriticalSection(&client->recovery.lock);
  4986.  
  4987.      if (!client->recovery.in_recovery) {
  4988. -        dprintf(1, "Entering recovery mode for client %llu\n", client->clnt_id);
  4989. +        DPRINTF(1, ("Entering recovery mode for client %llu\n", client->clnt_id));
  4990.          client->recovery.in_recovery = TRUE;
  4991.      } else {
  4992.          status = FALSE;
  4993. -        dprintf(1, "Waiting for recovery of client %llu\n", client->clnt_id);
  4994. +        DPRINTF(1, ("Waiting for recovery of client %llu\n", client->clnt_id));
  4995.          while (client->recovery.in_recovery)
  4996.              SleepConditionVariableCS(&client->recovery.cond,
  4997.                  &client->recovery.lock, INFINITE);
  4998. -        dprintf(1, "Woke up after recovery of client %llu\n", client->clnt_id);
  4999. +        DPRINTF(1, ("Woke up after recovery of client %llu\n", client->clnt_id));
  5000.      }
  5001.  
  5002.      LeaveCriticalSection(&client->recovery.lock);
  5003. @@ -58,7 +58,7 @@ void nfs41_recovery_finish(
  5004.      IN nfs41_client *client)
  5005.  {
  5006.      EnterCriticalSection(&client->recovery.lock);
  5007. -    dprintf(1, "Finished recovery for client %llu\n", client->clnt_id);
  5008. +    DPRINTF(1, ("Finished recovery for client %llu\n", client->clnt_id));
  5009.      client->recovery.in_recovery = FALSE;
  5010.      WakeAllConditionVariable(&client->recovery.cond);
  5011.      LeaveCriticalSection(&client->recovery.lock);
  5012. @@ -847,7 +847,7 @@ bool_t nfs41_recover_stateid(
  5013.          return recover_stateid_delegation(argop, stateid);
  5014.  
  5015.      default:
  5016. -        eprintf("%s can't recover stateid type %u\n",
  5017. +        eprintf("'%s' can't recover stateid type %u\n",
  5018.              nfs_opnum_to_string(argop->op), stateid->type);
  5019.          break;
  5020.      }
  5021. diff --git a/daemon/setattr.c b/daemon/setattr.c
  5022. index 369dd6f..1d3d85b 100644
  5023. --- a/daemon/setattr.c
  5024. +++ b/daemon/setattr.c
  5025. @@ -49,8 +49,8 @@ static int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
  5026.      args->root = upcall->root_ref;
  5027.      args->state = upcall->state_ref;
  5028.  
  5029. -    dprintf(1, "parsing NFS41_FILE_SET: filename='%s' info_class=%d "
  5030. -        "buf_len=%d\n", args->path, args->set_class, args->buf_len);
  5031. +    DPRINTF(1, ("parsing NFS41_FILE_SET: filename='%s' info_class=%d "
  5032. +        "buf_len=%d\n", args->path, args->set_class, args->buf_len));
  5033.  out:
  5034.      return status;
  5035.  }
  5036. @@ -140,8 +140,8 @@ static int handle_nfs41_setattr(void *daemon_context, setattr_upcall_args *args)
  5037.  
  5038.      status = nfs41_setattr(state->session, &state->file, &stateid, &info);
  5039.      if (status) {
  5040. -        dprintf(1, "nfs41_setattr() failed with error %s.\n",
  5041. -            nfs_error_string(status));
  5042. +        DPRINTF(1, ("nfs41_setattr() failed with error '%s'.\n",
  5043. +            nfs_error_string(status)));
  5044.          status = nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
  5045.      }
  5046.      args->ctime = info.change;
  5047. @@ -160,9 +160,10 @@ static int handle_nfs41_remove(void *daemon_context, setattr_upcall_args *args)
  5048.  
  5049.      status = nfs41_remove(state->session, &state->parent,
  5050.          &state->file.name, state->file.fh.fileid);
  5051. -    if (status)
  5052. -        dprintf(1, "nfs41_remove() failed with error %s.\n",
  5053. -            nfs_error_string(status));
  5054. +    if (status) {
  5055. +        DPRINTF(1, ("nfs41_remove() failed with error '%s'.\n",
  5056. +            nfs_error_string(status)));
  5057. +    }
  5058.  
  5059.      return nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
  5060.  }
  5061. @@ -232,7 +233,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  5062.          fh_copy(&dst_dir.fh, &state->parent.fh);
  5063.  
  5064.          create_silly_rename(&dst_path, &state->file.fh, &dst_name);
  5065. -        dprintf(1, "silly rename: %s -> %s\n", src_name->name, dst_name.name);
  5066. +        DPRINTF(1, ("silly rename: '%s' -> '%s'\n",
  5067. +            src_name->name, dst_name.name));
  5068.  
  5069.          /* break any delegations and truncate before silly rename */
  5070.          nfs41_delegation_return(state->session, &state->file,
  5071. @@ -242,8 +244,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  5072.              &state->parent, src_name,
  5073.              &dst_dir, &dst_name);
  5074.          if (status) {
  5075. -            dprintf(1, "nfs41_rename() failed with error %s.\n",
  5076. -                nfs_error_string(status));
  5077. +            DPRINTF(1, ("nfs41_rename() failed with error '%s'.\n",
  5078. +                nfs_error_string(status)));
  5079.              status = nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
  5080.          } else {
  5081.              /* rename state->path on success */
  5082. @@ -276,7 +278,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  5083.          /* replace the path with the symlink target's */
  5084.          status = nfs41_symlink_target(dst_session, &dst_dir, &dst_path);
  5085.          if (status) {
  5086. -            eprintf("nfs41_symlink_target() for %s failed with %d\n",
  5087. +            eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
  5088.                  dst_dir.path->path, status);
  5089.              goto out;
  5090.          }
  5091. @@ -299,8 +301,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  5092.          nfs41_delegation_return(dst_session, &dst,
  5093.              OPEN_DELEGATE_WRITE, TRUE);
  5094.      } else if (status != ERROR_FILE_NOT_FOUND) {
  5095. -        dprintf(1, "nfs41_lookup('%s') failed to find destination "
  5096. -            "directory with %d\n", dst_path.path, status);
  5097. +        DPRINTF(1, ("nfs41_lookup('%s') failed to find destination "
  5098. +            "directory with %d\n", dst_path.path, status));
  5099.          goto out;
  5100.      }
  5101.  
  5102. @@ -317,7 +319,7 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  5103.          /* AGLO: 03/21/2011: we can't handle rename of a file with a filename
  5104.           * that is currently opened by this client
  5105.           */
  5106. -        eprintf("handle_nfs41_rename: %s is opened\n", dst_path.path);
  5107. +        eprintf("handle_nfs41_rename: '%s' is opened\n", dst_path.path);
  5108.          status = ERROR_FILE_EXISTS;
  5109.          goto out;
  5110.      }
  5111. @@ -330,8 +332,8 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  5112.          &state->parent, src_name,
  5113.          &dst_dir, &dst_name);
  5114.      if (status) {
  5115. -        dprintf(1, "nfs41_rename() failed with error %s.\n",
  5116. -            nfs_error_string(status));
  5117. +        DPRINTF(1, ("nfs41_rename() failed with error '%s'.\n",
  5118. +            nfs_error_string(status)));
  5119.          status = nfs_to_windows_error(status, ERROR_ACCESS_DENIED);
  5120.      } else {
  5121.          /* rename state->path on success */
  5122. @@ -361,11 +363,11 @@ static int handle_nfs41_set_size(void *daemon_context, setattr_upcall_args *args
  5123.      info.attrmask.count = 1;
  5124.      info.attrmask.arr[0] = FATTR4_WORD0_SIZE;
  5125.  
  5126. -    dprintf(2, "calling setattr() with size=%lld\n", info.size);
  5127. +    DPRINTF(2, ("calling setattr() with size=%lld\n", info.size));
  5128.      status = nfs41_setattr(state->session, &state->file, &stateid, &info);
  5129.      if (status) {
  5130. -        dprintf(1, "nfs41_setattr() failed with error %s.\n",
  5131. -            nfs_error_string(status));
  5132. +        DPRINTF(1, ("nfs41_setattr() failed with error '%s'.\n",
  5133. +            nfs_error_string(status)));
  5134.          goto out;
  5135.      }
  5136.  
  5137. @@ -414,7 +416,7 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
  5138.          /* replace the path with the symlink target's */
  5139.          status = nfs41_symlink_target(dst_session, &dst_dir, &dst_path);
  5140.          if (status) {
  5141. -            eprintf("nfs41_symlink_target() for %s failed with %d\n",
  5142. +            eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
  5143.                  dst_dir.path->path, status);
  5144.              goto out;
  5145.          }
  5146. @@ -434,8 +436,8 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
  5147.              goto out;
  5148.          }
  5149.      } else if (status != ERROR_FILE_NOT_FOUND) {
  5150. -        dprintf(1, "nfs41_lookup('%s') failed to find destination "
  5151. -            "directory with %d\n", dst_path.path, status);
  5152. +        DPRINTF(1, ("nfs41_lookup('%s') failed to find destination "
  5153. +            "directory with %d\n", dst_path.path, status));
  5154.          goto out;
  5155.      }
  5156.  
  5157. @@ -457,8 +459,8 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
  5158.          status = nfs41_remove(state->session,
  5159.              &dst_dir, &dst_name, dst.fh.fileid);
  5160.          if (status) {
  5161. -            dprintf(1, "nfs41_remove() failed with error %s.\n",
  5162. -                nfs_error_string(status));
  5163. +            DPRINTF(1, ("nfs41_remove() failed with error '%s'.\n",
  5164. +                nfs_error_string(status)));
  5165.              status = ERROR_FILE_EXISTS;
  5166.              goto out;
  5167.          }
  5168. @@ -471,8 +473,8 @@ static int handle_nfs41_link(void *daemon_context, setattr_upcall_args *args)
  5169.      status = nfs41_link(state->session, &state->file, &dst_dir, &dst_name,
  5170.              &info);
  5171.      if (status) {
  5172. -        dprintf(1, "nfs41_link() failed with error %s.\n",
  5173. -            nfs_error_string(status));
  5174. +        DPRINTF(1, ("nfs41_link() failed with error '%s'.\n",
  5175. +            nfs_error_string(status)));
  5176.          status = nfs_to_windows_error(status, ERROR_INVALID_PARAMETER);
  5177.      }
  5178.      args->ctime = info.change;
  5179. diff --git a/daemon/sid.c b/daemon/sid.c
  5180. index 5326994..b522232 100644
  5181. --- a/daemon/sid.c
  5182. +++ b/daemon/sid.c
  5183. @@ -48,10 +48,10 @@ int create_unknownsid(WELL_KNOWN_SID_TYPE type, PSID *sid, DWORD *sid_len)
  5184.      *sid = NULL;
  5185.  
  5186.      status = CreateWellKnownSid(type, NULL, *sid, sid_len);
  5187. -    dprintf(ACLLVL,
  5188. -        "create_unknownsid: CreateWellKnownSid(type=%d) returned %d "
  5189. +    DPRINTF(ACLLVL,
  5190. +        ("create_unknownsid: CreateWellKnownSid(type=%d) returned %d "
  5191.          "GetLastError %d sid len %d needed\n", (int)type, status,
  5192. -        GetLastError(), *sid_len);
  5193. +        GetLastError(), *sid_len));
  5194.      if (status) {
  5195.          status = ERROR_INTERNAL_ERROR;
  5196.          goto err;
  5197. @@ -120,9 +120,9 @@ BOOL allocate_unixuser_sid(unsigned long uid, PSID *pSid)
  5198.              if (CopySid(sid_len, malloced_sid, sid)) {
  5199.                  FreeSid(sid);
  5200.                  *pSid = malloced_sid;
  5201. -                dprintf(ACLLVL, "allocate_unixuser_sid(): Allocated "
  5202. +                DPRINTF(ACLLVL, ("allocate_unixuser_sid(): Allocated "
  5203.                      "Unix_User+%lu: success, len=%ld\n",
  5204. -                    uid, (long)sid_len);
  5205. +                    uid, (long)sid_len));
  5206.                  return TRUE;
  5207.              }
  5208.          }
  5209. @@ -130,9 +130,9 @@ BOOL allocate_unixuser_sid(unsigned long uid, PSID *pSid)
  5210.  
  5211.      FreeSid(sid);
  5212.      free(malloced_sid);
  5213. -    dprintf(ACLLVL, "allocate_unixuser_sid(): Failed to allocate "
  5214. +    DPRINTF(ACLLVL, ("allocate_unixuser_sid(): Failed to allocate "
  5215.          "SID for Unix_User+%lu: error code %d\n",
  5216. -        uid, GetLastError());
  5217. +        uid, GetLastError()));
  5218.      return FALSE;
  5219.  }
  5220.  
  5221. @@ -158,9 +158,9 @@ BOOL allocate_unixgroup_sid(unsigned long gid, PSID *pSid)
  5222.              if (CopySid(sid_len, malloced_sid, sid)) {
  5223.                  FreeSid(sid);
  5224.                  *pSid = malloced_sid;
  5225. -                dprintf(ACLLVL, "allocate_unixgroup_sid(): Allocated "
  5226. +                DPRINTF(ACLLVL, ("allocate_unixgroup_sid(): Allocated "
  5227.                      "Unix_Group+%lu: success, len=%ld\n",
  5228. -                    gid, (long)sid_len);
  5229. +                    gid, (long)sid_len));
  5230.                  return TRUE;
  5231.              }
  5232.          }
  5233. @@ -168,9 +168,9 @@ BOOL allocate_unixgroup_sid(unsigned long gid, PSID *pSid)
  5234.  
  5235.      FreeSid(sid);
  5236.      free(malloced_sid);
  5237. -    dprintf(ACLLVL, "allocate_unixgroup_sid(): Failed to allocate "
  5238. +    DPRINTF(ACLLVL, ("allocate_unixgroup_sid(): Failed to allocate "
  5239.          "SID for Unix_Group+%lu: error code %d\n",
  5240. -        gid, GetLastError());
  5241. +        gid, GetLastError()));
  5242.      return FALSE;
  5243.  }
  5244.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  5245. @@ -205,7 +205,7 @@ sidcache user_sidcache = { 0 };
  5246.  
  5247.  void sidcache_init(void)
  5248.  {
  5249. -    dprintf(1, "SID cache init\n");
  5250. +    DPRINTF(1, ("SID cache init\n"));
  5251.      InitializeCriticalSection(&user_sidcache.lock);
  5252.  }
  5253.  
  5254. @@ -331,7 +331,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5255.  #ifdef USE_SID_CACHE
  5256.          if (*sid = sidcache_getcached(&user_sidcache, name)) {
  5257.              *sid_len = GetLengthSid(*sid);
  5258. -            dprintf(1, "map_nfs4servername_2_sid: returning cached sid for '%s'\n", name);
  5259. +            DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for '%s'\n", name));
  5260.              return 0;
  5261.          }
  5262.  #endif /* USE_SID_CACHE */
  5263. @@ -341,10 +341,10 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5264.  #endif /* !USE_SID_CACHE */
  5265.          if (!cygwin_getent_passwd(name, name_buff, &udummy, &gdummy)) {
  5266.              if (strcmp(name, name_buff)) {
  5267. -                dprintf(1,
  5268. -                    "map_nfs4servername_2_sid: remap '%s' --> '%s'\n",
  5269. +                DPRINTF(1,
  5270. +                    ("map_nfs4servername_2_sid: remap '%s' --> '%s'\n",
  5271.                      name,
  5272. -                    name_buff);
  5273. +                    name_buff));
  5274.                  name = name_buff;
  5275.              }
  5276.          }
  5277. @@ -352,9 +352,10 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5278.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  5279.  
  5280.      status = LookupAccountNameA(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
  5281. -    dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): LookupAccountName returned %d "
  5282. +    DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  5283. +        "LookupAccountName returned %d "
  5284.          "GetLastError %d name len %d domain len %d\n",
  5285. -        query, name, status, GetLastError(), *sid_len, tmp);
  5286. +        query, name, status, GetLastError(), *sid_len, tmp));
  5287.      if (status)
  5288.          return ERROR_INTERNAL_ERROR;
  5289.  
  5290. @@ -380,14 +381,17 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5291.  #ifdef DEBUG_ACLS
  5292.              LPSTR ssid = NULL;
  5293.              if (IsValidSid(*sid))
  5294. -                if (ConvertSidToStringSidA(*sid, &ssid))
  5295. -                    dprintf(1, "map_nfs4servername_2_sid: sid_type = %d SID '%s'\n",
  5296. -                        sid_type, ssid);
  5297. -                else
  5298. -                    dprintf(1, "map_nfs4servername_2_sid: ConvertSidToStringSidA failed "
  5299. -                        "with %d\n", GetLastError());
  5300. -            else
  5301. -                dprintf(1, "map_nfs4servername_2_sid: Invalid Sid ?\n");
  5302. +                if (ConvertSidToStringSidA(*sid, &ssid)) {
  5303. +                    DPRINTF(1, ("map_nfs4servername_2_sid: sid_type = %d SID '%s'\n",
  5304. +                        sid_type, ssid));
  5305. +                }
  5306. +                else {
  5307. +                    DPRINTF(1, ("map_nfs4servername_2_sid: ConvertSidToStringSidA failed "
  5308. +                        "with %d\n", GetLastError()));
  5309. +                }
  5310. +            else {
  5311. +                DPRINTF(1, ("map_nfs4servername_2_sid: Invalid Sid ?\n"));
  5312. +            }
  5313.              if (ssid)
  5314.                  LocalFree(ssid);
  5315.  #endif
  5316. @@ -396,10 +400,10 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5317.          break;
  5318.      case ERROR_NONE_MAPPED:
  5319.  #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  5320. -        dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): "
  5321. +        DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  5322.              "none mapped, "
  5323.              "trying Unix_User+/Unix_Group+ mapping\n",
  5324. -            query, name);
  5325. +            query, name));
  5326.  
  5327.          if ((user_uid == -1) && (query & OWNER_SECURITY_INFORMATION)) {
  5328.              uid_t map_uid = -1;
  5329. @@ -413,8 +417,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5330.                  user_uid = map_uid;
  5331.              }
  5332.              else {
  5333. -                dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_name_to_ids() failed\n",
  5334. -                    query, name);
  5335. +                DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_name_to_ids() failed\n",
  5336. +                    query, name));
  5337.                  /* fixme: try harder here, "1234" should to to |atol()| */
  5338.              }
  5339.          }
  5340. @@ -429,56 +433,56 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  5341.                  group_gid = map_gid;
  5342.              }
  5343.              else {
  5344. -                dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_group_to_gid() failed\n",
  5345. -                    query, name);
  5346. +                DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): nfs41_idmap_group_to_gid() failed\n",
  5347. +                    query, name));
  5348.                  /* fixme: try harder here, "1234" should to to |atol()| */
  5349.              }
  5350.          }
  5351.  
  5352.          if (user_uid != -1) {
  5353.              if (allocate_unixuser_sid(user_uid, sid)) {
  5354. -                dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
  5355. +                DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  5356.                      "allocate_unixuser_sid(uid=%ld) success\n",
  5357. -                    query, name, user_uid);
  5358. +                    query, name, user_uid));
  5359.                  status = ERROR_SUCCESS;
  5360.                  goto out;
  5361.              }
  5362.  
  5363.              status = GetLastError();
  5364. -            dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
  5365. +            DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  5366.                  "allocate_unixuser_sid(uid=%ld) failed, error=%d\n",
  5367. -                query, name, user_uid, status);
  5368. +                query, name, user_uid, status));
  5369.              return status;
  5370.          }
  5371.  
  5372.          if (group_gid != -1) {
  5373.              if (allocate_unixgroup_sid(group_gid, sid)) {
  5374. -                dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
  5375. +                DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  5376.                      "allocate_unixgroup_sid(gid=%ld) success\n",
  5377. -                    query, name, group_gid);
  5378. +                    query, name, group_gid));
  5379.                  status = ERROR_SUCCESS;
  5380.                  goto out;
  5381.              }
  5382.  
  5383.              status = GetLastError();
  5384. -            dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): "
  5385. +            DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  5386.                  "allocate_unixgroup_sid(gid=%ld) failed, error=%d\n",
  5387. -                query, name, group_gid, status);
  5388. +                query, name, group_gid, status));
  5389.              return status;
  5390.          }
  5391.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  5392.  
  5393. -        dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): none mapped, "
  5394. +        DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): none mapped, "
  5395.              "using WinNullSid mapping\n",
  5396. -            query, name);
  5397. +            query, name));
  5398.  
  5399.          status = create_unknownsid(WinNullSid, sid, sid_len);
  5400.          if (status)
  5401.              goto out_free_sid;
  5402.          break;
  5403.      default:
  5404. -        dprintf(1, "map_nfs4servername_2_sid(query=%x,name='%s'): error %d not handled\n",
  5405. -            query, name, GetLastError());
  5406. +        DPRINTF(1, ("map_nfs4servername_2_sid(query=%x,name='%s'): error %d not handled\n",
  5407. +            query, name, GetLastError()));
  5408.          break;
  5409.      }
  5410.  out:
  5411. diff --git a/daemon/symlink.c b/daemon/symlink.c
  5412. index 285b60d..dd57072 100644
  5413. --- a/daemon/symlink.c
  5414. +++ b/daemon/symlink.c
  5415. @@ -103,13 +103,13 @@ int nfs41_symlink_target(
  5416.      /* read the link */
  5417.      status = nfs41_readlink(session, file, NFS41_MAX_PATH_LEN, link, &link_len);
  5418.      if (status) {
  5419. -        eprintf("nfs41_readlink() for %s failed with %s\n", file->path->path,
  5420. +        eprintf("nfs41_readlink() for '%s' failed with '%s'\n", file->path->path,
  5421.              nfs_error_string(status));
  5422.          status = ERROR_PATH_NOT_FOUND;
  5423.          goto out;
  5424.      }
  5425.  
  5426. -    dprintf(2, "--> nfs41_symlink_target('%s', '%s')\n", path->path, link);
  5427. +    DPRINTF(2, ("--> nfs41_symlink_target('%s', '%s')\n", path->path, link));
  5428.  
  5429.      /* append any components after the symlink */
  5430.      if (FAILED(StringCchCatA(link, NFS41_MAX_PATH_LEN,
  5431. @@ -133,13 +133,13 @@ int nfs41_symlink_target(
  5432.      }
  5433.      status = abs_path_link(target, target->path + path_offset, link, link_len);
  5434.      if (status) {
  5435. -        eprintf("abs_path_link() for path %s with link %s failed with %d\n",
  5436. +        eprintf("abs_path_link() for path '%s' with link '%s' failed with %d\n",
  5437.              target->path, link, status);
  5438.          goto out;
  5439.      }
  5440.  out:
  5441. -    dprintf(2, "<-- nfs41_symlink_target('%s') returning %d\n",
  5442. -        target->path, status);
  5443. +    DPRINTF(2, ("<-- nfs41_symlink_target('%s') returning %d\n",
  5444. +        target->path, status));
  5445.      return status;
  5446.  }
  5447.  
  5448. @@ -157,7 +157,7 @@ int nfs41_symlink_follow(
  5449.      file.path = &path;
  5450.      InitializeSRWLock(&path.lock);
  5451.  
  5452. -    dprintf(2, "--> nfs41_symlink_follow('%s')\n", symlink->path->path);
  5453. +    DPRINTF(2, ("--> nfs41_symlink_follow('%s')\n", symlink->path->path));
  5454.  
  5455.      do {
  5456.          if (++depth > NFS41_MAX_SYMLINK_DEPTH) {
  5457. @@ -169,7 +169,7 @@ int nfs41_symlink_follow(
  5458.          status = nfs41_symlink_target(session, symlink, &path);
  5459.          if (status) goto out;
  5460.  
  5461. -        dprintf(2, "looking up '%s'\n", path.path);
  5462. +        DPRINTF(2, ("looking up '%s'\n", path.path));
  5463.  
  5464.          last_component(path.path, path.path + path.len, &file.name);
  5465.  
  5466. @@ -181,7 +181,7 @@ int nfs41_symlink_follow(
  5467.          symlink = &file;
  5468.      } while (info->type == NF4LNK);
  5469.  out:
  5470. -    dprintf(2, "<-- nfs41_symlink_follow() returning %d\n", status);
  5471. +    DPRINTF(2, ("<-- nfs41_symlink_follow() returning %d\n", status));
  5472.      return status;
  5473.  }
  5474.  
  5475. @@ -202,8 +202,8 @@ static int parse_symlink(unsigned char *buffer, uint32_t length, nfs41_upcall *u
  5476.      else
  5477.          args->target_set = NULL;
  5478.  
  5479. -    dprintf(1, "parsing NFS41_SYMLINK: path='%s' set=%u target='%s'\n",
  5480. -        args->path, args->set, args->target_set);
  5481. +    DPRINTF(1, ("parsing NFS41_SYMLINK: path='%s' set=%u target='%s'\n",
  5482. +        args->path, args->set, args->target_set));
  5483.  out:
  5484.      return status;
  5485.  }
  5486. @@ -230,7 +230,7 @@ static int handle_symlink(void *daemon_context, nfs41_upcall *upcall)
  5487.              status = nfs41_remove(state->session, &state->parent,
  5488.                  &state->file.name, state->file.fh.fileid);
  5489.              if (status) {
  5490. -                eprintf("nfs41_remove() for symlink=%s failed with %s\n",
  5491. +                eprintf("nfs41_remove() for symlink='%s' failed with '%s'\n",
  5492.                      args->target_set, nfs_error_string(status));
  5493.                  status = map_symlink_errors(status);
  5494.                  goto out;
  5495. @@ -245,7 +245,7 @@ static int handle_symlink(void *daemon_context, nfs41_upcall *upcall)
  5496.          status = nfs41_create(state->session, NF4LNK, &createattrs,
  5497.              args->target_set, &state->parent, &state->file, &info);
  5498.          if (status) {
  5499. -            eprintf("nfs41_create() for symlink=%s failed with %s\n",
  5500. +            eprintf("nfs41_create() for symlink='%s' failed with '%s'\n",
  5501.                  args->target_set, nfs_error_string(status));
  5502.              status = map_symlink_errors(status);
  5503.              goto out;
  5504. @@ -257,13 +257,13 @@ static int handle_symlink(void *daemon_context, nfs41_upcall *upcall)
  5505.          status = nfs41_readlink(state->session, &state->file,
  5506.              NFS41_MAX_PATH_LEN, args->target_get.path, &len);
  5507.          if (status) {
  5508. -            eprintf("nfs41_readlink() for filename=%s failed with %s\n",
  5509. +            eprintf("nfs41_readlink() for filename='%s' failed with '%s'\n",
  5510.                  state->file.path->path, nfs_error_string(status));
  5511.              status = map_symlink_errors(status);
  5512.              goto out;
  5513.          }
  5514.          args->target_get.len = (unsigned short)len;
  5515. -        dprintf(2, "returning symlink target '%s'\n", args->target_get.path);
  5516. +        DPRINTF(2, ("returning symlink target '%s'\n", args->target_get.path));
  5517.      }
  5518.  out:
  5519.      return status;
  5520. diff --git a/daemon/upcall.c b/daemon/upcall.c
  5521. index 0c07ccb..f183dc8 100644
  5522. --- a/daemon/upcall.c
  5523. +++ b/daemon/upcall.c
  5524. @@ -87,7 +87,7 @@ int upcall_parse(
  5525.          goto out;
  5526.      }
  5527.  
  5528. -    dprintf(2, "received %d bytes upcall data: processing upcall\n", length);
  5529. +    DPRINTF(2, ("received %d bytes upcall data: processing upcall\n", length));
  5530.      print_hexbuf(4, (unsigned char *)"upcall buffer: ", buffer, length);
  5531.  
  5532.      /* parse common elements */
  5533. @@ -102,9 +102,9 @@ int upcall_parse(
  5534.      status = safe_read(&buffer, &length, &upcall->state_ref, sizeof(HANDLE));
  5535.      if (status) goto out;
  5536.  
  5537. -    dprintf(2, "time=%ld version=%d xid=%d opcode=%s session=0x%x open_state=0x%x\n",
  5538. +    DPRINTF(2, ("time=%ld version=%d xid=%d opcode='%s' session=0x%x open_state=0x%x\n",
  5539.          time(NULL), version, upcall->xid, opcode2string(upcall->opcode), upcall->root_ref,
  5540. -        upcall->state_ref);
  5541. +        upcall->state_ref));
  5542.      if (version != NFS41D_VERSION) {
  5543.          eprintf("received version %d expecting version %d\n", version, NFS41D_VERSION);
  5544.          upcall->status = status = NFSD_VERSION_MISMATCH;
  5545. diff --git a/daemon/util.c b/daemon/util.c
  5546. index 3d366d2..df06c80 100644
  5547. --- a/daemon/util.c
  5548. +++ b/daemon/util.c
  5549. @@ -104,23 +104,23 @@ bool_t verify_write(
  5550.  {
  5551.      if (verf->committed != UNSTABLE4) {
  5552.          *stable = verf->committed;
  5553. -        dprintf(3, "verify_write: committed to stable storage\n");
  5554. +        DPRINTF(3, ("verify_write: committed to stable storage\n"));
  5555.          return 1;
  5556.      }
  5557.  
  5558.      if (*stable != UNSTABLE4) {
  5559.          memcpy(verf->expected, verf->verf, NFS4_VERIFIER_SIZE);
  5560.          *stable = UNSTABLE4;
  5561. -        dprintf(3, "verify_write: first unstable write, saving verifier\n");
  5562. +        DPRINTF(3, ("verify_write: first unstable write, saving verifier\n"));
  5563.          return 1;
  5564.      }
  5565.  
  5566.      if (memcmp(verf->expected, verf->verf, NFS4_VERIFIER_SIZE) == 0) {
  5567. -        dprintf(3, "verify_write: verifier matches expected\n");
  5568. +        DPRINTF(3, ("verify_write: verifier matches expected\n"));
  5569.          return 1;
  5570.      }
  5571.  
  5572. -    dprintf(2, "verify_write: verifier changed; writes have been lost!\n");
  5573. +    DPRINTF(2, ("verify_write: verifier changed; writes have been lost!\n"));
  5574.      return 0;
  5575.  }
  5576.  
  5577. @@ -128,10 +128,10 @@ bool_t verify_commit(
  5578.      IN nfs41_write_verf *verf)
  5579.  {
  5580.      if (memcmp(verf->expected, verf->verf, NFS4_VERIFIER_SIZE) == 0) {
  5581. -        dprintf(3, "verify_commit: verifier matches expected\n");
  5582. +        DPRINTF(3, ("verify_commit: verifier matches expected\n"));
  5583.          return 1;
  5584.      }
  5585. -    dprintf(2, "verify_commit: verifier changed; writes have been lost!\n");
  5586. +    DPRINTF(2, ("verify_commit: verifier changed; writes have been lost!\n"));
  5587.      return 0;
  5588.  }
  5589.  
  5590. @@ -145,9 +145,11 @@ ULONG nfs_file_info_to_attributes(
  5591.          attrs |= FILE_ATTRIBUTE_REPARSE_POINT;
  5592.          if (info->symlink_dir)
  5593.              attrs |= FILE_ATTRIBUTE_DIRECTORY;
  5594. -    } else if (info->type != NF4REG)
  5595. -        dprintf(1, "unhandled file type %d, defaulting to NF4REG\n",
  5596. -            info->type);
  5597. +    }
  5598. +    else if (info->type != NF4REG) {
  5599. +        DPRINTF(1, ("unhandled file type %d, defaulting to NF4REG\n",
  5600. +            info->type));
  5601. +    }
  5602.  
  5603.      if (info->mode == 0444) /* XXX: 0444 for READONLY */
  5604.          attrs |= FILE_ATTRIBUTE_READONLY;
  5605. @@ -297,9 +299,9 @@ int nfs_to_windows_error(int status, int default_error)
  5606.      case NFS4ERR_WRONGSEC:      return ERROR_ACCESS_DENIED;
  5607.  
  5608.      default:
  5609. -        dprintf(1, "nfs error %s not mapped to windows error; "
  5610. +        DPRINTF(1, ("nfs error '%s' not mapped to windows error; "
  5611.              "returning default error %d\n",
  5612. -            nfs_error_string(status), default_error);
  5613. +            nfs_error_string(status), default_error));
  5614.          return default_error;
  5615.      }
  5616.  }
  5617. @@ -510,14 +512,14 @@ subcmd_popen_context *subcmd_popen(const char *command)
  5618.       * processes
  5619.       */
  5620.      if (!CreatePipe(&pinfo->hReadPipe, &pinfo->hWritePipe, &sa, 0)) {
  5621. -        dprintf(0, "subcmd_popen: CreatePipe error, status=%d\n",
  5622. -            (int)GetLastError());
  5623. +        DPRINTF(0, ("subcmd_popen: CreatePipe error, status=%d\n",
  5624. +            (int)GetLastError()));
  5625.          goto fail;
  5626.      }
  5627.  
  5628.      /* Set the pipe handles to non-inheritable */
  5629.      if (!SetHandleInformation(pinfo->hReadPipe, HANDLE_FLAG_INHERIT, FALSE)) {
  5630. -        dprintf(0, "subcmd_popen: SetHandleInformation error\n");
  5631. +        DPRINTF(0, ("subcmd_popen: SetHandleInformation error\n"));
  5632.          goto fail;
  5633.      }
  5634.  
  5635. @@ -531,7 +533,7 @@ subcmd_popen_context *subcmd_popen(const char *command)
  5636.      if (!CreateProcessA(NULL,
  5637.          (LPSTR)command, NULL, NULL, TRUE, 0, NULL, NULL, &si,
  5638.          &pinfo->pi)) {
  5639. -        dprintf(0, "subcmd_popen: cannot create process\n");
  5640. +        DPRINTF(0, ("subcmd_popen: cannot create process\n"));
  5641.          goto fail;
  5642.      }
  5643.  
  5644. @@ -568,7 +570,7 @@ int subcmd_pclose(subcmd_popen_context *pinfo)
  5645.      CloseHandle(pinfo->pi.hThread);
  5646.  
  5647.      if (status != 0) {
  5648. -        (void)dprintf(0, "subcmd_pclose(): exit code=%d\n", (int)status);
  5649. +        DPRINTF(0, ("subcmd_pclose(): exit code=%d\n", (int)status));
  5650.      }
  5651.      free(pinfo);
  5652.  
  5653. diff --git a/daemon/volume.c b/daemon/volume.c
  5654. index 55aabd5..1157278 100644
  5655. --- a/daemon/volume.c
  5656. +++ b/daemon/volume.c
  5657. @@ -51,7 +51,7 @@ static int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *up
  5658.      status = safe_read(&buffer, &length, &args->query, sizeof(FS_INFORMATION_CLASS));
  5659.      if (status) goto out;
  5660.  
  5661. -    dprintf(1, "parsing NFS41_VOLUME_QUERY: query=%d\n", args->query);
  5662. +    DPRINTF(1, ("parsing NFS41_VOLUME_QUERY: query=%d\n", args->query));
  5663.  out:
  5664.      return status;
  5665.  }
  5666. @@ -75,8 +75,8 @@ static int get_volume_size_info(
  5667.          info.space_free = superblock->space_free;
  5668.          status = NO_ERROR;
  5669.  
  5670. -        dprintf(2, "%s cached: %llu user, %llu free of %llu total\n",
  5671. -            query, info.space_avail, info.space_free, info.space_total);
  5672. +        DPRINTF(2, ("'%s' cached: %llu user, %llu free of %llu total\n",
  5673. +            query, info.space_avail, info.space_free, info.space_total));
  5674.      }
  5675.      ReleaseSRWLockShared(&superblock->lock);
  5676.  
  5677. @@ -88,7 +88,7 @@ static int get_volume_size_info(
  5678.          status = nfs41_getattr(state->session, &state->file,
  5679.              &attr_request, &info);
  5680.          if (status) {
  5681. -            eprintf("nfs41_getattr() failed with %s\n",
  5682. +            eprintf("get_volume_size_info: nfs41_getattr() failed with '%s'\n",
  5683.                  nfs_error_string(status));
  5684.              status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  5685.              goto out;
  5686. @@ -101,8 +101,8 @@ static int get_volume_size_info(
  5687.          superblock->cache_expiration = time(NULL) + VOLUME_CACHE_EXPIRATION;
  5688.          ReleaseSRWLockExclusive(&superblock->lock);
  5689.  
  5690. -        dprintf(2, "%s: %llu user, %llu free of %llu total\n",
  5691. -            query, info.space_avail, info.space_free, info.space_total);
  5692. +        DPRINTF(2, ("'%s': %llu user, %llu free of %llu total\n",
  5693. +            query, info.space_avail, info.space_free, info.space_total));
  5694.      }
  5695.  
  5696.      if (total_out) *total_out = TO_UNITS(info.space_total);
  5697. --
  5698. 2.43.0
  5699.  
  5700. From 9aa07132243c35176734c01446b5f99e37c9f3a9 Mon Sep 17 00:00:00 2001
  5701. From: Roland Mainz <roland.mainz@nrubsig.org>
  5702. Date: Thu, 8 Feb 2024 12:54:56 +0100
  5703. Subject: [PATCH 4/4] daemon: cp -p fails with "Function not implemented"
  5704.  instead of "Permission denied" [refix]
  5705.  
  5706. Fix handling of |LookupAccountSidA()| success.
  5707.  
  5708. Testcase:
  5709. $ ksh93 -c 'builtin id ; rm -f x ; touch x ; chown "$(id -u -n):$(id -g -n)" x && print OK'
  5710.  
  5711. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  5712. ---
  5713.  daemon/acl.c | 8 ++++++++
  5714.  1 file changed, 8 insertions(+)
  5715.  
  5716. diff --git a/daemon/acl.c b/daemon/acl.c
  5717. index 279f321..8c1ad9f 100644
  5718. --- a/daemon/acl.c
  5719. +++ b/daemon/acl.c
  5720. @@ -513,6 +513,9 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  5721.       * SIDs, and Unix_User+<uid> or Unix_Group+<gid> SIDs
  5722.       */
  5723.      switch (status) {
  5724. +        /* |LookupAccountSidA()| success */
  5725. +        case 0:
  5726. +            break;
  5727.          /* This happens for Unix_User+<uid> or Unix_Group+<gid> SIDs */
  5728.          case ERROR_NONE_MAPPED:
  5729.          /* Catch other cases */
  5730. @@ -520,6 +523,11 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  5731.          case ERROR_NO_SUCH_GROUP:
  5732.              goto out;
  5733.          default:
  5734. +            eprintf("map_nfs4ace_who: Internal error, "
  5735. +                "LookupAccountSidA() returned unexpected ERROR_%d "
  5736. +                "for sidstr='%s'\n",
  5737. +                status,
  5738. +                sidstr);
  5739.              status = ERROR_INTERNAL_ERROR;
  5740.              goto out;
  5741.      }
  5742. --
  5743. 2.43.0

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at