lkml.org 
[lkml]   [2014]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] drbd: change one-bit bitfield to be an unsigned int
Date
The one-bit bitfields are assigned true (1) or false (0) and checked
for them respectively. While it should work either way and -1 is true
as well it is more clear to see what's going on when using an unsigned int
because 1 doesn't silently become -1 behind the label true.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
---
Thanks for looking at it. This is more of a question: Does this make sense
to you now? I can be mistaken. It just wasn't totally clear to me at first
sight and even though it should be, why not try to improve it.

sparse called it 'dubious' before the change.

(built but untested)

drivers/block/drbd/drbd_interval.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_interval.h b/drivers/block/drbd/drbd_interval.h
index f38fcb0..8d670e6 100644
--- a/drivers/block/drbd/drbd_interval.h
+++ b/drivers/block/drbd/drbd_interval.h
@@ -9,8 +9,8 @@ struct drbd_interval {
sector_t sector; /* start sector of the interval */
unsigned int size; /* size in bytes */
sector_t end; /* highest interval end in subtree */
- int local:1 /* local or remote request? */;
- int waiting:1;
+ unsigned int local:1; /* local or remote request? */
+ unsigned int waiting:1;
};

static inline void drbd_clear_interval(struct drbd_interval *i)
--
1.7.10.4


\
 
 \ /
  Last update: 2014-06-17 09:21    [W:0.278 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site