mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: drbd-dev@lists.linbit.com
Subject: [PATCH 06/15] drbd: Introduce __s32_field in the genetlink macro magic
Date: Thu,  6 Oct 2011 15:37:51 +0200	[thread overview]
Message-ID: <1317908280-28951-7-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1317908280-28951-1-git-send-email-philipp.reisner@linbit.com>

From: Lars Ellenberg <lars.ellenberg@linbit.com>

...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      |    8 ++++----
 include/linux/drbd_genl.h         |    2 +-
 include/linux/genl_magic_struct.h |    3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 4efeffa..84b055f 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1289,7 +1289,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;
 	}
@@ -1325,7 +1325,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,
@@ -1361,7 +1361,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);
@@ -1392,7 +1392,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");
 	}
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 8cad681..529627b 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -104,7 +104,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)
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
index f2c7cc7..ddbdd0a 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -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)
-- 
1.7.4.1


  parent reply	other threads:[~2011-10-06 13:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 13:37 [RFC 00/15] drbd: part 15 of adding multiple volume support to drbd Philipp Reisner
2011-10-06 13:37 ` [PATCH 01/15] drbd: Removed dead code Philipp Reisner
2011-10-06 13:37 ` [PATCH 02/15] drbd: Renamed the net_conf_update mutex to conf_update Philipp Reisner
2011-10-06 13:37 ` [PATCH 03/15] drbd: drbd_dew_dev_size() gets the user requests disk_size as argument Philipp Reisner
2011-10-06 13:37 ` [PATCH 04/15] drbd: Split drbd_alter_sa() into drbd_sync_after_valid() and drbd_sync_after_changed() Philipp Reisner
2011-10-06 13:37 ` [PATCH 05/15] drbd: Renamed (old|new)_conf into (old|new)_net_conf in receive_SyncParam Philipp Reisner
2011-10-06 13:37 ` Philipp Reisner [this message]
2011-10-06 13:37 ` [PATCH 07/15] drbd: RCU for disk_conf Philipp Reisner
2011-10-06 13:37 ` [PATCH 08/15] drbd: Made the fifo object a self contained object (preparing for RCU) Philipp Reisner
2011-10-06 13:37 ` [PATCH 09/15] drbd: Enforce limits of disk_conf members; centralized these checks Philipp Reisner
2011-10-06 13:37 ` [PATCH 10/15] drbd: RCU for rs_plan_s Philipp Reisner
2011-10-06 13:37 ` [PATCH 11/15] drbd: Convert boolean flags on netlink from NLA_FLAG to NLA_U8 Philipp Reisner
2011-10-06 13:37 ` [PATCH 12/15] drbd: Turn no-disk-flushes into disk-flushes={yes|no} Philipp Reisner
2011-10-06 13:37 ` [PATCH 13/15] drbd: Turn no-disk-drain into disk-drain={yes|no} Philipp Reisner
2011-10-06 13:37 ` [PATCH 14/15] drbd: Turn no-md-flushes into md-flushes={yes|no} Philipp Reisner
2011-10-06 13:38 ` [PATCH 15/15] drbd: Turn no-tcp-cork into tcp-cork={yes|no} Philipp Reisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317908280-28951-7-git-send-email-philipp.reisner@linbit.com \
    --to=philipp.reisner@linbit.com \
    --cc=axboe@kernel.dk \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome