Cleanup copy helpers
cover Cleanup copy helpers
As already discussed:
The copy helpers for timespec/itimerspec elements using a temporary element on the stack work for both worlds (4 and 8 byte time_t).
This patch could be applied on top of Philippes queue, as well as on current next.
Florian Bezdeka (1):
cobalt: Remove duplicate timespec/itimerspec copy helpers
.../include/asm-generic/xenomai/syscall.h | 31 ------------------- 1 file changed, 31 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/1 cobalt: Remove duplicate timespec/itimerspec copy helpers
The variant of such helpers which are using a temporary element on the stack work in both worlds, so on systems with 4 and 8 byte time_t. To keep the code as simple as possible we can remove the __BITS_PER_LONG == 64 implementation.
--- .../include/asm-generic/xenomai/syscall.h | 31 ------------------- 1 file changed, 31 deletions(-)
kernel/cobalt/include/asm-generic/xenomai/syscall.h +0 -31
@@ -75,41 +75,12 @@ static inline int cobalt_strncpy_from_user(char *dst, const char __user *src,return __xn_strncpy_from_user (dst, src, count); } -#if __BITS_PER_LONG ==64 /* * NOTE: those copy helpers won't work in compat mode: use * sys32_get_*(), sys32_put_*() instead. */ -static inline int cobalt_get_u_timespec (struct timespec64 *dst, -const struct __user_old_timespec __user *src) -{ -return cobalt_copy_from_user (dst, src,sizeof (*dst)); -} - -static inline int cobalt_put_u_timespec ( -struct __user_old_timespec __user *dst, -const struct timespec64 *src) -{ -return cobalt_copy_to_user (dst, src,sizeof (*dst)); -} - -static inline int cobalt_get_u_itimerspec (struct itimerspec64 *dst, -const struct __user_old_itimerspec __user *src) -{ -return cobalt_copy_from_user (dst, src,sizeof (*dst)); -} - -static inline int cobalt_put_u_itimerspec ( -struct __user_old_itimerspec __user *dst, -const struct itimerspec64 *src) -{ -return cobalt_copy_to_user (dst, src,sizeof (*dst)); -} - -#else /* __BITS_PER_LONG == 32 */ -static inline int cobalt_get_u_timespec (struct timespec64 *dst,const struct __user_old_timespec __user *src) {
@@ -175,8 +146,6 @@ static inline int cobalt_put_u_itimerspec(return cobalt_copy_to_user (dst, &u_its,sizeof (*dst)); } -#endif -/* 32bit syscall emulation */ #define __COBALT_COMPAT_BIT 0x1/* 32bit syscall emulation - extended form */
Signature · 1 line
2.31.1
Jan Kiszka
AppliedRe: [PATCH wip/dovetail 1/1] cobalt: Remove duplicate timespec/itimerspec copy helpers
Quoted 58 lines · Florian Bezdeka
The variant of such helpers which are using a temporary element on the stack work in both worlds, so on systems with 4 and 8 byte
time_t. To keep the code as simple as possible we can remove the__BITS_PER_LONG== 64 implementation.Signed-off-by Florian Bezdeka <[email protected]>--- .../include/asm-generic/xenomai/syscall.h | 31 ------------------- 1 file changed, 31 deletions(-)kernel/cobalt/include/asm-generic/xenomai/syscall.h +0
-29@@ -75,41 +75,12 @@ static inline int cobalt_strncpy_from_user(char *dst, const char __user *src,return __xn_strncpy_from_user (dst, src, count); } -#if __BITS_PER_LONG ==64 /* * NOTE: those copy helpers won't work in compat mode: use * sys32_get_*(), sys32_put_*() instead. */ -static inline int cobalt_get_u_timespec (struct timespec64 *dst, -const struct __user_old_timespec __user *src) -{ -return cobalt_copy_from_user (dst, src,sizeof (*dst)); -} - -static inline int cobalt_put_u_timespec ( -struct __user_old_timespec __user *dst, -const struct timespec64 *src) -{ -return cobalt_copy_to_user (dst, src,sizeof (*dst)); -} - -static inline int cobalt_get_u_itimerspec (struct itimerspec64 *dst, -const struct __user_old_itimerspec __user *src) -{ -return cobalt_copy_from_user (dst, src,sizeof (*dst)); -} - -static inline int cobalt_put_u_itimerspec ( -struct __user_old_itimerspec __user *dst, -const struct itimerspec64 *src) -{ -return cobalt_copy_to_user (dst, src,sizeof (*dst)); -} - -#else /* __BITS_PER_LONG == 32 */ -static inline int cobalt_get_u_timespec (struct timespec64 *dst,const struct __user_old_timespec __user *src) {
kernel/cobalt/include/asm-generic/xenomai/syscall.h static inline int cobalt_put_u_itimerspec( · line 151
Quoted 8 lines
kernel/cobalt/include/asm-generic/xenomai/syscall.h +0
-2@@ -175,8 +146,6 @@ static inline int cobalt_put_u_itimerspec(return cobalt_copy_to_user (dst, &u_its,sizeof (*dst)); } -#endif -/* 32bit syscall emulation */ #define __COBALT_COMPAT_BIT 0x1/* 32bit syscall emulation - extended form */
Thanks, applied to next.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux