zfs/cmd/zinject
Brian Behlendorf 1a5c611a22 Make command line guid parsing more tolerant
Several of the zfs utilities allow you to pass a vdev's guid rather
than the device name.  However, the utilities are not consistent in
how they parse that guid.  For example, 'zinject' expects the guid
to be passed as a hex value while 'zpool replace' wants it as a
decimal.  The user is forced to just know what format to use.

This patch improve things by making the parsing more tolerant.
When strtol(3) is called using 0 for the base, rather than say
10 or 16, it will then accept hex, decimal, or octal input based
on the prefix.  From the man page.

    If base is zero or 16, the string may then include a "0x"
    prefix, and  the number  will  be read in base 16; otherwise,
    a zero base is taken as 10 (decimal) unless the next character
    is '0', in which case it  is  taken as 8 (octal).

NOTE: There may be additional conversions not caught be this patch.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
Issue #2
2014-04-02 13:10:08 -07:00
..
.gitignore Add .gitignore files to exclude build products 2010-01-08 11:35:17 -08:00
Makefile.am Add missing libzfs_core to Makefiles 2013-11-20 15:44:15 -08:00
translate.c Make command line guid parsing more tolerant 2014-04-02 13:10:08 -07:00
zinject.c Illumos #3120 zinject hangs in zfsdev_ioctl() due to uninitialized zc 2014-03-24 11:06:11 -07:00
zinject.h Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00