|
|
1.1 root 1: /*
2: * linux/fs/chrdev.c
3: *
4: * (C) 1991 Linus Torvalds
5: */
6:
7: #include <linux/sched.h>
8: #include <linux/minix_fs.h>
9: #include <linux/tty.h>
10:
11: #include <errno.h>
12: #include <fcntl.h>
13: #include <sys/stat.h>
14:
15: /*
16: * Called every time a minix block special file is opened
17: */
18: static int blkdev_open(struct inode * inode, struct file * filp)
19: {
20: int i;
21:
22: check_disk_change(inode->i_rdev);
23: i = MAJOR(inode->i_rdev);
24: if (i < MAX_BLKDEV) {
25: filp->f_op = blkdev_fops[i];
26: if (filp->f_op && filp->f_op->open)
27: return filp->f_op->open(inode,filp);
28: }
29: return 0;
30: }
31:
32: /*
33: * Dummy default file-operations: the only thing this does
34: * is contain the open that then fills in the correct operations
35: * depending on the special file...
36: */
37: static struct file_operations def_blk_fops = {
38: NULL, /* lseek */
39: NULL, /* read */
40: NULL, /* write */
41: NULL, /* readdir */
42: NULL, /* select */
43: NULL, /* ioctl */
44: blkdev_open, /* open */
45: NULL, /* release */
46: };
47:
48: struct inode_operations minix_blkdev_inode_operations = {
49: &def_blk_fops, /* default file operations */
50: NULL, /* create */
51: NULL, /* lookup */
52: NULL, /* link */
53: NULL, /* unlink */
54: NULL, /* symlink */
55: NULL, /* mkdir */
56: NULL, /* rmdir */
57: NULL, /* mknod */
58: NULL, /* rename */
59: NULL, /* readlink */
60: NULL, /* follow_link */
61: minix_bmap, /* bmap */
62: minix_truncate /* truncate */
63: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.