X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Flstddef.h;h=46e290174af47522a3f3772c3d6d211144a0bdc5;hb=1e4d10af3909452b0eee1f99010d80aeb01d42a7;hp=c10ab0bbd54eb4e9fbc43202b5d50e54558b8381;hpb=66172e3274ca3187edd519dd87a81a478a6d7259;p=fs%2Flustre-release.git diff --git a/lustre/utils/lstddef.h b/lustre/utils/lstddef.h index c10ab0b..46e2901 100644 --- a/lustre/utils/lstddef.h +++ b/lustre/utils/lstddef.h @@ -1,7 +1,11 @@ #ifndef _LSTDDEF_H #define _LSTDDEF_H -#include +#include +#include +#include +#include +#include #define __ALIGN_LSTDDEF_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define __ALIGN_LSTDDEF(x, a) __ALIGN_LSTDDEF_MASK(x, (typeof(x))(a) - 1) @@ -29,7 +33,6 @@ #define round_up(x, y) ((((x) - 1) | __round_mask(x, y)) + 1) #define round_down(x, y) ((x) & ~__round_mask(x, y)) -#define FIELD_SIZEOF(t, f) (sizeof(((t *)0)->f)) #define DIV_ROUND_UP __USER_DIV_ROUND_UP #define DIV_ROUND_DOWN_ULL(ll, d) \ @@ -43,12 +46,6 @@ # define DIV_ROUND_UP_SECTOR_T(ll, d) DIV_ROUND_UP(ll, d) #endif -/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ -#define roundup(x, y) ({ \ - const typeof(y) __y = y; \ - (((x) + (__y - 1)) / __y) * __y; \ -}) - #define rounddown(x, y) ({ \ typeof(x) __x = (x); \ __x - (__x % (y)); \ @@ -292,4 +289,27 @@ static inline __u32 reciprocal_scale(__u32 val, __u32 ep_ro) (type *)((char *)__mptr - offsetof(type, member)); \ }) +#ifndef HAVE_COPY_FILE_RANGE + +#ifndef __NR_copy_file_range + +#if defined(_ASM_X86_UNISTD_64_H) +#define __NR_copy_file_range 326 +#elif defined(_ASM_X86_UNISTD_32_H) +#define __NR_copy_file_range 285 +#else +#define __NR_copy_file_range 285 +#endif + +#endif + +static inline loff_t copy_file_range(int fd_in, loff_t *off_in, int fd_out, + loff_t *off_out, size_t len, + unsigned int flags) +{ + return syscall(__NR_copy_file_range, fd_in, off_in, fd_out, + off_out, len, flags); +} +#endif /* !HAVE_COPY_FILE_RANGE */ + #endif /* !_LSTDDEF_H */