[1799] in linux-scsi channel archive
Possible code frag for sd.c
daemon@ATHENA.MIT.EDU (campbell@tirian.che.curtin.edu.au)
Fri May 2 23:01:04 1997
From: campbell@tirian.che.curtin.edu.au
To: Richard Henderson <richard@stommel.tamu.edu>
Date: Sat, 3 May 1997 10:58:56 +0000
Cc: tmw20@cam.ac.uk, linux-scsi@vger.rutgers.edu
After looking more into the problem (and into several files,
/usr/include/linux/kerneld.h, linux/fs/devices.c) I answers most of
my concerns. I have come up with what appears to be a workable solution.
Comments most welcome...
David Campbell
Existing sd_open() in sd.c....
============================================================
static int sd_open(struct inode * inode, struct file * filp)
{
int target;
target = DEVICE_NR(inode->i_rdev);
if(target >= sd_template.dev_max || !rscsi_disks[target].device)
return -ENXIO; /* No such device */
============================================================
Proposed sd_open()...
============================================================
static int sd_open(struct inode * inode, struct file * filp)
{
int target;
target = DEVICE_NR(inode->i_rdev);
if(target >= sd_template.dev_max)
return -ENXIO; /* No such device */
#ifdef CONFIG_KERNELD
/*
* Load any scsi driver modules if we can't find the disk.
*/
if(!rscsi_disks[target].device)
request_module("scsi_hostadapter");
#endif
if(!rscsi_disks[target].device)
return -ENXIO; /* No such device */
============================================================