Magellan Linux

Annotation of /trunk/ati-drivers/patches/fglrx-2.6.14-compat_ioctl.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (hide annotations) (download)
Tue May 8 20:06:05 2007 UTC (17 years ago) by niro
File size: 3227 byte(s)
-import

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

Properties

Name Value
svn:executable *