]> git.proxmox.com Git - mirror_zfs-debian.git/commit
Strip partition from device name for whole disks
authorNed Bass <bass6@llnl.gov>
Fri, 1 Oct 2010 19:00:58 +0000 (12:00 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 4 Oct 2010 20:53:24 +0000 (13:53 -0700)
commit83c62c939938ca5915a61022208a31c4ab3faa1c
tree000c0c218e5ea83753ce5dabc701f1e1737ffb5d
parent3a7381e531f55929f894fa2e81b79e1980de6f22
Strip partition from device name for whole disks

Under Solaris, the slice number is chopped off when displaying the device name
if the vdev is a whole disk.  Under Linux we should similarly discard the
partition number.  This commit adds the logic to perform the name truncation
for devices ending in -partX, XpX, or X, where X is a string of digits.  The
second case handles devices like md0p0. The third case is limited to scsi and
ide disks, i.e. those beginning with "sd" or "hd", in order to avoid stripping
the number from names like "loop0".

This commit removes the Solaris-specific code for removing slices, since we no
longer reasonably expect our changes to be merged in upstream.  The partition
stripping code was moved off to a helper function to improve readability.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
lib/libzfs/libzfs_pool.c