mount.nfs: Add new files for supporting string-ified mount options
Subsystems (2)
PATCH 4/5 mount.nfs: Add new files for supporting string-ified mount options
Introduce support files which contain code that builds string mount options and passes them to the kernel. This is a pre-requisite for actually enabling /sbin/mount.nfs to do text-based mounts.
This is only partially complete at the moment, but is presented so that folks can start banging on the kernel mount option string parsing code. There are clearly still parts that are not implemented quite yet, such as bg and retry support, but it should be enough to get going.
---
utils/mount/Makefile.am | 4 - utils/mount/stropts.c | 326 +++++++++++++++++++++++++++++++++++++++++++++++ utils/mount/stropts.h | 25 ++++ 3 files changed, 353 insertions(+), 2 deletions(-)
utils/mount/Makefile.am +2 -2
@@ -10,10 +10,10 @@ man5_MANS = nfs.man sbin_PROGRAMS = mount.nfs EXTRA_DIST = nfsmount.x $(man8_MANS) $(man5_MANS) mount_nfs_SOURCES = mount.c error.c network.c fstab.c \ - nfsmount.c nfs4mount.c \ + nfsmount.c nfs4mount.c stropts.c\ nfsumount.c \ mount_constants.h error.h network.h fstab.h \ - nfs4_mount.h nfs_mount4.h + nfs4_mount.h nfs_mount4.h stropts.h mount_nfs_LDADD = ../../support/nfs/libnfs.a \ ../../support/export/libexport.a
utils/mount/stropts.c new file +326 -0
326 lines not on this page · raw message
utils/mount/stropts.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* stropts.h -- Provide common network functions for NFS mount/umount +* +* Copyright (C) 2007 Oracle. All rights reserved. +* Copyright (C) 2007 Chuck Lever <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public +* License along with this program; if not, write to the +* Free Software Foundation, Inc., 59 Temple Place - Suite 330, +* Boston, MA 021110-1307, USA. +* +*/ + +int nfsmount_s (const char *,const char *,int ,char **,int ,int ); +int nfs4mount_s (const char *,const char *,int ,char **,int ,int );
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 12 lines · On Thursday August 9, [email protected] wrote:
Introduce support files which contain code that builds string mount options and passes them to the kernel. This is a pre-requisite for actually enabling
/sbin/mount.nfsto do text-based mounts.This is only partially complete at the moment, but is presented so that folks can start banging on the kernel mount option string parsing code. There are clearly still parts that are not implemented quite yet, such as bg and retry support, but it should be enough to get going.
Signed-off-by Chuck Lever <[email protected]>---
Review
Quoted 2 lines
(quoted diff) +2
-0+ +static int retry_opt = 10000; /* 10,000 minutes ~= 1 week */
Why one week? Why no "MAX_INT"? retry_opt is never actually used, so I cannot guess.
Neither is bg_opt, but you did say it was incomplete.
Quoted 1 line
+static int
bg_opt= 0;
...
utils/mount/stropts.c line 140
Quoted 11 lines
utils/mount/stropts.c new file +11
-0+ +/* +* Walk through our mount options string, and indicate the presence +* of 'bg', 'retry=', and 'clientaddr='. +*/ +static void extract_interesting_options (char *opts) +{ +char *opt, *opteq; +int val; + +for (opt =strtok (opts,"," ); opt; opt =strtok (NULL ,"," )) {
Do you really want to use 'strtok'? It modifies the 'opts' argument, so where you go to use it later, you cannot be sure that it is still the same (all the ','s will be turned to nuls).
I'm surprised that this works at all... I'd better go test it....
OK, it doesn't work.
I run
mount.nfs host:/path /mnt -i -v -o bg,ro,something=whatever
and it says:
mount.nfs: using C string mount system call interface mount.nfs: option string is 'bg,addr=192.168.1.10' mount.nfs: Invalid argument
so the 'ro' and the 'something=whatever' don't make it to the kernel.
I'm happy to take the patch before it is complete, but I think at least this bit needs to work as expected before it goes into nfs-utils....
Thanks,
NeilBrown
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 10 lines · Neil Brown
Quoted 9 lines · On Thursday August 9, [email protected] wrote:
Introduce support files which contain code that builds string mount options and passes them to the kernel. This is a pre-requisite for actually enabling
/sbin/mount.nfsto do text-based mounts.This is only partially complete at the moment, but is presented so that folks can start banging on the kernel mount option string parsing code. There are clearly still parts that are not implemented quite yet, such as bg and retry support, but it should be enough to get going.
Quoted 8 lines
Review
Quoted 5 lines
Signed-off-by Chuck Lever <[email protected]>---
(quoted diff) +2
-0+ +static int retry_opt = 10000; /* 10,000 minutes ~= 1 week */Why one week? Why not "
MAX_INT"?retry_optis never actually used, so I cannot guess.
retry=10000 is the default setting. According to the nfs(5) man page, this is about 1 week.
The plan is to extract the retry setting from the mount options string if it exists, and use the default value of 10000 if it does not.
begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs