]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drbd: Introduce __s32_field in the genetlink macro magic
authorLars Ellenberg <lars.ellenberg@linbit.com>
Wed, 4 May 2011 08:33:52 +0000 (10:33 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:55:43 +0000 (16:55 +0100)
...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>
drivers/block/drbd/drbd_nl.c
include/linux/drbd_genl.h
include/linux/genl_magic_struct.h

index a1854e3aa15e1cda77f1a79468625659e5b8aff1..b8ea4807c981a661d5b2733064bac2964074e6f3 100644 (file)
@@ -1253,7 +1253,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
                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;
                goto fail;
        }
@@ -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,
                                  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);
        if (IS_ERR(bdev)) {
                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)
                goto fail;
        }
 
-       if ((int)nbc->dc.meta_dev_idx < 0) {
+       if (nbc->dc.meta_dev_idx < 0) {
                max_possible_sectors = DRBD_MAX_SECTORS_FLEX;
                /* at least one MB, otherwise it does not make sense */
                min_md_device_sectors = (2<<10);
@@ -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 "
                        "to currently maximum possible %llu sectors <==\n",
                        (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 "
                                      "meta data may help <<==\n");
        }
index 549800668cb96c1ead542387a78600debbc89ea6..f143e3c0f33b0257b5672faf7b89052fe0050a06 100644 (file)
@@ -102,7 +102,7 @@ GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
 GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
        __str_field(1, GENLA_F_REQUIRED | GENLA_F_INVARIANT,    backing_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 */
        __u64_field(4, GENLA_F_MANDATORY | GENLA_F_INVARIANT,   disk_size)
index f2c7cc7831df5f2f24d2593652bf37466e04d13e..ddbdd0a24476491b3417b0ce127c3dc8efc62c56 100644 (file)
@@ -97,6 +97,9 @@ enum {
 #define __u32_field(attr_nr, attr_flag, name)  \
        __field(attr_nr, attr_flag, name, NLA_U32, __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)  \
        __field(attr_nr, attr_flag, name, NLA_U64, __u64, \
                        nla_get_u64, NLA_PUT_U64)