diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-02-06 12:51:58 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-06 12:51:58 -0500 |
commit | 82ac34581e8fae6ef3f84758361c75f5b30c576d (patch) | |
tree | b7bb32f9e4b4f5989cc148543bf2782abb0a1c93 /kerncompat.h | |
parent | 7b1c567c84a6292c138db3bd1638e19e73e0e593 (diff) | |
parent | 2986545ccd655273658e0e4463a669bb1893ba68 (diff) |
Merge branch 'cov-fixes-v1-integration-20130201' of http://git.zabbo.net/cgit/btrfs-progs into merged
Diffstat (limited to 'kerncompat.h')
-rw-r--r-- | kerncompat.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kerncompat.h b/kerncompat.h index 0ab2baf9..9c116b4f 100644 --- a/kerncompat.h +++ b/kerncompat.h @@ -207,6 +207,16 @@ static inline long IS_ERR(const void *ptr) ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) /* + * This looks more complex than it should be. But we need to + * get the type for the ~ right in round_down (it needs to be + * as wide as the result!), and we want to evaluate the macro + * arguments just once each. + */ +#define __round_mask(x, y) ((__typeof__(x))((y)-1)) +#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down(x, y) ((x) & ~__round_mask(x, y)) + +/* * printk */ #define printk(fmt, args...) fprintf(stderr, fmt, ##args) |