1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

ioctl: Allow minor without major.

There's no need to insist on a major number being supplied when the
code's going to override it if it's wrong anyway.
This commit is contained in:
Alasdair G Kergon 2017-08-04 14:45:20 +01:00
parent 5dd53943c9
commit e6afe9e782
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.143 - Version 1.02.143 -
================================= =================================
Accept minor number without major in library when it knows dm major number.
Introduce single-line concise table output format: dmsetup table --concise Introduce single-line concise table output format: dmsetup table --concise
Version 1.02.142 - 20th July 2017 Version 1.02.142 - 20th July 2017

View File

@ -1172,11 +1172,6 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
dmi->data_start = sizeof(struct dm_ioctl); dmi->data_start = sizeof(struct dm_ioctl);
if (dmt->minor >= 0) { if (dmt->minor >= 0) {
if (dmt->major <= 0) {
log_error("Missing major number for persistent device.");
goto bad;
}
if (!_dm_multiple_major_support && dmt->allow_default_major_fallback && if (!_dm_multiple_major_support && dmt->allow_default_major_fallback &&
dmt->major != (int) _dm_device_major) { dmt->major != (int) _dm_device_major) {
log_verbose("Overriding major number of %d " log_verbose("Overriding major number of %d "
@ -1185,6 +1180,11 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
dmt->major = _dm_device_major; dmt->major = _dm_device_major;
} }
if (dmt->major <= 0) {
log_error("Missing major number for persistent device.");
goto bad;
}
dmi->flags |= DM_PERSISTENT_DEV_FLAG; dmi->flags |= DM_PERSISTENT_DEV_FLAG;
dmi->dev = MKDEV((dev_t)dmt->major, (dev_t)dmt->minor); dmi->dev = MKDEV((dev_t)dmt->major, (dev_t)dmt->minor);
} }