summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-05-21 13:37:48 +0000
committertrasz <trasz@FreeBSD.org>2015-05-21 13:37:48 +0000
commit936900ca6b2f1fb85a27937bb54a2ecbd681ffbd (patch)
tree57e7f2a19ec0d9b601a233145c2f690205f561e2 /usr.sbin
parentffdd97ce45793ac2206ca85895ccf346c9fc4bbc (diff)
downloadFreeBSD-src-936900ca6b2f1fb85a27937bb54a2ecbd681ffbd.zip
FreeBSD-src-936900ca6b2f1fb85a27937bb54a2ecbd681ffbd.tar.gz
MFC r279916:
Make "automount -LL -o whatever" present options in the same order as used by automountd(8). Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/autofs/automount.c3
-rw-r--r--usr.sbin/autofs/common.c20
-rw-r--r--usr.sbin/autofs/common.h2
3 files changed, 16 insertions, 9 deletions
diff --git a/usr.sbin/autofs/automount.c b/usr.sbin/autofs/automount.c
index 8bcc79b..ce5d861 100644
--- a/usr.sbin/autofs/automount.c
+++ b/usr.sbin/autofs/automount.c
@@ -381,13 +381,12 @@ main_automount(int argc, char **argv)
parse_master(root, AUTO_MASTER_PATH);
if (show_maps) {
- root->n_options = concat(options, ',', root->n_options);
if (show_maps > 1) {
node_expand_indirect_maps(root);
node_expand_ampersand(root, NULL);
}
node_expand_defined(root);
- node_print(root);
+ node_print(root, options);
return (0);
}
diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c
index 7c744d3..4df177c 100644
--- a/usr.sbin/autofs/common.c
+++ b/usr.sbin/autofs/common.c
@@ -607,13 +607,16 @@ node_options(const struct node *n)
}
static void
-node_print_indent(const struct node *n, int indent)
+node_print_indent(const struct node *n, const char *cmdline_options,
+ int indent)
{
const struct node *child, *first_child;
- char *path, *options;
+ char *path, *options, *tmp;
path = node_path(n);
- options = node_options(n);
+ tmp = node_options(n);
+ options = concat(cmdline_options, ',', tmp);
+ free(tmp);
/*
* Do not show both parent and child node if they have the same
@@ -644,16 +647,21 @@ node_print_indent(const struct node *n, int indent)
free(options);
TAILQ_FOREACH(child, &n->n_children, n_next)
- node_print_indent(child, indent + 2);
+ node_print_indent(child, cmdline_options, indent + 2);
}
+/*
+ * Recursively print node with all its children. The cmdline_options
+ * argument is used for additional options to be prepended to all the
+ * others - usually those are the options passed by command line.
+ */
void
-node_print(const struct node *n)
+node_print(const struct node *n, const char *cmdline_options)
{
const struct node *child;
TAILQ_FOREACH(child, &n->n_children, n_next)
- node_print_indent(child, 0);
+ node_print_indent(child, cmdline_options, 0);
}
static struct node *
diff --git a/usr.sbin/autofs/common.h b/usr.sbin/autofs/common.h
index 686a89d..dc84415 100644
--- a/usr.sbin/autofs/common.h
+++ b/usr.sbin/autofs/common.h
@@ -87,7 +87,7 @@ void node_expand_ampersand(struct node *root, const char *key);
void node_expand_wildcard(struct node *root, const char *key);
int node_expand_defined(struct node *root);
void node_expand_indirect_maps(struct node *n);
-void node_print(const struct node *n);
+void node_print(const struct node *n, const char *cmdline_options);
void parse_master(struct node *root, const char *path);
void parse_map(struct node *parent, const char *map, const char *args,
bool *wildcards);
OpenPOWER on IntegriCloud