mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: keep MKNOD type cast clean
Setup major already a dev_t type before it gets shifted.
This commit is contained in:
parent
ba309e0da5
commit
ff86c6ed00
@ -347,7 +347,7 @@ int get_primary_dev(const char *sysfs_dir,
|
||||
path, buffer);
|
||||
goto out;
|
||||
}
|
||||
*result = MKDEV(pri_maj, pri_min);
|
||||
*result = MKDEV((dev_t)pri_maj, pri_min);
|
||||
ret = 1;
|
||||
|
||||
out:
|
||||
|
@ -239,7 +239,7 @@ static int _control_exists(const char *control, uint32_t major, uint32_t minor)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (major && buf.st_rdev != MKDEV(major, minor)) {
|
||||
if (major && buf.st_rdev != MKDEV((dev_t)major, minor)) {
|
||||
log_verbose("%s: Wrong device number: (%u, %u) instead of "
|
||||
"(%u, %u)", control,
|
||||
MAJOR(buf.st_mode), MINOR(buf.st_mode),
|
||||
@ -282,7 +282,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
|
||||
(void) dm_prepare_selinux_context(control, S_IFCHR);
|
||||
old_umask = umask(DM_CONTROL_NODE_UMASK);
|
||||
if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
|
||||
MKDEV(major, minor)) < 0) {
|
||||
MKDEV((dev_t)major, minor)) < 0) {
|
||||
log_sys_error("mknod", control);
|
||||
(void) dm_prepare_selinux_context(NULL, 0);
|
||||
return 0;
|
||||
@ -1062,7 +1062,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
|
||||
}
|
||||
|
||||
dmi->flags |= DM_PERSISTENT_DEV_FLAG;
|
||||
dmi->dev = MKDEV(dmt->major, dmt->minor);
|
||||
dmi->dev = MKDEV((dev_t)dmt->major, dmt->minor);
|
||||
}
|
||||
|
||||
/* Does driver support device number referencing? */
|
||||
|
@ -841,7 +841,7 @@ static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
struct stat info;
|
||||
dev_t dev = MKDEV(major, minor);
|
||||
dev_t dev = MKDEV((dev_t)major, minor);
|
||||
mode_t old_mask;
|
||||
|
||||
_build_dev_path(path, sizeof(path), dev_name);
|
||||
|
@ -484,7 +484,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
|
||||
dm_list_init(&node->used_by);
|
||||
dm_list_init(&node->props.segs);
|
||||
|
||||
dev = MKDEV(info->major, info->minor);
|
||||
dev = MKDEV((dev_t)info->major, info->minor);
|
||||
|
||||
if (!dm_hash_insert_binary(dtree->devs, (const char *) &dev,
|
||||
sizeof(dev), node)) {
|
||||
@ -508,7 +508,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
|
||||
static struct dm_tree_node *_find_dm_tree_node(struct dm_tree *dtree,
|
||||
uint32_t major, uint32_t minor)
|
||||
{
|
||||
dev_t dev = MKDEV(major, minor);
|
||||
dev_t dev = MKDEV((dev_t)major, minor);
|
||||
|
||||
return dm_hash_lookup_binary(dtree->devs, (const char *) &dev,
|
||||
sizeof(dev));
|
||||
|
@ -209,7 +209,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (major < 0 || minor < 0)
|
||||
continue;
|
||||
|
||||
devno = MKDEV(major, minor);
|
||||
devno = MKDEV((dev_t)major, minor);
|
||||
|
||||
if (!(dev = dev_cache_get_by_devt(devno, NULL))) {
|
||||
if (!dm_asprintf(&buf, "%" PRIi32 ":%" PRIi32, major, minor))
|
||||
|
Loading…
Reference in New Issue
Block a user