From e2aa476b7ec3a680b5cc4e3c461cce7ec4f69cd6 Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Mon, 14 Jul 2025 18:11:53 +0200 Subject: 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. --- nfs/main.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'nfs/main.c') diff --git a/nfs/main.c b/nfs/main.c index 17ba51d5..691d707d 100644 --- a/nfs/main.c +++ b/nfs/main.c @@ -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; -- cgit v1.2.3