]> git.pld-linux.org Git - packages/X11-driver-firegl.git/blame - X11-driver-firegl-ioctl32.patch
- outdated part removed.
[packages/X11-driver-firegl.git] / X11-driver-firegl-ioctl32.patch
CommitLineData
07175bf1
PS
1http://ati.cchtml.com/show_bug.cgi?id=211
2
3--- X11-driver-firegl-8.16.20/lib/modules/fglrx/build_mod/firegl_public.c.orig 2005-11-02 20:29:43.535048712 -0800
4+++ X11-driver-firegl-8.16.20/lib/modules/fglrx/build_mod/firegl_public.c 2005-11-02 20:27:19.013019400 -0800
07175bf1
PS
5@@ -191,6 +190,16 @@ _syscall3( int, modify_ldt, int, func, v
6 // ============================================================
7 /* globals */
8
9+int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*));
10+long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
11+void unregister_ioctl32_conversion(unsigned int cmd);
12+struct HandlerList {
13+ unsigned int cmd;
14+ void *handler;
15+ struct HandlerList *next;
16+};
17+struct HandlerList *HandlerListHead = 0x0;
18+
19 char* firegl = NULL;
20 int __ke_debuglevel = 0;
21 int __ke_moduleflags = 0;
22@@ -258,6 +267,7 @@ static struct file_operations firegl_fop
23 open: ip_firegl_open,
24 release: ip_firegl_release,
25 ioctl: ip_firegl_ioctl,
26+ compat_ioctl: realHandler_compat_ioctl,
27 mmap: ip_firegl_mmap,
28 };
29
30@@ -1475,7 +1485,7 @@ int ATI_API_CALL __ke_copy_to_user(void*
31
32 int ATI_API_CALL __ke_verify_area(int type, const void * addr, unsigned long size)
33 {
34- return verify_area(type, addr, size);
ec7f3e8c 35+ return (access_ok(type, addr, size) ? 0 : -EFAULT);
07175bf1
PS
36 }
37
38 int ATI_API_CALL __ke_get_pci_device_info(__ke_pci_dev_t* dev, __ke_pci_device_info_t *pinfo)
39@@ -2220,10 +2230,68 @@ int ATI_API_CALL __ke_register_ioctl32_c
40 return register_ioctl32_conversion(cmd, handler);
41 }
42
43+
44+ int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*))
45+ {
46+ sizeof(struct HandlerList);
47+ struct HandlerList *newHandler = kmalloc(sizeof(struct HandlerList), 0);
48+ newHandler->cmd = cmd;
49+ newHandler->handler = handler;
50+ newHandler->next = HandlerListHead;
51+ HandlerListHead = newHandler;
52+ return 0;
53+ }
54+
55+ long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
56+ {
57+ int fd;
58+ int (*handler)(unsigned int, unsigned int, unsigned long, struct file*);
59+ struct fdtable *fdt;
60+ struct HandlerList *HandlerEntry = HandlerListHead;
61+
62+ while(HandlerEntry->cmd != cmd){
63+ if(HandlerEntry->next == 0x0){
64+ return -1;
65+ }
66+ HandlerEntry = HandlerEntry->next;
67+ }
68+ handler = HandlerEntry->handler;
69+ fdt = files_fdtable(current->files);
70+ for(fd=0;fd<fdt->max_fds;fd++){
71+ if(fdt->fd[fd] == filp){
72+ return handler(fd, cmd, arg, filp);
73+ }
74+ }
75+ return -1;
76+}
77+
78+
79+
80 void ATI_API_CALL __ke_unregister_ioctl32_conversion(unsigned int cmd)
81 {
82 unregister_ioctl32_conversion(cmd);
83 }
84+
85+ void unregister_ioctl32_conversion(unsigned int cmd)
86+ {
87+ struct HandlerList *ahead, *behind;
88+ if(HandlerListHead == 0x0) return;
89+ behind = HandlerListHead;
90+ ahead = HandlerListHead->next;
91+ if(behind->cmd == cmd){
92+ HandlerListHead = ahead;
93+ kfree(behind);
94+ return;
95+ }
96+ while(ahead->cmd != cmd){
97+ behind = ahead;
98+ ahead = ahead->next;
99+ }
100+ behind->next = ahead->next;
101+ kfree(ahead);
102+ return;
103+ }
104+
105 #endif
106
107 /* agp_memory related routine for IGP */
This page took 0.068665 seconds and 4 git commands to generate.