1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

cleanup: reindent and make obvious error path

This commit is contained in:
Zdenek Kabelac 2014-08-18 22:04:39 +02:00
parent 10e2370d2e
commit 3e4a21427b

View File

@ -158,25 +158,21 @@ static int dev_is_mpath(struct dev_filter *f, struct device *dev)
return 0; return 0;
switch (dev_get_primary_dev(dt, dev, &primary_dev)) { switch (dev_get_primary_dev(dt, dev, &primary_dev)) {
default: case 2: /* The dev is partition. */
case 0: part_name = dev_name(dev); /* name of original dev for log_debug msg */
/* Error. */ if (!(name = get_sysfs_name_by_devt(sysfs_dir, primary_dev, parent_name, sizeof(parent_name))))
log_error("Failed to get primary device for %d:%d.", major, minor); return_0;
return 0; log_debug_devs("%s: Device is a partition, using primary "
case 1: "device %s for mpath component detection",
/* The dev is already a primary dev. Just continue with the dev. */ part_name, name);
if (!(name = get_sysfs_name(dev))) break;
return_0; case 1: /* The dev is already a primary dev. Just continue with the dev. */
break; if (!(name = get_sysfs_name(dev)))
case 2: return_0;
/* The dev is partition. */ break;
part_name = dev_name(dev); /* name of original dev for log_debug msg */ default: /* 0, error. */
if (!(name = get_sysfs_name_by_devt(sysfs_dir, primary_dev, parent_name, PATH_MAX))) log_error("Failed to get primary device for %d:%d.", major, minor);
return_0; return 0;
log_debug_devs("%s: Device is a partition, using primary "
"device %s for mpath component detection",
part_name, name);
break;
} }
if (dm_snprintf(path, PATH_MAX, "%s/block/%s/holders", sysfs_dir, name) < 0) { if (dm_snprintf(path, PATH_MAX, "%s/block/%s/holders", sysfs_dir, name) < 0) {