text-based mount.nfs: parse option strings into lists
Subsystems (2)
PATCH 1/7 text-based mount.nfs: parse option strings into lists
Adapt a parsing trick used by Python.
The strategy is to parse mount option strings into an abstract data type so we don't have to copy and/or tokenize the whole option string multiple times while trying to manipulate the mount options. Then, just before calling the mount(2) system call, convert the object back into a C string.
This initial patch adds methods for creating and manipulating mount option data objects.
One major advantage of this approach is that we can copy the final version of the mount options into /etc/mtab when we're done, instead of copying in the original mount options that the user specified. Any fallback from NFS v3 to NFS v2 or TCP to UDP that was done by mount.nfs will be reflected in /etc/mtab.
---
utils/mount/Makefile.am | 4 utils/mount/parse_opt.c | 430 +++++++++++++++++++++++++++++++++++++++++++++++ utils/mount/parse_opt.h | 46 +++++ 3 files changed, 478 insertions(+), 2 deletions(-)
utils/mount/Makefile.am +2 -2
@@ -9,11 +9,11 @@ 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 \ +mount_nfs_SOURCES = mount.c error.c network.c fstab.c parse_opt.c \ nfsmount.c nfs4mount.c stropts.c\ nfsumount.c \ mount_constants.h error.h network.h fstab.h \ - nfs4_mount.h nfs_mount4.h stropts.h + nfs4_mount.h nfs_mount4.h stropts.h parse_opt.h mount_nfs_LDADD = ../../support/nfs/libnfs.a \ ../../support/export/libexport.a
utils/mount/parse_opt.c new file +430 -0
430 lines not on this page · raw message
utils/mount/parse_opt.h new file +46 -0
46 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs