Commit 563e4cf2 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

drbd: Introduce __s32_field in the genetlink macro magic

...and drop explicit typecasts (int)meta_dev_idx < 0.
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 2ec91e0e
...@@ -1253,7 +1253,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1253,7 +1253,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
goto fail; goto fail;
} }
if ((int)nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) { if (nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) {
retcode = ERR_MD_IDX_INVALID; retcode = ERR_MD_IDX_INVALID;
goto fail; goto fail;
} }
...@@ -1289,7 +1289,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1289,7 +1289,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
*/ */
bdev = blkdev_get_by_path(nbc->dc.meta_dev, bdev = blkdev_get_by_path(nbc->dc.meta_dev,
FMODE_READ | FMODE_WRITE | FMODE_EXCL, FMODE_READ | FMODE_WRITE | FMODE_EXCL,
((int)nbc->dc.meta_dev_idx < 0) ? (nbc->dc.meta_dev_idx < 0) ?
(void *)mdev : (void *)drbd_m_holder); (void *)mdev : (void *)drbd_m_holder);
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.meta_dev, dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.meta_dev,
...@@ -1325,7 +1325,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1325,7 +1325,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
goto fail; goto fail;
} }
if ((int)nbc->dc.meta_dev_idx < 0) { if (nbc->dc.meta_dev_idx < 0) {
max_possible_sectors = DRBD_MAX_SECTORS_FLEX; max_possible_sectors = DRBD_MAX_SECTORS_FLEX;
/* at least one MB, otherwise it does not make sense */ /* at least one MB, otherwise it does not make sense */
min_md_device_sectors = (2<<10); min_md_device_sectors = (2<<10);
...@@ -1356,7 +1356,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1356,7 +1356,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
dev_warn(DEV, "==> truncating very big lower level device " dev_warn(DEV, "==> truncating very big lower level device "
"to currently maximum possible %llu sectors <==\n", "to currently maximum possible %llu sectors <==\n",
(unsigned long long) max_possible_sectors); (unsigned long long) max_possible_sectors);
if ((int)nbc->dc.meta_dev_idx >= 0) if (nbc->dc.meta_dev_idx >= 0)
dev_warn(DEV, "==>> using internal or flexible " dev_warn(DEV, "==>> using internal or flexible "
"meta data may help <<==\n"); "meta data may help <<==\n");
} }
......
...@@ -102,7 +102,7 @@ GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context, ...@@ -102,7 +102,7 @@ GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf, GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
__str_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT, backing_dev, 128) __str_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT, backing_dev, 128)
__str_field(2, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev, 128) __str_field(2, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev, 128)
__u32_field(3, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev_idx) __s32_field(3, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev_idx)
/* use the resize command to try and change the disk_size */ /* use the resize command to try and change the disk_size */
__u64_field(4, GENLA_F_MANDATORY | GENLA_F_INVARIANT, disk_size) __u64_field(4, GENLA_F_MANDATORY | GENLA_F_INVARIANT, disk_size)
......
...@@ -97,6 +97,9 @@ enum { ...@@ -97,6 +97,9 @@ enum {
#define __u32_field(attr_nr, attr_flag, name) \ #define __u32_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U32, __u32, \ __field(attr_nr, attr_flag, name, NLA_U32, __u32, \
nla_get_u32, NLA_PUT_U32) nla_get_u32, NLA_PUT_U32)
#define __s32_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U32, __s32, \
nla_get_u32, NLA_PUT_U32)
#define __u64_field(attr_nr, attr_flag, name) \ #define __u64_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U64, __u64, \ __field(attr_nr, attr_flag, name, NLA_U64, __u64, \
nla_get_u64, NLA_PUT_U64) nla_get_u64, NLA_PUT_U64)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment