#ifndef _LSTDDEF_H
#define _LSTDDEF_H
-#include <stddef.h>
+#include <linux/types.h>
+#include <sys/param.h>
#define __ALIGN_LSTDDEF_MASK(x, mask) (((x) + (mask)) & ~(mask))
#define __ALIGN_LSTDDEF(x, a) __ALIGN_LSTDDEF_MASK(x, (typeof(x))(a) - 1)
# 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)); \
(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 */