[PATCH 1/3] nfsmount.conf: New variables that explicitly set default (Release 2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 7c9406cbfb7cf4d694890c6ddf7f4597b026cb7a
Author: Steve Dickson <steved@xxxxxxxxxx>
Date:   Mon Oct 12 16:48:21 2009 -0400

    Introducing the parsing of both 'defaultvers' and 'defaultproto'
    config variables which will be used to set the the default
    version and network protocol.
    
    A global variable is used to mark the fact these options
    are have be set.
    
    Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>

diff --git a/support/include/conffile.h b/support/include/conffile.h
index 672020a..da8e836 100644
--- a/support/include/conffile.h
+++ b/support/include/conffile.h
@@ -75,4 +75,12 @@ static inline void upper2lower(char *str)
 	while ((c = tolower(*str)))
 		*str++ = c;
 }
+
+/*
+ * Default Mount options
+ */
+#define DEFAULT_PROTO 0x1
+#define DEFAULT_VERS  0x2
+extern int config_default_opts;
+
 #endif				/* _CONFFILE_H_ */
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index d3285f8..ff1bb5f 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -197,6 +197,30 @@ int inline check_vers(char *mopt, char *field)
 	}
 	return 0;
 }
+
+/*
+ * See if there are any default values being set.
+ * If so mark the bit and turn the option into a 
+ * valid option.
+ */
+int config_default_opts;
+void inline set_default_bits(char *mopt)
+{
+	int dftlen = strlen("default");
+	char *field;
+
+	if (strncasecmp(mopt, "default", dftlen) != 0)
+		return;
+
+	field = mopt + dftlen;
+	if (strncasecmp(field, "proto", strlen("proto")) == 0) {
+		config_default_opts |= DEFAULT_PROTO;
+		strcpy(mopt, field);
+	} else if (strncasecmp(field, "vers", strlen("vers")) == 0) {
+			config_default_opts |= DEFAULT_VERS;
+			strcpy(mopt, field);
+	}
+}
 /*
  * Parse the given section of the configuration 
  * file to if there are any mount options set.
@@ -325,6 +349,7 @@ char *conf_get_mntopts(char *spec, char *mount_point,
 		strcat(config_opts, ",");
 	}
 	SLIST_FOREACH(entry, &head, entries) {
+		set_default_bits(entry->opt);
 		strcat(config_opts, entry->opt);
 		strcat(config_opts, ",");
 	}

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux