]>
Commit | Line | Data |
---|---|---|
07175bf1 PS |
1 | --- X11-driver-firegl-8.16.20/lib/modules/fglrx/build_mod/firegl_public.c.orig 2005-11-02 20:29:43.535048712 -0800 |
2 | +++ X11-driver-firegl-8.16.20/lib/modules/fglrx/build_mod/firegl_public.c 2005-11-02 20:27:19.013019400 -0800 | |
07175bf1 PS |
3 | @@ -191,6 +190,16 @@ _syscall3( int, modify_ldt, int, func, v |
4 | // ============================================================ | |
5 | /* globals */ | |
6 | ||
7 | +int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*)); | |
8 | +long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | |
9 | +void unregister_ioctl32_conversion(unsigned int cmd); | |
10 | +struct HandlerList { | |
11 | + unsigned int cmd; | |
12 | + void *handler; | |
13 | + struct HandlerList *next; | |
14 | +}; | |
15 | +struct HandlerList *HandlerListHead = 0x0; | |
16 | + | |
17 | char* firegl = NULL; | |
18 | int __ke_debuglevel = 0; | |
19 | int __ke_moduleflags = 0; | |
20 | @@ -258,6 +267,7 @@ static struct file_operations firegl_fop | |
21 | open: ip_firegl_open, | |
22 | release: ip_firegl_release, | |
23 | ioctl: ip_firegl_ioctl, | |
24 | + compat_ioctl: realHandler_compat_ioctl, | |
25 | mmap: ip_firegl_mmap, | |
26 | }; | |
27 | ||
07175bf1 PS |
28 | @@ -2220,10 +2230,68 @@ int ATI_API_CALL __ke_register_ioctl32_c |
29 | return register_ioctl32_conversion(cmd, handler); | |
30 | } | |
31 | ||
32 | + | |
33 | + int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file*)) | |
34 | + { | |
35 | + sizeof(struct HandlerList); | |
36 | + struct HandlerList *newHandler = kmalloc(sizeof(struct HandlerList), 0); | |
37 | + newHandler->cmd = cmd; | |
38 | + newHandler->handler = handler; | |
39 | + newHandler->next = HandlerListHead; | |
40 | + HandlerListHead = newHandler; | |
41 | + return 0; | |
42 | + } | |
43 | + | |
44 | + long realHandler_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |
45 | + { | |
46 | + int fd; | |
47 | + int (*handler)(unsigned int, unsigned int, unsigned long, struct file*); | |
48 | + struct fdtable *fdt; | |
49 | + struct HandlerList *HandlerEntry = HandlerListHead; | |
50 | + | |
51 | + while(HandlerEntry->cmd != cmd){ | |
52 | + if(HandlerEntry->next == 0x0){ | |
53 | + return -1; | |
54 | + } | |
55 | + HandlerEntry = HandlerEntry->next; | |
56 | + } | |
57 | + handler = HandlerEntry->handler; | |
58 | + fdt = files_fdtable(current->files); | |
59 | + for(fd=0;fd<fdt->max_fds;fd++){ | |
60 | + if(fdt->fd[fd] == filp){ | |
61 | + return handler(fd, cmd, arg, filp); | |
62 | + } | |
63 | + } | |
64 | + return -1; | |
65 | +} | |
66 | + | |
67 | + | |
68 | + | |
69 | void ATI_API_CALL __ke_unregister_ioctl32_conversion(unsigned int cmd) | |
70 | { | |
71 | unregister_ioctl32_conversion(cmd); | |
72 | } | |
73 | + | |
74 | + void unregister_ioctl32_conversion(unsigned int cmd) | |
75 | + { | |
76 | + struct HandlerList *ahead, *behind; | |
77 | + if(HandlerListHead == 0x0) return; | |
78 | + behind = HandlerListHead; | |
79 | + ahead = HandlerListHead->next; | |
80 | + if(behind->cmd == cmd){ | |
81 | + HandlerListHead = ahead; | |
82 | + kfree(behind); | |
83 | + return; | |
84 | + } | |
85 | + while(ahead->cmd != cmd){ | |
86 | + behind = ahead; | |
87 | + ahead = ahead->next; | |
88 | + } | |
89 | + behind->next = ahead->next; | |
90 | + kfree(ahead); | |
91 | + return; | |
92 | + } | |
93 | + | |
94 | #endif | |
95 | ||
96 | /* agp_memory related routine for IGP */ |