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         NULL,           /* mmap */
  43         blkdev_open,    /* open */
  44         NULL,           /* release */
  45 };
  46 
  47 struct inode_operations minix_blkdev_inode_operations = {
  48         &def_blk_fops,          /* default file operations */
  49         NULL,                   /* create */
  50         NULL,                   /* lookup */
  51         NULL,                   /* link */
  52         NULL,                   /* unlink */
  53         NULL,                   /* symlink */
  54         NULL,                   /* mkdir */
  55         NULL,                   /* rmdir */
  56         NULL,                   /* mknod */
  57         NULL,                   /* rename */
  58         NULL,                   /* readlink */
  59         NULL,                   /* follow_link */
  60         NULL,                   /* bmap */
  61         NULL                    /* truncate */
  62 };

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