[PATCH RFC] Add a macro for null mount options to sbin/mount*

[ Available lists | Index of freebsd-arch | Month of Jun 2005 | Week of 1 Jun 2005 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Xin LI <delphij@frontfree.net>
Date
1 Jun 2005 08:11:20
Subject
[PATCH RFC] Add a macro for null mount options to sbin/mount*
Message-ID
1117613456.771.16.camel@spirit


[ Hide this part ]
Hi, -arch@,

In our mount* utilities, the null mount option, which is usually be used
as a terminator of an option vector, is defined with some hand-rolled
terms, e.g.: {NULL}, {NULL, 0, 0, 0}, etc.

I think it would be nice to have a new macro to deal with this, say,
MOPT_NULL, which would be extended to {NULL, 0, 0, 0}, which can act as
an explicit initialize. And in my opinion, something like:

%%%
opt = {
MOPT_STD,
MOPT_NULL
};
%%%

Looks better than:

%%%
opt = {
MOPT_STD,
{ NULL }
};
%%%

That has lead to the attached patchset. May I go ahead and commit it?

Thanks in advance!

Cheers,
--
Xin LI <delphij delphij net> http://www.delphij.net/


[ Hide this part ]
Index: mount/mntopts.h
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mntopts.h,v
retrieving revision 1.24
diff -u -r1.24 mntopts.h
--- mount/mntopts.h 30 Nov 2004 19:36:40 -0000 1.24
+++ mount/mntopts.h 25 May 2005 09:41:59 -0000
@@ -65,6 +65,9 @@
/* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */
#define MOPT_AUTO { "auto", 0, 0, 0 }

+/* A handy macro as terminator of MNT_ array */
+#define MOPT_NULL { NULL, 0, 0, 0 }
+
#define MOPT_FSTAB_COMPAT \
MOPT_RO, \
MOPT_RW, \
Index: mount/mount_ufs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount/mount_ufs.c,v
retrieving revision 1.24
diff -u -r1.24 mount_ufs.c
--- mount/mount_ufs.c 9 Apr 2004 19:58:31 -0000 1.24
+++ mount/mount_ufs.c 1 Jun 2005 07:56:00 -0000
@@ -64,7 +64,7 @@
MOPT_SYNC,
MOPT_UPDATE,
MOPT_SNAPSHOT,
- { NULL }
+ MOPT_NULL
};

int
Index: mount_cd9660/mount_cd9660.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_cd9660/mount_cd9660.c,v
retrieving revision 1.28
diff -u -r1.28 mount_cd9660.c
--- mount_cd9660/mount_cd9660.c 13 Nov 2004 17:26:54 -0000 1.28
+++ mount_cd9660/mount_cd9660.c 1 Jun 2005 07:57:38 -0000
@@ -77,7 +77,7 @@
{ "rrip", 1, ISOFSMNT_NORRIP, 1 },
{ "joliet", 1, ISOFSMNT_NOJOLIET, 1 },
{ "strictjoliet", 1, ISOFSMNT_BROKENJOLIET, 1 },
- { NULL }
+ MOPT_NULL
};

int get_ssector(const char *dev);
Index: mount_ext2fs/mount_ext2fs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_ext2fs/mount_ext2fs.c,v
retrieving revision 1.18
diff -u -r1.18 mount_ext2fs.c
--- mount_ext2fs/mount_ext2fs.c 9 Apr 2004 19:58:31 -0000 1.18
+++ mount_ext2fs/mount_ext2fs.c 1 Jun 2005 07:57:48 -0000
@@ -60,7 +60,7 @@
MOPT_FORCE,
MOPT_SYNC,
MOPT_UPDATE,
- { NULL }
+ MOPT_NULL
};

static void usage(void) __dead2;
Index: mount_hpfs/mount_hpfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_hpfs/mount_hpfs.c,v
retrieving revision 1.4
diff -u -r1.4 mount_hpfs.c
--- mount_hpfs/mount_hpfs.c 7 Aug 2003 04:50:29 -0000 1.4
+++ mount_hpfs/mount_hpfs.c 1 Jun 2005 07:57:56 -0000
@@ -50,7 +50,7 @@

static struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

static gid_t a_gid(char *);
Index: mount_msdosfs/mount_msdosfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_msdosfs/mount_msdosfs.c,v
retrieving revision 1.34
diff -u -r1.34 mount_msdosfs.c
--- mount_msdosfs/mount_msdosfs.c 31 Aug 2004 05:19:57 -0000 1.34
+++ mount_msdosfs/mount_msdosfs.c 1 Jun 2005 07:58:09 -0000
@@ -73,7 +73,7 @@
{ "shortnames", 0, MSDOSFSMNT_SHORTNAME, 1 },
{ "longnames", 0, MSDOSFSMNT_LONGNAME, 1 },
{ "nowin95", 0, MSDOSFSMNT_NOWIN95, 1 },
- { NULL }
+ MOPT_NULL
};

static gid_t a_gid(char *);
Index: mount_nfs/mount_nfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_nfs/mount_nfs.c,v
retrieving revision 1.63
diff -u -r1.63 mount_nfs.c
--- mount_nfs/mount_nfs.c 10 Feb 2005 09:19:31 -0000 1.63
+++ mount_nfs/mount_nfs.c 1 Jun 2005 07:58:22 -0000
@@ -121,7 +121,7 @@
{ "lockd", 1, ALTF_NOLOCKD, 1 },
{ "inet4", 1, ALTF_NOINET4, 1 },
{ "inet6", 1, ALTF_NOINET6, 1 },
- { NULL }
+ MOPT_NULL
};

struct nfs_args nfsdefargs = {
Index: mount_nfs4/mount_nfs4.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_nfs4/mount_nfs4.c,v
retrieving revision 1.5
diff -u -r1.5 mount_nfs4.c
--- mount_nfs4/mount_nfs4.c 10 Feb 2005 09:19:31 -0000 1.5
+++ mount_nfs4/mount_nfs4.c 1 Jun 2005 07:58:35 -0000
@@ -151,7 +151,7 @@
{ "lockd", 1, ALTF_NOLOCKD, 1 },
{ "inet4", 1, ALTF_NOINET4, 1 },
{ "inet6", 1, ALTF_NOINET6, 1 },
- { NULL }
+ MOPT_NULL
};

struct nfs_args nfsdefargs = {
Index: mount_ntfs/mount_ntfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_ntfs/mount_ntfs.c,v
retrieving revision 1.12
diff -u -r1.12 mount_ntfs.c
--- mount_ntfs/mount_ntfs.c 10 Feb 2005 09:19:31 -0000 1.12
+++ mount_ntfs/mount_ntfs.c 1 Jun 2005 07:58:49 -0000
@@ -58,7 +58,7 @@

static struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

static gid_t a_gid(char *);
Index: mount_nullfs/mount_nullfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_nullfs/mount_nullfs.c,v
retrieving revision 1.23
diff -u -r1.23 mount_nullfs.c
--- mount_nullfs/mount_nullfs.c 10 Feb 2005 09:19:31 -0000 1.23
+++ mount_nullfs/mount_nullfs.c 1 Jun 2005 07:58:58 -0000
@@ -59,7 +59,7 @@

struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

int subdir(const char *, const char *);
Index: mount_reiserfs/mount_reiserfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_reiserfs/mount_reiserfs.c,v
retrieving revision 1.1
diff -u -r1.1 mount_reiserfs.c
--- mount_reiserfs/mount_reiserfs.c 24 May 2005 12:34:45 -0000 1.1
+++ mount_reiserfs/mount_reiserfs.c 25 May 2005 09:40:41 -0000
@@ -41,7 +41,7 @@

struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

void usage(void);
Index: mount_std/mount_std.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_std/mount_std.c,v
retrieving revision 1.19
diff -u -r1.19 mount_std.c
--- mount_std/mount_std.c 9 Apr 2004 19:58:32 -0000 1.19
+++ mount_std/mount_std.c 1 Jun 2005 07:59:16 -0000
@@ -59,7 +59,7 @@

static struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

static char *fsname;
Index: mount_udf/mount_udf.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_udf/mount_udf.c,v
retrieving revision 1.11
diff -u -r1.11 mount_udf.c
--- mount_udf/mount_udf.c 9 Apr 2004 20:34:51 -0000 1.11
+++ mount_udf/mount_udf.c 1 Jun 2005 07:59:24 -0000
@@ -64,7 +64,7 @@
struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_UPDATE,
- { NULL, 0, 0, 0 }
+ MOPT_NULL
};

int set_charset(char **, char **, const char *);
Index: mount_ufs/mount_ufs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_ufs/mount_ufs.c,v
retrieving revision 1.2
diff -u -r1.2 mount_ufs.c
--- mount_ufs/mount_ufs.c 28 Mar 2005 22:21:45 -0000 1.2
+++ mount_ufs/mount_ufs.c 1 Jun 2005 07:59:32 -0000
@@ -61,7 +61,7 @@
MOPT_SYNC,
MOPT_UPDATE,
MOPT_SNAPSHOT,
- { NULL }
+ MOPT_NULL
};

void usage(void);
Index: mount_umapfs/mount_umapfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_umapfs/mount_umapfs.c,v
retrieving revision 1.23
diff -u -r1.23 mount_umapfs.c
--- mount_umapfs/mount_umapfs.c 10 Feb 2005 09:19:32 -0000 1.23
+++ mount_umapfs/mount_umapfs.c 1 Jun 2005 07:59:40 -0000
@@ -79,7 +79,7 @@

static struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

static void usage(void) __dead2;
Index: mount_unionfs/mount_unionfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mount_unionfs/mount_unionfs.c,v
retrieving revision 1.22
diff -u -r1.22 mount_unionfs.c
--- mount_unionfs/mount_unionfs.c 10 Feb 2005 09:19:32 -0000 1.22
+++ mount_unionfs/mount_unionfs.c 1 Jun 2005 07:59:49 -0000
@@ -60,7 +60,7 @@

static struct mntopt mopts[] = {
MOPT_STDOPTS,
- { NULL }
+ MOPT_NULL
};

static int subdir(const char *, const char *);

[ Show this part (application/pgp-signature) ]

Elapsed time: 0.077 seconds