mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
devs: rename dev_is_md dev_is_md_component
The naming was confusing and misleading since it it's testing if a device is an md component, not an md device.
This commit is contained in:
parent
0c26aa13ca
commit
19ef399ea7
@ -88,8 +88,21 @@ static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
|
|||||||
return sb_offset;
|
return sb_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _udev_dev_is_md_component() only works if
|
||||||
|
* external_device_info_source="udev"
|
||||||
|
*
|
||||||
|
* but
|
||||||
|
*
|
||||||
|
* udev_dev_is_md_component() in dev-type.c only works if
|
||||||
|
* obtain_device_list_from_udev=1
|
||||||
|
*
|
||||||
|
* and neither of those config setting matches very well
|
||||||
|
* with what we're doing here.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef UDEV_SYNC_SUPPORT
|
#ifdef UDEV_SYNC_SUPPORT
|
||||||
static int _udev_dev_is_md(struct device *dev)
|
static int _udev_dev_is_md_component(struct device *dev)
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
struct dev_ext *ext;
|
struct dev_ext *ext;
|
||||||
@ -103,7 +116,7 @@ static int _udev_dev_is_md(struct device *dev)
|
|||||||
return !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID);
|
return !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int _udev_dev_is_md(struct device *dev)
|
static int _udev_dev_is_md_component(struct device *dev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -112,7 +125,7 @@ static int _udev_dev_is_md(struct device *dev)
|
|||||||
/*
|
/*
|
||||||
* Returns -1 on error
|
* Returns -1 on error
|
||||||
*/
|
*/
|
||||||
static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int full)
|
static int _native_dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
|
||||||
{
|
{
|
||||||
md_minor_version_t minor;
|
md_minor_version_t minor;
|
||||||
uint64_t size, sb_offset;
|
uint64_t size, sb_offset;
|
||||||
@ -188,7 +201,7 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
|
int dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -198,7 +211,7 @@ int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
|
|||||||
* information is not in udev db.
|
* information is not in udev db.
|
||||||
*/
|
*/
|
||||||
if ((dev->ext.src == DEV_EXT_NONE) || offset_found) {
|
if ((dev->ext.src == DEV_EXT_NONE) || offset_found) {
|
||||||
ret = _native_dev_is_md(dev, offset_found, full);
|
ret = _native_dev_is_md_component(dev, offset_found, full);
|
||||||
|
|
||||||
if (!full) {
|
if (!full) {
|
||||||
if (!ret || (ret == -EAGAIN)) {
|
if (!ret || (ret == -EAGAIN)) {
|
||||||
@ -210,7 +223,7 @@ int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dev->ext.src == DEV_EXT_UDEV)
|
if (dev->ext.src == DEV_EXT_UDEV)
|
||||||
return _udev_dev_is_md(dev);
|
return _udev_dev_is_md_component(dev);
|
||||||
|
|
||||||
log_error(INTERNAL_ERROR "Missing hook for MD device recognition "
|
log_error(INTERNAL_ERROR "Missing hook for MD device recognition "
|
||||||
"using external device info source %s", dev_ext_name(dev));
|
"using external device info source %s", dev_ext_name(dev));
|
||||||
@ -439,7 +452,7 @@ int dev_is_md_with_end_superblock(struct dev_types *dt, struct device *dev)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int dev_is_md(struct device *dev __attribute__((unused)),
|
int dev_is_md_component(struct device *dev __attribute__((unused)),
|
||||||
uint64_t *sb __attribute__((unused)))
|
uint64_t *sb __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -866,7 +866,7 @@ static int _wipe_known_signatures_with_lvm(struct device *dev, const char *name,
|
|||||||
wiped = &wiped_tmp;
|
wiped = &wiped_tmp;
|
||||||
*wiped = 0;
|
*wiped = 0;
|
||||||
|
|
||||||
if (!_wipe_signature(dev, "software RAID md superblock", name, 4, yes, force, wiped, dev_is_md) ||
|
if (!_wipe_signature(dev, "software RAID md superblock", name, 4, yes, force, wiped, dev_is_md_component) ||
|
||||||
!_wipe_signature(dev, "swap signature", name, 10, yes, force, wiped, dev_is_swap) ||
|
!_wipe_signature(dev, "swap signature", name, 10, yes, force, wiped, dev_is_swap) ||
|
||||||
!_wipe_signature(dev, "LUKS signature", name, 8, yes, force, wiped, dev_is_luks))
|
!_wipe_signature(dev, "LUKS signature", name, 8, yes, force, wiped, dev_is_luks))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -57,7 +57,7 @@ const char *dev_subsystem_name(struct dev_types *dt, struct device *dev);
|
|||||||
int major_is_scsi_device(struct dev_types *dt, int major);
|
int major_is_scsi_device(struct dev_types *dt, int major);
|
||||||
|
|
||||||
/* Signature/superblock recognition with position returned where found. */
|
/* Signature/superblock recognition with position returned where found. */
|
||||||
int dev_is_md(struct device *dev, uint64_t *sb, int full);
|
int dev_is_md_component(struct device *dev, uint64_t *sb, int full);
|
||||||
int dev_is_swap(struct device *dev, uint64_t *signature, int full);
|
int dev_is_swap(struct device *dev, uint64_t *signature, int full);
|
||||||
int dev_is_luks(struct device *dev, uint64_t *signature, int full);
|
int dev_is_luks(struct device *dev, uint64_t *signature, int full);
|
||||||
int dasd_is_cdl_formatted(struct device *dev);
|
int dasd_is_cdl_formatted(struct device *dev);
|
||||||
|
@ -93,7 +93,7 @@ static int _passes_md_filter(struct cmd_context *cmd, struct dev_filter *f __att
|
|||||||
if (!md_filtering())
|
if (!md_filtering())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
ret = dev_is_md(dev, NULL, cmd->use_full_md_check);
|
ret = dev_is_md_component(dev, NULL, cmd->use_full_md_check);
|
||||||
|
|
||||||
if (ret == -EAGAIN) {
|
if (ret == -EAGAIN) {
|
||||||
/* let pass, call again after scan */
|
/* let pass, call again after scan */
|
||||||
|
@ -298,7 +298,7 @@ static int _read_pv(struct format_instance *fid,
|
|||||||
* see the PV size, and can finally compare it with the device size.
|
* see the PV size, and can finally compare it with the device size.
|
||||||
*/
|
*/
|
||||||
if (pv->dev && (pv->size != pv->dev->size)) {
|
if (pv->dev && (pv->size != pv->dev->size)) {
|
||||||
if (dev_is_md(pv->dev, NULL, 1)) {
|
if (dev_is_md_component(pv->dev, NULL, 1)) {
|
||||||
log_warn("WARNING: device %s is an md component, ignoring PV.", dev_name(pv->dev));
|
log_warn("WARNING: device %s is an md component, ignoring PV.", dev_name(pv->dev));
|
||||||
return_0;
|
return_0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user