svn commit: r247856 - in head/sbin: mount_cd9660 mount_msdosfs mount_nfs mount_nullfs mount_reiserfs mount_std mount_udf mount_unionfs

Jung-uk Kim jkim at FreeBSD.org
Tue Mar 5 22:41:38 UTC 2013


Author: jkim
Date: Tue Mar  5 22:41:35 2013
New Revision: 247856
URL: http://svnweb.freebsd.org/changeset/base/247856

Log:
  GC unused variables.  Prefer NULL over 0 for pointers.

Modified:
  head/sbin/mount_cd9660/mount_cd9660.c
  head/sbin/mount_msdosfs/mount_msdosfs.c
  head/sbin/mount_nfs/mount_nfs.c
  head/sbin/mount_nullfs/mount_nullfs.c
  head/sbin/mount_reiserfs/mount_reiserfs.c
  head/sbin/mount_std/mount_std.c
  head/sbin/mount_udf/mount_udf.c
  head/sbin/mount_unionfs/mount_unionfs.c

Modified: head/sbin/mount_cd9660/mount_cd9660.c
==============================================================================
--- head/sbin/mount_cd9660/mount_cd9660.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_cd9660/mount_cd9660.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -83,7 +83,7 @@ main(int argc, char **argv)
 {
 	struct iovec *iov;
 	int iovlen;
-	int ch, mntflags, opts;
+	int ch, mntflags;
 	char *dev, *dir, *p, *val, mntpath[MAXPATHLEN];
 	int verbose;
 	int ssector;		/* starting sector, 0 for 1st session */
@@ -91,7 +91,7 @@ main(int argc, char **argv)
 
 	iov = NULL;
 	iovlen = 0;
-	mntflags = opts = verbose = 0;
+	mntflags = verbose = 0;
 	ssector = -1;
 
 	while ((ch = getopt(argc, argv, "begjo:rs:vC:")) != -1)
@@ -109,7 +109,7 @@ main(int argc, char **argv)
 			build_iovec(&iov, &iovlen, "nojoliet", NULL, (size_t)-1);
 			break;
 		case 'o':
-			getmntopts(optarg, mopts, &mntflags, &opts);
+			getmntopts(optarg, mopts, &mntflags, NULL);
 			p = strchr(optarg, '=');
 			val = NULL;
 			if (p != NULL) {

Modified: head/sbin/mount_msdosfs/mount_msdosfs.c
==============================================================================
--- head/sbin/mount_msdosfs/mount_msdosfs.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_msdosfs/mount_msdosfs.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -69,7 +69,7 @@ main(int argc, char **argv)
 	struct iovec *iov = NULL;
 	int iovlen = 0;
 	struct stat sb;
-	int c, mntflags, set_gid, set_uid, set_mask, set_dirmask;
+	int c, set_gid, set_uid, set_mask, set_dirmask;
 	char *dev, *dir, mntpath[MAXPATHLEN], *csp;
 	char fstype[] = "msdosfs";
 	char errmsg[255] = {0};
@@ -78,9 +78,8 @@ main(int argc, char **argv)
 	mode_t mask = 0, dirmask = 0;
 	uid_t uid = 0;
 	gid_t gid = 0;
-	getmnt_silent = 1;
 
-	mntflags = set_gid = set_uid = set_mask = set_dirmask = 0;
+	set_gid = set_uid = set_mask = set_dirmask = 0;
 
 	while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:D:W:")) != -1) {
 		switch (c) {
@@ -219,7 +218,7 @@ main(int argc, char **argv)
 	build_iovec_argf(&iov, &iovlen, "mask", "%u", mask);
 	build_iovec_argf(&iov, &iovlen, "dirmask", "%u", dirmask);
 
-	if (nmount(iov, iovlen, mntflags) < 0) {
+	if (nmount(iov, iovlen, 0) < 0) {
 		if (errmsg[0])
 			err(1, "%s: %s", dev, errmsg);
 		else

Modified: head/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_nfs/mount_nfs.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -130,7 +130,7 @@ enum tryret {
 	TRYRET_LOCALERR		/* Local failure. */
 };
 
-static int	fallback_mount(struct iovec *iov, int iovlen, int mntflags);
+static int	fallback_mount(struct iovec *iov, int iovlen);
 static int	sec_name_to_num(char *sec);
 static char	*sec_num_to_name(int num);
 static int	getnfsargs(char *, struct iovec **iov, int *iovlen);
@@ -149,13 +149,12 @@ main(int argc, char *argv[])
 {
 	int c;
 	struct iovec *iov;
-	int mntflags, num, iovlen;
+	int num, iovlen;
 	int osversion;
 	char *name, *p, *spec, *fstype;
 	char mntpath[MAXPATHLEN], errmsg[255];
 	char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50];
 
-	mntflags = 0;
 	iov = NULL;
 	iovlen = 0;
 	memset(errmsg, 0, sizeof(errmsg));
@@ -427,10 +426,10 @@ main(int argc, char *argv[])
 	 */
 	osversion = getosreldate();
 	if (osversion >= 702100) {
-		if (nmount(iov, iovlen, mntflags))
+		if (nmount(iov, iovlen, 0))
 			err(1, "%s, %s", mntpath, errmsg);
 	} else {
-		if (fallback_mount(iov, iovlen, mntflags))
+		if (fallback_mount(iov, iovlen))
 			err(1, "%s, %s", mntpath, errmsg);
 	}
 
@@ -473,7 +472,7 @@ copyopt(struct iovec **newiov, int *newi
  *      parameters.  It should be eventually be removed.
  */
 static int
-fallback_mount(struct iovec *iov, int iovlen, int mntflags)
+fallback_mount(struct iovec *iov, int iovlen)
 {
 	struct nfs_args args = {
 	    .version = NFS_ARGSVERSION,
@@ -663,7 +662,7 @@ fallback_mount(struct iovec *iov, int io
 	copyopt(&newiov, &newiovlen, iov, iovlen, "fspath");
 	copyopt(&newiov, &newiovlen, iov, iovlen, "errmsg");
 
-	return nmount(newiov, newiovlen, mntflags);
+	return nmount(newiov, newiovlen, 0);
 }
 
 static int

Modified: head/sbin/mount_nullfs/mount_nullfs.c
==============================================================================
--- head/sbin/mount_nullfs/mount_nullfs.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_nullfs/mount_nullfs.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -68,12 +68,11 @@ main(int argc, char *argv[])
 	char source[MAXPATHLEN];
 	char target[MAXPATHLEN];
 	char errmsg[255];
-	int ch, mntflags, iovlen;
+	int ch, iovlen;
 	char nullfs[] = "nullfs";
 
 	iov = NULL;
 	iovlen = 0;
-	mntflags = 0;
 	errmsg[0] = '\0';
 	while ((ch = getopt(argc, argv, "o:")) != -1)
 		switch(ch) {
@@ -111,7 +110,7 @@ main(int argc, char *argv[])
 	build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
 	build_iovec(&iov, &iovlen, "target", target, (size_t)-1);
 	build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
-	if (nmount(iov, iovlen, mntflags) < 0) {
+	if (nmount(iov, iovlen, 0) < 0) {
 		if (errmsg[0] != 0)
 			err(1, "%s: %s", source, errmsg);
 		else

Modified: head/sbin/mount_reiserfs/mount_reiserfs.c
==============================================================================
--- head/sbin/mount_reiserfs/mount_reiserfs.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_reiserfs/mount_reiserfs.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
 	while ((ch = getopt(argc, argv, "o:")) != -1) {
 		switch(ch) {
 		case 'o':
-			getmntopts(optarg, mopts, &mntflags, 0);
+			getmntopts(optarg, mopts, &mntflags, NULL);
 			break;
 		case '?':
 		default:

Modified: head/sbin/mount_std/mount_std.c
==============================================================================
--- head/sbin/mount_std/mount_std.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_std/mount_std.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
 	while ((ch = getopt(argc, argv, "o:")) != -1)
 		switch (ch) {
 		case 'o':
-			getmntopts(optarg, mopts, &mntflags, 0);
+			getmntopts(optarg, mopts, &mntflags, NULL);
 			break;
 		case '?':
 		default:

Modified: head/sbin/mount_udf/mount_udf.c
==============================================================================
--- head/sbin/mount_udf/mount_udf.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_udf/mount_udf.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -74,17 +74,17 @@ int
 main(int argc, char **argv)
 {
 	struct iovec iov[12];
-	int ch, i, mntflags, opts, udf_flags;
+	int ch, i, mntflags, udf_flags;
 	char *dev, *dir, mntpath[MAXPATHLEN];
 	char *cs_disk, *cs_local;
 	int verbose;
 
-	i = mntflags = opts = udf_flags = verbose = 0;
+	i = mntflags = udf_flags = verbose = 0;
 	cs_disk = cs_local = NULL;
 	while ((ch = getopt(argc, argv, "o:vC:")) != -1)
 		switch (ch) {
 		case 'o':
-			getmntopts(optarg, mopts, &mntflags, &opts);
+			getmntopts(optarg, mopts, &mntflags, NULL);
 			break;
 		case 'v':
 			verbose++;

Modified: head/sbin/mount_unionfs/mount_unionfs.c
==============================================================================
--- head/sbin/mount_unionfs/mount_unionfs.c	Tue Mar  5 20:00:11 2013	(r247855)
+++ head/sbin/mount_unionfs/mount_unionfs.c	Tue Mar  5 22:41:35 2013	(r247856)
@@ -129,7 +129,7 @@ int 
 main(int argc, char *argv[])
 {
 	struct iovec	*iov;
-	int ch, mntflags, iovlen;
+	int ch, iovlen;
 	char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255];
 	char uid_str[20], gid_str[20];
 	char fstype[] = "unionfs";
@@ -137,7 +137,6 @@ main(int argc, char *argv[])
 
 	iov = NULL;
 	iovlen = 0;
-	mntflags = 0;
 	memset(errmsg, 0, sizeof(errmsg));
 
 	while ((ch = getopt(argc, argv, "bo:")) != -1) {
@@ -190,7 +189,7 @@ main(int argc, char *argv[])
 	build_iovec(&iov, &iovlen, "from", target, (size_t)-1);
 	build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
 
-	if (nmount(iov, iovlen, mntflags))
+	if (nmount(iov, iovlen, 0))
 		err(EX_OSERR, "%s: %s", source, errmsg);
 	exit(0);
 }


More information about the svn-src-all mailing list