root/kernel/blk_drv/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/fs.h>
   4 #include <linux/hdreg.h>
   5 #include <linux/errno.h>
   6 
   7 #include <asm/segment.h>
   8 
   9 #include "../blk.h"
  10 #include "scsi.h"
  11 #include "hosts.h"
  12 #include "sd.h"
  13 
  14 extern int scsi_ioctl (Scsi_Device *dev, int cmd, void *arg);
  15 extern int revalidate_scsidisk(int, int);
  16 
  17 int sd_ioctl(struct inode * inode, struct file * file, unsigned long cmd, unsigned long arg)
     /* [previous][next][first][last][top][bottom][index][help] */
  18 {
  19         int dev = inode->i_rdev;
  20         int host;
  21         int diskinfo[4];
  22         struct hd_geometry *loc = (void *) arg;
  23 
  24         switch (cmd) {
  25                 case HDIO_REQ:   /* Return BIOS disk parameters */
  26                         if (!loc)  return -EINVAL;
  27                         verify_area(loc, sizeof(*loc));
  28                         host = rscsi_disks[MINOR(dev) >> 4].device->host_no;
  29                         diskinfo[0] = 0;
  30                         diskinfo[1] = 0;
  31                         diskinfo[2] = 0;
  32                         if(scsi_hosts[host].bios_param != NULL)
  33                               scsi_hosts[host].bios_param(rscsi_disks[MINOR(dev) >> 4].capacity,
  34                                                           dev,
  35                                                           &diskinfo[0]);
  36                         put_fs_byte(diskinfo[0],
  37                                 (char *) &loc->heads);
  38                         put_fs_byte(diskinfo[1],
  39                                 (char *) &loc->sectors);
  40                         put_fs_word(diskinfo[2],
  41                                 (short *) &loc->cylinders);
  42                         put_fs_long(sd[MINOR(inode->i_rdev)].start_sect,
  43                                 (long *) &loc->start);
  44                         return 0;
  45                 case BLKGETSIZE:   /* Return device size */
  46                         if (!arg)  return -EINVAL;
  47                         verify_area((long *) arg, sizeof(long));
  48                         put_fs_long(sd[MINOR(inode->i_rdev)].nr_sects,
  49                                 (long *) arg);
  50                         return 0;
  51                 case BLKRRPART: /* Re-read partition tables */
  52                         return revalidate_scsidisk(dev, 1);
  53                 default:
  54                         return scsi_ioctl(rscsi_disks[MINOR(dev) >> 4].device , cmd, (void *) arg);
  55         }
  56 }

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