mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: simplier error message
Use single 'error' message just with different reason.
This commit is contained in:
parent
7379a2624b
commit
1f6d79ab48
@ -917,33 +917,26 @@ out:
|
|||||||
|
|
||||||
static int _check_device_not_in_use(const char *name, struct dm_info *info)
|
static int _check_device_not_in_use(const char *name, struct dm_info *info)
|
||||||
{
|
{
|
||||||
|
const char *reason;
|
||||||
|
|
||||||
if (!info->exists)
|
if (!info->exists)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* If sysfs is not used, use open_count information only. */
|
/* If sysfs is not used, use open_count information only. */
|
||||||
if (!*dm_sysfs_dir()) {
|
if (!*dm_sysfs_dir()) {
|
||||||
if (info->open_count) {
|
if (!info->open_count)
|
||||||
log_error("Device %s (%" PRIu32 ":%" PRIu32 ") in use",
|
|
||||||
name, info->major, info->minor);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
reason = "in use";
|
||||||
|
} else if (dm_device_has_holders(info->major, info->minor))
|
||||||
if (dm_device_has_holders(info->major, info->minor)) {
|
reason = "is used by another device";
|
||||||
log_error("Device %s (%" PRIu32 ":%" PRIu32 ") is used "
|
else if (dm_device_has_mounted_fs(info->major, info->minor))
|
||||||
"by another device.", name, info->major, info->minor);
|
reason = "constains a filesystem in use";
|
||||||
return 0;
|
else
|
||||||
}
|
|
||||||
|
|
||||||
if (dm_device_has_mounted_fs(info->major, info->minor)) {
|
|
||||||
log_error("Device %s (%" PRIu32 ":%" PRIu32 ") contains "
|
|
||||||
"a filesystem in use.", name, info->major, info->minor);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
log_error("Device %s (" FMTu32 ":" FMTu32 ") %s.",
|
||||||
|
name, info->major, info->minor, reason);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if all parent nodes of given node have open_count == 0 */
|
/* Check if all parent nodes of given node have open_count == 0 */
|
||||||
|
Loading…
Reference in New Issue
Block a user