[PATCH 08/11] Generalize ROUND_UP() macro and introduce matching ROUND_UP_PTR()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
 mdadm.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mdadm.h b/mdadm.h
index 45198bb..314f3ac 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1252,10 +1252,10 @@ static inline int dev2minor(int d)
 	return (-1-d) << MdpMinorShift;
-static inline int ROUND_UP(int a, int base)
-	return ((a+base-1)/base)*base;
+#define _ROUND_UP(val, base)	(((val) + (base)) & ~(base - 1))
+#define ROUND_UP(val, base)	_ROUND_UP(val, (typeof(val))(base))
+#define ROUND_UP_PTR(ptr, base)	((typeof(ptr)) \
+				 (ROUND_UP((unsigned long)(ptr), base)))
 static inline int is_subarray(char *vers)

To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[ATA RAID]     [Linux SCSI Target Infrastructure]     [Managing RAID on Linux]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device-Mapper]     [Kernel]     [Linux Books]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Photos]     [Yosemite Photos]     [Yosemite News]     [AMD 64]     [Linux Networking]

Add to Google Powered by Linux