diff options
author | Michael Kelly <mike@weatherwax.co.uk> | 2025-07-14 18:11:53 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-07-14 18:11:53 +0200 |
commit | e2aa476b7ec3a680b5cc4e3c461cce7ec4f69cd6 (patch) | |
tree | 5fb86e7483167503549e42d2e0eca647f5d12731 | |
parent | 731cb45706623016e1871d1a05ea4a5571fc5760 (diff) |
nfs: Implement --nfs-program command line option to enable v3 functionality
Note that I have altered the specification of the argument value so that the
version can be specified without the program number rather than the other way
around. I think it is much more likely the version would be specified than the
program number.
-rw-r--r-- | nfs/main.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -197,7 +197,7 @@ static const struct argp_option startup_options[] = { "Port for nfs operations"}, {"default-nfs-port", OPT_NFS_PORT_D,"PORT", 0, "Port for nfs operations, if none can be found automatically"}, - {"nfs-program", OPT_NFS_PROG, "ID[.VERS]"}, + {"nfs-program", OPT_NFS_PROG, "[ID.]VERS"}, {"pmap-port", OPT_PMAP_PORT, "SVC|PORT"}, @@ -338,6 +338,30 @@ parse_startup_opt (int key, char *arg, struct argp_state *state) nfs_port = atoi (arg); break; + case OPT_NFS_PROG: + { + const char* version = strrchr (arg, '.'); + const char* program = NULL; + + if (version != NULL) + { + program = arg; + version++; + } + else + version = arg; + + nfs_version = atoi (version); + if (program) + nfs_program = atoi (program); + + if (nfs_version < 2 || nfs_version > 3) + argp_error (state, "Invalid NFS version: %d", nfs_version); + + protocol_version = nfs_version; + } + break; + case ARGP_KEY_ARG: if (state->arg_num == 0) remote_fs = arg; |