1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*
* Linux Rendering Resource Manager
*
* Implements the SGI-compatible rendering resource manager.
* This takes care of implementing the virtualized video hardware
* access required for OpenGL direct rendering.
*
* Author: Miguel de Icaza (miguel@nuclecu.unam.mx)
*
* Fixes:
*/
#include <linux/module.h>
#include <asm/uaccess.h>
#include <asm/rrm.h>
int
rrm_open_rn (int rnid, void *arg)
{
return 0;
}
int
rrm_close_rn (int rnid, void *arg)
{
return 0;
}
int
rrm_bind_proc_to_rn (int rnid, void *arg)
{
return 0;
}
typedef int (*rrm_function )(void *arg);
struct {
int (*r_fn)(int rnid, void *arg);
int arg_size;
} rrm_functions [] = {
{ rrm_open_rn, sizeof (struct RRM_OpenRN) },
{ rrm_close_rn, sizeof (struct RRM_CloseRN) },
{ rrm_bind_proc_to_rn, sizeof (struct RRM_BindProcToRN) }
};
#define RRM_FUNCTIONS (sizeof (rrm_functions)/sizeof (rrm_functions [0]))
/* cmd is a number in the range [0..RRM_CMD_LIMIT-RRM_BASE] */
int
rrm_command (unsigned int cmd, void *arg)
{
int i, rnid;
if (cmd > RRM_FUNCTIONS){
printk ("Called unimplemented rrm ioctl: %d\n", cmd + RRM_BASE);
return -EINVAL;
}
i = verify_area (VERIFY_READ, arg, rrm_functions [cmd].arg_size);
if (i) return i;
if (__get_user (rnid, (int *) arg))
return -EFAULT;
return (*(rrm_functions [cmd].r_fn))(rnid, arg);
}
int
rrm_close (struct inode *inode, struct file *file)
{
/* This routine is invoked when the device is closed */
return 0;
}
EXPORT_SYMBOL(rrm_command);
EXPORT_SYMBOL(rrm_close);
|