1
0
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:
Zdenek Kabelac 2012-08-16 20:06:07 +02:00
parent ba309e0da5
commit ff86c6ed00
5 changed files with 8 additions and 8 deletions

View File

@ -347,7 +347,7 @@ int get_primary_dev(const char *sysfs_dir,
path, buffer); path, buffer);
goto out; goto out;
} }
*result = MKDEV(pri_maj, pri_min); *result = MKDEV((dev_t)pri_maj, pri_min);
ret = 1; ret = 1;
out: out:

View File

@ -239,7 +239,7 @@ static int _control_exists(const char *control, uint32_t major, uint32_t minor)
return -1; 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 " log_verbose("%s: Wrong device number: (%u, %u) instead of "
"(%u, %u)", control, "(%u, %u)", control,
MAJOR(buf.st_mode), MINOR(buf.st_mode), 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); (void) dm_prepare_selinux_context(control, S_IFCHR);
old_umask = umask(DM_CONTROL_NODE_UMASK); old_umask = umask(DM_CONTROL_NODE_UMASK);
if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR, if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
MKDEV(major, minor)) < 0) { MKDEV((dev_t)major, minor)) < 0) {
log_sys_error("mknod", control); log_sys_error("mknod", control);
(void) dm_prepare_selinux_context(NULL, 0); (void) dm_prepare_selinux_context(NULL, 0);
return 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->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? */ /* Does driver support device number referencing? */

View File

@ -841,7 +841,7 @@ static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
{ {
char path[PATH_MAX]; char path[PATH_MAX];
struct stat info; struct stat info;
dev_t dev = MKDEV(major, minor); dev_t dev = MKDEV((dev_t)major, minor);
mode_t old_mask; mode_t old_mask;
_build_dev_path(path, sizeof(path), dev_name); _build_dev_path(path, sizeof(path), dev_name);

View File

@ -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->used_by);
dm_list_init(&node->props.segs); 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, if (!dm_hash_insert_binary(dtree->devs, (const char *) &dev,
sizeof(dev), node)) { 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, static struct dm_tree_node *_find_dm_tree_node(struct dm_tree *dtree,
uint32_t major, uint32_t minor) 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, return dm_hash_lookup_binary(dtree->devs, (const char *) &dev,
sizeof(dev)); sizeof(dev));

View File

@ -209,7 +209,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
if (major < 0 || minor < 0) if (major < 0 || minor < 0)
continue; continue;
devno = MKDEV(major, minor); devno = MKDEV((dev_t)major, minor);
if (!(dev = dev_cache_get_by_devt(devno, NULL))) { if (!(dev = dev_cache_get_by_devt(devno, NULL))) {
if (!dm_asprintf(&buf, "%" PRIi32 ":%" PRIi32, major, minor)) if (!dm_asprintf(&buf, "%" PRIi32 ":%" PRIi32, major, minor))