diff options
author | Christoph Hellwig <hch@lst.de> | 2005-11-17 16:41:26 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@parisc-linux.org> | 2005-11-17 16:41:26 -0500 |
commit | 784412f74c0f74dac8ba30a4713273423c2ae155 (patch) | |
tree | 527c35d66e4987296f4aed9929617836e3e897d8 | |
parent | ad7dd338fbb82ea54a866b369c4c9a78cfd16234 (diff) |
[PARISC] remove drm compat ioctls handlers
Remove drm compat_ioctl handlers. The drm drivers have proper
compat_ioctl methods these days.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
-rw-r--r-- | arch/parisc/kernel/ioctl32.c | 541 |
1 files changed, 0 insertions, 541 deletions
diff --git a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c index 5da44c3d62ec..4eada1bb27f0 100644 --- a/arch/parisc/kernel/ioctl32.c +++ b/arch/parisc/kernel/ioctl32.c | |||
@@ -19,536 +19,6 @@ | |||
19 | #define CODE | 19 | #define CODE |
20 | #include "compat_ioctl.c" | 20 | #include "compat_ioctl.c" |
21 | 21 | ||
22 | /* Use this to get at 32-bit user passed pointers. | ||
23 | See sys_sparc32.c for description about these. */ | ||
24 | #define A(__x) ((unsigned long)(__x)) | ||
25 | /* The same for use with copy_from_user() and copy_to_user(). */ | ||
26 | #define B(__x) ((void *)(unsigned long)(__x)) | ||
27 | |||
28 | #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE) | ||
29 | /* This really belongs in include/linux/drm.h -DaveM */ | ||
30 | #include "../../../drivers/char/drm/drm.h" | ||
31 | |||
32 | typedef struct drm32_version { | ||
33 | int version_major; /* Major version */ | ||
34 | int version_minor; /* Minor version */ | ||
35 | int version_patchlevel;/* Patch level */ | ||
36 | int name_len; /* Length of name buffer */ | ||
37 | u32 name; /* Name of driver */ | ||
38 | int date_len; /* Length of date buffer */ | ||
39 | u32 date; /* User-space buffer to hold date */ | ||
40 | int desc_len; /* Length of desc buffer */ | ||
41 | u32 desc; /* User-space buffer to hold desc */ | ||
42 | } drm32_version_t; | ||
43 | #define DRM32_IOCTL_VERSION DRM_IOWR(0x00, drm32_version_t) | ||
44 | |||
45 | static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
46 | { | ||
47 | drm32_version_t *uversion = (drm32_version_t *)arg; | ||
48 | char *name_ptr, *date_ptr, *desc_ptr; | ||
49 | u32 tmp1, tmp2, tmp3; | ||
50 | drm_version_t kversion; | ||
51 | mm_segment_t old_fs; | ||
52 | int ret; | ||
53 | |||
54 | memset(&kversion, 0, sizeof(kversion)); | ||
55 | if (get_user(kversion.name_len, &uversion->name_len) || | ||
56 | get_user(kversion.date_len, &uversion->date_len) || | ||
57 | get_user(kversion.desc_len, &uversion->desc_len) || | ||
58 | get_user(tmp1, &uversion->name) || | ||
59 | get_user(tmp2, &uversion->date) || | ||
60 | get_user(tmp3, &uversion->desc)) | ||
61 | return -EFAULT; | ||
62 | |||
63 | name_ptr = (char *) A(tmp1); | ||
64 | date_ptr = (char *) A(tmp2); | ||
65 | desc_ptr = (char *) A(tmp3); | ||
66 | |||
67 | ret = -ENOMEM; | ||
68 | if (kversion.name_len && name_ptr) { | ||
69 | kversion.name = kmalloc(kversion.name_len, GFP_KERNEL); | ||
70 | if (!kversion.name) | ||
71 | goto out; | ||
72 | } | ||
73 | if (kversion.date_len && date_ptr) { | ||
74 | kversion.date = kmalloc(kversion.date_len, GFP_KERNEL); | ||
75 | if (!kversion.date) | ||
76 | goto out; | ||
77 | } | ||
78 | if (kversion.desc_len && desc_ptr) { | ||
79 | kversion.desc = kmalloc(kversion.desc_len, GFP_KERNEL); | ||
80 | if (!kversion.desc) | ||
81 | goto out; | ||
82 | } | ||
83 | |||
84 | old_fs = get_fs(); | ||
85 | set_fs(KERNEL_DS); | ||
86 | ret = sys_ioctl (fd, DRM_IOCTL_VERSION, (unsigned long)&kversion); | ||
87 | set_fs(old_fs); | ||
88 | |||
89 | if (!ret) { | ||
90 | if ((kversion.name && | ||
91 | copy_to_user(name_ptr, kversion.name, kversion.name_len)) || | ||
92 | (kversion.date && | ||
93 | copy_to_user(date_ptr, kversion.date, kversion.date_len)) || | ||
94 | (kversion.desc && | ||
95 | copy_to_user(desc_ptr, kversion.desc, kversion.desc_len))) | ||
96 | ret = -EFAULT; | ||
97 | if (put_user(kversion.version_major, &uversion->version_major) || | ||
98 | put_user(kversion.version_minor, &uversion->version_minor) || | ||
99 | put_user(kversion.version_patchlevel, &uversion->version_patchlevel) || | ||
100 | put_user(kversion.name_len, &uversion->name_len) || | ||
101 | put_user(kversion.date_len, &uversion->date_len) || | ||
102 | put_user(kversion.desc_len, &uversion->desc_len)) | ||
103 | ret = -EFAULT; | ||
104 | } | ||
105 | |||
106 | out: | ||
107 | kfree(kversion.name); | ||
108 | kfree(kversion.date); | ||
109 | kfree(kversion.desc); | ||
110 | return ret; | ||
111 | } | ||
112 | |||
113 | typedef struct drm32_unique { | ||
114 | int unique_len; /* Length of unique */ | ||
115 | u32 unique; /* Unique name for driver instantiation */ | ||
116 | } drm32_unique_t; | ||
117 | #define DRM32_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm32_unique_t) | ||
118 | #define DRM32_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm32_unique_t) | ||
119 | |||
120 | static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
121 | { | ||
122 | drm32_unique_t *uarg = (drm32_unique_t *)arg; | ||
123 | drm_unique_t karg; | ||
124 | mm_segment_t old_fs; | ||
125 | char *uptr; | ||
126 | u32 tmp; | ||
127 | int ret; | ||
128 | |||
129 | if (get_user(karg.unique_len, &uarg->unique_len)) | ||
130 | return -EFAULT; | ||
131 | karg.unique = NULL; | ||
132 | |||
133 | if (get_user(tmp, &uarg->unique)) | ||
134 | return -EFAULT; | ||
135 | |||
136 | uptr = (char *) A(tmp); | ||
137 | |||
138 | if (uptr) { | ||
139 | karg.unique = kmalloc(karg.unique_len, GFP_KERNEL); | ||
140 | if (!karg.unique) | ||
141 | return -ENOMEM; | ||
142 | if (cmd == DRM32_IOCTL_SET_UNIQUE && | ||
143 | copy_from_user(karg.unique, uptr, karg.unique_len)) { | ||
144 | kfree(karg.unique); | ||
145 | return -EFAULT; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | old_fs = get_fs(); | ||
150 | set_fs(KERNEL_DS); | ||
151 | if (cmd == DRM32_IOCTL_GET_UNIQUE) | ||
152 | ret = sys_ioctl (fd, DRM_IOCTL_GET_UNIQUE, (unsigned long)&karg); | ||
153 | else | ||
154 | ret = sys_ioctl (fd, DRM_IOCTL_SET_UNIQUE, (unsigned long)&karg); | ||
155 | set_fs(old_fs); | ||
156 | |||
157 | if (!ret) { | ||
158 | if (cmd == DRM32_IOCTL_GET_UNIQUE && | ||
159 | uptr != NULL && | ||
160 | copy_to_user(uptr, karg.unique, karg.unique_len)) | ||
161 | ret = -EFAULT; | ||
162 | if (put_user(karg.unique_len, &uarg->unique_len)) | ||
163 | ret = -EFAULT; | ||
164 | } | ||
165 | |||
166 | kfree(karg.unique); | ||
167 | return ret; | ||
168 | } | ||
169 | |||
170 | typedef struct drm32_map { | ||
171 | u32 offset; /* Requested physical address (0 for SAREA)*/ | ||
172 | u32 size; /* Requested physical size (bytes) */ | ||
173 | drm_map_type_t type; /* Type of memory to map */ | ||
174 | drm_map_flags_t flags; /* Flags */ | ||
175 | u32 handle; /* User-space: "Handle" to pass to mmap */ | ||
176 | /* Kernel-space: kernel-virtual address */ | ||
177 | int mtrr; /* MTRR slot used */ | ||
178 | /* Private data */ | ||
179 | } drm32_map_t; | ||
180 | #define DRM32_IOCTL_ADD_MAP DRM_IOWR(0x15, drm32_map_t) | ||
181 | |||
182 | static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
183 | { | ||
184 | drm32_map_t *uarg = (drm32_map_t *) arg; | ||
185 | drm_map_t karg; | ||
186 | mm_segment_t old_fs; | ||
187 | u32 tmp; | ||
188 | int ret; | ||
189 | |||
190 | ret = get_user(karg.offset, &uarg->offset); | ||
191 | ret |= get_user(karg.size, &uarg->size); | ||
192 | ret |= get_user(karg.type, &uarg->type); | ||
193 | ret |= get_user(karg.flags, &uarg->flags); | ||
194 | ret |= get_user(tmp, &uarg->handle); | ||
195 | ret |= get_user(karg.mtrr, &uarg->mtrr); | ||
196 | if (ret) | ||
197 | return -EFAULT; | ||
198 | |||
199 | karg.handle = (void *) A(tmp); | ||
200 | |||
201 | old_fs = get_fs(); | ||
202 | set_fs(KERNEL_DS); | ||
203 | ret = sys_ioctl(fd, DRM_IOCTL_ADD_MAP, (unsigned long) &karg); | ||
204 | set_fs(old_fs); | ||
205 | |||
206 | if (!ret) { | ||
207 | ret = put_user(karg.offset, &uarg->offset); | ||
208 | ret |= put_user(karg.size, &uarg->size); | ||
209 | ret |= put_user(karg.type, &uarg->type); | ||
210 | ret |= put_user(karg.flags, &uarg->flags); | ||
211 | tmp = (u32) (long)karg.handle; | ||
212 | ret |= put_user(tmp, &uarg->handle); | ||
213 | ret |= put_user(karg.mtrr, &uarg->mtrr); | ||
214 | if (ret) | ||
215 | ret = -EFAULT; | ||
216 | } | ||
217 | |||
218 | return ret; | ||
219 | } | ||
220 | |||
221 | typedef struct drm32_buf_info { | ||
222 | int count; /* Entries in list */ | ||
223 | u32 list; /* (drm_buf_desc_t *) */ | ||
224 | } drm32_buf_info_t; | ||
225 | #define DRM32_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm32_buf_info_t) | ||
226 | |||
227 | static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
228 | { | ||
229 | drm32_buf_info_t *uarg = (drm32_buf_info_t *)arg; | ||
230 | drm_buf_desc_t *ulist; | ||
231 | drm_buf_info_t karg; | ||
232 | mm_segment_t old_fs; | ||
233 | int orig_count, ret; | ||
234 | u32 tmp; | ||
235 | |||
236 | if (get_user(karg.count, &uarg->count) || | ||
237 | get_user(tmp, &uarg->list)) | ||
238 | return -EFAULT; | ||
239 | |||
240 | ulist = (drm_buf_desc_t *) A(tmp); | ||
241 | |||
242 | orig_count = karg.count; | ||
243 | |||
244 | karg.list = kmalloc(karg.count * sizeof(drm_buf_desc_t), GFP_KERNEL); | ||
245 | if (!karg.list) | ||
246 | return -EFAULT; | ||
247 | |||
248 | old_fs = get_fs(); | ||
249 | set_fs(KERNEL_DS); | ||
250 | ret = sys_ioctl(fd, DRM_IOCTL_INFO_BUFS, (unsigned long) &karg); | ||
251 | set_fs(old_fs); | ||
252 | |||
253 | if (!ret) { | ||
254 | if (karg.count <= orig_count && | ||
255 | (copy_to_user(ulist, karg.list, | ||
256 | karg.count * sizeof(drm_buf_desc_t)))) | ||
257 | ret = -EFAULT; | ||
258 | if (put_user(karg.count, &uarg->count)) | ||
259 | ret = -EFAULT; | ||
260 | } | ||
261 | |||
262 | kfree(karg.list); | ||
263 | return ret; | ||
264 | } | ||
265 | |||
266 | typedef struct drm32_buf_free { | ||
267 | int count; | ||
268 | u32 list; /* (int *) */ | ||
269 | } drm32_buf_free_t; | ||
270 | #define DRM32_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm32_buf_free_t) | ||
271 | |||
272 | static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
273 | { | ||
274 | drm32_buf_free_t *uarg = (drm32_buf_free_t *)arg; | ||
275 | drm_buf_free_t karg; | ||
276 | mm_segment_t old_fs; | ||
277 | int *ulist; | ||
278 | int ret; | ||
279 | u32 tmp; | ||
280 | |||
281 | if (get_user(karg.count, &uarg->count) || | ||
282 | get_user(tmp, &uarg->list)) | ||
283 | return -EFAULT; | ||
284 | |||
285 | ulist = (int *) A(tmp); | ||
286 | |||
287 | karg.list = kmalloc(karg.count * sizeof(int), GFP_KERNEL); | ||
288 | if (!karg.list) | ||
289 | return -ENOMEM; | ||
290 | |||
291 | ret = -EFAULT; | ||
292 | if (copy_from_user(karg.list, ulist, (karg.count * sizeof(int)))) | ||
293 | goto out; | ||
294 | |||
295 | old_fs = get_fs(); | ||
296 | set_fs(KERNEL_DS); | ||
297 | ret = sys_ioctl(fd, DRM_IOCTL_FREE_BUFS, (unsigned long) &karg); | ||
298 | set_fs(old_fs); | ||
299 | |||
300 | out: | ||
301 | kfree(karg.list); | ||
302 | return ret; | ||
303 | } | ||
304 | |||
305 | typedef struct drm32_buf_pub { | ||
306 | int idx; /* Index into master buflist */ | ||
307 | int total; /* Buffer size */ | ||
308 | int used; /* Amount of buffer in use (for DMA) */ | ||
309 | u32 address; /* Address of buffer (void *) */ | ||
310 | } drm32_buf_pub_t; | ||
311 | |||
312 | typedef struct drm32_buf_map { | ||
313 | int count; /* Length of buflist */ | ||
314 | u32 virtual; /* Mmaped area in user-virtual (void *) */ | ||
315 | u32 list; /* Buffer information (drm_buf_pub_t *) */ | ||
316 | } drm32_buf_map_t; | ||
317 | #define DRM32_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm32_buf_map_t) | ||
318 | |||
319 | static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
320 | { | ||
321 | drm32_buf_map_t *uarg = (drm32_buf_map_t *)arg; | ||
322 | drm32_buf_pub_t *ulist; | ||
323 | drm_buf_map_t karg; | ||
324 | mm_segment_t old_fs; | ||
325 | int orig_count, ret, i; | ||
326 | u32 tmp1, tmp2; | ||
327 | |||
328 | if (get_user(karg.count, &uarg->count) || | ||
329 | get_user(tmp1, &uarg->virtual) || | ||
330 | get_user(tmp2, &uarg->list)) | ||
331 | return -EFAULT; | ||
332 | |||
333 | karg.virtual = (void *) A(tmp1); | ||
334 | ulist = (drm32_buf_pub_t *) A(tmp2); | ||
335 | |||
336 | orig_count = karg.count; | ||
337 | |||
338 | karg.list = kmalloc(karg.count * sizeof(drm_buf_pub_t), GFP_KERNEL); | ||
339 | if (!karg.list) | ||
340 | return -ENOMEM; | ||
341 | |||
342 | ret = -EFAULT; | ||
343 | for (i = 0; i < karg.count; i++) { | ||
344 | if (get_user(karg.list[i].idx, &ulist[i].idx) || | ||
345 | get_user(karg.list[i].total, &ulist[i].total) || | ||
346 | get_user(karg.list[i].used, &ulist[i].used) || | ||
347 | get_user(tmp1, &ulist[i].address)) | ||
348 | goto out; | ||
349 | |||
350 | karg.list[i].address = (void *) A(tmp1); | ||
351 | } | ||
352 | |||
353 | old_fs = get_fs(); | ||
354 | set_fs(KERNEL_DS); | ||
355 | ret = sys_ioctl(fd, DRM_IOCTL_MAP_BUFS, (unsigned long) &karg); | ||
356 | set_fs(old_fs); | ||
357 | |||
358 | if (!ret) { | ||
359 | for (i = 0; i < orig_count; i++) { | ||
360 | tmp1 = (u32) (long) karg.list[i].address; | ||
361 | if (put_user(karg.list[i].idx, &ulist[i].idx) || | ||
362 | put_user(karg.list[i].total, &ulist[i].total) || | ||
363 | put_user(karg.list[i].used, &ulist[i].used) || | ||
364 | put_user(tmp1, &ulist[i].address)) { | ||
365 | ret = -EFAULT; | ||
366 | goto out; | ||
367 | } | ||
368 | } | ||
369 | if (put_user(karg.count, &uarg->count)) | ||
370 | ret = -EFAULT; | ||
371 | } | ||
372 | |||
373 | out: | ||
374 | kfree(karg.list); | ||
375 | return ret; | ||
376 | } | ||
377 | |||
378 | typedef struct drm32_dma { | ||
379 | /* Indices here refer to the offset into | ||
380 | buflist in drm_buf_get_t. */ | ||
381 | int context; /* Context handle */ | ||
382 | int send_count; /* Number of buffers to send */ | ||
383 | u32 send_indices; /* List of handles to buffers (int *) */ | ||
384 | u32 send_sizes; /* Lengths of data to send (int *) */ | ||
385 | drm_dma_flags_t flags; /* Flags */ | ||
386 | int request_count; /* Number of buffers requested */ | ||
387 | int request_size; /* Desired size for buffers */ | ||
388 | u32 request_indices; /* Buffer information (int *) */ | ||
389 | u32 request_sizes; /* (int *) */ | ||
390 | int granted_count; /* Number of buffers granted */ | ||
391 | } drm32_dma_t; | ||
392 | #define DRM32_IOCTL_DMA DRM_IOWR(0x29, drm32_dma_t) | ||
393 | |||
394 | /* RED PEN The DRM layer blindly dereferences the send/request | ||
395 | * indice/size arrays even though they are userland | ||
396 | * pointers. -DaveM | ||
397 | */ | ||
398 | static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
399 | { | ||
400 | drm32_dma_t *uarg = (drm32_dma_t *) arg; | ||
401 | int *u_si, *u_ss, *u_ri, *u_rs; | ||
402 | drm_dma_t karg; | ||
403 | mm_segment_t old_fs; | ||
404 | int ret; | ||
405 | u32 tmp1, tmp2, tmp3, tmp4; | ||
406 | |||
407 | karg.send_indices = karg.send_sizes = NULL; | ||
408 | karg.request_indices = karg.request_sizes = NULL; | ||
409 | |||
410 | if (get_user(karg.context, &uarg->context) || | ||
411 | get_user(karg.send_count, &uarg->send_count) || | ||
412 | get_user(tmp1, &uarg->send_indices) || | ||
413 | get_user(tmp2, &uarg->send_sizes) || | ||
414 | get_user(karg.flags, &uarg->flags) || | ||
415 | get_user(karg.request_count, &uarg->request_count) || | ||
416 | get_user(karg.request_size, &uarg->request_size) || | ||
417 | get_user(tmp3, &uarg->request_indices) || | ||
418 | get_user(tmp4, &uarg->request_sizes) || | ||
419 | get_user(karg.granted_count, &uarg->granted_count)) | ||
420 | return -EFAULT; | ||
421 | |||
422 | u_si = (int *) A(tmp1); | ||
423 | u_ss = (int *) A(tmp2); | ||
424 | u_ri = (int *) A(tmp3); | ||
425 | u_rs = (int *) A(tmp4); | ||
426 | |||
427 | if (karg.send_count) { | ||
428 | karg.send_indices = kmalloc(karg.send_count * sizeof(int), GFP_KERNEL); | ||
429 | karg.send_sizes = kmalloc(karg.send_count * sizeof(int), GFP_KERNEL); | ||
430 | |||
431 | ret = -ENOMEM; | ||
432 | if (!karg.send_indices || !karg.send_sizes) | ||
433 | goto out; | ||
434 | |||
435 | ret = -EFAULT; | ||
436 | if (copy_from_user(karg.send_indices, u_si, | ||
437 | (karg.send_count * sizeof(int))) || | ||
438 | copy_from_user(karg.send_sizes, u_ss, | ||
439 | (karg.send_count * sizeof(int)))) | ||
440 | goto out; | ||
441 | } | ||
442 | |||
443 | if (karg.request_count) { | ||
444 | karg.request_indices = kmalloc(karg.request_count * sizeof(int), GFP_KERNEL); | ||
445 | karg.request_sizes = kmalloc(karg.request_count * sizeof(int), GFP_KERNEL); | ||
446 | |||
447 | ret = -ENOMEM; | ||
448 | if (!karg.request_indices || !karg.request_sizes) | ||
449 | goto out; | ||
450 | |||
451 | ret = -EFAULT; | ||
452 | if (copy_from_user(karg.request_indices, u_ri, | ||
453 | (karg.request_count * sizeof(int))) || | ||
454 | copy_from_user(karg.request_sizes, u_rs, | ||
455 | (karg.request_count * sizeof(int)))) | ||
456 | goto out; | ||
457 | } | ||
458 | |||
459 | old_fs = get_fs(); | ||
460 | set_fs(KERNEL_DS); | ||
461 | ret = sys_ioctl(fd, DRM_IOCTL_DMA, (unsigned long) &karg); | ||
462 | set_fs(old_fs); | ||
463 | |||
464 | if (!ret) { | ||
465 | if (put_user(karg.context, &uarg->context) || | ||
466 | put_user(karg.send_count, &uarg->send_count) || | ||
467 | put_user(karg.flags, &uarg->flags) || | ||
468 | put_user(karg.request_count, &uarg->request_count) || | ||
469 | put_user(karg.request_size, &uarg->request_size) || | ||
470 | put_user(karg.granted_count, &uarg->granted_count)) | ||
471 | ret = -EFAULT; | ||
472 | |||
473 | if (karg.send_count) { | ||
474 | if (copy_to_user(u_si, karg.send_indices, | ||
475 | (karg.send_count * sizeof(int))) || | ||
476 | copy_to_user(u_ss, karg.send_sizes, | ||
477 | (karg.send_count * sizeof(int)))) | ||
478 | ret = -EFAULT; | ||
479 | } | ||
480 | if (karg.request_count) { | ||
481 | if (copy_to_user(u_ri, karg.request_indices, | ||
482 | (karg.request_count * sizeof(int))) || | ||
483 | copy_to_user(u_rs, karg.request_sizes, | ||
484 | (karg.request_count * sizeof(int)))) | ||
485 | ret = -EFAULT; | ||
486 | } | ||
487 | } | ||
488 | |||
489 | out: | ||
490 | kfree(karg.send_indices); | ||
491 | kfree(karg.send_sizes); | ||
492 | kfree(karg.request_indices); | ||
493 | kfree(karg.request_sizes); | ||
494 | return ret; | ||
495 | } | ||
496 | |||
497 | typedef struct drm32_ctx_res { | ||
498 | int count; | ||
499 | u32 contexts; /* (drm_ctx_t *) */ | ||
500 | } drm32_ctx_res_t; | ||
501 | #define DRM32_IOCTL_RES_CTX DRM_IOWR(0x26, drm32_ctx_res_t) | ||
502 | |||
503 | static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
504 | { | ||
505 | drm32_ctx_res_t *uarg = (drm32_ctx_res_t *) arg; | ||
506 | drm_ctx_t *ulist; | ||
507 | drm_ctx_res_t karg; | ||
508 | mm_segment_t old_fs; | ||
509 | int orig_count, ret; | ||
510 | u32 tmp; | ||
511 | |||
512 | karg.contexts = NULL; | ||
513 | if (get_user(karg.count, &uarg->count) || | ||
514 | get_user(tmp, &uarg->contexts)) | ||
515 | return -EFAULT; | ||
516 | |||
517 | ulist = (drm_ctx_t *) A(tmp); | ||
518 | |||
519 | orig_count = karg.count; | ||
520 | if (karg.count && ulist) { | ||
521 | karg.contexts = kmalloc((karg.count * sizeof(drm_ctx_t)), GFP_KERNEL); | ||
522 | if (!karg.contexts) | ||
523 | return -ENOMEM; | ||
524 | if (copy_from_user(karg.contexts, ulist, | ||
525 | (karg.count * sizeof(drm_ctx_t)))) { | ||
526 | kfree(karg.contexts); | ||
527 | return -EFAULT; | ||
528 | } | ||
529 | } | ||
530 | |||
531 | old_fs = get_fs(); | ||
532 | set_fs(KERNEL_DS); | ||
533 | ret = sys_ioctl(fd, DRM_IOCTL_RES_CTX, (unsigned long) &karg); | ||
534 | set_fs(old_fs); | ||
535 | |||
536 | if (!ret) { | ||
537 | if (orig_count) { | ||
538 | if (copy_to_user(ulist, karg.contexts, | ||
539 | (orig_count * sizeof(drm_ctx_t)))) | ||
540 | ret = -EFAULT; | ||
541 | } | ||
542 | if (put_user(karg.count, &uarg->count)) | ||
543 | ret = -EFAULT; | ||
544 | } | ||
545 | |||
546 | kfree(karg.contexts); | ||
547 | return ret; | ||
548 | } | ||
549 | |||
550 | #endif | ||
551 | |||
552 | #define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, NULL }, | 22 | #define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, NULL }, |
553 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl) | 23 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl) |
554 | 24 | ||
@@ -585,17 +55,6 @@ HANDLE_IOCTL(RTC_EPOCH_READ, w_long) | |||
585 | COMPATIBLE_IOCTL(RTC_EPOCH_SET) | 55 | COMPATIBLE_IOCTL(RTC_EPOCH_SET) |
586 | #endif | 56 | #endif |
587 | 57 | ||
588 | #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE) | ||
589 | HANDLE_IOCTL(DRM32_IOCTL_VERSION, drm32_version); | ||
590 | HANDLE_IOCTL(DRM32_IOCTL_GET_UNIQUE, drm32_getsetunique); | ||
591 | HANDLE_IOCTL(DRM32_IOCTL_SET_UNIQUE, drm32_getsetunique); | ||
592 | HANDLE_IOCTL(DRM32_IOCTL_ADD_MAP, drm32_addmap); | ||
593 | HANDLE_IOCTL(DRM32_IOCTL_INFO_BUFS, drm32_info_bufs); | ||
594 | HANDLE_IOCTL(DRM32_IOCTL_FREE_BUFS, drm32_free_bufs); | ||
595 | HANDLE_IOCTL(DRM32_IOCTL_MAP_BUFS, drm32_map_bufs); | ||
596 | HANDLE_IOCTL(DRM32_IOCTL_DMA, drm32_dma); | ||
597 | HANDLE_IOCTL(DRM32_IOCTL_RES_CTX, drm32_res_ctx); | ||
598 | #endif /* DRM */ | ||
599 | IOCTL_TABLE_END | 58 | IOCTL_TABLE_END |
600 | 59 | ||
601 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | 60 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); |