|
|
1.1 ! root 1: /* ! 2: * linux/fs/ext/chrdev.c ! 3: * ! 4: * (C) 1992 Remy Card ([email protected]) ! 5: * ! 6: * from ! 7: * ! 8: * linux/fs/minix/chrdev.c ! 9: * ! 10: * (C) 1991 Linus Torvalds ! 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: ! 19: #include <errno.h> ! 20: ! 21: /* ! 22: * Called every time an ext character special file is opened ! 23: */ ! 24: static int chrdev_open(struct inode * inode, struct file * filp) ! 25: { ! 26: int i; ! 27: ! 28: i = MAJOR(inode->i_rdev); ! 29: if (i < MAX_CHRDEV) { ! 30: filp->f_op = chrdev_fops[i]; ! 31: if (filp->f_op && filp->f_op->open) ! 32: return filp->f_op->open(inode,filp); ! 33: } ! 34: return 0; ! 35: } ! 36: ! 37: /* ! 38: * Dummy default file-operations: the only thing this does ! 39: * is contain the open that then fills in the correct operations ! 40: * depending on the special file... ! 41: */ ! 42: static struct file_operations def_chr_fops = { ! 43: NULL, /* lseek */ ! 44: NULL, /* read */ ! 45: NULL, /* write */ ! 46: NULL, /* readdir */ ! 47: NULL, /* select */ ! 48: NULL, /* ioctl */ ! 49: chrdev_open, /* open */ ! 50: NULL, /* release */ ! 51: }; ! 52: ! 53: struct inode_operations ext_chrdev_inode_operations = { ! 54: &def_chr_fops, /* default file operations */ ! 55: NULL, /* create */ ! 56: NULL, /* lookup */ ! 57: NULL, /* link */ ! 58: NULL, /* unlink */ ! 59: NULL, /* symlink */ ! 60: NULL, /* mkdir */ ! 61: NULL, /* rmdir */ ! 62: NULL, /* mknod */ ! 63: NULL, /* rename */ ! 64: NULL, /* readlink */ ! 65: NULL, /* follow_link */ ! 66: ext_bmap, /* bmap */ ! 67: ext_truncate /* truncate */ ! 68: }; ! 69:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.