btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / kernel / util / syscall_args.h
blob46eab7342c1fffe001fca104877f6146862e1f4a
1 // syscall_args.h
3 #ifndef _SYSCALL_ARGS_H
4 #define _SYSCALL_ARGS_H
6 #include <kernel.h>
9 // Hack to be able to use the IS_USER_ADDRESS macro when compiling for R5.
10 #ifdef R5_MEMORY_LAYOUT
11 # undef KERNEL_BASE
12 # define KERNEL_BASE 0x0
13 #endif
15 // copy_ref_var_from_user
16 template<typename T>
17 inline
18 status_t
19 copy_ref_var_from_user(T *user, T &kernel)
21 if (!IS_USER_ADDRESS(user))
22 return B_BAD_ADDRESS;
23 return user_memcpy(&kernel, user, sizeof(T));
26 // copy_ref_var_to_user
27 template<typename T>
28 inline
29 status_t
30 copy_ref_var_to_user(T &kernel, T *user)
32 if (!IS_USER_ADDRESS(user))
33 return B_BAD_ADDRESS;
34 return user_memcpy(user, &kernel, sizeof(T));
38 #endif // _SYSCALL_ARGS_H