home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / fs / minix / blkdev.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  1.5 KB  |  68 lines

  1. /*
  2.  *  linux/fs/minix/blkdev.c
  3.  *
  4.  *  Copyright (C) 1991, 1992  Linus Torvalds
  5.  *
  6.  * This file is subject to the terms and conditions of the GNU General Public
  7.  * License.  See the file README.legal in the main directory of this archive
  8.  * for more details.
  9.  */
  10.  
  11. #include <linux/errno.h>
  12. #include <linux/sched.h>
  13. #include <linux/minix_fs.h>
  14. #include <linux/tty.h>
  15. #include <linux/stat.h>
  16. #include <linux/fcntl.h>
  17.  
  18. /*
  19.  * Called every time a minix block special file is opened
  20.  */
  21. static int blkdev_open(struct inode * inode, struct file * filp)
  22. {
  23.     int i;
  24.  
  25.     i = MAJOR(inode->i_rdev);
  26.     if (i >= MAX_BLKDEV || !blkdev_fops[i])
  27.         return -ENODEV;
  28.     filp->f_op = blkdev_fops[i];
  29.     if (filp->f_op->open)
  30.         return filp->f_op->open(inode,filp);
  31.     return 0;
  32. }
  33.  
  34. /*
  35.  * Dummy default file-operations: the only thing this does
  36.  * is contain the open that then fills in the correct operations
  37.  * depending on the special file...
  38.  */
  39. static struct file_operations def_blk_fops = {
  40.     NULL,        /* lseek */
  41.     NULL,        /* read */
  42.     NULL,        /* write */
  43.     NULL,        /* readdir */
  44.     NULL,        /* select */
  45.     NULL,        /* ioctl */
  46.     NULL,        /* mmap */
  47.     blkdev_open,    /* open */
  48.     NULL,        /* release */
  49. };
  50.  
  51. struct inode_operations minix_blkdev_inode_operations = {
  52.     &def_blk_fops,        /* default file operations */
  53.     NULL,            /* create */
  54.     NULL,            /* lookup */
  55.     NULL,            /* link */
  56.     NULL,            /* unlink */
  57.     NULL,            /* symlink */
  58.     NULL,            /* mkdir */
  59.     NULL,            /* rmdir */
  60.     NULL,            /* mknod */
  61.     NULL,            /* rename */
  62.     NULL,            /* readlink */
  63.     NULL,            /* follow_link */
  64.     NULL,            /* bmap */
  65.     NULL,            /* truncate */
  66.     NULL            /* permission */
  67. };
  68.