Author: avg
Date: Wed Jul 20 10:06:56 2016
New Revision: 303084
URL: https://svnweb.freebsd.org/changeset/base/303084

Log:
  MFV r303082: 6391 Override default SPA config location via environment
  
  illumos/illumos-gate@ae24175b2b25e9fb4bfd9ac0648b57e0735b6651
  
https://github.com/illumos/illumos-gate/commit/ae24175b2b25e9fb4bfd9ac0648b57e0735b6651
  
  https://www.illumos.org/issues/6391
    When using zdb with non-default SPA config file it is not convenient
    to add -U <non-default-config-file-path> all the time. This commit
    introduces support for setting/overriding SPA config location via
    environment variable 'SPA_CONFIG_PATH'.
    If -U flag is specified in the command line it will override any other
    value as usual.
  
  
https://github.com/zfsonlinux/zfs/commit/64d7b6cf75e52a4698d9bdec61745573c39d2e5a
  
  Reviewed by: Brian Behlendorf <behlendo...@llnl.gov>
  Reviewed by: Richard Yao <r...@gentoo.org>
  Reviewed by: Matthew Ahrens <mahr...@delphix.com>
  Reviewed by: Will Andrews <w...@freebsd.org>
  Reviewed by: George Wilson <george.wil...@delphix.com>
  Approved by: Robert Mustacchi <r...@joyent.com>
  Author: Cyril Plisko <cyril.pli...@mountall.com>
  MFC after:    1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 20 09:58:10 2016        
(r303083)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jul 20 10:06:56 2016        
(r303084)
@@ -3558,12 +3558,22 @@ main(int argc, char **argv)
        nvlist_t *policy = NULL;
        uint64_t max_txg = UINT64_MAX;
        int rewind = ZPOOL_NEVER_REWIND;
+       char *spa_config_path_env;
 
        (void) setrlimit(RLIMIT_NOFILE, &rl);
        (void) enable_extended_FILE_stdio(-1, -1);
 
        dprintf_setup(&argc, argv);
 
+       /*
+        * If there is an environment variable SPA_CONFIG_PATH it overrides
+        * default spa_config_path setting. If -U flag is specified it will
+        * override this environment variable settings once again.
+        */
+       spa_config_path_env = getenv("SPA_CONFIG_PATH");
+       if (spa_config_path_env != NULL)
+               spa_config_path = spa_config_path_env;
+
        while ((c = getopt(argc, argv,
            "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) {
                switch (c) {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to