git: sbin/hammer: Add depth indentation option to hammer show

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sun Mar 27 10:07:47 PDT 2016


commit db7212b1c7d9e61bb3cac1e24f7201dbf20245e2
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sat Mar 26 12:19:11 2016 +0900

    sbin/hammer: Add depth indentation option to hammer show
    
    Print tab(s) based on the current depth in B-Tree. This makes
    hammer show output look like below instead of having everything
    without indentation. Depth indentation uses tabs instead of
    whitespaces because using 0x20s greatly increases the size of
    hammer show output.
    
    This option can be specifed by (-vvv are optional)
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show none indent
    
    With obfuscate option, it would be like
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show none indent,obfuscate
    
    With B-Tree search directive, it would be like
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show 1:00000001020bc6f7:... indent
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show 1:00000001020bc6f7:... obfuscate,indent
    
    With filter/nofilter option, it would be like
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show 1:00000001020bc6f7:... indent,filter
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show 1:00000001020bc6f7:... nofilter,indent
     # hammer -vvvf /dev/da1:/dev/da2:/dev/da3 show 1:00000001020bc6f7:... indent,filter,obfuscate
    
    Note that this commit also changes hammer show's suboption format
    mentioned above. Above examples are examples of the new format.
    The format used to be as follows,
     hammer [getopt options] show [search directives] ["filter"/"nofilter"] ["obfuscate"]
    but now it's
     hammer [getopt options] show [search directives] [comma separated suboptions]
    The format mentioned in 337ec5f is obsolete. This was necessary
    to keep simplicity of suboption format after search directives.
    
    The comma separated suboptions (filter,nofilter,obfuscate,indent)
    are not mentioned in hammer(8) manpage which means this change
    doesn't impact anyone (aside from real users almost never use
    this command in the first place). Having these suboptions just
    makes easier to debug or examine the structure in certain cases.
    
    --
    NODE aaa parent=0 depth=0
     ELM 0
     ELM 1
     ...
     ELM N
        NODE bbb parent=aaa depth=1
         ELM 0
         ELM 1
         ...
         ELM N
        NODE ccc parent=aaa depth=1
         ELM 0
         ELM 1
         ...
         ELM N
            NODE ddd parent=ccc depth=2
             ELM 0
             ELM 1
             ...
             ELM N
        ...
    ...

Summary of changes:
 sbin/hammer/cmd_show.c | 96 +++++++++++++++++++++++++++++++-------------------
 sbin/hammer/hammer.c   | 26 +++++++++-----
 sbin/hammer/hammer.h   |  2 +-
 3 files changed, 78 insertions(+), 46 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/db7212b1c7d9e61bb3cac1e24f7201dbf20245e2


-- 
DragonFly BSD source repository



More information about the Commits mailing list