From cc12f65ef0563b694b0c0b2968b052681dca6622 Mon Sep 17 00:00:00 2001 From: Hiten Pandya Date: Sat, 18 Oct 2003 20:12:26 +0000 Subject: [PATCH] Update sysinstall's NFS module: * Add ability to select NFSv3 version (default) * Add ability to use TCP as protocol. TCP is not made default to retain automatic compatiblity with a wider range of NFS servers. * Fix argument processing in mediaInitNFS(), variable_get() cannot be used in a conditional statement because it returns a "char *" string; instead, use variable_cmp(). * Update I/O block sizes in the case when NFS_SLOW is not set to "YES". Previously, the NFS_SLOW case had a bigger block size than the fast case which defaulted to 512b, whereas the former was 1024. The new block size used is 4096, which is reasonable for the lowest of connection mediums. Reviewed by: dillon, drhodus --- release/sysinstall/install.c | 4 +++- release/sysinstall/nfs.c | 12 ++++++++---- release/sysinstall/options.c | 6 +++++- release/sysinstall/sysinstall.h | 4 +++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c index 39e144152a..5972036c40 100644 --- a/release/sysinstall/install.c +++ b/release/sysinstall/install.c @@ -5,7 +5,7 @@ * generation being essentially a complete rewrite. * * $FreeBSD: src/release/sysinstall/install.c,v 1.268.2.42 2003/02/22 21:16:47 ceri Exp $ - * $DragonFly: src/release/sysinstall/Attic/install.c,v 1.3 2003/08/08 04:18:36 dillon Exp $ + * $DragonFly: src/release/sysinstall/Attic/install.c,v 1.4 2003/10/18 20:12:26 hmp Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -1140,6 +1140,8 @@ installVarDefaults(dialogMenuItem *self) variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/links", 0); variable_set2(VAR_FTP_STATE, "passive", 0); variable_set2(VAR_NFS_SECURE, "NO", -1); + variable_set2(VAR_NFS_TCP, "NO", -1); + variable_set2(VAR_NFS_V3, "YES", -1); if (OnVTY) variable_set2(VAR_FIXIT_TTY, "standard", 0); else diff --git a/release/sysinstall/nfs.c b/release/sysinstall/nfs.c index bdc429977e..d25de049fc 100644 --- a/release/sysinstall/nfs.c +++ b/release/sysinstall/nfs.c @@ -5,7 +5,7 @@ * generation being slated to essentially a complete rewrite. * * $FreeBSD: src/release/sysinstall/nfs.c,v 1.21.2.1 2001/07/22 13:50:20 dd Exp $ - * $DragonFly: src/release/sysinstall/Attic/nfs.c,v 1.2 2003/06/17 04:27:21 dillon Exp $ + * $DragonFly: src/release/sysinstall/Attic/nfs.c,v 1.3 2003/10/18 20:12:26 hmp Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -61,9 +61,13 @@ mediaInitNFS(Device *dev) return FALSE; msgNotify("Mounting %s over NFS on %s", dev->name, mountpoint); - if (vsystem("mount_nfs %s %s %s %s", - variable_get(VAR_SLOW_ETHER) ? "-r 1024 -w 1024" : "", - variable_get(VAR_NFS_SECURE) ? "-P" : "", dev->name, mountpoint)) { + if (vsystem("mount_nfs %s %s %s %s %s %s", + !variable_cmp(VAR_NFS_TCP, "YES") ? "-T" : "", + !variable_cmp(VAR_NFS_V3, "YES") ? "-3" : "", + !variable_cmp(VAR_SLOW_ETHER, "YES") ? + "-r 1024 -w 1024" : "-r 4096 -w 4096", + !variable_cmp(VAR_NFS_SECURE, "YES") ? "-P" : "", + dev->name, mountpoint)) { msgConfirm("Error mounting %s on %s: %s.", dev->name, mountpoint, strerror(errno)); if (netDevice) DEVICE_SHUTDOWN(netDevice); diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c index fa672d0ddd..1475dce56e 100644 --- a/release/sysinstall/options.c +++ b/release/sysinstall/options.c @@ -5,7 +5,7 @@ * generation being slated for what's essentially a complete rewrite. * * $FreeBSD: src/release/sysinstall/options.c,v 1.70.2.5 2001/09/27 07:38:49 murray Exp $ - * $DragonFly: src/release/sysinstall/Attic/options.c,v 1.2 2003/06/17 04:27:21 dillon Exp $ + * $DragonFly: src/release/sysinstall/Attic/options.c,v 1.3 2003/10/18 20:12:26 hmp Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -113,6 +113,10 @@ static Option Options[] = { OPT_IS_VAR, NULL, VAR_NFS_SECURE, varCheck }, { "NFS Slow", "User is using a slow PC or ethernet card", OPT_IS_VAR, NULL, VAR_SLOW_ETHER, varCheck }, +{ "NFS TCP", "Use TCP protocol for NFS", + OPT_IS_VAR, NULL, VAR_NFS_TCP, varCheck }, +{ "NFS version 3", "Use NFS version 3", + OPT_IS_VAR, NULL, VAR_NFS_V3, varCheck }, { "Debugging", "Emit extra debugging output on VTY2 (ALT-F2)", OPT_IS_VAR, NULL, VAR_DEBUG, varCheck }, { "No Warnings", "Don't Warn the user when a setting seems incorrect", diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 9966b0775f..3f8a599294 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -5,7 +5,7 @@ * generation being slated to essentially a complete rewrite. * * $FreeBSD: src/release/sysinstall/sysinstall.h,v 1.186.2.30 2002/07/03 00:05:05 jhb Exp $ - * $DragonFly: src/release/sysinstall/Attic/sysinstall.h,v 1.2 2003/06/17 04:27:21 dillon Exp $ + * $DragonFly: src/release/sysinstall/Attic/sysinstall.h,v 1.3 2003/10/18 20:12:26 hmp Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -148,6 +148,8 @@ #define VAR_NEWFS_ARGS "newfsArgs" #define VAR_NFS_PATH "nfs" #define VAR_NFS_HOST "nfsHost" +#define VAR_NFS_V3 "nfs_use_v3" +#define VAR_NFS_TCP "nfs_use_tcp" #define VAR_NFS_SECURE "nfs_reserved_port_only" #define VAR_NFS_SERVER "nfs_server_enable" #define VAR_NO_CONFIRM "noConfirm" -- 2.41.0