pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for moving device open into util function, cleanup, asyncop status in sysdebug+misc, 2025-10-12
Posted by Anonymous on Sat 11th Oct 2025 23:44
raw | new post

  1. From 634823c5baed103d7f0893e0267c647f9152dff7 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Sat, 11 Oct 2025 15:21:18 +0200
  4. Subject: [PATCH 1/6] daemon: Move creation/closing of nfs41sys device
  5.  pipelines into helper function
  6.  
  7. Move creation/closing of nfs41sys device pipelines into helper function.
  8.  
  9. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  10. ---
  11. daemon/delegation.c   | 10 +++++-----
  12.  daemon/nfs41_daemon.c | 34 +++++++++++++++++++---------------
  13.  daemon/util.c         | 26 +++++++++++++++++++-------
  14.  daemon/util.h         |  3 +++
  15.  4 files changed, 46 insertions(+), 27 deletions(-)
  16.  
  17. diff --git a/daemon/delegation.c b/daemon/delegation.c
  18. index c6e7898..7585b62 100644
  19. --- a/daemon/delegation.c
  20. +++ b/daemon/delegation.c
  21. @@ -283,11 +283,11 @@ static int delegation_return(
  22.          DPRINTF(1,
  23.              ("delegation_return: making a downcall for srv_open=0x%p\n",
  24.              deleg->srv_open));
  25. -        pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
  26. -                FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
  27. +        pipe = create_nfs41sys_device_pipe();
  28.          if (pipe == INVALID_HANDLE_VALUE) {
  29. -            eprintf("delegation_return: Unable to open downcall pipe %d\n",
  30. -                GetLastError());
  31. +            eprintf("delegation_return: "
  32. +                "Unable to open downcall pipe, lasterr=%d\n",
  33. +                (int)GetLastError());
  34.              goto out_downcall;
  35.          }
  36.          length = inbuf_len;
  37. @@ -297,7 +297,7 @@ static int delegation_return(
  38.              NULL, 0, (LPDWORD)&outbuf_len, NULL);
  39.          if (!dstatus)
  40.              eprintf("IOCTL_NFS41_INVALCACHE failed %d\n", GetLastError());
  41. -        CloseHandle(pipe);
  42. +        close_nfs41sys_device_pipe(pipe);
  43.      }
  44.  out_downcall:
  45.  
  46. diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
  47. index ff528c4..38d6d02 100644
  48. --- a/daemon/nfs41_daemon.c
  49. +++ b/daemon/nfs41_daemon.c
  50. @@ -36,7 +36,7 @@
  51.  #include <sdkddkver.h>
  52.  
  53.  #include "nfs41_build_features.h"
  54. -#include "nfs41_driver.h" /* for NFS41_USER_DEVICE_NAME_A */
  55. +#include "nfs41_driver.h" /* for |IOCTL_NFS41_*|  */
  56.  #include "nfs41_np.h" /* for NFS41NP_SHARED_MEMORY */
  57.  
  58.  #include "nfs41_daemon.h"
  59. @@ -173,13 +173,11 @@ static unsigned int nfsd_worker_thread_main(void *args)
  60.          eprintf("Failed set THREAD_PRIORITY_TIME_CRITICAL\n");
  61.      }
  62.  
  63. -    pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  64. -        FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  65. -        0, NULL);
  66. -    if (pipe == INVALID_HANDLE_VALUE)
  67. -    {
  68. +    pipe = create_nfs41sys_device_pipe();
  69. +    if (pipe == INVALID_HANDLE_VALUE) {
  70.          DWORD lasterr = GetLastError();
  71. -        eprintf("Unable to open upcall pipe %d\n", (int)lasterr);
  72. +        eprintf("nfsd_worker_thread_main: Unable to open upcall pipe %d\n",
  73. +            (int)lasterr);
  74.          return lasterr;
  75.      }
  76.  
  77. @@ -267,7 +265,8 @@ write_downcall:
  78.          if (upcall.status != NFSD_VERSION_MISMATCH)
  79.              upcall_cleanup(&upcall);
  80.      }
  81. -    CloseHandle(pipe);
  82. +
  83. +    close_nfs41sys_device_pipe(pipe);
  84.  
  85.      return GetLastError();
  86.  }
  87. @@ -890,12 +889,16 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  88.      NFS41D_VERSION = GetTickCount();
  89.      DPRINTF(1, ("NFS41 Daemon starting: version %d\n", NFS41D_VERSION));
  90.  
  91. -    pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  92. -        FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  93. -        0, NULL);
  94. -    if (pipe == INVALID_HANDLE_VALUE)
  95. -    {
  96. -        eprintf("Unable to open upcall pipe %d\n", GetLastError());
  97. +    pipe = create_nfs41sys_device_pipe();
  98. +    if (pipe == INVALID_HANDLE_VALUE) {
  99. +        eprintf(
  100. +#ifdef STANDALONE_NFSD
  101. +            "wmain: "
  102. +#else
  103. +            "ServiceStart: "
  104. +#endif /* STANDALONE_NFSD */
  105. +            "Unable to open upcall pipe %d\n",
  106. +            (int)GetLastError());
  107.          goto out_idmap;
  108.      }
  109.  
  110. @@ -957,7 +960,8 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  111.      DPRINTF(1, ("Parent woke up!!!!\n"));
  112.  
  113.  out_pipe:
  114. -    CloseHandle(pipe);
  115. +    close_nfs41sys_device_pipe(pipe);
  116. +
  117.  out_idmap:
  118.      if (nfs41_dg.idmapper)
  119.          nfs41_idmap_free(nfs41_dg.idmapper);
  120. diff --git a/daemon/util.c b/daemon/util.c
  121. index 1c284d9..3d36780 100644
  122. --- a/daemon/util.c
  123. +++ b/daemon/util.c
  124. @@ -800,14 +800,9 @@ int parse_fs_location_server_address(IN const char *restrict inaddr,
  125.      return ERROR_BAD_NET_NAME;
  126.  }
  127.  
  128. -int delayxid(LONGLONG xid, LONGLONG moredelaysecs)
  129. +HANDLE create_nfs41sys_device_pipe(void)
  130.  {
  131. -    int status;
  132.      HANDLE pipe;
  133. -    unsigned char inbuf[sizeof(LONGLONG)*2], *buffer = inbuf;
  134. -    DWORD inbuf_len = sizeof(LONGLONG)*2, outbuf_len, dstatus;
  135. -    uint32_t length;
  136. -
  137.      pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A,
  138.          GENERIC_READ|GENERIC_WRITE,
  139.          FILE_SHARE_READ|FILE_SHARE_WRITE,
  140. @@ -815,6 +810,23 @@ int delayxid(LONGLONG xid, LONGLONG moredelaysecs)
  141.          OPEN_EXISTING,
  142.          0,
  143.          NULL);
  144. +    return pipe;
  145. +}
  146. +
  147. +void close_nfs41sys_device_pipe(HANDLE pipe)
  148. +{
  149. +    (void)CloseHandle(pipe);
  150. +}
  151. +
  152. +int delayxid(LONGLONG xid, LONGLONG moredelaysecs)
  153. +{
  154. +    int status;
  155. +    HANDLE pipe;
  156. +    unsigned char inbuf[sizeof(LONGLONG)*2], *buffer = inbuf;
  157. +    DWORD inbuf_len = sizeof(LONGLONG)*2, outbuf_len, dstatus;
  158. +    uint32_t length;
  159. +
  160. +    pipe = create_nfs41sys_device_pipe();
  161.      if (pipe == INVALID_HANDLE_VALUE) {
  162.          status = GetLastError();
  163.          eprintf("delayxid: Unable to open downcall pipe. lasterr=%d\n",
  164. @@ -837,7 +849,7 @@ int delayxid(LONGLONG xid, LONGLONG moredelaysecs)
  165.          eprintf("delayxid: IOCTL_NFS41_INVALCACHE failed, lasterr=%d\n",
  166.              status);
  167.      }
  168. -    (void)CloseHandle(pipe);
  169. +    close_nfs41sys_device_pipe(pipe);
  170.  
  171.      return status;
  172.  }
  173. diff --git a/daemon/util.h b/daemon/util.h
  174. index bb3fbaa..ab62721 100644
  175. --- a/daemon/util.h
  176. +++ b/daemon/util.h
  177. @@ -439,6 +439,9 @@ int parse_fs_location_server_address(IN const char *restrict inaddr,
  178.      OUT char *restrict addr,
  179.      OUT unsigned short *restrict port);
  180.  
  181. +HANDLE create_nfs41sys_device_pipe(void);
  182. +void close_nfs41sys_device_pipe(HANDLE pipe);
  183. +
  184.  int delayxid(LONGLONG xid, LONGLONG moredelaysecs);
  185.  
  186.  #endif /* !__NFS41_DAEMON_UTIL_H__ */
  187. --
  188. 2.51.0
  189.  
  190. From 372adf6bac81a004bf8c166fadbc90a89d2693a6 Mon Sep 17 00:00:00 2001
  191. From: Roland Mainz <roland.mainz@nrubsig.org>
  192. Date: Sat, 11 Oct 2025 15:58:16 +0200
  193. Subject: [PATCH 2/6] tests: nfsbuildtest: Use git fsck for better filesystem
  194.  test coverage
  195.  
  196. Use git fsck for better filesystem test coverage.
  197.  
  198. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  199. ---
  200. tests/nfsbuildtest/nfsbuildtest.ksh93 | 17 ++++++++++++++++-
  201.  1 file changed, 16 insertions(+), 1 deletion(-)
  202.  
  203. diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
  204. index 322c685..2103fa3 100644
  205. --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
  206. +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
  207. @@ -161,6 +161,12 @@ function gcc_build
  208.  
  209.         cd "$PWD/gcc/"
  210.  
  211. +       # make sure git commands (like git "describe", "fsck", ...) work
  212. +       git config --global --add safe.directory "$PWD"
  213. +
  214. +       # use git fsck as filesystem test
  215. +       time git fsck
  216. +
  217.         if $config_use_posix_ksh93_builtins ; then
  218.                 PATH="/usr/ast/bin:/opt/ast/bin:$PATH"
  219.         fi
  220. @@ -338,6 +344,12 @@ function bash_build
  221.  
  222.         cd "$PWD/bash/"
  223.  
  224. +       # make sure git commands (like git "describe", "fsck", ...) work
  225. +       git config --global --add safe.directory "$PWD"
  226. +
  227. +       # use git fsck as filesystem test
  228. +       time git fsck
  229. +
  230.         if $config_use_posix_ksh93_builtins ; then
  231.                 PATH="/usr/ast/bin:/opt/ast/bin:$PATH"
  232.         fi
  233. @@ -507,9 +519,12 @@ function msnfs41client_build
  234.  
  235.         cd "$PWD/ms-nfs41-client/"
  236.  
  237. -       # make sure git commands (like "git describe ...") work
  238. +       # make sure git commands (like git "describe", "fsck", ...) work
  239.         git config --global --add safe.directory "$PWD"
  240.  
  241. +       # use git fsck as filesystem test
  242. +       time git fsck
  243. +
  244.         #
  245.         # patch sources and configure build
  246.         #
  247. --
  248. 2.51.0
  249.  
  250. From d3291b7781da2bd7f5d89dbe53289efee6709f87 Mon Sep 17 00:00:00 2001
  251. From: Roland Mainz <roland.mainz@nrubsig.org>
  252. Date: Sat, 11 Oct 2025 15:59:33 +0200
  253. Subject: [PATCH 3/6] daemon: Use |restrict|+|const| for |marshall_*|-functions
  254.  
  255. Use |restrict|+|const| for |marshall_*|-functions.
  256.  
  257. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  258. ---
  259. daemon/acl.c       | 15 ++++++++++-----
  260.  daemon/ea.c        | 14 ++++++++++----
  261.  daemon/fsctl.c     | 25 ++++++++++++++++---------
  262.  daemon/getattr.c   |  7 +++++--
  263.  daemon/mount.c     |  7 +++++--
  264.  daemon/open.c      |  7 +++++--
  265.  daemon/readdir.c   |  7 +++++--
  266.  daemon/readwrite.c |  7 +++++--
  267.  daemon/setattr.c   |  7 +++++--
  268.  daemon/symlink.c   |  8 +++++---
  269.  daemon/upcall.h    |  4 +++-
  270.  daemon/volume.c    |  7 +++++--
  271.  12 files changed, 79 insertions(+), 36 deletions(-)
  272.  
  273. diff --git a/daemon/acl.c b/daemon/acl.c
  274. index d2baf96..9a7f812 100644
  275. --- a/daemon/acl.c
  276. +++ b/daemon/acl.c
  277. @@ -498,11 +498,13 @@ out:
  278.      return status;
  279.  }
  280.  
  281. -static int marshall_getacl(unsigned char *buffer, uint32_t *length,
  282. -                           nfs41_upcall *upcall)
  283. +static int marshall_getacl(
  284. +    unsigned char *restrict buffer,
  285. +    uint32_t *restrict length,
  286. +    nfs41_upcall *restrict upcall)
  287.  {
  288.      int status = ERROR_NOT_SUPPORTED;
  289. -    getacl_upcall_args *args = &upcall->args.getacl;
  290. +    const getacl_upcall_args *args = &upcall->args.getacl;
  291.  
  292.      status = safe_write(&buffer, length, &args->sec_desc_len, sizeof(DWORD));
  293.      if (status) goto out;
  294. @@ -1557,9 +1559,12 @@ out:
  295.      return status;
  296.  }
  297.  
  298. -static int marshall_setacl(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  299. +static int marshall_setacl(
  300. +    unsigned char *restrict buffer,
  301. +    uint32_t *restrict length,
  302. +    nfs41_upcall *restrict upcall)
  303.  {
  304. -    setacl_upcall_args *args = &upcall->args.setacl;
  305. +    const setacl_upcall_args *args = &upcall->args.setacl;
  306.      return safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
  307.  }
  308.  
  309. diff --git a/daemon/ea.c b/daemon/ea.c
  310. index 5acf81b..fa52f7e 100644
  311. --- a/daemon/ea.c
  312. +++ b/daemon/ea.c
  313. @@ -259,9 +259,12 @@ out:
  314.      return nfs_to_windows_error(status, ERROR_NOT_SUPPORTED);
  315.  }
  316.  
  317. -static int marshall_setexattr(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  318. +static int marshall_setexattr(
  319. +    unsigned char *restrict buffer,
  320. +    uint32_t *restrict length,
  321. +    nfs41_upcall *restrict upcall)
  322.  {
  323. -    setexattr_upcall_args *args = &upcall->args.setexattr;
  324. +    const setexattr_upcall_args *args = &upcall->args.setexattr;
  325.      return safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
  326.  }
  327.  
  328. @@ -786,10 +789,13 @@ out_free:
  329.      goto out;
  330.  }
  331.  
  332. -static int marshall_getexattr(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  333. +static int marshall_getexattr(
  334. +    unsigned char *restrict buffer,
  335. +    uint32_t *restrict length,
  336. +    nfs41_upcall *restrict upcall)
  337.  {
  338.      int status = NO_ERROR;
  339. -    getexattr_upcall_args *args = &upcall->args.getexattr;
  340. +    const getexattr_upcall_args *args = &upcall->args.getexattr;
  341.  
  342.      status = safe_write(&buffer, length, &args->overflow, sizeof(args->overflow));
  343.      if (status) goto out;
  344. diff --git a/daemon/fsctl.c b/daemon/fsctl.c
  345. index 096d207..44f2f57 100644
  346. --- a/daemon/fsctl.c
  347. +++ b/daemon/fsctl.c
  348. @@ -300,11 +300,14 @@ int handle_queryallocatedranges(void *daemon_context,
  349.      return status;
  350.  }
  351.  
  352. -static int marshall_queryallocatedranges(unsigned char *buffer,
  353. -    uint32_t *length, nfs41_upcall *upcall)
  354. +static int marshall_queryallocatedranges(
  355. +    unsigned char *restrict buffer,
  356. +    uint32_t *restrict length,
  357. +    nfs41_upcall *restrict upcall)
  358.  {
  359.      int status;
  360. -    queryallocatedranges_upcall_args *args = &upcall->args.queryallocatedranges;
  361. +    const queryallocatedranges_upcall_args *args =
  362. +        &upcall->args.queryallocatedranges;
  363.  
  364.      status = safe_write(&buffer, length, &args->buffer_overflow, sizeof(args->buffer_overflow));
  365.      if (status) goto out;
  366. @@ -426,10 +429,12 @@ out:
  367.      return status;
  368.  }
  369.  
  370. -static int marshall_setzerodata(unsigned char *buffer,
  371. -    uint32_t *length, nfs41_upcall *upcall)
  372. +static int marshall_setzerodata(
  373. +    unsigned char *restrict buffer,
  374. +    uint32_t *restrict length,
  375. +    nfs41_upcall *restrict upcall)
  376.  {
  377. -    setzerodata_upcall_args *args = &upcall->args.setzerodata;
  378. +    const setzerodata_upcall_args *args = &upcall->args.setzerodata;
  379.      int status;
  380.      status = safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
  381.      return status;
  382. @@ -902,10 +907,12 @@ out:
  383.      return status;
  384.  }
  385.  
  386. -static int marshall_duplicatedata(unsigned char *buffer,
  387. -    uint32_t *length, nfs41_upcall *upcall)
  388. +static int marshall_duplicatedata(
  389. +    unsigned char *restrict buffer,
  390. +    uint32_t *restrict length,
  391. +    nfs41_upcall *restrict upcall)
  392.  {
  393. -    setzerodata_upcall_args *args = &upcall->args.setzerodata;
  394. +    const setzerodata_upcall_args *args = &upcall->args.setzerodata;
  395.      int status;
  396.      status = safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
  397.      return status;
  398. diff --git a/daemon/getattr.c b/daemon/getattr.c
  399. index bc6709f..4744285 100644
  400. --- a/daemon/getattr.c
  401. +++ b/daemon/getattr.c
  402. @@ -216,10 +216,13 @@ out:
  403.      return status;
  404.  }
  405.  
  406. -static int marshall_getattr(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  407. +static int marshall_getattr(
  408. +    unsigned char *restrict buffer,
  409. +    uint32_t *restrict length,
  410. +    nfs41_upcall *restrict upcall)
  411.  {
  412.      int status;
  413. -    getattr_upcall_args *args = &upcall->args.getattr;
  414. +    const getattr_upcall_args *args = &upcall->args.getattr;
  415.      uint32_t info_len;
  416.  
  417.      switch (args->query_class) {
  418. diff --git a/daemon/mount.c b/daemon/mount.c
  419. index 88c3067..81f1b30 100644
  420. --- a/daemon/mount.c
  421. +++ b/daemon/mount.c
  422. @@ -316,9 +316,12 @@ out_err:
  423.      goto out;
  424.  }
  425.  
  426. -static int marshall_mount(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  427. +static int marshall_mount(
  428. +    unsigned char *restrict buffer,
  429. +    uint32_t *restrict length,
  430. +    nfs41_upcall *restrict upcall)
  431.  {
  432. -    mount_upcall_args *args = &upcall->args.mount;
  433. +    const mount_upcall_args *args = &upcall->args.mount;
  434.      int status;
  435.      DPRINTF(2, ("NFS41_SYSOP_MOUNT: writing pointer to nfs41_root 0x%p, version %d, "
  436.          "lease_time %d\n", upcall->root_ref, NFS41D_VERSION, args->lease_time));
  437. diff --git a/daemon/open.c b/daemon/open.c
  438. index 1d5f30d..2454138 100644
  439. --- a/daemon/open.c
  440. +++ b/daemon/open.c
  441. @@ -1232,10 +1232,13 @@ out_free_state:
  442.      goto out;
  443.  }
  444.  
  445. -static int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  446. +static int marshall_open(
  447. +    unsigned char *restrict buffer,
  448. +    uint32_t *restrict length,
  449. +    nfs41_upcall *restrict upcall)
  450.  {
  451.      int status;
  452. -    open_upcall_args *args = &upcall->args.open;
  453. +    const open_upcall_args *args = &upcall->args.open;
  454.  
  455.      status = safe_write(&buffer, length, &args->basic_info, sizeof(args->basic_info));
  456.      if (status) goto out;
  457. diff --git a/daemon/readdir.c b/daemon/readdir.c
  458. index c7f0d18..82f4800 100644
  459. --- a/daemon/readdir.c
  460. +++ b/daemon/readdir.c
  461. @@ -958,10 +958,13 @@ out_free_cookie:
  462.      goto out_free_entry;
  463.  }
  464.  
  465. -static int marshall_readdir(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  466. +static int marshall_readdir(
  467. +    unsigned char *restrict buffer,
  468. +    uint32_t *restrict length,
  469. +    nfs41_upcall *restrict upcall)
  470.  {
  471.      int status;
  472. -    readdir_upcall_args *args = &upcall->args.readdir;
  473. +    const readdir_upcall_args *args = &upcall->args.readdir;
  474.  
  475.      status = safe_write(&buffer, length, &args->query_reply_len, sizeof(args->query_reply_len));
  476.      return status;
  477. diff --git a/daemon/readwrite.c b/daemon/readwrite.c
  478. index 4dd610f..7f5ce32 100644
  479. --- a/daemon/readwrite.c
  480. +++ b/daemon/readwrite.c
  481. @@ -399,9 +399,12 @@ out:
  482.      return status;
  483.  }
  484.  
  485. -static int marshall_rw(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  486. +static int marshall_rw(
  487. +    unsigned char *restrict buffer,
  488. +    uint32_t *restrict length,
  489. +    nfs41_upcall *restrict upcall)
  490.  {
  491. -    readwrite_upcall_args *args = &upcall->args.rw;
  492. +    const readwrite_upcall_args *args = &upcall->args.rw;
  493.      int status;
  494.      status = safe_write(&buffer, length, &args->out_len, sizeof(args->out_len));
  495.      if (status) goto out;
  496. diff --git a/daemon/setattr.c b/daemon/setattr.c
  497. index 8705161..90b177a 100644
  498. --- a/daemon/setattr.c
  499. +++ b/daemon/setattr.c
  500. @@ -717,9 +717,12 @@ static int handle_setattr(void *daemon_context, nfs41_upcall *upcall)
  501.      return status;
  502.  }
  503.  
  504. -static int marshall_setattr(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  505. +static int marshall_setattr(
  506. +    unsigned char *restrict buffer,
  507. +    uint32_t *restrict length,
  508. +    nfs41_upcall *restrict upcall)
  509.  {
  510. -    setattr_upcall_args *args = &upcall->args.setattr;
  511. +    const setattr_upcall_args *args = &upcall->args.setattr;
  512.      return safe_write(&buffer, length, &args->ctime, sizeof(args->ctime));
  513.  }
  514.  
  515. diff --git a/daemon/symlink.c b/daemon/symlink.c
  516. index 49c3271..d1a746b 100644
  517. --- a/daemon/symlink.c
  518. +++ b/daemon/symlink.c
  519. @@ -287,10 +287,12 @@ out:
  520.      return status;
  521.  }
  522.  
  523. -static int marshall_symlink_get(unsigned char *buffer, uint32_t *length,
  524. -    nfs41_upcall *upcall)
  525. +static int marshall_symlink_get(
  526. +    unsigned char *restrict buffer,
  527. +    uint32_t *restrict length,
  528. +    nfs41_upcall *restrict upcall)
  529.  {
  530. -    symlink_upcall_args *args = &upcall->args.symlink;
  531. +    const symlink_upcall_args *args = &upcall->args.symlink;
  532.      unsigned short len = (args->target_get.len + 1) * sizeof(WCHAR);
  533.      int status = NO_ERROR;
  534.      int wc_len;
  535. diff --git a/daemon/upcall.h b/daemon/upcall.h
  536. index 43016e5..f0c2016 100644
  537. --- a/daemon/upcall.h
  538. +++ b/daemon/upcall.h
  539. @@ -287,7 +287,9 @@ typedef int (*upcall_parse_proc)(
  540.      uint32_t length,
  541.      nfs41_upcall *upcall);
  542.  typedef int (*upcall_handle_proc)(void*, nfs41_upcall*);
  543. -typedef int (*upcall_marshall_proc)(unsigned char*, uint32_t*, nfs41_upcall*);
  544. +typedef int (*upcall_marshall_proc)(unsigned char* restrict,
  545. +    uint32_t*restrict,
  546. +    nfs41_upcall* restrict);
  547.  typedef void (*upcall_cancel_proc)(nfs41_upcall*);
  548.  typedef void (*upcall_cleanup_proc)(nfs41_upcall*);
  549.  
  550. diff --git a/daemon/volume.c b/daemon/volume.c
  551. index 8a6ef44..4417b37 100644
  552. --- a/daemon/volume.c
  553. +++ b/daemon/volume.c
  554. @@ -230,10 +230,13 @@ static int handle_volume(void *daemon_context, nfs41_upcall *upcall)
  555.      return status;
  556.  }
  557.  
  558. -static int marshall_volume(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
  559. +static int marshall_volume(
  560. +    unsigned char *restrict buffer,
  561. +    uint32_t *restrict length,
  562. +    nfs41_upcall *restrict upcall)
  563.  {
  564.      int status;
  565. -    volume_upcall_args *args = &upcall->args.volume;
  566. +    const volume_upcall_args *args = &upcall->args.volume;
  567.  
  568.      status = safe_write(&buffer, length, &args->len, sizeof(args->len));
  569.      if (status) goto out;
  570. --
  571. 2.51.0
  572.  
  573. From 423da89c7b4f5b0d3f09091a7572bc86db29a36e Mon Sep 17 00:00:00 2001
  574. From: Roland Mainz <roland.mainz@nrubsig.org>
  575. Date: Sat, 11 Oct 2025 16:06:38 +0200
  576. Subject: [PATCH 4/6] daemon: Fix clang "assigned but not used" warnings in
  577.  |marshall_*()|-functions
  578.  
  579. Fix clang "assigned but not used" warnings in |marshall_*()|-functions.
  580.  
  581. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  582. ---
  583. daemon/acl.c     | 2 +-
  584.  daemon/ea.c      | 2 +-
  585.  daemon/symlink.c | 2 +-
  586.  3 files changed, 3 insertions(+), 3 deletions(-)
  587.  
  588. diff --git a/daemon/acl.c b/daemon/acl.c
  589. index 9a7f812..7a3cbb6 100644
  590. --- a/daemon/acl.c
  591. +++ b/daemon/acl.c
  592. @@ -503,7 +503,7 @@ static int marshall_getacl(
  593.      uint32_t *restrict length,
  594.      nfs41_upcall *restrict upcall)
  595.  {
  596. -    int status = ERROR_NOT_SUPPORTED;
  597. +    int status;
  598.      const getacl_upcall_args *args = &upcall->args.getacl;
  599.  
  600.      status = safe_write(&buffer, length, &args->sec_desc_len, sizeof(DWORD));
  601. diff --git a/daemon/ea.c b/daemon/ea.c
  602. index fa52f7e..be5ecac 100644
  603. --- a/daemon/ea.c
  604. +++ b/daemon/ea.c
  605. @@ -794,7 +794,7 @@ static int marshall_getexattr(
  606.      uint32_t *restrict length,
  607.      nfs41_upcall *restrict upcall)
  608.  {
  609. -    int status = NO_ERROR;
  610. +    int status;
  611.      const getexattr_upcall_args *args = &upcall->args.getexattr;
  612.  
  613.      status = safe_write(&buffer, length, &args->overflow, sizeof(args->overflow));
  614. diff --git a/daemon/symlink.c b/daemon/symlink.c
  615. index d1a746b..d03c738 100644
  616. --- a/daemon/symlink.c
  617. +++ b/daemon/symlink.c
  618. @@ -294,7 +294,7 @@ static int marshall_symlink_get(
  619.  {
  620.      const symlink_upcall_args *args = &upcall->args.symlink;
  621.      unsigned short len = (args->target_get.len + 1) * sizeof(WCHAR);
  622. -    int status = NO_ERROR;
  623. +    int status;
  624.      int wc_len;
  625.  
  626.      unsigned short *wc_len_out;
  627. --
  628. 2.51.0
  629.  
  630. From a2dcaf2d2b98985462018f3e02aa4fb889a353ab Mon Sep 17 00:00:00 2001
  631. From: Dan Shelton <dan.f.shelton@gmail.com>
  632. Date: Sat, 11 Oct 2025 21:47:55 +0200
  633. Subject: [PATCH 5/6] sys: Split unmarshal_nfs41_symlink() into
  634.  unmarshal_nfs41_get_symlink()+unmarshal_nfs41_set_symlink()
  635.  
  636. Split unmarshal_nfs41_symlink() into unmarshal_nfs41_get_symlink() +
  637. unmarshal_nfs41_set_symlink().
  638.  
  639. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  640. ---
  641. sys/nfs41sys_driver.h     |  5 ++++-
  642.  sys/nfs41sys_symlink.c    | 12 ++++++++----
  643.  sys/nfs41sys_updowncall.c |  4 +++-
  644.  3 files changed, 15 insertions(+), 6 deletions(-)
  645.  
  646. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  647. index 92c21cc..8061528 100644
  648. --- a/sys/nfs41sys_driver.h
  649. +++ b/sys/nfs41sys_driver.h
  650. @@ -842,7 +842,10 @@ NTSTATUS marshal_nfs41_symlink(
  651.      unsigned char *buf,
  652.      ULONG buf_len,
  653.      ULONG *len);
  654. -void unmarshal_nfs41_symlink(
  655. +void unmarshal_nfs41_get_symlink(
  656. +    nfs41_updowncall_entry *cur,
  657. +    const unsigned char *restrict *restrict buf);
  658. +void unmarshal_nfs41_set_symlink(
  659.      nfs41_updowncall_entry *cur,
  660.      const unsigned char *restrict *restrict buf);
  661.  NTSTATUS nfs41_SetSymlinkReparsePoint(
  662. diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
  663. index c669565..2e85f48 100644
  664. --- a/sys/nfs41sys_symlink.c
  665. +++ b/sys/nfs41sys_symlink.c
  666. @@ -119,13 +119,10 @@ out:
  667.      return status;
  668.  }
  669.  
  670. -void unmarshal_nfs41_symlink(
  671. +void unmarshal_nfs41_get_symlink(
  672.      nfs41_updowncall_entry *cur,
  673.      const unsigned char *restrict *restrict buf)
  674.  {
  675. -    if (cur->opcode == NFS41_SYSOP_SYMLINK_SET)
  676. -        return;
  677. -
  678.      RtlCopyMemory(&cur->u.Symlink.target->Length, *buf, sizeof(USHORT));
  679.      *buf += sizeof(USHORT);
  680.      if (cur->u.Symlink.target->Length >
  681. @@ -138,6 +135,13 @@ void unmarshal_nfs41_symlink(
  682.      *buf += cur->u.Symlink.target->Length;
  683.  }
  684.  
  685. +void unmarshal_nfs41_set_symlink(
  686. +    nfs41_updowncall_entry *cur,
  687. +    const unsigned char *restrict *restrict buf)
  688. +{
  689. +    /* empty */
  690. +}
  691. +
  692.  NTSTATUS map_symlink_errors(
  693.      NTSTATUS status)
  694.  {
  695. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  696. index 6d4c6c9..9f246f6 100644
  697. --- a/sys/nfs41sys_updowncall.c
  698. +++ b/sys/nfs41sys_updowncall.c
  699. @@ -745,8 +745,10 @@ NTSTATUS nfs41_downcall(
  700.              unmarshal_nfs41_eaget(cur, &inbuf);
  701.              break;
  702.          case NFS41_SYSOP_SYMLINK_GET:
  703. +            unmarshal_nfs41_get_symlink(cur, &inbuf);
  704. +            break;
  705.          case NFS41_SYSOP_SYMLINK_SET:
  706. -            unmarshal_nfs41_symlink(cur, &inbuf);
  707. +            unmarshal_nfs41_set_symlink(cur, &inbuf);
  708.              break;
  709.          case NFS41_SYSOP_VOLUME_QUERY:
  710.              unmarshal_nfs41_volume(cur, &inbuf);
  711. --
  712. 2.51.0
  713.  
  714. From 3bf8514cbf4118a78e5874bc1f08367aaf426844 Mon Sep 17 00:00:00 2001
  715. From: Roland Mainz <roland.mainz@nrubsig.org>
  716. Date: Sun, 12 Oct 2025 00:31:41 +0200
  717. Subject: [PATCH 6/6] sys: Shorten upcall/downcall header debug message+include
  718.  async_op boolean
  719.  
  720. Shorten upcall/downcall header debug message+include async_op boolean
  721.  
  722. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  723. ---
  724. sys/nfs41sys_driver.c     | 13 +++++++++----
  725.  sys/nfs41sys_updowncall.c |  4 ++--
  726.  2 files changed, 11 insertions(+), 6 deletions(-)
  727.  
  728. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  729. index e9e4486..38cc8e3 100644
  730. --- a/sys/nfs41sys_driver.c
  731. +++ b/sys/nfs41sys_driver.c
  732. @@ -255,10 +255,15 @@ NTSTATUS marshal_nfs41_header(
  733.      tmp += sizeof(HANDLE);
  734.  
  735.  #ifdef DEBUG_MARSHAL_HEADER
  736. -    DbgP("[upcall header] xid=%lld opcode='%s' filename='%wZ' version=%d "
  737. -        "session=0x%p open_state=0x%x\n", entry->xid,
  738. -        ENTRY_OPCODE2STRING(entry), entry->filename,
  739. -        entry->version, entry->session, entry->open_state);
  740. +    DbgP("[upcall hdr] xid=%lld op='%s'%s filename='%wZ' vers=%d "
  741. +        "sess=0x%p open_state=0x%x\n",
  742. +        entry->xid,
  743. +        opcode2string(entry->opcode),
  744. +        (entry->async_op?"(async)":""),
  745. +        entry->filename,
  746. +        (int)entry->version,
  747. +        entry->session,
  748. +        entry->open_state);
  749.  #endif /* DEBUG_MARSHAL_HEADER */
  750.  out:
  751.      return status;
  752. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  753. index 9f246f6..f491a29 100644
  754. --- a/sys/nfs41sys_updowncall.c
  755. +++ b/sys/nfs41sys_updowncall.c
  756. @@ -154,8 +154,8 @@ static void unmarshal_nfs41_header(
  757.      RtlCopyMemory(&tmp->errno, *buf, sizeof(tmp->errno));
  758.      *buf += sizeof(tmp->errno);
  759.  #ifdef DEBUG_MARSHAL_HEADER
  760. -    DbgP("[downcall header] "
  761. -        "xid=%lld opcode='%s' status=0x%lx errno=%d\n",
  762. +    DbgP("[downcall hdr] "
  763. +        "xid=%lld op='%s' status=0x%lx errno=%d\n",
  764.          tmp->xid,
  765.          opcode2string(tmp->opcode),
  766.          (long)tmp->status,
  767. --
  768. 2.51.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