aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-03-17 16:50:49 -0500
committerRalf Baechle <ralf@linux-mips.org>2005-10-29 14:30:57 -0400
commit1592dac2410511d24836e18d416b1d02c678322b (patch)
tree2cd73f3693b3c3c8df895459690f2a02c4653803
parentb4dbf95e3080cf43a27cc324bfa0975f88174d07 (diff)
Reformatting, remove debugging code.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/kernel/irixioctl.c63
-rw-r--r--include/asm-mips/inventory.h8
2 files changed, 32 insertions, 39 deletions
diff --git a/arch/mips/kernel/irixioctl.c b/arch/mips/kernel/irixioctl.c
index 3cdc22346f4c..e2863821a3dd 100644
--- a/arch/mips/kernel/irixioctl.c
+++ b/arch/mips/kernel/irixioctl.c
@@ -59,7 +59,7 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
59{ 59{
60 struct tty_struct *tp, *rtp; 60 struct tty_struct *tp, *rtp;
61 mm_segment_t old_fs; 61 mm_segment_t old_fs;
62 int error = 0; 62 int i, error = 0;
63 63
64#ifdef DEBUG_IOCTLS 64#ifdef DEBUG_IOCTLS
65 printk("[%s:%d] irix_ioctl(%d, ", current->comm, current->pid, fd); 65 printk("[%s:%d] irix_ioctl(%d, ", current->comm, current->pid, fd);
@@ -74,12 +74,13 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
74 74
75 case 0x0000540d: { 75 case 0x0000540d: {
76 struct termios kt; 76 struct termios kt;
77 struct irix_termios *it = (struct irix_termios *) arg; 77 struct irix_termios __user *it =
78 (struct irix_termios __user *) arg;
78 79
79#ifdef DEBUG_IOCTLS 80#ifdef DEBUG_IOCTLS
80 printk("TCGETS, %08lx) ", arg); 81 printk("TCGETS, %08lx) ", arg);
81#endif 82#endif
82 if(!access_ok(VERIFY_WRITE, it, sizeof(*it))) { 83 if (!access_ok(VERIFY_WRITE, it, sizeof(*it))) {
83 error = -EFAULT; 84 error = -EFAULT;
84 break; 85 break;
85 } 86 }
@@ -88,13 +89,14 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
88 set_fs(old_fs); 89 set_fs(old_fs);
89 if (error) 90 if (error)
90 break; 91 break;
91 __put_user(kt.c_iflag, &it->c_iflag); 92
92 __put_user(kt.c_oflag, &it->c_oflag); 93 error = __put_user(kt.c_iflag, &it->c_iflag);
93 __put_user(kt.c_cflag, &it->c_cflag); 94 error |= __put_user(kt.c_oflag, &it->c_oflag);
94 __put_user(kt.c_lflag, &it->c_lflag); 95 error |= __put_user(kt.c_cflag, &it->c_cflag);
95 for(error = 0; error < NCCS; error++) 96 error |= __put_user(kt.c_lflag, &it->c_lflag);
96 __put_user(kt.c_cc[error], &it->c_cc[error]); 97
97 error = 0; 98 for (i = 0; i < NCCS; i++)
99 error |= __put_user(kt.c_cc[i], &it->c_cc[i]);
98 break; 100 break;
99 } 101 }
100 102
@@ -112,14 +114,19 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
112 old_fs = get_fs(); set_fs(get_ds()); 114 old_fs = get_fs(); set_fs(get_ds());
113 error = sys_ioctl(fd, TCGETS, (unsigned long) &kt); 115 error = sys_ioctl(fd, TCGETS, (unsigned long) &kt);
114 set_fs(old_fs); 116 set_fs(old_fs);
115 if(error) 117 if (error)
118 break;
119
120 error = __get_user(kt.c_iflag, &it->c_iflag);
121 error |= __get_user(kt.c_oflag, &it->c_oflag);
122 error |= __get_user(kt.c_cflag, &it->c_cflag);
123 error |= __get_user(kt.c_lflag, &it->c_lflag);
124
125 for (i = 0; i < NCCS; i++)
126 error |= __get_user(kt.c_cc[i], &it->c_cc[i]);
127
128 if (error)
116 break; 129 break;
117 __get_user(kt.c_iflag, &it->c_iflag);
118 __get_user(kt.c_oflag, &it->c_oflag);
119 __get_user(kt.c_cflag, &it->c_cflag);
120 __get_user(kt.c_lflag, &it->c_lflag);
121 for(error = 0; error < NCCS; error++)
122 __get_user(kt.c_cc[error], &it->c_cc[error]);
123 old_fs = get_fs(); set_fs(get_ds()); 130 old_fs = get_fs(); set_fs(get_ds());
124 error = sys_ioctl(fd, TCSETS, (unsigned long) &kt); 131 error = sys_ioctl(fd, TCSETS, (unsigned long) &kt);
125 set_fs(old_fs); 132 set_fs(old_fs);
@@ -153,7 +160,7 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
153#ifdef DEBUG_IOCTLS 160#ifdef DEBUG_IOCTLS
154 printk("rtp->session=%d ", rtp->session); 161 printk("rtp->session=%d ", rtp->session);
155#endif 162#endif
156 error = put_user(rtp->session, (unsigned long *) arg); 163 error = put_user(rtp->session, (unsigned long __user *) arg);
157 break; 164 break;
158 165
159 case 0x746e: 166 case 0x746e:
@@ -195,50 +202,32 @@ asmlinkage int irix_ioctl(int fd, unsigned long cmd, unsigned long arg)
195 break; 202 break;
196 203
197 case 0x8004667e: 204 case 0x8004667e:
198#ifdef DEBUG_IOCTLS
199 printk("FIONBIO, %08lx) arg=%d ", arg, *(int *)arg);
200#endif
201 error = sys_ioctl(fd, FIONBIO, arg); 205 error = sys_ioctl(fd, FIONBIO, arg);
202 break; 206 break;
203 207
204 case 0x80047476: 208 case 0x80047476:
205#ifdef DEBUG_IOCTLS
206 printk("TIOCSPGRP, %08lx) arg=%d ", arg, *(int *)arg);
207#endif
208 error = sys_ioctl(fd, TIOCSPGRP, arg); 209 error = sys_ioctl(fd, TIOCSPGRP, arg);
209 break; 210 break;
210 211
211 case 0x8020690c: 212 case 0x8020690c:
212#ifdef DEBUG_IOCTLS
213 printk("SIOCSIFADDR, %08lx) arg=%d ", arg, *(int *)arg);
214#endif
215 error = sys_ioctl(fd, SIOCSIFADDR, arg); 213 error = sys_ioctl(fd, SIOCSIFADDR, arg);
216 break; 214 break;
217 215
218 case 0x80206910: 216 case 0x80206910:
219#ifdef DEBUG_IOCTLS
220 printk("SIOCSIFFLAGS, %08lx) arg=%d ", arg, *(int *)arg);
221#endif
222 error = sys_ioctl(fd, SIOCSIFFLAGS, arg); 217 error = sys_ioctl(fd, SIOCSIFFLAGS, arg);
223 break; 218 break;
224 219
225 case 0xc0206911: 220 case 0xc0206911:
226#ifdef DEBUG_IOCTLS
227 printk("SIOCGIFFLAGS, %08lx) arg=%d ", arg, *(int *)arg);
228#endif
229 error = sys_ioctl(fd, SIOCGIFFLAGS, arg); 221 error = sys_ioctl(fd, SIOCGIFFLAGS, arg);
230 break; 222 break;
231 223
232 case 0xc020691b: 224 case 0xc020691b:
233#ifdef DEBUG_IOCTLS
234 printk("SIOCGIFMETRIC, %08lx) arg=%d ", arg, *(int *)arg);
235#endif
236 error = sys_ioctl(fd, SIOCGIFMETRIC, arg); 225 error = sys_ioctl(fd, SIOCGIFMETRIC, arg);
237 break; 226 break;
238 227
239 default: { 228 default: {
240#ifdef DEBUG_MISSING_IOCTL 229#ifdef DEBUG_MISSING_IOCTL
241 char *msg = "Unimplemented IOCTL cmd tell linux@engr.sgi.com\n"; 230 char *msg = "Unimplemented IOCTL cmd tell linux-mips@linux-mips.org\n";
242 231
243#ifdef DEBUG_IOCTLS 232#ifdef DEBUG_IOCTLS
244 printk("UNIMP_IOCTL, %08lx)\n", arg); 233 printk("UNIMP_IOCTL, %08lx)\n", arg);
diff --git a/include/asm-mips/inventory.h b/include/asm-mips/inventory.h
index 4cd36fe98173..92d90f75a636 100644
--- a/include/asm-mips/inventory.h
+++ b/include/asm-mips/inventory.h
@@ -4,6 +4,8 @@
4#ifndef __ASM_INVENTORY_H 4#ifndef __ASM_INVENTORY_H
5#define __ASM_INVENTORY_H 5#define __ASM_INVENTORY_H
6 6
7#include <linux/compiler.h>
8
7typedef struct inventory_s { 9typedef struct inventory_s {
8 struct inventory_s *inv_next; 10 struct inventory_s *inv_next;
9 int inv_class; 11 int inv_class;
@@ -14,7 +16,9 @@ typedef struct inventory_s {
14} inventory_t; 16} inventory_t;
15 17
16extern int inventory_items; 18extern int inventory_items;
17void add_to_inventory (int class, int type, int controller, int unit, int state); 19
18int dump_inventory_to_user (void *userbuf, int size); 20extern void add_to_inventory (int class, int type, int controller, int unit, int state);
21extern int dump_inventory_to_user (void __user *userbuf, int size);
22extern int __init init_inventory(void);
19 23
20#endif /* __ASM_INVENTORY_H */ 24#endif /* __ASM_INVENTORY_H */