aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2011-05-04 04:33:52 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:55:43 -0500
commit563e4cf25ec804eb02cd30a41baa2fcc6c06679b (patch)
tree78714255143b283d7a58681ab6142c3e245ebc7b
parent2ec91e0e29a3f1166ad96dbb3466b57dbc5d8ebf (diff)
drbd: Introduce __s32_field in the genetlink macro magic
...and drop explicit typecasts (int)meta_dev_idx < 0. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_nl.c8
-rw-r--r--include/linux/drbd_genl.h2
-rw-r--r--include/linux/genl_magic_struct.h3
3 files changed, 8 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index a1854e3aa15e..b8ea4807c981 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1253,7 +1253,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1253 goto fail; 1253 goto fail;
1254 } 1254 }
1255 1255
1256 if ((int)nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) { 1256 if (nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) {
1257 retcode = ERR_MD_IDX_INVALID; 1257 retcode = ERR_MD_IDX_INVALID;
1258 goto fail; 1258 goto fail;
1259 } 1259 }
@@ -1289,7 +1289,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1289 */ 1289 */
1290 bdev = blkdev_get_by_path(nbc->dc.meta_dev, 1290 bdev = blkdev_get_by_path(nbc->dc.meta_dev,
1291 FMODE_READ | FMODE_WRITE | FMODE_EXCL, 1291 FMODE_READ | FMODE_WRITE | FMODE_EXCL,
1292 ((int)nbc->dc.meta_dev_idx < 0) ? 1292 (nbc->dc.meta_dev_idx < 0) ?
1293 (void *)mdev : (void *)drbd_m_holder); 1293 (void *)mdev : (void *)drbd_m_holder);
1294 if (IS_ERR(bdev)) { 1294 if (IS_ERR(bdev)) {
1295 dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.meta_dev, 1295 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 goto fail; 1325 goto fail;
1326 } 1326 }
1327 1327
1328 if ((int)nbc->dc.meta_dev_idx < 0) { 1328 if (nbc->dc.meta_dev_idx < 0) {
1329 max_possible_sectors = DRBD_MAX_SECTORS_FLEX; 1329 max_possible_sectors = DRBD_MAX_SECTORS_FLEX;
1330 /* at least one MB, otherwise it does not make sense */ 1330 /* at least one MB, otherwise it does not make sense */
1331 min_md_device_sectors = (2<<10); 1331 min_md_device_sectors = (2<<10);
@@ -1356,7 +1356,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
1356 dev_warn(DEV, "==> truncating very big lower level device " 1356 dev_warn(DEV, "==> truncating very big lower level device "
1357 "to currently maximum possible %llu sectors <==\n", 1357 "to currently maximum possible %llu sectors <==\n",
1358 (unsigned long long) max_possible_sectors); 1358 (unsigned long long) max_possible_sectors);
1359 if ((int)nbc->dc.meta_dev_idx >= 0) 1359 if (nbc->dc.meta_dev_idx >= 0)
1360 dev_warn(DEV, "==>> using internal or flexible " 1360 dev_warn(DEV, "==>> using internal or flexible "
1361 "meta data may help <<==\n"); 1361 "meta data may help <<==\n");
1362 } 1362 }
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 549800668cb9..f143e3c0f33b 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -102,7 +102,7 @@ GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
102GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf, 102GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
103 __str_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT, backing_dev, 128) 103 __str_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT, backing_dev, 128)
104 __str_field(2, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev, 128) 104 __str_field(2, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev, 128)
105 __u32_field(3, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev_idx) 105 __s32_field(3, GENLA_F_REQUIRED | GENLA_F_INVARIANT, meta_dev_idx)
106 106
107 /* use the resize command to try and change the disk_size */ 107 /* use the resize command to try and change the disk_size */
108 __u64_field(4, GENLA_F_MANDATORY | GENLA_F_INVARIANT, disk_size) 108 __u64_field(4, GENLA_F_MANDATORY | GENLA_F_INVARIANT, disk_size)
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
index f2c7cc7831df..ddbdd0a24476 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -97,6 +97,9 @@ enum {
97#define __u32_field(attr_nr, attr_flag, name) \ 97#define __u32_field(attr_nr, attr_flag, name) \
98 __field(attr_nr, attr_flag, name, NLA_U32, __u32, \ 98 __field(attr_nr, attr_flag, name, NLA_U32, __u32, \
99 nla_get_u32, NLA_PUT_U32) 99 nla_get_u32, NLA_PUT_U32)
100#define __s32_field(attr_nr, attr_flag, name) \
101 __field(attr_nr, attr_flag, name, NLA_U32, __s32, \
102 nla_get_u32, NLA_PUT_U32)
100#define __u64_field(attr_nr, attr_flag, name) \ 103#define __u64_field(attr_nr, attr_flag, name) \
101 __field(attr_nr, attr_flag, name, NLA_U64, __u64, \ 104 __field(attr_nr, attr_flag, name, NLA_U64, __u64, \
102 nla_get_u64, NLA_PUT_U64) 105 nla_get_u64, NLA_PUT_U64)