summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-10-06 11:18:34 +0000
committerpjd <pjd@FreeBSD.org>2005-10-06 11:18:34 +0000
commita73b4cad051586c05530418c22023697d27e96f3 (patch)
treeb8d84aad719388f7c5aafad10a9545fcb9642f1f /sys/nfsclient
parent59920608e1c3ce13948e58e7b07557e629c46224 (diff)
downloadFreeBSD-src-a73b4cad051586c05530418c22023697d27e96f3.zip
FreeBSD-src-a73b4cad051586c05530418c22023697d27e96f3.tar.gz
Add boot.nfsroot.options loader tunable.
It allows to specify options for NFS root file system. Currently supported options are: soft, intr, conn, lockd. I'm adding this functionality mostly for 'lockd' option, which is only honored when performing the initial mount and will be silently ignored if used while updating the mount options. This will allow to use flock(2) without the need of using varmfs or rpc.lockd and friends. Example of use: boot.nfsroot.options="intr,lockd" MFC after: 2 weeks
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_diskless.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_diskless.c b/sys/nfsclient/nfs_diskless.c
index 9f17cd9..56a5a2f 100644
--- a/sys/nfsclient/nfs_diskless.c
+++ b/sys/nfsclient/nfs_diskless.c
@@ -60,6 +60,31 @@ static int inaddr_to_sockaddr(char *ev, struct sockaddr_in *sa);
static int hwaddr_to_sockaddr(char *ev, struct sockaddr_dl *sa);
static int decode_nfshandle(char *ev, u_char *fh);
+static void
+nfs_parse_options(const char *envopts, struct nfs_diskless *nd)
+{
+ char *opts, *o;
+
+ opts = strdup(envopts, M_TEMP);
+ if (opts == NULL) {
+ printf("nfs_diskless: cannot allocate memory for options\n");
+ return;
+ }
+ for (o = strtok(opts, ":;, "); o != NULL; o = strtok(NULL, ":;, ")) {
+ if (strcmp(o, "soft") == 0)
+ nd->root_args.flags |= NFSMNT_SOFT;
+ else if (strcmp(o, "intr") == 0)
+ nd->root_args.flags |= NFSMNT_INT;
+ else if (strcmp(o, "conn") == 0)
+ nd->root_args.flags |= NFSMNT_NOCONN;
+ else if (strcmp(o, "lockd") == 0)
+ nd->root_args.flags |= NFSMNT_NOLOCKD;
+ else
+ printf("nfs_diskless: unknown option: %s\n", o);
+ }
+ free(opts, M_TEMP);
+}
+
/*
* Populate the essential fields in the nfsv3_diskless structure.
*
@@ -73,6 +98,7 @@ static int decode_nfshandle(char *ev, u_char *fh);
* boot.nfsroot.server IP address of root filesystem server
* boot.nfsroot.path path of the root filesystem on server
* boot.nfsroot.nfshandle NFS handle for root filesystem on server
+ * boot.nfsroot.options NFS options for the root filesystem
*/
void
nfs_setup_diskless(void)
@@ -148,6 +174,10 @@ match_done:
strncpy(nd->root_hostnam, cp, MNAMELEN - 1);
freeenv(cp);
}
+ if ((cp = getenv("boot.nfsroot.options")) != NULL) {
+ nfs_parse_options(cp, nd);
+ freeenv(cp);
+ }
nfs_diskless_valid = 1;
}
OpenPOWER on IntegriCloud