int res;
int retval;
- nonseekable_open(inode, filp);
SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags));
sdp = sg_get_dev(dev);
if ((!sdp) || (!sdp->device))
return -ENXIO;
if (sdp->detached)
return -ENODEV;
+
+ /* scsi generic is only for non-disk, non-cd, non-tape devices */
+ if ( (sdp->device->type == TYPE_DISK) || (sdp->device->type == TYPE_MOD) || (sdp->device->type == TYPE_ROM)
+ || (sdp->device->type == TYPE_WORM) || ( sdp->device->type == TYPE_TAPE))
+ printk(KERN_WARNING "%s: Using deprecated /dev/sg mechanism instead of SG_IO on the actual device\n",current->comm);
+
/* This driver's module count bumped by fops_get in <linux/fs.h> */
/* Prevent the device driver from vanishing while we sleep */
return -ENXIO;
SCSI_LOG_TIMEOUT(3, printk("sg_read: %s, count=%d\n",
sdp->disk->disk_name, (int) count));
+ if (ppos != &filp->f_pos) ; /* FIXME: Hmm. Seek to the right place, or fail? */
if ((k = verify_area(VERIFY_WRITE, buf, count)))
return k;
if (sfp->force_packid && (count >= SZ_SG_HEADER)) {
if (!((filp->f_flags & O_NONBLOCK) ||
scsi_block_when_processing_errors(sdp->device)))
return -ENXIO;
+ if (ppos != &filp->f_pos) ; /* FIXME: Hmm. Seek to the right place, or fail? */
if ((k = verify_area(VERIFY_READ, buf, count)))
return k; /* protects following copy_from_user()s + get_user()s */