This source file includes following definitions.
- chrdev_open
1
2
3
4
5
6
7
8
9
10
11
12
13 #include <linux/sched.h>
14 #include <linux/ext_fs.h>
15 #include <linux/tty.h>
16 #include <linux/stat.h>
17 #include <linux/fcntl.h>
18 #include <linux/errno.h>
19
20
21
22
23 static int chrdev_open(struct inode * inode, struct file * filp)
24 {
25 int i;
26
27 i = MAJOR(inode->i_rdev);
28 if (i < MAX_CHRDEV) {
29 filp->f_op = chrdev_fops[i];
30 if (filp->f_op && filp->f_op->open)
31 return filp->f_op->open(inode,filp);
32 }
33 return 0;
34 }
35
36
37
38
39
40
41 static struct file_operations def_chr_fops = {
42 NULL,
43 NULL,
44 NULL,
45 NULL,
46 NULL,
47 NULL,
48 chrdev_open,
49 NULL,
50 };
51
52 struct inode_operations ext_chrdev_inode_operations = {
53 &def_chr_fops,
54 NULL,
55 NULL,
56 NULL,
57 NULL,
58 NULL,
59 NULL,
60 NULL,
61 NULL,
62 NULL,
63 NULL,
64 NULL,
65 ext_bmap,
66 ext_truncate
67 };
68