rpms/autofs/devel autofs-5.0.1-bad-cast.patch, NONE, 1.1 autofs-5.0.1-drop-default-prefix-from-config.patch, NONE, 1.1 autofs-5.0.1-random-selection.patch, NONE, 1.1 autofs.spec, 1.194, 1.195
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Mar 16 07:26:22 UTC 2007
Author: ikent
Update of /cvs/dist/rpms/autofs/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv507
Modified Files:
autofs.spec
Added Files:
autofs-5.0.1-bad-cast.patch
autofs-5.0.1-drop-default-prefix-from-config.patch
autofs-5.0.1-random-selection.patch
Log Message:
* Fri Mar 16 2007 Ian Kent <ikent at redhat.com> - 5.0.1-5
- drop "DEFAULT_" prefix from configuration names.
- add option to select replicated server at random (instead of ping response time) (bz 227604).
- fix incorrect cast in directory cleanup routines (bz 231864).
autofs-5.0.1-bad-cast.patch:
automount.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE autofs-5.0.1-bad-cast.patch ---
diff --git a/daemon/automount.c b/daemon/automount.c
index 938ee1b..37e040b 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -276,7 +276,7 @@ static int walk_tree(const char *base, int (*fn) (const char *file,
static int rm_unwanted_fn(const char *file, const struct stat *st, int when, void *arg)
{
- dev_t dev = *(int *) arg;
+ dev_t dev = *(dev_t *) arg;
char buf[MAX_ERR_BUF];
struct stat newst;
autofs-5.0.1-drop-default-prefix-from-config.patch:
README.v5.release | 3 -
gentoo/net-fs/autofs/files/autofs.conf | 52 ++++++++++----------
lib/defaults.c | 85 +++++++++++++++++++++------------
man/auto.master.5.in | 24 ++++-----
redhat/autofs.sysconfig.in | 50 +++++++++----------
samples/autofs.conf.default.in | 50 +++++++++----------
6 files changed, 145 insertions(+), 119 deletions(-)
--- NEW FILE autofs-5.0.1-drop-default-prefix-from-config.patch ---
diff --git a/README.v5.release b/README.v5.release
index 3f23b91..3b4e02b 100644
--- a/README.v5.release
+++ b/README.v5.release
@@ -13,8 +13,7 @@ Differences between version 4 and version 5.
installed "/etc/auto.master" to ensure that those using NIS will
still find their master map. This is in line with other industry
automount implementations. The name of the default master map can
- be overridden by setting the DEFAULT_MASTER_MAP_NAME configuration
- variable.
+ be overridden by setting the MASTER_MAP_NAME configuration variable.
- The `automount' daemon is now a multi-threaded application and so
appears as a single process (unless a thread process display option
diff --git a/gentoo/net-fs/autofs/files/autofs.conf b/gentoo/net-fs/autofs/files/autofs.conf
index 836a4a1..7b34c20 100644
--- a/gentoo/net-fs/autofs/files/autofs.conf
+++ b/gentoo/net-fs/autofs/files/autofs.conf
@@ -1,50 +1,50 @@
#
# Define default options for autofs.
#
-# DEFAULT_MASTER_MAP_NAME - default map name for the master map.
+# MASTER_MAP_NAME - default map name for the master map.
#
-#DEFAULT_MASTER_MAP_NAME="/etc/auto.master"
+#MASTER_MAP_NAME="/etc/auto.master"
#
-# DEFAULT_TIMEOUT - set the default mount timeout (default 600).
+# TIMEOUT - set the default mount timeout (default 600).
#
-DEFAULT_TIMEOUT=300
+TIMEOUT=300
#
-# DEFAULT_BROWSE_MODE - maps are browsable by default.
+# BROWSE_MODE - maps are browsable by default.
#
-DEFAULT_BROWSE_MODE="no"
+BROWSE_MODE="no"
#
-# DEFAULT_LOGGING - set default log level "none", "verbode" or "debug"
+# LOGGING - set default log level "none", "verbode" or "debug"
#
-#DEFAULT_LOGGING="none"
+#LOGGING="none"
#
# Define the default LDAP schema to use for lookups
#
# System default
#
-#DEFAULT_MAP_OBJECT_CLASS="nisMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"
-#DEFAULT_MAP_ATTRIBUTE="nisMapName"
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
-#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"
+#MAP_OBJECT_CLASS="nisMap"
+#ENTRY_OBJECT_CLASS="nisObject"
+#MAP_ATTRIBUTE="nisMapName"
+#ENTRY_ATTRIBUTE="cn"
+#VALUE_ATTRIBUTE="nisMapEntry"
#
# Other common LDAP nameing
#
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
-#DEFAULT_MAP_ATTRIBUTE="ou"
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
+#MAP_OBJECT_CLASS="automountMap"
+#ENTRY_OBJECT_CLASS="automount"
+#MAP_ATTRIBUTE="ou"
+#ENTRY_ATTRIBUTE="cn"
+#VALUE_ATTRIBUTE="automountInformation"
#
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
-#DEFAULT_MAP_ATTRIBUTE="automountMapName"
-#DEFAULT_ENTRY_ATTRIBUTE="automountKey"
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
+#MAP_OBJECT_CLASS="automountMap"
+#ENTRY_OBJECT_CLASS="automount"
+#MAP_ATTRIBUTE="automountMapName"
+#ENTRY_ATTRIBUTE="automountKey"
+#VALUE_ATTRIBUTE="automountInformation"
#
-# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL
-# authentication configuration file.
+# AUTH_CONF_FILE - set the default location for the SASL
+# authentication configuration file.
#
-#DEFAULT_AUTH_CONF_FILE="/etc/autofs/autofs-auth.conf"
+#AUTH_CONF_FILE="/etc/autofs/autofs-auth.conf"
#
# General global options
#
diff --git a/lib/defaults.c b/lib/defaults.c
index 65dbd8d..f76478e 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -23,21 +23,21 @@
#define DEFAULTS_CONFIG_FILE AUTOFS_CONF_DIR "/autofs"
#define MAX_LINE_LEN 256
-#define ENV_NAME_MASTER_MAP "DEFAULT_MASTER_MAP_NAME"
+#define ENV_NAME_MASTER_MAP "MASTER_MAP_NAME"
-#define ENV_NAME_TIMEOUT "DEFAULT_TIMEOUT"
-#define ENV_NAME_BROWSE_MODE "DEFAULT_BROWSE_MODE"
-#define ENV_NAME_LOGGING "DEFAULT_LOGGING"
+#define ENV_NAME_TIMEOUT "TIMEOUT"
+#define ENV_NAME_BROWSE_MODE "BROWSE_MODE"
+#define ENV_NAME_LOGGING "LOGGING"
-#define ENV_LDAP_SERVER "DEFAULT_LDAP_SERVER"
+#define ENV_LDAP_SERVER "LDAP_SERVER"
-#define ENV_NAME_MAP_OBJ_CLASS "DEFAULT_MAP_OBJECT_CLASS"
-#define ENV_NAME_ENTRY_OBJ_CLASS "DEFAULT_ENTRY_OBJECT_CLASS"
-#define ENV_NAME_MAP_ATTR "DEFAULT_MAP_ATTRIBUTE"
-#define ENV_NAME_ENTRY_ATTR "DEFAULT_ENTRY_ATTRIBUTE"
-#define ENV_NAME_VALUE_ATTR "DEFAULT_VALUE_ATTRIBUTE"
+#define ENV_NAME_MAP_OBJ_CLASS "MAP_OBJECT_CLASS"
+#define ENV_NAME_ENTRY_OBJ_CLASS "ENTRY_OBJECT_CLASS"
+#define ENV_NAME_MAP_ATTR "MAP_ATTRIBUTE"
+#define ENV_NAME_ENTRY_ATTR "ENTRY_ATTRIBUTE"
+#define ENV_NAME_VALUE_ATTR "VALUE_ATTRIBUTE"
-#define ENV_AUTH_CONF_FILE "DEFAULT_AUTH_CONF_FILE"
+#define ENV_AUTH_CONF_FILE "AUTH_CONF_FILE"
static const char *default_master_map_name = DEFAULT_MASTER_MAP_NAME;
@@ -104,6 +104,39 @@ static int get_env_yesno(const char *name)
}
/*
+ * We've changed the key names so we need to check for the
+ * config key and it's old name for backward conpatibility.
+*/
+static int check_set_config_value(const char *res, const char *name, const char *value)
+{
+ char *old_name;
+ int ret;
+
+ if (!strcasecmp(res, name)) {
+ ret = setenv(name, value, 0);
+ if (ret)
+ fprintf(stderr,
+ "can't set config value for %s, "
+ "error %d", name, ret);
+ return 1;
+ }
+
+ old_name = alloca(strlen(name) + 9);
+ strcpy(old_name, "DEFAULT_");
+ strcat(old_name, name);
+
+ if (!strcasecmp(res, old_name)) {
+ ret = setenv(name, value, 0);
+ if (ret)
+ fprintf(stderr,
+ "can't set config value for %s, "
+ "error %d", name, ret);
+ return 1;
+ }
+ return 0;
+}
+
+/*
* Read config env variables and check they have been set.
*
* This simple minded routine assumes the config file
@@ -115,7 +148,6 @@ unsigned int defaults_read_config(void)
FILE *f;
char buf[MAX_LINE_LEN];
char *res, *value;
- unsigned int ret;
f = fopen(DEFAULTS_CONFIG_FILE, "r");
if (!f)
@@ -158,23 +190,18 @@ unsigned int defaults_read_config(void)
while (*trailer && (*trailer == '"' || isblank(*trailer)))
*(trailer--) = '\0';;
- if (!strcasecmp(res, ENV_NAME_MASTER_MAP) ||
- !strcasecmp(res, ENV_NAME_TIMEOUT) ||
- !strcasecmp(res, ENV_NAME_BROWSE_MODE) ||
- !strcasecmp(res, ENV_NAME_LOGGING) ||
- !strcasecmp(res, ENV_LDAP_SERVER) ||
- !strcasecmp(res, ENV_NAME_MAP_OBJ_CLASS) ||
- !strcasecmp(res, ENV_NAME_ENTRY_OBJ_CLASS) ||
- !strcasecmp(res, ENV_NAME_MAP_ATTR) ||
- !strcasecmp(res, ENV_NAME_ENTRY_ATTR) ||
- !strcasecmp(res, ENV_NAME_VALUE_ATTR) ||
- !strcasecmp(res, ENV_AUTH_CONF_FILE)) {
- ret = setenv(res, value, 0);
- if (ret)
- fprintf(stderr,
- "can't set config value for %s, "
- "error %d", res, ret);
- }
+ if (check_set_config_value(res, ENV_NAME_MASTER_MAP, value) ||
+ check_set_config_value(res, ENV_NAME_TIMEOUT, value) ||
+ check_set_config_value(res, ENV_NAME_BROWSE_MODE, value) ||
+ check_set_config_value(res, ENV_NAME_LOGGING, value) ||
+ check_set_config_value(res, ENV_LDAP_SERVER, value) ||
+ check_set_config_value(res, ENV_NAME_MAP_OBJ_CLASS, value) ||
+ check_set_config_value(res, ENV_NAME_ENTRY_OBJ_CLASS, value) ||
+ check_set_config_value(res, ENV_NAME_MAP_ATTR, value) ||
+ check_set_config_value(res, ENV_NAME_ENTRY_ATTR, value) ||
+ check_set_config_value(res, ENV_NAME_VALUE_ATTR, value) ||
+ check_set_config_value(res, ENV_AUTH_CONF_FILE, value))
+ ;
}
if (!feof(f)) {
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index cb3c1d6..cfeefe7 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -25,7 +25,7 @@ The default location of the master map is
but an alternate name may be given on the command line when running
the automounter and the default master map may changed by setting the
.nh
-.B "DEFAULT_MASTER_MAP_NAME"
+.B "MASTER_MAP_NAME"
.hy
configuration variable in
.nh
@@ -144,13 +144,13 @@ configuration file
.hy
They are:
.TP
-.B DEFAULT_TIMEOUT
+.B TIMEOUT
sets the default mount timeout (program default 600).
.TP
-.B DEFAULT_BROWSE_MODE
+.B BROWSE_MODE
Maps are browsable by default (program default "yes").
.TP
-.B DEFAULT_LOGGING
+.B LOGGING
set default log level "none", "verbose" or "debug" (program default "none").
=======
.SH GENERAL SYSTEM DEFAULTS CONFIGURATION
@@ -163,13 +163,13 @@ configuration file
.P
They are:
.TP
-.B DEFAULT_TIMEOUT
+.B TIMEOUT
sets the default mount timeout (program default 600).
.TP
-.B DEFAULT_BROWSE_MODE
+.B BROWSE_MODE
Maps are browsable by default (program default "yes").
.TP
-.B DEFAULT_LOGGING
+.B LOGGING
set default log level "none", "verbose" or "debug" (program default "none").
.SH BUILTIN MAP -hosts
If "-hosts" is given as the map then accessing a key under the mount point
@@ -215,7 +215,7 @@ located in
.P
The configuration settings available are:
.TP
-\fBDEFAULT_MAP_OBJECT_CLASS\fP
+\fBMAP_OBJECT_CLASS\fP
The map object class. Its Default value is "nisMap". In the
.nh
automountMap
@@ -225,14 +225,14 @@ schema this corresponds to the class
.BR automountMap .
.hy
.TP
-.B DEFAULT_ENTRY_OBJECT_CLASS
+.B ENTRY_OBJECT_CLASS
The map entry object class. Its default value is \fBnisObject\fP.
In the automountMap schema this corresponds to the class
.nh
.BR automount .
.hy
.TP
-.B DEFAULT_MAP_ATTRIBUTE
+.B MAP_ATTRIBUTE
The attribute used to identify the name of the map to which this
entry belongs. Its default value is
.nh
@@ -247,7 +247,7 @@ schema this corresponds to the attributes \fBou\fP or
.BR automountMapName .
.hy
.TP
-.B DEFAULT_ENTRY_ATTRIBUTE
+.B ENTRY_ATTRIBUTE
The attribute used to identify a map key. Its default value is
In the
.nh
@@ -258,7 +258,7 @@ schema this corresponds to the attribute
.BR automountKey .
.hy
.TP
-.B DEFAULT_VALUE_ATTRIBUTE
+.B VALUE_ATTRIBUTE
The attribute used to identify the value of the map entry. Its default
value is
.nh
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
index 7cbc03f..84d524b 100644
--- a/redhat/autofs.sysconfig.in
+++ b/redhat/autofs.sysconfig.in
@@ -1,50 +1,50 @@
#
# Define default options for autofs.
#
-# DEFAULT_MASTER_MAP_NAME - default map name for the master map.
+# MASTER_MAP_NAME - default map name for the master map.
#
-#DEFAULT_MASTER_MAP_NAME="auto.master"
+#MASTER_MAP_NAME="auto.master"
#
-# DEFAULT_TIMEOUT - set the default mount timeout (default 600).
+# TIMEOUT - set the default mount timeout (default 600).
#
-DEFAULT_TIMEOUT=300
+TIMEOUT=300
#
-# DEFAULT_BROWSE_MODE - maps are browsable by default.
+# BROWSE_MODE - maps are browsable by default.
#
-DEFAULT_BROWSE_MODE="no"
+BROWSE_MODE="no"
#
-# DEFAULT_LOGGING - set default log level "none", "verbose" or "debug"
+# LOGGING - set default log level "none", "verbose" or "debug"
#
-#DEFAULT_LOGGING="none"
+#LOGGING="none"
#
# Define the default LDAP schema to use for lookups
#
# System default
#
-#DEFAULT_MAP_OBJECT_CLASS="nisMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"
-#DEFAULT_MAP_ATTRIBUTE="nisMapName"
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
-#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"
+#MAP_OBJECT_CLASS="nisMap"
+#ENTRY_OBJECT_CLASS="nisObject"
+#MAP_ATTRIBUTE="nisMapName"
+#ENTRY_ATTRIBUTE="cn"
+#VALUE_ATTRIBUTE="nisMapEntry"
#
# Other common LDAP nameing
#
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
-#DEFAULT_MAP_ATTRIBUTE="ou"
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
+#MAP_OBJECT_CLASS="automountMap"
+#ENTRY_OBJECT_CLASS="automount"
+#MAP_ATTRIBUTE="ou"
+#ENTRY_ATTRIBUTE="cn"
+#VALUE_ATTRIBUTE="automountInformation"
#
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
-#DEFAULT_MAP_ATTRIBUTE="automountMapName"
-#DEFAULT_ENTRY_ATTRIBUTE="automountKey"
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
+#MAP_OBJECT_CLASS="automountMap"
+#ENTRY_OBJECT_CLASS="automount"
+#MAP_ATTRIBUTE="automountMapName"
+#ENTRY_ATTRIBUTE="automountKey"
+#VALUE_ATTRIBUTE="automountInformation"
#
-# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL
+# AUTH_CONF_FILE - set the default location for the SASL
# authentication configuration file.
#
-#DEFAULT_AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
+#AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
#
# General global options
#
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index 7cbc03f..84d524b 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -1,50 +1,50 @@
#
# Define default options for autofs.
#
-# DEFAULT_MASTER_MAP_NAME - default map name for the master map.
+# MASTER_MAP_NAME - default map name for the master map.
#
-#DEFAULT_MASTER_MAP_NAME="auto.master"
+#MASTER_MAP_NAME="auto.master"
#
-# DEFAULT_TIMEOUT - set the default mount timeout (default 600).
+# TIMEOUT - set the default mount timeout (default 600).
#
-DEFAULT_TIMEOUT=300
+TIMEOUT=300
#
-# DEFAULT_BROWSE_MODE - maps are browsable by default.
+# BROWSE_MODE - maps are browsable by default.
#
-DEFAULT_BROWSE_MODE="no"
+BROWSE_MODE="no"
#
-# DEFAULT_LOGGING - set default log level "none", "verbose" or "debug"
+# LOGGING - set default log level "none", "verbose" or "debug"
#
-#DEFAULT_LOGGING="none"
+#LOGGING="none"
#
# Define the default LDAP schema to use for lookups
#
# System default
#
-#DEFAULT_MAP_OBJECT_CLASS="nisMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="nisObject"
-#DEFAULT_MAP_ATTRIBUTE="nisMapName"
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
-#DEFAULT_VALUE_ATTRIBUTE="nisMapEntry"
+#MAP_OBJECT_CLASS="nisMap"
+#ENTRY_OBJECT_CLASS="nisObject"
+#MAP_ATTRIBUTE="nisMapName"
+#ENTRY_ATTRIBUTE="cn"
+#VALUE_ATTRIBUTE="nisMapEntry"
#
# Other common LDAP nameing
#
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
-#DEFAULT_MAP_ATTRIBUTE="ou"
-#DEFAULT_ENTRY_ATTRIBUTE="cn"
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
+#MAP_OBJECT_CLASS="automountMap"
+#ENTRY_OBJECT_CLASS="automount"
+#MAP_ATTRIBUTE="ou"
+#ENTRY_ATTRIBUTE="cn"
+#VALUE_ATTRIBUTE="automountInformation"
#
-#DEFAULT_MAP_OBJECT_CLASS="automountMap"
-#DEFAULT_ENTRY_OBJECT_CLASS="automount"
-#DEFAULT_MAP_ATTRIBUTE="automountMapName"
-#DEFAULT_ENTRY_ATTRIBUTE="automountKey"
-#DEFAULT_VALUE_ATTRIBUTE="automountInformation"
+#MAP_OBJECT_CLASS="automountMap"
+#ENTRY_OBJECT_CLASS="automount"
+#MAP_ATTRIBUTE="automountMapName"
+#ENTRY_ATTRIBUTE="automountKey"
+#VALUE_ATTRIBUTE="automountInformation"
#
-# DEFAULT_AUTH_CONF_FILE - set the default location for the SASL
+# AUTH_CONF_FILE - set the default location for the SASL
# authentication configuration file.
#
-#DEFAULT_AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
+#AUTH_CONF_FILE="@@autofsmapdir@@/autofs_ldap_auth.conf"
#
# General global options
#
autofs-5.0.1-random-selection.patch:
daemon/automount.c | 12 +++++++++++-
include/replicated.h | 1 +
man/automount.8 | 4 ++++
modules/mount_nfs.c | 2 ++
modules/replicated.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-----
5 files changed, 63 insertions(+), 6 deletions(-)
--- NEW FILE autofs-5.0.1-random-selection.patch ---
diff --git a/daemon/automount.c b/daemon/automount.c
index 5989324..938ee1b 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -48,6 +48,8 @@ const char *mapdir = AUTOFS_MAP_DIR; /* Location of mount maps */
const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */
static char *pid_file = NULL; /* File in which to keep pid */
+unsigned int random_selection; /* use random policy when selecting
+ * which multi-mount host to mount */
static int start_pipefd[2];
static int st_stat = 0;
static int *pst_stat = &st_stat;
@@ -1363,6 +1365,8 @@ static void usage(void)
" -d --debug log debuging info\n"
" -D --define define global macro variable\n"
/*" -f --foreground do not fork into background\n" */
+ " -r --random-replicated-selection"
+ " use ramdom replicated server selection\n"
" -V --version print version, build config and exit\n"
, program);
}
@@ -1461,6 +1465,7 @@ int main(int argc, char *argv[])
{"debug", 0, 0, 'd'},
{"define", 1, 0, 'D'},
{"foreground", 0, 0, 'f'},
+ {"random-selection", 0, 0, 'r'},
{"version", 0, 0, 'V'},
{0, 0, 0, 0}
};
@@ -1476,10 +1481,11 @@ int main(int argc, char *argv[])
timeout = defaults_get_timeout();
ghost = defaults_get_browse_mode();
logging = defaults_get_logging();
+ random_selection = 0;
foreground = 0;
opterr = 0;
- while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fV", long_options, NULL)) != EOF) {
+ while ((opt = getopt_long(argc, argv, "+hp:t:vdD:fVr", long_options, NULL)) != EOF) {
switch (opt) {
case 'h':
usage();
@@ -1513,6 +1519,10 @@ int main(int argc, char *argv[])
show_build_info();
exit(0);
+ case 'r':
+ random_selection = 1;
+ break;
+
case '?':
case ':':
printf("%s: Ambiguous or unknown options\n", program);
diff --git a/include/replicated.h b/include/replicated.h
index 970cd31..c77cda6 100644
--- a/include/replicated.h
+++ b/include/replicated.h
@@ -60,6 +60,7 @@ struct host {
struct host *next;
};
+void seed_random(void);
void free_host_list(struct host **);
int parse_location(struct host **, const char *);
int prune_host_list(struct host **, unsigned int, const char *);
diff --git a/man/automount.8 b/man/automount.8
index 9da82c4..59f2805 100644
--- a/man/automount.8
+++ b/man/automount.8
@@ -47,6 +47,10 @@ Define a global macro substitution variable. Global definitions
are over-ridden macro definitions of the same name specified in
mount entries.
.TP
+.I "\-r, \-\-random-replicated-selection"
+Enables the use of ramdom selection when choosing a host from a
+list of replicated servers.
+.TP
.I "\-V, \-\-version"
Display the version number, then exit.
.SH ARGUMENTS
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 4063e9a..25f72b9 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -51,6 +51,8 @@ int mount_init(void **context)
} else
init_ctr++;
+ seed_random();
+
return !mount_bind;
}
diff --git a/modules/replicated.c b/modules/replicated.c
index cb65d82..de1b40c 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -74,6 +74,29 @@
#define max(x, y) (x >= y ? x : y)
#define mmax(x, y, z) (max(x, y) == x ? max(x, z) : max(y, z))
+extern unsigned int random_selection;
+
+void seed_random(void)
+{
+ int fd;
+ unsigned int seed;
+
+ fd = open("/dev/random", O_RDONLY);
+ if (fd < 0) {
+ srandom(time(NULL));
+ return;
+ }
+
+ if (read(fd, &seed, sizeof(seed)) != -1)
+ srandom(seed);
+ else
+ srandom(time(NULL));
+
+ close(fd);
+
+ return;
+}
+
static unsigned int get_proximity(const char *host_addr, int addr_len)
{
struct sockaddr_in *msk_addr, *if_addr;
@@ -403,7 +426,11 @@ static unsigned int get_nfs_info(struct host *host,
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
if (status) {
- taken += elapsed(start, end);
+ if (random_selection)
+ /* Random value between 0 and 1 */
+ taken += ((float) random())/((float) RAND_MAX+1);
+ else
+ taken += elapsed(start, end);;
count++;
supported = NFS4_SUPPORTED;
}
@@ -440,7 +467,11 @@ v3_ver:
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
if (status) {
- taken += elapsed(start, end);
+ if (random_selection)
+ /* Random value between 0 and 1 */
+ taken += ((float) random())/((float) RAND_MAX+1);
+ else
+ taken += elapsed(start, end);;
count++;
supported |= NFS3_SUPPORTED;
}
@@ -470,7 +501,11 @@ v2_ver:
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
if (status) {
- taken += elapsed(start, end);
+ if (random_selection)
+ /* Random value between 0 and 1 */
+ taken += ((float) random())/((float) RAND_MAX+1);
+ else
+ taken += elapsed(start, end);;
count++;
supported |= NFS2_SUPPORTED;
}
@@ -610,8 +645,13 @@ static int get_supported_ver_and_cost(struct host *host, unsigned int version, c
gettimeofday(&start, &tz);
status = rpc_ping_proto(&rpc_info);
gettimeofday(&end, &tz);
- if (status)
- taken = elapsed(start, end);
+ if (status) {
+ if (random_selection)
+ /* Random value between 0 and 1 */
+ taken = ((float) random())/((float) RAND_MAX+1);
+ else
+ taken = elapsed(start, end);
+ }
}
done:
if (rpc_info.proto->p_proto == IPPROTO_UDP) {
Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -r1.194 -r1.195
--- autofs.spec 8 Mar 2007 03:41:50 -0000 1.194
+++ autofs.spec 16 Mar 2007 07:26:19 -0000 1.195
@@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.1
-Release: 4
+Release: 5
Epoch: 1
License: GPL
Group: System Environment/Daemons
@@ -16,6 +16,9 @@
Patch4: autofs-5.0.1-check-mtab-updated.patch
Patch5: autofs-5.0.1-file-map-allow-white-space-only-line.patch
Patch6: autofs-5.0.1-network_match-fix.patch
+Patch7: autofs-5.0.1-drop-default-prefix-from-config.patch
+Patch8: autofs-5.0.1-random-selection.patch
+Patch9: autofs-5.0.1-bad-cast.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel
Conflicts: kernel < 2.6.17
@@ -63,6 +66,9 @@
%patch4 -p1
%patch5 -p1
%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -115,6 +121,14 @@
%{_libdir}/autofs/
%changelog
+* Fri Mar 16 2007 Ian Kent <ikent at redhat.com> - 5.0.1-5
+- drop "DEFAULT_" prefix from configuration names.
+- add option to select replicated server at random (instead of
+ ping response time) (bz 227604).
+- fix incorrect cast in directory cleanup routines (bz 231864).
+
+- fixed numeric export match (bz 231188).
+
* Thu Mar 8 2007 Ian Kent <ikent at redhat.com> - 5.0.1-4
- fixed numeric export match (bz 231188).
More information about the fedora-cvs-commits
mailing list