root/fs/ext/blkdev.c

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

DEFINITIONS

This source file includes following definitions.
  1. blkdev_open

   1 /*
   2  *  linux/fs/ext/blkdev.c
   3  *
   4  *  Copyright (C) 1992  Remy Card (card@masi.ibp.fr)
   5  *
   6  *  from
   7  *
   8  *  linux/fs/minix/blkdev.c
   9  *
  10  *  Copyright (C) 1991, 1992  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 #include <linux/errno.h>
  19 
  20 /*
  21  * Called every time an ext block special file is opened
  22  */
  23 static int blkdev_open(struct inode * inode, struct file * filp)
     /* [previous][next][first][last][top][bottom][index][help] */
  24 {
  25         int i;
  26 
  27         i = MAJOR(inode->i_rdev);
  28         if (i < MAX_BLKDEV) {
  29                 filp->f_op = blkdev_fops[i];
  30                 if (filp->f_op && filp->f_op->open)
  31                         return filp->f_op->open(inode,filp);
  32         }
  33         return 0;
  34 }       
  35 
  36 /*
  37  * Dummy default file-operations: the only thing this does
  38  * is contain the open that then fills in the correct operations
  39  * depending on the special file...
  40  */
  41 static struct file_operations def_blk_fops = {
  42         NULL,           /* lseek */
  43         NULL,           /* read */
  44         NULL,           /* write */
  45         NULL,           /* readdir */
  46         NULL,           /* select */
  47         NULL,           /* ioctl */
  48         blkdev_open,    /* open */
  49         NULL,           /* release */
  50 };
  51 
  52 struct inode_operations ext_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         ext_bmap,               /* bmap */
  66         ext_truncate            /* truncate */
  67 };

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