root/fs/minix/blkdev.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. blkdev_open

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

/* [previous][next][first][last][top][bottom][index][help] */