aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2006-03-26 04:37:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:57 -0500
commit88959ea968709c35e8b979ac9f5a398fa748091a (patch)
tree7d93892ec8d7b15cd810e4bcb75715c797e01ab3 /arch
parenteb76b3fda1f7c2aa2d1523b36835048a15e5e5d2 (diff)
[PATCH] create struct compat_timex and use it everywhere
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/ia32/sys_ia32.c15
-rw-r--r--arch/mips/kernel/linux32.c15
-rw-r--r--arch/parisc/kernel/sys_parisc32.c37
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c15
-rw-r--r--arch/s390/kernel/compat_linux.c15
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c15
-rw-r--r--arch/x86_64/ia32/sys_ia32.c19
7 files changed, 12 insertions, 119 deletions
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 13e739e4c84d..1e1a2353aefd 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2594,23 +2594,10 @@ sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
2594 2594
2595/* Handle adjtimex compatibility. */ 2595/* Handle adjtimex compatibility. */
2596 2596
2597struct timex32 {
2598 u32 modes;
2599 s32 offset, freq, maxerror, esterror;
2600 s32 status, constant, precision, tolerance;
2601 struct compat_timeval time;
2602 s32 tick;
2603 s32 ppsfreq, jitter, shift, stabil;
2604 s32 jitcnt, calcnt, errcnt, stbcnt;
2605 s32 :32; s32 :32; s32 :32; s32 :32;
2606 s32 :32; s32 :32; s32 :32; s32 :32;
2607 s32 :32; s32 :32; s32 :32; s32 :32;
2608};
2609
2610extern int do_adjtimex(struct timex *); 2597extern int do_adjtimex(struct timex *);
2611 2598
2612asmlinkage long 2599asmlinkage long
2613sys32_adjtimex(struct timex32 *utp) 2600sys32_adjtimex(struct compat_timex *utp)
2614{ 2601{
2615 struct timex txc; 2602 struct timex txc;
2616 int ret; 2603 int ret;
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 013bc93688e8..f33e779796f0 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -1159,22 +1159,9 @@ out:
1159 1159
1160/* Handle adjtimex compatibility. */ 1160/* Handle adjtimex compatibility. */
1161 1161
1162struct timex32 {
1163 u32 modes;
1164 s32 offset, freq, maxerror, esterror;
1165 s32 status, constant, precision, tolerance;
1166 struct compat_timeval time;
1167 s32 tick;
1168 s32 ppsfreq, jitter, shift, stabil;
1169 s32 jitcnt, calcnt, errcnt, stbcnt;
1170 s32 :32; s32 :32; s32 :32; s32 :32;
1171 s32 :32; s32 :32; s32 :32; s32 :32;
1172 s32 :32; s32 :32; s32 :32; s32 :32;
1173};
1174
1175extern int do_adjtimex(struct timex *); 1162extern int do_adjtimex(struct timex *);
1176 1163
1177asmlinkage int sys32_adjtimex(struct timex32 __user *utp) 1164asmlinkage int sys32_adjtimex(struct compat_timex __user *utp)
1178{ 1165{
1179 struct timex txc; 1166 struct timex txc;
1180 int ret; 1167 int ret;
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 613569018410..ca1d8dbbadf3 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -567,43 +567,14 @@ asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *off
567} 567}
568 568
569 569
570struct timex32 { 570asmlinkage long sys32_adjtimex(struct compat_timex __user *txc_p32)
571 unsigned int modes; /* mode selector */
572 int offset; /* time offset (usec) */
573 int freq; /* frequency offset (scaled ppm) */
574 int maxerror; /* maximum error (usec) */
575 int esterror; /* estimated error (usec) */
576 int status; /* clock command/status */
577 int constant; /* pll time constant */
578 int precision; /* clock precision (usec) (read only) */
579 int tolerance; /* clock frequency tolerance (ppm)
580 * (read only)
581 */
582 struct compat_timeval time; /* (read only) */
583 int tick; /* (modified) usecs between clock ticks */
584
585 int ppsfreq; /* pps frequency (scaled ppm) (ro) */
586 int jitter; /* pps jitter (us) (ro) */
587 int shift; /* interval duration (s) (shift) (ro) */
588 int stabil; /* pps stability (scaled ppm) (ro) */
589 int jitcnt; /* jitter limit exceeded (ro) */
590 int calcnt; /* calibration intervals (ro) */
591 int errcnt; /* calibration errors (ro) */
592 int stbcnt; /* stability limit exceeded (ro) */
593
594 int :32; int :32; int :32; int :32;
595 int :32; int :32; int :32; int :32;
596 int :32; int :32; int :32; int :32;
597};
598
599asmlinkage long sys32_adjtimex(struct timex32 __user *txc_p32)
600{ 571{
601 struct timex txc; 572 struct timex txc;
602 struct timex32 t32; 573 struct compat_timex t32;
603 int ret; 574 int ret;
604 extern int do_adjtimex(struct timex *txc); 575 extern int do_adjtimex(struct timex *txc);
605 576
606 if(copy_from_user(&t32, txc_p32, sizeof(struct timex32))) 577 if(copy_from_user(&t32, txc_p32, sizeof(struct compat_timex)))
607 return -EFAULT; 578 return -EFAULT;
608#undef CP 579#undef CP
609#define CP(x) txc.x = t32.x 580#define CP(x) txc.x = t32.x
@@ -620,7 +591,7 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *txc_p32)
620 CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter); 591 CP(time.tv_sec); CP(time.tv_usec); CP(tick); CP(ppsfreq); CP(jitter);
621 CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt); 592 CP(shift); CP(stabil); CP(jitcnt); CP(calcnt); CP(errcnt);
622 CP(stbcnt); 593 CP(stbcnt);
623 return copy_to_user(txc_p32, &t32, sizeof(struct timex32)) ? -EFAULT : ret; 594 return copy_to_user(txc_p32, &t32, sizeof(struct compat_timex)) ? -EFAULT : ret;
624} 595}
625 596
626 597
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index cd75ab2908fa..d9867f583c68 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -162,22 +162,9 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
162} 162}
163 163
164/* Handle adjtimex compatibility. */ 164/* Handle adjtimex compatibility. */
165struct timex32 {
166 u32 modes;
167 s32 offset, freq, maxerror, esterror;
168 s32 status, constant, precision, tolerance;
169 struct compat_timeval time;
170 s32 tick;
171 s32 ppsfreq, jitter, shift, stabil;
172 s32 jitcnt, calcnt, errcnt, stbcnt;
173 s32 :32; s32 :32; s32 :32; s32 :32;
174 s32 :32; s32 :32; s32 :32; s32 :32;
175 s32 :32; s32 :32; s32 :32; s32 :32;
176};
177
178extern int do_adjtimex(struct timex *); 165extern int do_adjtimex(struct timex *);
179 166
180asmlinkage long compat_sys_adjtimex(struct timex32 __user *utp) 167asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
181{ 168{
182 struct timex txc; 169 struct timex txc;
183 int ret; 170 int ret;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index cc058dc3bc8b..9809264f2f4d 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -707,22 +707,9 @@ asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
707 707
708/* Handle adjtimex compatibility. */ 708/* Handle adjtimex compatibility. */
709 709
710struct timex32 {
711 u32 modes;
712 s32 offset, freq, maxerror, esterror;
713 s32 status, constant, precision, tolerance;
714 struct compat_timeval time;
715 s32 tick;
716 s32 ppsfreq, jitter, shift, stabil;
717 s32 jitcnt, calcnt, errcnt, stbcnt;
718 s32 :32; s32 :32; s32 :32; s32 :32;
719 s32 :32; s32 :32; s32 :32; s32 :32;
720 s32 :32; s32 :32; s32 :32; s32 :32;
721};
722
723extern int do_adjtimex(struct timex *); 710extern int do_adjtimex(struct timex *);
724 711
725asmlinkage long sys32_adjtimex(struct timex32 __user *utp) 712asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
726{ 713{
727 struct timex txc; 714 struct timex txc;
728 int ret; 715 int ret;
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 0e41df024489..48f02f201918 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -947,22 +947,9 @@ asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
947 947
948/* Handle adjtimex compatibility. */ 948/* Handle adjtimex compatibility. */
949 949
950struct timex32 {
951 u32 modes;
952 s32 offset, freq, maxerror, esterror;
953 s32 status, constant, precision, tolerance;
954 struct compat_timeval time;
955 s32 tick;
956 s32 ppsfreq, jitter, shift, stabil;
957 s32 jitcnt, calcnt, errcnt, stbcnt;
958 s32 :32; s32 :32; s32 :32; s32 :32;
959 s32 :32; s32 :32; s32 :32; s32 :32;
960 s32 :32; s32 :32; s32 :32; s32 :32;
961};
962
963extern int do_adjtimex(struct timex *); 950extern int do_adjtimex(struct timex *);
964 951
965asmlinkage long sys32_adjtimex(struct timex32 __user *utp) 952asmlinkage long sys32_adjtimex(struct compat_timex __user *utp)
966{ 953{
967 struct timex txc; 954 struct timex txc;
968 int ret; 955 int ret;
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 2b2d029f477c..b13121e451a8 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -769,30 +769,17 @@ sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
769 769
770/* Handle adjtimex compatibility. */ 770/* Handle adjtimex compatibility. */
771 771
772struct timex32 {
773 u32 modes;
774 s32 offset, freq, maxerror, esterror;
775 s32 status, constant, precision, tolerance;
776 struct compat_timeval time;
777 s32 tick;
778 s32 ppsfreq, jitter, shift, stabil;
779 s32 jitcnt, calcnt, errcnt, stbcnt;
780 s32 :32; s32 :32; s32 :32; s32 :32;
781 s32 :32; s32 :32; s32 :32; s32 :32;
782 s32 :32; s32 :32; s32 :32; s32 :32;
783};
784
785extern int do_adjtimex(struct timex *); 772extern int do_adjtimex(struct timex *);
786 773
787asmlinkage long 774asmlinkage long
788sys32_adjtimex(struct timex32 __user *utp) 775sys32_adjtimex(struct compat_timex __user *utp)
789{ 776{
790 struct timex txc; 777 struct timex txc;
791 int ret; 778 int ret;
792 779
793 memset(&txc, 0, sizeof(struct timex)); 780 memset(&txc, 0, sizeof(struct timex));
794 781
795 if (!access_ok(VERIFY_READ, utp, sizeof(struct timex32)) || 782 if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) ||
796 __get_user(txc.modes, &utp->modes) || 783 __get_user(txc.modes, &utp->modes) ||
797 __get_user(txc.offset, &utp->offset) || 784 __get_user(txc.offset, &utp->offset) ||
798 __get_user(txc.freq, &utp->freq) || 785 __get_user(txc.freq, &utp->freq) ||
@@ -817,7 +804,7 @@ sys32_adjtimex(struct timex32 __user *utp)
817 804
818 ret = do_adjtimex(&txc); 805 ret = do_adjtimex(&txc);
819 806
820 if (!access_ok(VERIFY_WRITE, utp, sizeof(struct timex32)) || 807 if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) ||
821 __put_user(txc.modes, &utp->modes) || 808 __put_user(txc.modes, &utp->modes) ||
822 __put_user(txc.offset, &utp->offset) || 809 __put_user(txc.offset, &utp->offset) ||
823 __put_user(txc.freq, &utp->freq) || 810 __put_user(txc.freq, &utp->freq) ||