[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interface for SCSI transactions ?

From: Thomas Schmitt
Subject: Re: Interface for SCSI transactions ?
Date: Tue, 13 Sep 2011 16:49:55 +0200


i had to learn that a kvm emulated CD-ROM appears as /dev/hd2.

I suspect this means it is not controlled by an SCSI driver but by

Is this correct ?

If so then i will try to use ATAPI commands. E.g via 
  int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq,
                        ide_action_t action)

Linux >= 2.6 is so nice to hide the difference by allowing to use
ioctl(SG_IO) on /dev/srN and /dev/hdX.
On 2.4 one had to use kernel module ide-scsi for ioctl(SG_IO) on /dev/sgN,
or ioctl(CDROM_SEND_PACKET) on /dev/hdX. growisofs uses both ioctls with
the same SCSI commands.
So in principle, this replugging should be doable.

Well, first i will have to find a road from device_t to ide_drive_t ...

Hey. That was easy !  gnumach/linux/src/drivers/block/ide.c:
 * get_info_ptr() returns the (ide_drive_t *) for a given device number.
 * It returns NULL if the given device number does not match any present drives.
static ide_drive_t *get_info_ptr (kdev_t i_rdev)

(Hopefully not too easy.)

Have a nice day :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]