Re: [PATCH] compat: generic compat get/settimeofday

Previous thread: new: regression iwl3945/mac80211 endless after suspend associate/deassociate loop by Michael S. Tsirkin on Monday, September 1, 2008 - 9:07 am. (14 messages)

Next thread: [PATCH] proc: proc_sys_root tweak by Alexey Dobriyan on Monday, September 1, 2008 - 9:41 am. (1 message)
From: Christoph Hellwig
Date: Monday, September 1, 2008 - 9:22 am

Nothing arch specific in get/settimeofday.  The details of the timeval
conversion varied a little from arch to arch, but all with the same
results.

Also add an extern declaration for sys_tz to linux/time.h because
externs in .c files are fowned upon.  I'll kill the externs in various
other files in a sparate patch.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/arch/powerpc/kernel/sys_ppc32.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/sys_ppc32.c	2008-09-01 09:31:49.000000000 -0300
+++ linux-2.6/arch/powerpc/kernel/sys_ppc32.c	2008-09-01 09:32:42.000000000 -0300
@@ -71,69 +71,6 @@ asmlinkage long compat_sys_sysfs(u32 opt
 	return sys_sysfs((int)option, arg1, arg2);
 }
 
-static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
-{
-	long usec;
-
-	if (!access_ok(VERIFY_READ, i, sizeof(*i)))
-		return -EFAULT;
-	if (__get_user(o->tv_sec, &i->tv_sec))
-		return -EFAULT;
-	if (__get_user(usec, &i->tv_usec))
-		return -EFAULT;
-	o->tv_nsec = usec * 1000;
-	return 0;
-}
-
-static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
-{
-	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
-		(__put_user(i->tv_sec, &o->tv_sec) |
-		 __put_user(i->tv_usec, &o->tv_usec)));
-}
-
-
-
-
-/* Translations due to time_t size differences.  Which affects all
-   sorts of things, like timeval and itimerval.  */
-extern struct timezone sys_tz;
-
-asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
-{
-	if (tv) {
-		struct timeval ktv;
-		do_gettimeofday(&ktv);
-		if (put_tv32(tv, &ktv))
-			return -EFAULT;
-	}
-	if (tz) {
-		if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
-			return -EFAULT;
-	}
-	
-	return 0;
-}
-
-
-
-asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
-{
-	struct timespec kts;
-	struct timezone ktz;
-	
- 	if (tv) ...
From: Ingo Molnar
Date: Saturday, September 6, 2008 - 8:57 am

Acked-by: Ingo Molnar <mingo@elte.hu>

	Ingo
--

Previous thread: new: regression iwl3945/mac80211 endless after suspend associate/deassociate loop by Michael S. Tsirkin on Monday, September 1, 2008 - 9:07 am. (14 messages)

Next thread: [PATCH] proc: proc_sys_root tweak by Alexey Dobriyan on Monday, September 1, 2008 - 9:41 am. (1 message)