]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] create struct compat_timex and use it everywhere
authorStephen Rothwell <sfr@canb.auug.org.au>
Sun, 26 Mar 2006 09:37:27 +0000 (01:37 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 26 Mar 2006 16:56:57 +0000 (08:56 -0800)
We had a copy of the compatibility version of struct timex in each 64 bit
architecture.  This patch just creates a global one and replaces all the
usages of the old ones.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kyle McMartin <kyle@parisc-linux.org>
Acked-by: Tony Luck <tony.luck@intel.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ia64/ia32/sys_ia32.c
arch/mips/kernel/linux32.c
arch/parisc/kernel/sys_parisc32.c
arch/powerpc/kernel/sys_ppc32.c
arch/s390/kernel/compat_linux.c
arch/sparc64/kernel/sys_sparc32.c
arch/x86_64/ia32/sys_ia32.c
include/linux/compat.h

index 13e739e4c84d9827ca49506175a1fabfb225f1ae..1e1a2353aefd02d672e039f3f73beff92f73c211 100644 (file)
@@ -2594,23 +2594,10 @@ sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
 
 /* Handle adjtimex compatibility. */
 
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
 asmlinkage long
-sys32_adjtimex(struct timex32 *utp)
+sys32_adjtimex(struct compat_timex *utp)
 {
        struct timex txc;
        int ret;
index 013bc93688e8a3dd28caf15da957da976998d05b..f33e779796f0603b79cfd5c63948bfc0535ad4ba 100644 (file)
@@ -1159,22 +1159,9 @@ out:
 
 /* Handle adjtimex compatibility. */
 
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
-asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
+asmlinkage int sys32_adjtimex(struct compat_timex __user *utp)
 {
        struct timex txc;
        int ret;
index 61356901841093163f7deb95fa46c045179d0d65..ca1d8dbbadf373e666b3b38ea3197a0ad967f4bb 100644 (file)
@@ -567,43 +567,14 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off
 }
 
 
-struct timex32 {
-       unsigned int modes;     /* mode selector */
-       int offset;             /* time offset (usec) */
-       int freq;               /* frequency offset (scaled ppm) */
-       int maxerror;           /* maximum error (usec) */
-       int esterror;           /* estimated error (usec) */
-       int status;             /* clock command/status */
-       int constant;           /* pll time constant */
-       int precision;          /* clock precision (usec) (read only) */
-       int tolerance;          /* clock frequency tolerance (ppm)
-                                * (read only)
-                                */
-       struct compat_timeval time;     /* (read only) */
-       int tick;               /* (modified) usecs between clock ticks */
-
-       int ppsfreq;           /* pps frequency (scaled ppm) (ro) */
-       int jitter;            /* pps jitter (us) (ro) */
-       int shift;              /* interval duration (s) (shift) (ro) */
-       int stabil;            /* pps stability (scaled ppm) (ro) */
-       int jitcnt;            /* jitter limit exceeded (ro) */
-       int calcnt;            /* calibration intervals (ro) */
-       int errcnt;            /* calibration errors (ro) */
-       int stbcnt;            /* stability limit exceeded (ro) */
-
-       int  :32; int  :32; int  :32; int  :32;
-       int  :32; int  :32; int  :32; int  :32;
-       int  :32; int  :32; int  :32; int  :32;
-};
-
-asmlinkage long sys32_adjtimex(struct timex32 __user *txc_p32)
+asmlinkage long sys32_adjtimex(struct compat_timex __user *txc_p32)
 {
        struct timex txc;
-       struct timex32 t32;
+       struct compat_timex t32;
        int ret;
        extern int do_adjtimex(struct timex *txc);
 
-       if(copy_from_user(&t32, txc_p32, sizeof(struct timex32)))
+       if(copy_from_user(&t32, txc_p32, sizeof(struct compat_timex)))
                return -EFAULT;
 #undef CP
 #define CP(x) txc.x = t32.x
@@ -620,7 +591,7 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *txc_p32)
        CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter);
        CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt);
        CP(stbcnt);
-       return copy_to_user(txc_p32, &t32, sizeof(struct timex32)) ? -EFAULT : ret;
+       return copy_to_user(txc_p32, &t32, sizeof(struct compat_timex)) ? -EFAULT : ret;
 }
 
 
index cd75ab2908fa851e9b34043f0c74f3b0322f957c..d9867f583c68495a02c61d5436614baf5dda0741 100644 (file)
@@ -162,22 +162,9 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
 }
 
 /* Handle adjtimex compatibility. */
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
-asmlinkage long compat_sys_adjtimex(struct timex32 __user *utp)
+asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
 {
        struct timex txc;
        int ret;
index cc058dc3bc8b96ad06ecd63c24c978a35a28eb7a..9809264f2f4d24edf18d6eee2f863699dc34e3fe 100644 (file)
@@ -707,22 +707,9 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
 
 /* Handle adjtimex compatibility. */
 
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
-asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
+asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
 {
        struct timex txc;
        int ret;
index 0e41df024489d3b981f726193a3ebbf50a807868..48f02f2019182e34aa82cc328090f3485ef91fbc 100644 (file)
@@ -947,22 +947,9 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
 
 /* Handle adjtimex compatibility. */
 
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
-asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
+asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
 {
        struct timex txc;
        int ret;
index 2b2d029f477ca4866caace5da4950fd5a17fa490..b13121e451a83839fbd364a5992db76da6b35c90 100644 (file)
@@ -769,30 +769,17 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
 
 /* Handle adjtimex compatibility. */
 
-struct timex32 {
-       u32 modes;
-       s32 offset, freq, maxerror, esterror;
-       s32 status, constant, precision, tolerance;
-       struct compat_timeval time;
-       s32 tick;
-       s32 ppsfreq, jitter, shift, stabil;
-       s32 jitcnt, calcnt, errcnt, stbcnt;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-       s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
 extern int do_adjtimex(struct timex *);
 
 asmlinkage long
-sys32_adjtimex(struct timex32 __user *utp)
+sys32_adjtimex(struct compat_timex __user *utp)
 {
        struct timex txc;
        int ret;
 
        memset(&txc, 0, sizeof(struct timex));
 
-       if (!access_ok(VERIFY_READ, utp, sizeof(struct timex32)) ||
+       if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
           __get_user(txc.modes, &utp->modes) ||
           __get_user(txc.offset, &utp->offset) ||
           __get_user(txc.freq, &utp->freq) ||
@@ -817,7 +804,7 @@ sys32_adjtimex(struct timex32 __user *utp)
 
        ret = do_adjtimex(&txc);
 
-       if (!access_ok(VERIFY_WRITE, utp, sizeof(struct timex32)) ||
+       if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
           __put_user(txc.modes, &utp->modes) ||
           __put_user(txc.offset, &utp->offset) ||
           __put_user(txc.freq, &utp->freq) ||
index c9ab2a26348cd6ff058f82e33d448e2313655783..859f95700d36bb31b677577d081fa0af0d2b4f6b 100644 (file)
@@ -45,6 +45,32 @@ struct compat_tms {
        compat_clock_t          tms_cstime;
 };
 
+struct compat_timex {
+       compat_uint_t modes;
+       compat_long_t offset;
+       compat_long_t freq;
+       compat_long_t maxerror;
+       compat_long_t esterror;
+       compat_int_t status;
+       compat_long_t constant;
+       compat_long_t precision;
+       compat_long_t tolerance;
+       struct compat_timeval time;
+       compat_long_t tick;
+       compat_long_t ppsfreq;
+       compat_long_t jitter;
+       compat_int_t shift;
+       compat_long_t stabil;
+       compat_long_t jitcnt;
+       compat_long_t calcnt;
+       compat_long_t errcnt;
+       compat_long_t stbcnt;
+
+       compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
+       compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
+       compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
+};
+
 #define _COMPAT_NSIG_WORDS     (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
 
 typedef struct {