pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: nfs_mount -t/-F patch
Posted by Anonymous on Fri 22nd Sep 2023 12:06
raw | new post

  1. From 882cfbf5ce78c7a5dac7ba967ee9fd39d615a134 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Fri, 22 Sep 2023 12:26:54 +0200
  4. Subject: [PATCH] nfs_mount should support the -t/-F filesystem type options
  5.  
  6. nfs_mount.exe should support the Linux -t / SystemV/Solaris/Illumos -F
  7. filesystem type options.
  8.  
  9. Right now this is intended for compatibility with Solaris/Illumos
  10. $ mount -F nfs ... # or Linux $ mount -t nfs # options and as a
  11. placeholder to avoid admin confusion, but can later be used to
  12. enable/disable other things.
  13.  
  14. In the future nfs_mount.exe can then also be used as "mount helper",
  15. i.e. /sbin/mount -t foo calls /sbin/mount.foo to handle filesystems
  16. of type "foo" (in our case "nfs4").
  17.  
  18. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  19. ---
  20.  mount/mount.c | 31 +++++++++++++++++++++++++++++++
  21.  1 file changed, 31 insertions(+)
  22.  
  23. diff --git a/mount/mount.c b/mount/mount.c
  24. index 6d8c8ee..0e57e64 100644
  25. --- a/mount/mount.c
  26. +++ b/mount/mount.c
  27. @@ -57,6 +57,10 @@ static VOID PrintUsage(LPTSTR pProcess)
  28.          TEXT("\t-h\thelp\n")
  29.          TEXT("\t-d\tunmount\n")
  30.          TEXT("\t-f\tforce unmount if the drive is in use\n")
  31. +        TEXT("\t-F <type>\tFilesystem type to use (only 'nfs' supported)"
  32. +           " (Solaris/Illumos compat)\n")
  33. +        TEXT("\t-t <type>\tFilesystem type to use (only 'nfs' supported)"
  34. +           " (Linux compat)\n")
  35.          TEXT("\t-p\tmake the mount persist over reboots\n")
  36.          TEXT("\t-o <comma-separated mount options>\n")
  37.          TEXT("Mount options:\n")
  38. @@ -136,6 +140,33 @@ DWORD __cdecl _tmain(DWORD argc, LPTSTR argv[])
  39.                      goto out_free;
  40.                  }
  41.              }
  42. +           /*
  43. +            * Filesystem type, we use this for Solaris
  44. +            * $ mount(1M) -F nfs ... # and Linux
  45. +            * $ mount.nfs4 -t nfs ... # compatiblity
  46. +            */
  47. +            else if ((_tcscmp(argv[i], TEXT("-F")) == 0) ||
  48. +                    (_tcscmp(argv[i], TEXT("-t")) == 0))
  49. +            {
  50. +                ++i;
  51. +                if (i >= argc)
  52. +                {
  53. +                    result = ERROR_BAD_ARGUMENTS;
  54. +                    _ftprintf(stderr, TEXT("Filesystem type missing ")
  55. +                        TEXT("after '-t'/'-F'.\n\n"));
  56. +                    PrintUsage(argv[0]);
  57. +                    goto out_free;
  58. +                }
  59. +
  60. +                if (_tcscmp(argv[i], TEXT("nfs")) != 0)
  61. +                {
  62. +                    result = ERROR_BAD_ARGUMENTS;
  63. +                    _ftprintf(stderr, TEXT("Filesystem type '%s' ")
  64. +                        TEXT("not supported.\n\n"), argv[i]);
  65. +                    PrintUsage(argv[0]);
  66. +                    goto out_free;
  67. +                }
  68. +            }
  69.              else
  70.                  _ftprintf(stderr, TEXT("Unrecognized option ")
  71.                      TEXT("'%s', disregarding.\n"), argv[i]);
  72. --
  73. 2.39.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