diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2018-11-03 17:13:10 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2018-11-05 17:25:11 +0100 |
commit | aa8b2d6a0feb91bb5ea4364cdc53a00dfa233dca (patch) | |
tree | f9b7163bfd5b43f3758ed2f9624dba38d7092f29 /libdm | |
parent | d3ebb18f4052fd90bb2d177089e79801b51f6242 (diff) | |
download | lvm2-aa8b2d6a0feb91bb5ea4364cdc53a00dfa233dca.tar.gz |
cleanup: move cast to det_t into MKDEV macro
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/ioctl/libdm-iface.c | 8 | ||||
-rw-r--r-- | libdm/libdm-common.c | 2 | ||||
-rw-r--r-- | libdm/libdm-deptree.c | 4 | ||||
-rw-r--r-- | libdm/misc/kdev_t.h | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index e775da7d9..6d87749fe 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -30,7 +30,7 @@ #else # define MAJOR(x) major((x)) # define MINOR(x) minor((x)) -# define MKDEV(x,y) makedev((x),(y)) +# define MKDEV(x,y) makedev(((dev_t)x),((dev_t)y)) #endif #include "libdm/misc/dm-ioctl.h" @@ -259,7 +259,7 @@ static int _control_exists(const char *control, uint32_t major, uint32_t minor) return -1; } - if (major && buf.st_rdev != MKDEV((dev_t)major, (dev_t)minor)) { + if (major && buf.st_rdev != MKDEV(major, minor)) { log_verbose("%s: Wrong device number: (%u, %u) instead of " "(%u, %u)", control, MAJOR(buf.st_mode), MINOR(buf.st_mode), @@ -302,7 +302,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((dev_t)major, (dev_t)minor)) < 0) { + MKDEV(major, minor)) < 0) { log_sys_error("mknod", control); ret = 0; } @@ -1194,7 +1194,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count) } dmi->flags |= DM_PERSISTENT_DEV_FLAG; - dmi->dev = MKDEV((dev_t)dmt->major, (dev_t)dmt->minor); + dmi->dev = MKDEV(dmt->major, dmt->minor); } /* Does driver support device number referencing? */ diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 5099f91d3..7d19f751a 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -1040,7 +1040,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((dev_t)major, (dev_t)minor); + dev_t dev = MKDEV(major, minor); mode_t old_mask; if (!_build_dev_path(path, sizeof(path), dev_name)) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 3e602e28b..3f95a0d6c 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -523,7 +523,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree, dm_list_init(&node->activated); dm_list_init(&node->props.segs); - dev = MKDEV((dev_t)info->major, (dev_t)info->minor); + dev = MKDEV(info->major, info->minor); if (!dm_hash_insert_binary(dtree->devs, (const char *) &dev, sizeof(dev), node)) { @@ -546,7 +546,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((dev_t)major, (dev_t)minor); + dev_t dev = MKDEV(major, minor); return dm_hash_lookup_binary(dtree->devs, (const char *) &dev, sizeof(dev)); diff --git a/libdm/misc/kdev_t.h b/libdm/misc/kdev_t.h index f88bb0ab6..12780d273 100644 --- a/libdm/misc/kdev_t.h +++ b/libdm/misc/kdev_t.h @@ -17,6 +17,6 @@ #define MAJOR(dev) ((dev & 0xfff00) >> 8) #define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00)) -#define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12)) +#define MKDEV(ma,mi) (((dev_t)mi & 0xff) | ((dev_t)ma << 8) | (((dev_t)mi & ~0xff) << 12)) #endif |