mirror of
git://sourceware.org/git/lvm2.git
synced 2024-10-05 12:19:48 +03:00
cleanup: some more MAJOR MINOR unsigned
Finish remaing missing cases where MAJOR/MINOR was casted to (int) while we can now use it directly as 'unsigned'.
This commit is contained in:
parent
91502446ac
commit
85e0636623
@ -310,7 +310,8 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
|
||||
|
||||
if (dm_list_empty(&dev->aliases)) {
|
||||
/* shouldn't happen */
|
||||
log_print_unless_silent("Cannot open device %d:%d with no valid paths.", (int)MAJOR(dev->dev), (int)MINOR(dev->dev));
|
||||
log_print_unless_silent("Cannot open device %u:%u with no valid paths.",
|
||||
MAJOR(dev->dev), MINOR(dev->dev));
|
||||
return 0;
|
||||
}
|
||||
name = dev_name(dev);
|
||||
|
@ -322,8 +322,8 @@ static int _md_sysfs_attribute_snprintf(char *path, size_t size,
|
||||
if (MAJOR(dev) != dt->md_major)
|
||||
return ret;
|
||||
|
||||
ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", sysfs_dir,
|
||||
(int)MAJOR(dev), (int)MINOR(dev), attribute);
|
||||
ret = dm_snprintf(path, size, "%s/dev/block/%u:%u/md/%s", sysfs_dir,
|
||||
MAJOR(dev), MINOR(dev), attribute);
|
||||
if (ret < 0) {
|
||||
log_error("dm_snprintf md %s failed", attribute);
|
||||
return ret;
|
||||
@ -335,8 +335,8 @@ static int _md_sysfs_attribute_snprintf(char *path, size_t size,
|
||||
return ret;
|
||||
}
|
||||
/* old sysfs structure */
|
||||
ret = dm_snprintf(path, size, "%s/block/md%d/md/%s",
|
||||
sysfs_dir, (int)MINOR(dev), attribute);
|
||||
ret = dm_snprintf(path, size, "%s/block/md%u/md/%s",
|
||||
sysfs_dir, MINOR(dev), attribute);
|
||||
if (ret < 0) {
|
||||
log_error("dm_snprintf old md %s failed", attribute);
|
||||
return ret;
|
||||
|
@ -358,8 +358,8 @@ static const char *_get_sysfs_name_by_devt(const char *sysfs_dir, dev_t devno,
|
||||
char path[PATH_MAX];
|
||||
int size;
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d", sysfs_dir,
|
||||
(int) MAJOR(devno), (int) MINOR(devno)) < 0) {
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u", sysfs_dir,
|
||||
MAJOR(devno), MINOR(devno)) < 0) {
|
||||
log_error("Sysfs path string is too long.");
|
||||
return NULL;
|
||||
}
|
||||
@ -466,8 +466,8 @@ static int _dev_is_mpath_component_sysfs(struct cmd_context *cmd, struct device
|
||||
const char *sysfs_dir = dm_sysfs_dir();
|
||||
DIR *dr;
|
||||
struct dirent *de;
|
||||
int dev_major = MAJOR(dev->dev);
|
||||
int dev_minor = MINOR(dev->dev);
|
||||
unsigned dev_major = MAJOR(dev->dev);
|
||||
unsigned dev_minor = MINOR(dev->dev);
|
||||
unsigned dm_dev_major;
|
||||
unsigned dm_dev_minor;
|
||||
struct stat info;
|
||||
@ -490,7 +490,7 @@ static int _dev_is_mpath_component_sysfs(struct cmd_context *cmd, struct device
|
||||
break;
|
||||
|
||||
default: /* 0, error. */
|
||||
log_warn("Failed to get primary device for %d:%d.", dev_major, dev_minor);
|
||||
log_warn("Failed to get primary device for %u:%u.", dev_major, dev_minor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -728,8 +728,8 @@ const char *dev_mpath_component_wwid(struct cmd_context *cmd, struct device *dev
|
||||
|
||||
/* /sys/dev/block/253:7/slaves/sda/device/wwid */
|
||||
|
||||
if (dm_snprintf(slaves_path, sizeof(slaves_path), "%sdev/block/%d:%d/slaves",
|
||||
dm_sysfs_dir(), (int)MAJOR(dev->dev), (int)MINOR(dev->dev)) < 0) {
|
||||
if (dm_snprintf(slaves_path, sizeof(slaves_path), "%sdev/block/%u:%u/slaves",
|
||||
dm_sysfs_dir(), MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
|
||||
log_warn("Sysfs path to check mpath components is too long.");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -87,7 +87,8 @@ int dev_is_used_by_active_lv(struct cmd_context *cmd, struct device *dev, int *u
|
||||
* sysfs "holders" dir.
|
||||
*/
|
||||
|
||||
if (dm_snprintf(holders_path, sizeof(holders_path), "%sdev/block/%d:%d/holders/", dm_sysfs_dir(), (int) MAJOR(dev->dev), (int) MINOR(dev->dev)) < 0) {
|
||||
if (dm_snprintf(holders_path, sizeof(holders_path), "%sdev/block/%u:%u/holders/",
|
||||
dm_sysfs_dir(), MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
|
||||
log_error("%s: dm_snprintf failed for path to holders directory.", dev_name(dev));
|
||||
return 0;
|
||||
}
|
||||
@ -440,10 +441,8 @@ static int _loop_is_with_partscan(struct device *dev)
|
||||
char path[PATH_MAX];
|
||||
char buffer[64];
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/loop/partscan",
|
||||
dm_sysfs_dir(),
|
||||
(int) MAJOR(dev->dev),
|
||||
(int) MINOR(dev->dev)) < 0) {
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u/loop/partscan",
|
||||
dm_sysfs_dir(), MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
|
||||
log_warn("Sysfs path for partscan is too long.");
|
||||
return 0;
|
||||
}
|
||||
@ -476,8 +475,8 @@ int dev_get_partition_number(struct device *dev, int *num)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/partition",
|
||||
dm_sysfs_dir(), (int)MAJOR(devt), (int)MINOR(devt)) < 0) {
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u/partition",
|
||||
dm_sysfs_dir(), MAJOR(devt), MINOR(devt)) < 0) {
|
||||
log_error("Failed to create sysfs path for %s", dev_name(dev));
|
||||
return 0;
|
||||
}
|
||||
@ -525,11 +524,11 @@ static int _has_sys_partition(struct device *dev)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
struct stat info;
|
||||
int major = (int) MAJOR(dev->dev);
|
||||
int minor = (int) MINOR(dev->dev);
|
||||
unsigned major = MAJOR(dev->dev);
|
||||
unsigned minor = MINOR(dev->dev);
|
||||
|
||||
/* check if dev is a partition */
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/partition",
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u/partition",
|
||||
dm_sysfs_dir(), major, minor) < 0) {
|
||||
log_warn("WARNING: %s: partition path is too long.", dev_name(dev));
|
||||
return 0;
|
||||
@ -705,8 +704,8 @@ int dev_is_partitioned(struct cmd_context *cmd, struct device *dev)
|
||||
*/
|
||||
int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
{
|
||||
int major = (int) MAJOR(dev->dev);
|
||||
int minor = (int) MINOR(dev->dev);
|
||||
unsigned major = MAJOR(dev->dev);
|
||||
unsigned minor = MINOR(dev->dev);
|
||||
char path[PATH_MAX];
|
||||
char temp_path[PATH_MAX];
|
||||
char buffer[64];
|
||||
@ -756,7 +755,7 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
* - basename ../../block/md0/md0 = md0
|
||||
* Parent's 'dev' sysfs attribute = /sys/block/md0/dev
|
||||
*/
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d",
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u",
|
||||
dm_sysfs_dir(), major, minor) < 0) {
|
||||
log_warn("WARNING: %s: major:minor sysfs path is too long.", dev_name(dev));
|
||||
return 0;
|
||||
@ -1193,9 +1192,8 @@ int wipe_known_signatures(struct cmd_context *cmd, struct device *dev,
|
||||
static int _snprintf_attr(char *buf, size_t buf_size, const char *sysfs_dir,
|
||||
const char *attribute, dev_t dev)
|
||||
{
|
||||
if (dm_snprintf(buf, buf_size, "%sdev/block/%d:%d/%s", sysfs_dir,
|
||||
(int)MAJOR(dev), (int)MINOR(dev),
|
||||
attribute) < 0) {
|
||||
if (dm_snprintf(buf, buf_size, "%sdev/block/%u:%u/%s", sysfs_dir,
|
||||
MAJOR(dev), MINOR(dev), attribute) < 0) {
|
||||
log_warn("WARNING: sysfs path for %s attribute is too long.", attribute);
|
||||
return 0;
|
||||
}
|
||||
|
@ -432,8 +432,8 @@ static int _read_sys_block(struct cmd_context *cmd, struct device *dev,
|
||||
|
||||
sysfs_dir = cmd->device_id_sysfs_dir ?: dm_sysfs_dir();
|
||||
retry:
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/%s",
|
||||
sysfs_dir, (int)MAJOR(devt), (int)MINOR(devt), suffix) < 0) {
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u/%s",
|
||||
sysfs_dir, MAJOR(devt), MINOR(devt), suffix) < 0) {
|
||||
log_error("Failed to create sysfs path for %s", dev_name(dev));
|
||||
return 0;
|
||||
}
|
||||
@ -2384,8 +2384,8 @@ static int _match_dm_names(struct cmd_context *cmd, char *idname, struct device
|
||||
dev2 = dev_cache_get_existing(cmd, idname, NULL);
|
||||
|
||||
if (dev2 && (dev == dev2)) {
|
||||
log_debug("Match dm names %s %s for %d:%d (from cache)",
|
||||
dev_name(dev), idname, (int)MAJOR(dev->dev), (int)MINOR(dev->dev));
|
||||
log_debug("Match dm names %s %s for %u:%u (from cache).",
|
||||
dev_name(dev), idname, MAJOR(dev->dev), MINOR(dev->dev));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2403,8 +2403,8 @@ static int _match_dm_names(struct cmd_context *cmd, char *idname, struct device
|
||||
|
||||
if ((MAJOR(buf.st_rdev) == cmd->dev_types->device_mapper_major) &&
|
||||
(MINOR(buf.st_rdev) == MINOR(dev->dev))) {
|
||||
log_debug("Match dm names %s %s for %d:%d (from stat)",
|
||||
dev_name(dev), idname, (int)MAJOR(dev->dev), (int)MINOR(dev->dev));
|
||||
log_debug("Match dm names %s %s for %u:%u (from stat)",
|
||||
dev_name(dev), idname, MAJOR(dev->dev), MINOR(dev->dev));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -2452,7 +2452,7 @@ static int _match_du_to_dev(struct cmd_context *cmd, struct dev_use *du, struct
|
||||
* so we can skip trying to match certain du entries based simply on
|
||||
* the major number of dev.
|
||||
*/
|
||||
if (!_idtype_compatible_with_major_number(cmd, du->idtype, (int)MAJOR(dev->dev))) {
|
||||
if (!_idtype_compatible_with_major_number(cmd, du->idtype, MAJOR(dev->dev))) {
|
||||
/*
|
||||
log_debug("Mismatch device_id %s %s to %s: wrong major",
|
||||
idtype_to_str(du->idtype), du->idname ?: ".", dev_name(dev));
|
||||
|
@ -48,8 +48,8 @@ static int _get_crypt_path(dev_t lv_devt, char *lv_path, char *crypt_path)
|
||||
struct dirent *de;
|
||||
int ret = 0;
|
||||
|
||||
if (dm_snprintf(holders_path, sizeof(holders_path), "%sdev/block/%d:%d/holders",
|
||||
dm_sysfs_dir(), (int)MAJOR(lv_devt), (int)MINOR(lv_devt)) < 0) {
|
||||
if (dm_snprintf(holders_path, sizeof(holders_path), "%sdev/block/%u:%u/holders",
|
||||
dm_sysfs_dir(), MAJOR(lv_devt), MINOR(lv_devt)) < 0) {
|
||||
log_error("Couldn't create holder path for %s.", lv_path);
|
||||
return 0;
|
||||
}
|
||||
@ -380,7 +380,7 @@ int crypt_resize_script(struct cmd_context *cmd, struct logical_volume *lv, stru
|
||||
if (dm_snprintf(newsize_str, sizeof(newsize_str), "%llu", (unsigned long long)newsize_bytes_fs) < 0)
|
||||
return_0;
|
||||
|
||||
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%d", (int)MINOR(fsi->crypt_devt)) < 0)
|
||||
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%u", MINOR(fsi->crypt_devt)) < 0)
|
||||
return_0;
|
||||
|
||||
argv[0] = _get_lvresize_fs_helper_path();
|
||||
@ -458,7 +458,7 @@ int fs_reduce_script(struct cmd_context *cmd, struct logical_volume *lv, struct
|
||||
argv[++args] = "--fsck";
|
||||
|
||||
if (fsi->needs_crypt) {
|
||||
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%d", (int)MINOR(fsi->crypt_devt)) < 0)
|
||||
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%u", MINOR(fsi->crypt_devt)) < 0)
|
||||
return_0;
|
||||
argv[++args] = "--cryptresize";
|
||||
argv[++args] = "--cryptpath";
|
||||
@ -543,7 +543,7 @@ int fs_extend_script(struct cmd_context *cmd, struct logical_volume *lv, struct
|
||||
argv[++args] = "--fsck";
|
||||
|
||||
if (fsi->needs_crypt) {
|
||||
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%d", (int)MINOR(fsi->crypt_devt)) < 0)
|
||||
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%u", MINOR(fsi->crypt_devt)) < 0)
|
||||
return_0;
|
||||
argv[++args] = "--cryptresize";
|
||||
argv[++args] = "--cryptpath";
|
||||
|
@ -61,7 +61,7 @@ static int _copy_pvid_file_field(const char *field, char *buf, int bufsize, char
|
||||
|
||||
#define MAX_PVID_FILE_SIZE 512
|
||||
|
||||
int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char *devname)
|
||||
int online_pvid_file_read(char *path, unsigned *major, unsigned *minor, char *vgname, char *devname)
|
||||
{
|
||||
char buf[MAX_PVID_FILE_SIZE] = { 0 };
|
||||
int fd, rv;
|
||||
@ -81,7 +81,7 @@ int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char
|
||||
}
|
||||
buf[rv] = 0; /* \0 terminated buffer */
|
||||
|
||||
if (sscanf(buf, "%d:%d", major, minor) != 2) {
|
||||
if (sscanf(buf, "%u:%u", major, minor) != 2) {
|
||||
log_warn("WARNING: No device numbers in %s.", path);
|
||||
return 0;
|
||||
}
|
||||
@ -148,7 +148,7 @@ int get_pvs_online(struct dm_list *pvs_online, const char *vgname)
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
struct pv_online *po;
|
||||
int file_major = 0, file_minor = 0;
|
||||
unsigned file_major, file_minor;
|
||||
|
||||
if (!(dir = opendir(PVS_ONLINE_DIR)))
|
||||
return 0;
|
||||
@ -252,8 +252,8 @@ int online_pvid_file_create(struct cmd_context *cmd, struct device *dev, const c
|
||||
char file_devname[NAME_LEN];
|
||||
char devname[NAME_LEN];
|
||||
int devnamelen;
|
||||
int file_major = 0, file_minor = 0;
|
||||
int major, minor;
|
||||
unsigned file_major = 0, file_minor = 0;
|
||||
unsigned major, minor;
|
||||
int fd;
|
||||
int rv;
|
||||
int len;
|
||||
@ -261,16 +261,16 @@ int online_pvid_file_create(struct cmd_context *cmd, struct device *dev, const c
|
||||
int len2 = 0;
|
||||
int len3 = 0;
|
||||
|
||||
major = (int)MAJOR(dev->dev);
|
||||
minor = (int)MINOR(dev->dev);
|
||||
major = MAJOR(dev->dev);
|
||||
minor = MINOR(dev->dev);
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%s/%s", PVS_ONLINE_DIR, dev->pvid) < 0) {
|
||||
log_error_pvscan(cmd, "Path %s/%s is too long.", PVS_ONLINE_DIR, dev->pvid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((len1 = dm_snprintf(buf, sizeof(buf), "%d:%d\n", major, minor)) < 0) {
|
||||
log_error_pvscan(cmd, "Cannot create online file path for %s %d:%d.", dev_name(dev), major, minor);
|
||||
if ((len1 = dm_snprintf(buf, sizeof(buf), "%u:%u\n", major, minor)) < 0) {
|
||||
log_error_pvscan(cmd, "Cannot create online file path for %s %u:%u.", dev_name(dev), major, minor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ int online_pvid_file_create(struct cmd_context *cmd, struct device *dev, const c
|
||||
|
||||
len = len1 + len2 + len3;
|
||||
|
||||
log_debug("Create pv online: %s %d:%d %s", path, major, minor, dev_name(dev));
|
||||
log_debug("Create pv online: %s %u:%u %s.", path, major, minor, dev_name(dev));
|
||||
|
||||
fd = open(path, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
|
||||
if (fd < 0) {
|
||||
@ -389,7 +389,7 @@ int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname)
|
||||
char file_vgname[NAME_LEN];
|
||||
char file_devname[NAME_LEN];
|
||||
struct pv_online *po;
|
||||
int file_major = 0, file_minor = 0;
|
||||
unsigned file_major, file_minor;
|
||||
FILE *fp;
|
||||
|
||||
if (dm_snprintf(lookup_path, sizeof(lookup_path), "%s/%s", PVS_LOOKUP_DIR, vgname) < 0)
|
||||
|
@ -45,7 +45,7 @@ do \
|
||||
log_error("pvscan[%d] " fmt, getpid(), ##args); \
|
||||
while (0)
|
||||
|
||||
int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char *devname);
|
||||
int online_pvid_file_read(char *path, unsigned *major, unsigned *minor, char *vgname, char *devname);
|
||||
int online_vg_file_create(struct cmd_context *cmd, const char *vgname);
|
||||
void online_vg_file_remove(const char *vgname);
|
||||
int online_pvid_file_create(struct cmd_context *cmd, struct device *dev, const char *vgname);
|
||||
|
@ -40,9 +40,9 @@ static int _ignore_mpath_component(struct cmd_context *cmd, struct dev_filter *f
|
||||
if ((dev->flags & DEV_MATCHED_USE_ID) && mpath_devno) {
|
||||
if (!get_du_for_devno(cmd, mpath_devno)) {
|
||||
struct device *mpath_dev = dev_cache_get_by_devt(cmd, mpath_devno);
|
||||
log_warn("WARNING: devices file is missing %s (%d:%d) using multipath component %s.",
|
||||
log_warn("WARNING: devices file is missing %s (%u:%u) using multipath component %s.",
|
||||
mpath_dev ? dev_name(mpath_dev) : "unknown",
|
||||
(int)MAJOR(mpath_devno), (int)MINOR(mpath_devno), dev_name(dev));
|
||||
MAJOR(mpath_devno), MINOR(mpath_devno), dev_name(dev));
|
||||
if (!_lvmdevices_update_msg && strcmp(get_cmd_name(), "lvmdevices")) {
|
||||
log_warn("See lvmdevices --update for devices file update.");
|
||||
_lvmdevices_update_msg = 1;
|
||||
|
@ -88,8 +88,8 @@ static int _lookup_p(struct cmd_context *cmd, struct dev_filter *f, struct devic
|
||||
return pf->real->passes_filter(cmd, pf->real, dev, use_filter_name);
|
||||
|
||||
if (dm_list_empty(&dev->aliases)) {
|
||||
log_debug_devs("%d:%d: filter cache skipping (no name)",
|
||||
(int)MAJOR(dev->dev), (int)MINOR(dev->dev));
|
||||
log_debug_devs("%u:%u: filter cache skipping (no name).",
|
||||
MAJOR(dev->dev), MINOR(dev->dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ static int _accept_p(struct cmd_context *cmd, struct dev_filter *f, struct devic
|
||||
if (dev->id && dev->id->idtype && (dev->id->idtype != DEV_ID_TYPE_DEVNAME))
|
||||
return 1;
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d",
|
||||
sysfs_dir, (int)MAJOR(dev->dev), (int)MINOR(dev->dev)) < 0) {
|
||||
if (dm_snprintf(path, sizeof(path), "%sdev/block/%u:%u",
|
||||
sysfs_dir, MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
|
||||
log_debug("failed to create sysfs path");
|
||||
return 1;
|
||||
}
|
||||
|
@ -917,9 +917,9 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
|
||||
return 1;
|
||||
}
|
||||
if (hp->devt != du->dev->dev) {
|
||||
log_debug("ignore hints: devno %d:%d does not match %d:%d for %s",
|
||||
(int)MAJOR(hp->devt), (int)MINOR(hp->devt),
|
||||
(int)MAJOR(du->dev->dev), (int)MINOR(du->dev->dev), hp->name);
|
||||
log_debug("ignore hints: devno %u:%u does not match %u:%u for %s",
|
||||
MAJOR(hp->devt), MINOR(hp->devt),
|
||||
MAJOR(du->dev->dev), MINOR(du->dev->dev), hp->name);
|
||||
*needs_refresh = 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -494,8 +494,8 @@ static int _scan_dev_open(struct device *dev)
|
||||
* dm_list_first() returns NULL if the list is empty.
|
||||
*/
|
||||
if (!(name_list = dm_list_first(&dev->aliases))) {
|
||||
log_error("Device open %d:%d has no path names.",
|
||||
(int)MAJOR(dev->dev), (int)MINOR(dev->dev));
|
||||
log_error("Device open %u:%u has no path names.",
|
||||
MAJOR(dev->dev), MINOR(dev->dev));
|
||||
return 0;
|
||||
}
|
||||
name_sl = dm_list_item(name_list, struct dm_str_list);
|
||||
@ -535,8 +535,8 @@ static int _scan_dev_open(struct device *dev)
|
||||
* drop any other invalid aliases before retrying open with
|
||||
* any remaining valid paths.
|
||||
*/
|
||||
log_debug("Drop alias for %d:%d failed open %s (%d)",
|
||||
(int)MAJOR(dev->dev), (int)MINOR(dev->dev), name, errno);
|
||||
log_debug("Drop alias for %u:%u failed open %s (%d).",
|
||||
MAJOR(dev->dev), MINOR(dev->dev), name, errno);
|
||||
dev_cache_failed_path(dev, name);
|
||||
dev_cache_verify_aliases(dev);
|
||||
goto next_name;
|
||||
@ -545,8 +545,8 @@ static int _scan_dev_open(struct device *dev)
|
||||
|
||||
/* Verify that major:minor from the path still match dev. */
|
||||
if ((fstat(fd, &sbuf) < 0) || (sbuf.st_rdev != dev->dev)) {
|
||||
log_warn("Invalid path %s for device %d:%d, trying different path.",
|
||||
name, (int)MAJOR(dev->dev), (int)MINOR(dev->dev));
|
||||
log_warn("Invalid path %s for device %u:%u, trying different path.",
|
||||
name, MAJOR(dev->dev), MINOR(dev->dev));
|
||||
(void)close(fd);
|
||||
dev_cache_failed_path(dev, name);
|
||||
dev_cache_verify_aliases(dev);
|
||||
@ -660,8 +660,8 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
|
||||
|
||||
if (!_in_bcache(devl->dev)) {
|
||||
if (!_scan_dev_open(devl->dev)) {
|
||||
log_debug_devs("Scan failed to open %d:%d %s.",
|
||||
(int)MAJOR(devl->dev->dev), (int)MINOR(devl->dev->dev), dev_name(devl->dev));
|
||||
log_debug_devs("Scan failed to open %u:%u %s.",
|
||||
MAJOR(devl->dev->dev), MINOR(devl->dev->dev), dev_name(devl->dev));
|
||||
dm_list_del(&devl->list);
|
||||
devl->dev->flags |= DEV_SCAN_NOT_READ;
|
||||
continue;
|
||||
@ -711,10 +711,9 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
|
||||
*/
|
||||
bcache_put(bb);
|
||||
|
||||
log_debug_devs("Processing data from device %s %d:%d di %d",
|
||||
log_debug_devs("Processing data from device %s %u:%u di %d.",
|
||||
dev_name(devl->dev),
|
||||
(int)MAJOR(devl->dev->dev),
|
||||
(int)MINOR(devl->dev->dev),
|
||||
MAJOR(devl->dev->dev), MINOR(devl->dev->dev),
|
||||
devl->dev->bcache_di);
|
||||
|
||||
ret = _process_block(cmd, f, devl->dev, headers_buf, sizeof(headers_buf), 0, 0, &is_lvm_device);
|
||||
@ -1036,8 +1035,8 @@ int label_scan_vg_online(struct cmd_context *cmd, const char *vgname,
|
||||
*/
|
||||
dm_list_iterate_items(po, &pvs_online) {
|
||||
if (!(po->dev = setup_dev_in_dev_cache(cmd, po->devno, po->devname[0] ? po->devname : NULL))) {
|
||||
log_debug("No device found for quick mapping of online PV %d:%d %s PVID %s",
|
||||
(int)MAJOR(po->devno), (int)MINOR(po->devno), po->devname, po->pvid);
|
||||
log_debug("No device found for quick mapping of online PV %u:%u %s PVID %s.",
|
||||
MAJOR(po->devno), MINOR(po->devno), po->devname, po->pvid);
|
||||
try_dev_scan = 1;
|
||||
continue;
|
||||
}
|
||||
@ -1061,8 +1060,8 @@ int label_scan_vg_online(struct cmd_context *cmd, const char *vgname,
|
||||
if (po->dev)
|
||||
continue;
|
||||
if (!(po->dev = dev_cache_get_by_devt(cmd, po->devno))) {
|
||||
log_error("No device found for %d:%d PVID %s",
|
||||
(int)MAJOR(po->devno), (int)MINOR(po->devno), po->pvid);
|
||||
log_error("No device found for %u:%u PVID %s.",
|
||||
MAJOR(po->devno), MINOR(po->devno), po->pvid);
|
||||
goto bad;
|
||||
}
|
||||
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
|
||||
@ -1813,15 +1812,15 @@ int label_scan_reopen_rw(struct device *dev)
|
||||
int fd;
|
||||
|
||||
if (dm_list_empty(&dev->aliases)) {
|
||||
log_error("Cannot reopen rw device %d:%d with no valid paths di %d fd %d.",
|
||||
(int)MAJOR(dev->dev), (int)MINOR(dev->dev), dev->bcache_di, dev->bcache_fd);
|
||||
log_error("Cannot reopen rw device %u:%u with no valid paths di %d fd %d.",
|
||||
MAJOR(dev->dev), MINOR(dev->dev), dev->bcache_di, dev->bcache_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
name = dev_name(dev);
|
||||
if (!name || name[0] != '/') {
|
||||
log_error("Cannot reopen rw device %d:%d with no valid name di %d fd %d.",
|
||||
(int)MAJOR(dev->dev), (int)MINOR(dev->dev), dev->bcache_di, dev->bcache_fd);
|
||||
log_error("Cannot reopen rw device %u:%u with no valid name di %d fd %d.",
|
||||
MAJOR(dev->dev), MINOR(dev->dev), dev->bcache_di, dev->bcache_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -228,15 +228,15 @@ out:
|
||||
* were created from.
|
||||
*/
|
||||
|
||||
static void _online_pvid_file_remove_devno(int major, int minor)
|
||||
static void _online_pvid_file_remove_devno(unsigned major, unsigned minor)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
char file_vgname[NAME_LEN];
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
int file_major = 0, file_minor = 0;
|
||||
unsigned file_major, file_minor;
|
||||
|
||||
log_debug("Remove pv online devno %d:%d", major, minor);
|
||||
log_debug("Remove pv online devno %u:%u", major, minor);
|
||||
|
||||
if (!(dir = opendir(PVS_ONLINE_DIR)))
|
||||
return;
|
||||
@ -547,7 +547,7 @@ static int _get_devs_from_saved_vg(struct cmd_context *cmd, const char *vgname,
|
||||
struct volume_group *vg;
|
||||
const char *name1, *name2;
|
||||
dev_t devno;
|
||||
int file_major = 0, file_minor = 0;
|
||||
unsigned file_major = 0, file_minor = 0;
|
||||
|
||||
/*
|
||||
* We previously saved the metadata (as a struct vg) from the device
|
||||
@ -923,8 +923,8 @@ static int _get_args_devs(struct cmd_context *cmd, struct dm_list *pvscan_args,
|
||||
if (!arg->devname && !arg->devno)
|
||||
return_0;
|
||||
if (!(arg->dev = setup_dev_in_dev_cache(cmd, arg->devno, arg->devname))) {
|
||||
log_error_pvscan(cmd, "No device set up for arg %s %d:%d",
|
||||
arg->devname ?: "", (int)MAJOR(arg->devno), (int)MINOR(arg->devno));
|
||||
log_error_pvscan(cmd, "No device set up for arg %s %u:%u.",
|
||||
arg->devname ?: "", MAJOR(arg->devno), MINOR(arg->devno));
|
||||
}
|
||||
}
|
||||
|
||||
@ -949,7 +949,7 @@ static void _set_pv_devices_online(struct cmd_context *cmd, struct volume_group
|
||||
char pvid[ID_LEN+1] = { 0 };
|
||||
struct pv_list *pvl;
|
||||
struct device *dev;
|
||||
int major, minor;
|
||||
unsigned major, minor;
|
||||
dev_t devno;
|
||||
|
||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
@ -1450,7 +1450,7 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
|
||||
dm_list_iterate_items(arg, &pvscan_args) {
|
||||
if (arg->dev || !arg->devno)
|
||||
continue;
|
||||
_online_pvid_file_remove_devno((int)MAJOR(arg->devno), (int)MINOR(arg->devno));
|
||||
_online_pvid_file_remove_devno(MAJOR(arg->devno), MINOR(arg->devno));
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user