From: Tom Hughes Date: Fri, 10 Feb 2012 10:41:07 +0000 (+0000) Subject: Add support for some SCSI ioctls. Patch from Jakub Jelinek on BZ#292627. X-Git-Tag: svn/VALGRIND_3_8_0~478 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc42e147f5160898ad6e9d00d3db8115032908d7;p=thirdparty%2Fvalgrind.git Add support for some SCSI ioctls. Patch from Jakub Jelinek on BZ#292627. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12375 --- diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index edf7d38a21..48c61b5107 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -4032,6 +4032,10 @@ PRE(sys_ioctl) case VKI_SNDRV_TIMER_IOCTL_STOP: case VKI_SNDRV_TIMER_IOCTL_CONTINUE: case VKI_SNDRV_TIMER_IOCTL_PAUSE: + + /* SCSI no operand */ + case VKI_SCSI_IOCTL_DOORLOCK: + case VKI_SCSI_IOCTL_DOORUNLOCK: PRINT("sys_ioctl ( %ld, 0x%lx )",ARG1,ARG2); PRE_REG_READ2(long, "ioctl", unsigned int, fd, unsigned int, request); @@ -4517,6 +4521,14 @@ PRE(sys_ioctl) VKI_SIZEOF_STRUCT_HD_DRIVEID ); break; + /* SCSI */ + case VKI_SCSI_IOCTL_GET_IDLUN: /* 0x5382 */ + PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_GET_IDLUN)", ARG3, sizeof(struct vki_scsi_idlun)); + break; + case VKI_SCSI_IOCTL_GET_BUS_NUMBER: /* 0x5386 */ + PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", ARG3, sizeof(int)); + break; + /* CD ROM stuff (??) */ case VKI_CDROM_GET_MCN: PRE_MEM_READ( "ioctl(CDROM_GET_MCN)", ARG3, @@ -5618,6 +5630,10 @@ POST(sys_ioctl) case VKI_SNDRV_TIMER_IOCTL_STOP: case VKI_SNDRV_TIMER_IOCTL_CONTINUE: case VKI_SNDRV_TIMER_IOCTL_PAUSE: + + /* SCSI no operand */ + case VKI_SCSI_IOCTL_DOORLOCK: + case VKI_SCSI_IOCTL_DOORUNLOCK: break; /* Real Time Clock (/dev/rtc) ioctls */ @@ -5684,6 +5700,14 @@ POST(sys_ioctl) POST_MEM_WRITE(ARG3, VKI_SIZEOF_STRUCT_HD_DRIVEID ); break; + /* SCSI */ + case VKI_SCSI_IOCTL_GET_IDLUN: /* 0x5382 */ + POST_MEM_WRITE(ARG3, sizeof(struct vki_scsi_idlun)); + break; + case VKI_SCSI_IOCTL_GET_BUS_NUMBER: /* 0x5386 */ + POST_MEM_WRITE(ARG3, sizeof(int)); + break; + /* CD ROM stuff (??) */ case VKI_CDROMSUBCHNL: POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_subchnl)); diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 6763b13a6e..65900f3fe2 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -1750,6 +1750,20 @@ typedef struct vki_sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */ //#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on) */ #define VKI_SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */ +//---------------------------------------------------------------------- +// From linux-2.6.34/include/scsi/scsi.h and scsi/scsi_ioctl.h +//---------------------------------------------------------------------- + +#define VKI_SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ +#define VKI_SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ +#define VKI_SCSI_IOCTL_GET_IDLUN 0x5382 +#define VKI_SCSI_IOCTL_GET_BUS_NUMBER 0x5386 + +struct vki_scsi_idlun { + __vki_u32 dev_id; + __vki_u32 host_unique_id; +}; + //---------------------------------------------------------------------- // From linux-2.6.8.1/include/linux/cdrom.h //----------------------------------------------------------------------