pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for upcall size increase, relative paths in public nfs://-URLs, unique volume labels+misc, 2025-06-30
Posted by Anonymous on Mon 30th Jun 2025 19:39
raw | new post

  1. From fe91d8b2cfb0891f57f9cb4617bf2f67bcd62a90 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Mon, 30 Jun 2025 13:36:47 +0200
  4. Subject: [PATCH 1/5] daemon: |UPCALL_BUF_SIZE| is too small to fit two
  5.  |PATH_MAX| paths
  6.  
  7. |UPCALL_BUF_SIZE| is too small to fit two |PATH_MAX| paths, because
  8. there needs to be room for the header, too.
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. daemon/nfs41_const.h | 2 +-
  13.  1 file changed, 1 insertion(+), 1 deletion(-)
  14.  
  15. diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
  16. index ee9674a..02e7954 100644
  17. --- a/daemon/nfs41_const.h
  18. +++ b/daemon/nfs41_const.h
  19. @@ -59,7 +59,7 @@
  20.   * This must fit at least twice the maximum path length
  21.   * (for rename) plus header
  22.   */
  23. -#define UPCALL_BUF_SIZE         8192
  24. +#define UPCALL_BUF_SIZE         ((2*4096)+1024)
  25.  
  26.  /*
  27.   * NFS41_MAX_COMPONENT_LEN - MaximumComponentNameLength
  28. --
  29. 2.45.1
  30.  
  31. From e362d22b9f4687403beb160b092f5a425db6cf58 Mon Sep 17 00:00:00 2001
  32. From: Roland Mainz <roland.mainz@nrubsig.org>
  33. Date: Mon, 30 Jun 2025 13:41:25 +0200
  34. Subject: [PATCH 2/5] daemon,docs: nfs://-URLs for public NFS must be relative
  35.  
  36. nfs://-URLs for public NFS must be relative (to the pubfh handle).
  37.  
  38. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  39. ---
  40. daemon/mount.c  | 40 ++++++++++++++++++++++++++++++++--------
  41.  docs/README.xml |  2 +-
  42.  mount/enum.c    | 16 +++++++++++-----
  43.  mount/mount.c   | 33 +++++++++++++++++++++++++++------
  44.  4 files changed, 71 insertions(+), 20 deletions(-)
  45.  
  46. diff --git a/daemon/mount.c b/daemon/mount.c
  47. index 10dad58..11f9a8b 100644
  48. --- a/daemon/mount.c
  49. +++ b/daemon/mount.c
  50. @@ -80,27 +80,47 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  51.      nfs41_root *root = NULL;
  52.      nfs41_client *client;
  53.      nfs41_path_fh file;
  54. +#ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  55. +    LUID authenticationid = { .LowPart = 0, .HighPart = 0L };
  56. +#endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
  57.  
  58.      EASSERT(args->hostport != NULL);
  59.  
  60. -#ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  61. -    LUID authenticationid = { .LowPart = 0, .HighPart = 0L };
  62. +    if (args->use_nfspubfh) {
  63. +        if (args->path[0] != '\\') {
  64. +            eprintf("handle_mount: "
  65. +                "public mount ('%s') root passed without backslash\n",
  66. +                args->path);
  67. +            status = ERROR_BAD_NETPATH;
  68. +            goto out;
  69. +        }
  70. +
  71. +        /*
  72. +         * public mounts should be relative to the pubfh. nfs_mount.exe
  73. +         * added the slash in front do the Win32 API can handle the path,
  74. +         * but for the NFS protocol only relative paths are allowed
  75. +         */
  76. +        args->path++;
  77. +    }
  78.  
  79. +#ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  80.      /* We ignore errors here since this is for logging only */
  81.      (void)get_token_authenticationid(upcall->currentthread_token,
  82.          &authenticationid);
  83.  
  84.      logprintf("mount(hostport='%s', "
  85. -        "use_nfspubfh=%d, path='%s', "
  86. +        "use_nfspubfh=%d, %s='%s', "
  87.          "authid=(0x%lx.0x%lx)) request\n",
  88.          args->hostport?args->hostport:"<NULL>",
  89.          (int)args->use_nfspubfh,
  90. +        (args->use_nfspubfh?"relative_path":"path"),
  91.          args->path?args->path:"<NULL>",
  92.          (long)authenticationid.HighPart,
  93.          (long)authenticationid.LowPart);
  94.  #else
  95. -    logprintf("mount(hostport='%s', path='%s') request\n",
  96. +    logprintf("mount(hostport='%s', %s='%s') request\n",
  97.          args->hostport?args->hostport:"<NULL>",
  98. +        (args->use_nfspubfh?"relative_path":"path"),
  99.          args->path?args->path:"<NULL>");
  100.  #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
  101.  
  102. @@ -199,20 +219,22 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  103.  out:
  104.      if (status == 0) {
  105.  #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  106. -        logprintf("mount(hostport='%s', use_nfspubfh=%d, path='%s', "
  107. +        logprintf("mount(hostport='%s', use_nfspubfh=%d, %s='%s', "
  108.              "authid=(0x%lx.0x%lx)) success, root=0x%p, NFS version=4.%d\n",
  109.              args->hostport?args->hostport:"<NULL>",
  110.              (int)args->use_nfspubfh,
  111. +            (args->use_nfspubfh?"relative_path":"path"),
  112.              args->path?args->path:"<NULL>",
  113.              (long)authenticationid.HighPart,
  114.              (long)authenticationid.LowPart,
  115.              root,
  116.              (int)root->nfsminorvers);
  117.  #else
  118. -        logprintf("mount(hostport='%s', use_nfspubfh=%d, path='%s') success, "
  119. +        logprintf("mount(hostport='%s', use_nfspubfh=%d, %s='%s') success, "
  120.              "root=0x%p, NFS version=4.%d\n",
  121.              args->hostport?args->hostport:"<NULL>",
  122.              (int)args->use_nfspubfh,
  123. +            (args->use_nfspubfh?"relative_path":"path"),
  124.              args->path?args->path:"<NULL>",
  125.              root,
  126.              (int)root->nfsminorvers);
  127. @@ -220,19 +242,21 @@ out:
  128.      }
  129.      else {
  130.  #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  131. -        logprintf("mount(hostport='%s', use_nfspubfh=%d, path='%s', "
  132. +        logprintf("mount(hostport='%s', use_nfspubfh=%d, %s='%s', "
  133.              "authid=(0x%lx.0x%lx))) failed, status=%d\n",
  134.              args->hostport?args->hostport:"<NULL>",
  135.              (int)args->use_nfspubfh,
  136. +            (args->use_nfspubfh?"relative_path":"path"),
  137.              args->path?args->path:"<NULL>",
  138.              (long)authenticationid.HighPart,
  139.              (long)authenticationid.LowPart,
  140.              (int)status);
  141.  #else
  142. -        logprintf("mount(hostport='%s', use_nfspubfh=%d, path='%s') "
  143. +        logprintf("mount(hostport='%s', use_nfspubfh=%d, %s='%s') "
  144.              "failed, status=%d\n",
  145.              args->hostport?args->hostport:"<NULL>",
  146.              (int)args->use_nfspubfh,
  147. +            (args->use_nfspubfh?"relative_path":"path"),
  148.              args->path?args->path:"<NULL>",
  149.              (int)status);
  150.  #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
  151. diff --git a/docs/README.xml b/docs/README.xml
  152. index be0949e..86f783e 100644
  153. --- a/docs/README.xml
  154. +++ b/docs/README.xml
  155. @@ -184,7 +184,7 @@
  156.          </para>
  157.        </listitem>
  158.        <listitem>
  159. -        <para>Support for NFSv4 public mounts (i.e., use the NFSv4 public file handle lookup protocol via <command>$ nfs_mount -o public ... #</command>)</para>
  160. +        <para>Support for NFSv4 public mounts (i.e., use the NFSv4 public file handle lookup protocol via <command>$ nfs_mount -o public ... relative-path-or-url#</command>)</para>
  161.        </listitem>
  162.        <listitem>
  163.          <para>Support for NFSv4 referrals
  164. diff --git a/mount/enum.c b/mount/enum.c
  165. index 455b888..11f8a6d 100644
  166. --- a/mount/enum.c
  167. +++ b/mount/enum.c
  168. @@ -159,19 +159,25 @@ void PrintMountLine(
  169.           */
  170.          if (slash_counter == 1) {
  171.              *us++ = uc;
  172. -            if (*utf8unc_p == 'p') {
  173. -                /* Skip "pubnfs4" */
  174. -                utf8unc_p += 7;
  175. +            if (strncmp(utf8unc_p, "pubnfs4/", 8) == 0) {
  176. +                /*
  177. +                 * Skip "pubnfs4/", the trailing slash is skipped
  178. +                 * because public nfs://-URLs must be relative to
  179. +                 * the pubfh
  180. +                 */
  181. +                utf8unc_p += 8;
  182. +                slash_counter++;
  183.                  is_pubfh = true;
  184.              }
  185. -            else if (*utf8unc_p == 'n') {
  186. +            else if (strncmp(utf8unc_p, "nfs4/", 5) == 0) {
  187.                  /* Skip "nfs4" */
  188.                  utf8unc_p += 4;
  189.              }
  190.              else {
  191.                  (void)fwprintf(stderr,
  192.                      L"PrintMountLine: ## Internal error, "
  193. -                    "unknown provider prefix\n");
  194. +                    "unknown provider prefix, utf8unc_p='%s'\n",
  195. +                    utf8unc_p);
  196.                  return;
  197.              }
  198.  
  199. diff --git a/mount/mount.c b/mount/mount.c
  200. index d731a77..5fd1dda 100644
  201. --- a/mount/mount.c
  202. +++ b/mount/mount.c
  203. @@ -191,7 +191,8 @@ void PrintMountUsage(LPWSTR pProcess)
  204.          "\tnfs_mount.exe -o sec=sys,rw nfs://myhost1//dirwithspace/dir%%20space/test2\n"
  205.          "\tnfs_mount.exe -o sec=sys,rw S nfs://myhost1//dirwithspace/dir+space/test2\n"
  206.          "\tnfs_mount.exe -o sec=sys S nfs://myhost1//dirwithspace/dir+space/test2?rw=1\n"
  207. -        "\tnfs_mount.exe -o sec=sys nfs://myhost1//dirwithspace/dir+space/test2?rw=1\n",
  208. +        "\tnfs_mount.exe -o sec=sys nfs://myhost1//dirwithspace/dir+space/test2?rw=1\n"
  209. +        "\tnfs_mount.exe -o public,sec=sys P nfs://myhost1/net_tmpfs2/test2\n",
  210.          pProcess, pProcess, pProcess, pProcess,
  211.          (int)NFS41_DRIVER_DEFAULT_DIR_CREATE_MODE,
  212.          (int)NFS41_DRIVER_DEFAULT_FILE_CREATE_MODE,
  213. @@ -915,13 +916,33 @@ static DWORD ParseRemoteName(
  214.              goto out;
  215.          }
  216.  
  217. -        if (uctx->path[0] != '/') {
  218. -            result = ERROR_BAD_ARGUMENTS;
  219. -            (void)fwprintf(stderr, L"Relative nfs://-URLs are not supported\n");
  220. -            goto out;
  221. +        if (use_nfspubfh) {
  222. +            if (uctx->path[0] == '/') {
  223. +                result = ERROR_BAD_ARGUMENTS;
  224. +                (void)fwprintf(stderr, L"Absolute nfs://-URLs are not permitted for public mounts\n");
  225. +                goto out;
  226. +            }
  227. +
  228. +            /*
  229. +             * Put '/' in front of the path to make sure the Network Provider
  230. +             * API&co can handle it, the daemon code will treat the
  231. +             * path as relative
  232. +             */
  233. +            char *tmppathbuff = _alloca(strlen(uctx->path)+2);
  234. +            (void)sprintf(tmppathbuff, "/%s", uctx->path);
  235. +
  236. +            pEnd = mountstrmem = utf8str2wcs(tmppathbuff);
  237. +        }
  238. +        else {
  239. +            if (uctx->path[0] != '/') {
  240. +                result = ERROR_BAD_ARGUMENTS;
  241. +                (void)fwprintf(stderr, L"Relative nfs://-URLs are not permitted for non-public mounts\n");
  242. +                goto out;
  243. +            }
  244. +
  245. +            pEnd = mountstrmem = utf8str2wcs(uctx->path);
  246.          }
  247.  
  248. -        pEnd = mountstrmem = utf8str2wcs(uctx->path);
  249.          if (!mountstrmem) {
  250.              result = GetLastError();
  251.              (void)fwprintf(stderr, L"Cannot convert URL path '%s', lasterr=%d\n",
  252. --
  253. 2.45.1
  254.  
  255. From 93d09f5ff2bd10ec49a4a08c301ec5f525f09ca3 Mon Sep 17 00:00:00 2001
  256. From: Roland Mainz <roland.mainz@nrubsig.org>
  257. Date: Mon, 30 Jun 2025 14:42:08 +0200
  258. Subject: [PATCH 3/5] daemon: Fix error handling in |handle_mount()|
  259.  
  260. Fix error handling in |handle_mount()|
  261.  
  262. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  263. ---
  264. daemon/mount.c | 17 +++++++++++++----
  265.  1 file changed, 13 insertions(+), 4 deletions(-)
  266.  
  267. diff --git a/daemon/mount.c b/daemon/mount.c
  268. index 11f9a8b..89f555c 100644
  269. --- a/daemon/mount.c
  270. +++ b/daemon/mount.c
  271. @@ -84,9 +84,12 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  272.      LUID authenticationid = { .LowPart = 0, .HighPart = 0L };
  273.  #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
  274.  
  275. -    EASSERT(args->hostport != NULL);
  276. -
  277. -    if (args->use_nfspubfh) {
  278. +    /*
  279. +     * Handle relative paths for public NFS
  280. +     * (|args->path==NULL| should be logged below, but we bail out with
  281. +     * an error immediately after that)
  282. +     */
  283. +    if (args->path && args->use_nfspubfh) {
  284.          if (args->path[0] != '\\') {
  285.              eprintf("handle_mount: "
  286.                  "public mount ('%s') root passed without backslash\n",
  287. @@ -130,8 +133,14 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  288.          goto out;
  289.      }
  290.  
  291. +    if (args->hostport == NULL) {
  292. +        eprintf("handle_mount: hostport==NULL\n");
  293. +        status = ERROR_BAD_NETPATH;
  294. +        goto out;
  295. +    }
  296. +
  297.      if ((args->path == NULL) || (strlen(args->path) == 0)) {
  298. -        DPRINTF(1, ("handle_mount: empty mount root\n"));
  299. +        eprintf("handle_mount: empty mount root\n");
  300.          status = ERROR_BAD_NETPATH;
  301.          goto out;
  302.      }
  303. --
  304. 2.45.1
  305.  
  306. From 60cfa045d3840a44b76eeedb787d068999be08eb Mon Sep 17 00:00:00 2001
  307. From: Roland Mainz <roland.mainz@nrubsig.org>
  308. Date: Mon, 30 Jun 2025 16:53:23 +0200
  309. Subject: [PATCH 4/5] tests: winfsinfo subcmd getvolumeinfo should support more
  310.  data fields
  311.  
  312. winfsinfo subcmd "getvolumeinfo" should support more data fields.
  313.  
  314. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  315. ---
  316. tests/winfsinfo1/winfsinfo.c | 19 +++++++++++++++++--
  317.  1 file changed, 17 insertions(+), 2 deletions(-)
  318.  
  319. diff --git a/tests/winfsinfo1/winfsinfo.c b/tests/winfsinfo1/winfsinfo.c
  320. index 8e28205..c72d606 100644
  321. --- a/tests/winfsinfo1/winfsinfo.c
  322. +++ b/tests/winfsinfo1/winfsinfo.c
  323. @@ -61,6 +61,10 @@ bool getvolumeinfo(const char *progname, const char *filename)
  324.  {
  325.      int res = EXIT_FAILURE;
  326.      bool ok;
  327. +    wchar_t volumeNameBuffer[MAX_PATH+1];
  328. +    wchar_t fileSystemNameBuffer[MAX_PATH+1];
  329. +    DWORD volumeSerialNumber = 0ULL;
  330. +    DWORD maximumComponentLength = 0ULL;
  331.  
  332.      HANDLE fileHandle = CreateFileA(filename,
  333.          GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
  334. @@ -75,8 +79,14 @@ bool getvolumeinfo(const char *progname, const char *filename)
  335.      }
  336.  
  337.      DWORD volumeFlags = 0;
  338. -    ok = GetVolumeInformationByHandleW(fileHandle, NULL, 0,
  339. -        NULL, NULL, &volumeFlags, NULL, 0);
  340. +    ok = GetVolumeInformationByHandleW(fileHandle,
  341. +        volumeNameBuffer,
  342. +        sizeof(volumeNameBuffer),
  343. +        &volumeSerialNumber,
  344. +        &maximumComponentLength,
  345. +        &volumeFlags,
  346. +        fileSystemNameBuffer,
  347. +        sizeof(fileSystemNameBuffer));
  348.  
  349.      if (!ok) {
  350.          (void)fprintf(stderr, "%s: GetVolumeInformationByHandleW() "
  351. @@ -89,6 +99,11 @@ bool getvolumeinfo(const char *progname, const char *filename)
  352.  
  353.      (void)printf("(\n");
  354.      (void)printf("\tfilename='%s'\n", filename);
  355. +    (void)printf("\tvolumename='%ls'\n", volumeNameBuffer);
  356. +    (void)printf("\tvolumeserialnumber=0x%lx\n", (long)volumeSerialNumber);
  357. +    (void)printf("\tmaximumcomponentlength='%lu'\n", (long)maximumComponentLength);
  358. +    (void)printf("\tfilesystemname='%ls'\n", fileSystemNameBuffer);
  359. +
  360.      (void)printf("\ttypeset -A volumeflags=(\n");
  361.  
  362.  #define TESTVOLFLAG(s) \
  363. --
  364. 2.45.1
  365.  
  366. From afa5df075f300ffaf846fcc2423a99ab02463482 Mon Sep 17 00:00:00 2001
  367. From: Roland Mainz <roland.mainz@nrubsig.org>
  368. Date: Mon, 30 Jun 2025 20:26:24 +0200
  369. Subject: [PATCH 5/5] daemon,include,sys: Win32 VolumeLabel should be unique
  370.  
  371. Win32 VolumeLabel should be unique.
  372. We do this by constructing a nfs://-URL for the volume label's
  373. value.
  374.  
  375. This is still a bit problematic: Windows 10 Explorer has a 32
  376. character limit for volume values, and it completly omits any
  377. volume name/label information if the string is longer.
  378.  
  379. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  380. ---
  381. daemon/upcall.h        |  8 ++++++++
  382.  daemon/volume.c        | 41 ++++++++++++++++++++++++++++++++++++++++-
  383.  include/from_kernel.h  |  8 ++++++++
  384.  sys/nfs41sys_driver.c  |  2 --
  385.  sys/nfs41sys_driver.h  |  9 ---------
  386.  sys/nfs41sys_volinfo.c | 26 +-------------------------
  387.  6 files changed, 57 insertions(+), 37 deletions(-)
  388.  
  389. diff --git a/daemon/upcall.h b/daemon/upcall.h
  390. index c14adc7..6575243 100644
  391. --- a/daemon/upcall.h
  392. +++ b/daemon/upcall.h
  393. @@ -172,6 +172,14 @@ typedef struct __volume_upcall_args {
  394.      FS_INFORMATION_CLASS query;
  395.      int len;
  396.      union {
  397. +#pragma warning( push )
  398. +/* Disable warning C4201 ("nonstandard extension used: nameless struct/union") */
  399. +#pragma warning (disable : 4201)
  400. +        struct {
  401. +            FILE_FS_VOLUME_INFORMATION volume_info;
  402. +            wchar_t volumelabelbuffer[MAX_PATH+1];
  403. +        };
  404. +#pragma warning( pop )
  405.          FILE_FS_SIZE_INFORMATION size;
  406.          FILE_FS_ATTRIBUTE_INFORMATION attribute;
  407.          FILE_FS_FULL_SIZE_INFORMATION fullsize;
  408. diff --git a/daemon/volume.c b/daemon/volume.c
  409. index f279e8e..2867386 100644
  410. --- a/daemon/volume.c
  411. +++ b/daemon/volume.c
  412. @@ -1,8 +1,10 @@
  413.  /* NFSv4.1 client for Windows
  414. - * Copyright (C) 2012 The Regents of the University of Michigan
  415. + * Copyright (C) 2012 The Regents of the University of Michigan
  416. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  417.   *
  418.   * Olga Kornievskaia <aglo@umich.edu>
  419.   * Casey Bodley <cbodley@umich.edu>
  420. + * Roland Mainz <roland.mainz@nrubsig.org>
  421.   *
  422.   * This library is free software; you can redistribute it and/or modify it
  423.   * under the terms of the GNU Lesser General Public License as published by
  424. @@ -115,9 +117,46 @@ out:
  425.  static int handle_volume(void *daemon_context, nfs41_upcall *upcall)
  426.  {
  427.      volume_upcall_args *args = &upcall->args.volume;
  428. +    nfs41_session *session = upcall->state_ref->session;
  429.      int status = NO_ERROR;
  430.  
  431.      switch (args->query) {
  432. +    case FileFsVolumeInformation:
  433. +        PFILE_FS_VOLUME_INFORMATION vi = &args->info.volume_info;
  434. +
  435. +        vi->VolumeCreationTime.QuadPart = 0LL;
  436. +        vi->VolumeSerialNumber = 0xBABAFACE;
  437. +        vi->SupportsObjects = FALSE;
  438. +
  439. +        /*
  440. +         * |VolumeLabel| should be unique per volume, so we construct
  441. +         * a nfs://-URL (without path)
  442. +         *
  443. +         * FIXME:
  444. +         * - We should really work on |session->client->rpc->addrs| to
  445. +         * peel-off the port number
  446. +         */
  447. +        (void)swprintf(vi->VolumeLabel,
  448. +#if 1
  449. +            /*
  450. +             * Windows bug:
  451. +             * Windows Explorer can only handle up to 31 characters per label
  452. +             * FIXME:
  453. +             * Maybe a "workaround" would be to get the "naked" IPv4/IPv6 address
  454. +             * from libtirpc's universal address
  455. +             */
  456. +            31,
  457. +#else
  458. +            (MAX_PATH*sizeof(wchar_t)),
  459. +#endif
  460. +            L"nfs://%s:%d/%s",
  461. +            session->client->rpc->server_name,
  462. +            2049,
  463. +            (session->client->root->use_nfspubfh?"":""));
  464. +        vi->VolumeLabelLength = (ULONG)(wcslen(vi->VolumeLabel)*sizeof(wchar_t));
  465. +        args->len = sizeof(args->info.volume_info) + vi->VolumeLabelLength;
  466. +        break;
  467. +
  468.      case FileFsSizeInformation:
  469.          args->len = sizeof(args->info.size);
  470.          args->info.size.SectorsPerAllocationUnit = SECTORS_PER_UNIT;
  471. diff --git a/include/from_kernel.h b/include/from_kernel.h
  472. index db8817c..7a305bc 100644
  473. --- a/include/from_kernel.h
  474. +++ b/include/from_kernel.h
  475. @@ -456,6 +456,14 @@ typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
  476.  } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
  477.  
  478.  /* ntddk.h */
  479. +typedef struct _FILE_FS_VOLUME_INFORMATION {
  480. +    LARGE_INTEGER VolumeCreationTime;
  481. +    ULONG VolumeSerialNumber;
  482. +    ULONG VolumeLabelLength;
  483. +    BOOLEAN SupportsObjects;
  484. +    WCHAR VolumeLabel[1];
  485. +} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
  486. +
  487.  typedef struct _FILE_FS_SIZE_INFORMATION {
  488.      LARGE_INTEGER TotalAllocationUnits;
  489.      LARGE_INTEGER AvailableAllocationUnits;
  490. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  491. index 3300723..20ac368 100644
  492. --- a/sys/nfs41sys_driver.c
  493. +++ b/sys/nfs41sys_driver.c
  494. @@ -1377,8 +1377,6 @@ NTSTATUS DriverEntry(
  495.  
  496.      RxDefineNode(dev_exts, NFS41_DEVICE_EXTENSION);
  497.      dev_exts->DeviceObject = nfs41_dev;
  498. -    nfs41_create_volume_info((PFILE_FS_VOLUME_INFORMATION)dev_exts->VolAttrs,
  499. -        &dev_exts->VolAttrsLen);
  500.  
  501.      RtlInitUnicodeString(&user_dev_name, NFS41_SHADOW_DEVICE_NAME);
  502.      DbgP("calling IoCreateSymbolicLink '%wZ' '%wZ'\n", &user_dev_name, &dev_name);
  503. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  504. index b8b3447..a40406d 100644
  505. --- a/sys/nfs41sys_driver.h
  506. +++ b/sys/nfs41sys_driver.h
  507. @@ -410,11 +410,6 @@ typedef struct _NFS41_NETROOT_EXTENSION {
  508.  #define FS_NAME_LEN (sizeof(FS_NAME) - sizeof(WCHAR))
  509.  #define FS_ATTR_LEN (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + FS_NAME_LEN)
  510.  
  511. -/* FileSystemName as reported by FileFsAttributeInfo query */
  512. -#define VOL_NAME     L"PnfsVolume"
  513. -#define VOL_NAME_LEN (sizeof(VOL_NAME) - sizeof(WCHAR))
  514. -#define VOL_ATTR_LEN (sizeof(FILE_FS_VOLUME_INFORMATION) + VOL_NAME_LEN)
  515. -
  516.  typedef struct _NFS41_V_NET_ROOT_EXTENSION {
  517.      NODE_TYPE_CODE          NodeTypeCode;
  518.      NODE_BYTE_SIZE          NodeByteSize;
  519. @@ -484,8 +479,6 @@ typedef struct _NFS41_DEVICE_EXTENSION {
  520.      ULONG                   ActiveNodes;
  521.      HANDLE                  SharedMemorySection;
  522.      DWORD                   nfs41d_version;
  523. -    BYTE                    VolAttrs[VOL_ATTR_LEN];
  524. -    DWORD                   VolAttrsLen;
  525.      HANDLE                  openlistHandle;
  526.  } NFS41_DEVICE_EXTENSION, *PNFS41_DEVICE_EXTENSION;
  527.  
  528. @@ -896,7 +889,5 @@ NTSTATUS marshal_nfs41_volume(
  529.      ULONG *len);
  530.  NTSTATUS nfs41_QueryVolumeInformation(
  531.      IN OUT PRX_CONTEXT RxContext);
  532. -void nfs41_create_volume_info(
  533. -    PFILE_FS_VOLUME_INFORMATION pVolInfo, DWORD *len);
  534.  
  535.  #endif /* !_NFS41SYS_DRIVER_H_ */
  536. diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
  537. index a8435b9..d78a3da 100644
  538. --- a/sys/nfs41sys_volinfo.c
  539. +++ b/sys/nfs41sys_volinfo.c
  540. @@ -128,18 +128,6 @@ NTSTATUS map_volume_errors(
  541.      }
  542.  }
  543.  
  544. -void nfs41_create_volume_info(PFILE_FS_VOLUME_INFORMATION pVolInfo, DWORD *len)
  545. -{
  546. -    DECLARE_CONST_UNICODE_STRING(VolName, VOL_NAME);
  547. -
  548. -    RtlZeroMemory(pVolInfo, sizeof(FILE_FS_VOLUME_INFORMATION));
  549. -    pVolInfo->VolumeSerialNumber = 0xBABAFACE;
  550. -    pVolInfo->VolumeLabelLength = VolName.Length;
  551. -    RtlCopyMemory(&pVolInfo->VolumeLabel[0], (PVOID)VolName.Buffer,
  552. -        VolName.MaximumLength);
  553. -    *len = sizeof(FILE_FS_VOLUME_INFORMATION) + VolName.Length;
  554. -}
  555. -
  556.  NTSTATUS nfs41_QueryVolumeInformation(
  557.      IN OUT PRX_CONTEXT RxContext)
  558.  {
  559. @@ -153,7 +141,6 @@ NTSTATUS nfs41_QueryVolumeInformation(
  560.      __notnull PNFS41_NETROOT_EXTENSION pNetRootContext =
  561.          NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
  562.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  563. -    NFS41GetDeviceExtension(RxContext, DevExt);
  564.  
  565.  #ifdef ENABLE_TIMINGS
  566.      LARGE_INTEGER t1, t2;
  567. @@ -171,18 +158,6 @@ NTSTATUS nfs41_QueryVolumeInformation(
  568.      RtlZeroMemory(RxContext->Info.Buffer, RxContext->Info.LengthRemaining);
  569.  
  570.      switch (InfoClass) {
  571. -    case FileFsVolumeInformation:
  572. -        if ((ULONG)RxContext->Info.LengthRemaining >= DevExt->VolAttrsLen) {
  573. -            RtlCopyMemory(RxContext->Info.Buffer, DevExt->VolAttrs,
  574. -                DevExt->VolAttrsLen);
  575. -            RxContext->Info.LengthRemaining -= DevExt->VolAttrsLen;
  576. -            status = STATUS_SUCCESS;
  577. -        } else {
  578. -            RtlCopyMemory(RxContext->Info.Buffer, DevExt->VolAttrs,
  579. -                RxContext->Info.LengthRemaining);
  580. -            status = STATUS_BUFFER_OVERFLOW;
  581. -        }
  582. -        goto out;
  583.      case FileFsDeviceInformation:
  584.      {
  585.          PFILE_FS_DEVICE_INFORMATION pDevInfo = RxContext->Info.Buffer;
  586. @@ -229,6 +204,7 @@ NTSTATUS nfs41_QueryVolumeInformation(
  587.      case FileFsSizeInformation:
  588.      case FileFsFullSizeInformation:
  589.      case FileFsSectorSizeInformation:
  590. +    case FileFsVolumeInformation:
  591.          break;
  592.  
  593.      default:
  594. --
  595. 2.45.1

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