root/drivers/scsi/sd_ioctl.c

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

DEFINITIONS

This source file includes following definitions.
  1. sd_ioctl

   1 #include <linux/kernel.h>
   2 #include <linux/sched.h>
   3 #include <linux/mm.h>
   4 #include <linux/fs.h>
   5 #include <linux/hdreg.h>
   6 #include <linux/errno.h>
   7 
   8 #include <asm/segment.h>
   9 
  10 #include "../block/blk.h"
  11 #include "scsi.h"
  12 #include "scsi_ioctl.h"
  13 #include "hosts.h"
  14 #include "sd.h"
  15 
  16 extern int revalidate_scsidisk(int, int);
  17 
  18 int sd_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg)
     /* [previous][next][first][last][top][bottom][index][help] */
  19 {
  20         int dev = inode->i_rdev;
  21         int error;
  22         struct Scsi_Host * host;
  23         int diskinfo[4];
  24         struct hd_geometry *loc = (struct hd_geometry *) arg;
  25 
  26         switch (cmd) {
  27                 case HDIO_REQ:   /* Return BIOS disk parameters */
  28                         if (!loc)  return -EINVAL;
  29                         error = verify_area(VERIFY_WRITE, loc, sizeof(*loc));
  30                         if (error)
  31                                 return error;
  32                         host = rscsi_disks[MINOR(dev) >> 4].device->host;
  33                         diskinfo[0] = 0;
  34                         diskinfo[1] = 0;
  35                         diskinfo[2] = 0;
  36                         if(host->hostt->bios_param != NULL)
  37                               host->hostt->bios_param(&rscsi_disks[MINOR(dev) >> 4],
  38                                                           dev,
  39                                                           &diskinfo[0]);
  40                         put_user(diskinfo[0], &loc->heads);
  41                         put_user(diskinfo[1], &loc->sectors);
  42                         put_user(diskinfo[2], &loc->cylinders);
  43                         put_user(sd[MINOR(inode->i_rdev)].start_sect, &loc->start);
  44                         return 0;
  45                 case BLKGETSIZE:   /* Return device size */
  46                         if (!arg)  return -EINVAL;
  47                         error = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long));
  48                         if (error)
  49                                 return error;
  50                         put_user(sd[MINOR(inode->i_rdev)].nr_sects,
  51                                  (long *) arg);
  52                         return 0;
  53                 case BLKRASET:
  54                         if(!suser())  return -EACCES;
  55                         if(!inode->i_rdev) return -EINVAL;
  56                         if(arg > 0xff) return -EINVAL;
  57                         read_ahead[MAJOR(inode->i_rdev)] = arg;
  58                         return 0;
  59                 case BLKFLSBUF:
  60                         if(!suser())  return -EACCES;
  61                         if(!inode->i_rdev) return -EINVAL;
  62                         fsync_dev(inode->i_rdev);
  63                         invalidate_buffers(inode->i_rdev);
  64                         return 0;
  65 
  66                 case BLKRRPART: /* Re-read partition tables */
  67                         return revalidate_scsidisk(dev, 1);
  68                 default:
  69                         return scsi_ioctl(rscsi_disks[MINOR(dev) >> 4].device , cmd, (void *) arg);
  70         }
  71 }
  72 /*
  73  * Overrides for Emacs so that we follow Linus's tabbing style.
  74  * Emacs will notice this stuff at the end of the file and automatically
  75  * adjust the settings for this buffer only.  This must remain at the end
  76  * of the file.
  77  * ---------------------------------------------------------------------------
  78  * Local variables:
  79  * c-indent-level: 8
  80  * c-brace-imaginary-offset: 0
  81  * c-brace-offset: -8
  82  * c-argdecl-indent: 8
  83  * c-label-offset: -8
  84  * c-continued-statement-offset: 8
  85  * c-continued-brace-offset: 0
  86  * End:
  87  */

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