1 /*
2 * linux/fs/isofs/blkdev.c
3 *
4 * (C) 1992 Eric Youngdale Modified for ISO9660 filesystem.
5 *
6 * Copyright (C) 1991, 1992 Linus Torvalds
7 *
8 * isofs blkdev handling code. This is only used with the Rock Ridge
9 * extensions to iso9660
10 */
11
12 #include <linux/errno.h>
13 #include <linux/sched.h>
14 #include <linux/iso_fs.h>
15 #include <linux/tty.h>
16 #include <linux/stat.h>
17 #include <linux/fcntl.h>
18
19 /*
20 * Called every time a isofs block special file is opened
21 */
22 static int blkdev_open(struct inode * inode, struct file * filp)
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
23 {
24 int i;
25
26 i = MAJOR(inode->i_rdev);
27 if (i < MAX_BLKDEV) {
28 filp->f_op = blkdev_fops[i];
29 if (filp->f_op && filp->f_op->open)
30 return filp->f_op->open(inode,filp);
31 }
32 return 0;
33 }
34
35 /*
36 * Dummy default file-operations: the only thing this does
37 * is contain the open that then fills in the correct operations
38 * depending on the special file...
39 */
40 static struct file_operations def_blk_fops = {
41 NULL, /* lseek */
42 NULL, /* read */
43 NULL, /* write */
44 NULL, /* readdir */
45 NULL, /* select */
46 NULL, /* ioctl */
47 NULL, /* mmap */
48 blkdev_open, /* open */
49 NULL, /* release */
50 };
51
52 struct inode_operations isofs_blkdev_inode_operations = {
53 &def_blk_fops, /* default file operations */
54 NULL, /* create */
55 NULL, /* lookup */
56 NULL, /* link */
57 NULL, /* unlink */
58 NULL, /* symlink */
59 NULL, /* mkdir */
60 NULL, /* rmdir */
61 NULL, /* mknod */
62 NULL, /* rename */
63 NULL, /* readlink */
64 NULL, /* follow_link */
65 isofs_bmap, /* bmap */
66 NULL /* truncate */
67 };