From owner-svn-src-all@FreeBSD.ORG Thu May 21 13:37:49 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B79614AA; Thu, 21 May 2015 13:37:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4B081E5B; Thu, 21 May 2015 13:37:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4LDbndp004600; Thu, 21 May 2015 13:37:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4LDbmXG004595; Thu, 21 May 2015 13:37:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505211337.t4LDbmXG004595@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 May 2015 13:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283239 - stable/10/usr.sbin/autofs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 13:37:49 -0000 Author: trasz Date: Thu May 21 13:37:48 2015 New Revision: 283239 URL: https://svnweb.freebsd.org/changeset/base/283239 Log: MFC r279916: Make "automount -LL -o whatever" present options in the same order as used by automountd(8). Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/autofs/automount.c stable/10/usr.sbin/autofs/common.c stable/10/usr.sbin/autofs/common.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/autofs/automount.c ============================================================================== --- stable/10/usr.sbin/autofs/automount.c Thu May 21 13:36:00 2015 (r283238) +++ stable/10/usr.sbin/autofs/automount.c Thu May 21 13:37:48 2015 (r283239) @@ -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); } Modified: stable/10/usr.sbin/autofs/common.c ============================================================================== --- stable/10/usr.sbin/autofs/common.c Thu May 21 13:36:00 2015 (r283238) +++ stable/10/usr.sbin/autofs/common.c Thu May 21 13:37:48 2015 (r283239) @@ -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, 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 * Modified: stable/10/usr.sbin/autofs/common.h ============================================================================== --- stable/10/usr.sbin/autofs/common.h Thu May 21 13:36:00 2015 (r283238) +++ stable/10/usr.sbin/autofs/common.h Thu May 21 13:37:48 2015 (r283239) @@ -87,7 +87,7 @@ void node_expand_ampersand(struct node * 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);