Bug 302827

Summary: [PATCH] add wrapper for CDROM_GET_CAPABILITY
Product: [Developer tools] valgrind Reporter: nick black <nick.black>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: tom
Priority: NOR    
Version: 3.7 SVN   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description nick black 2012-07-01 12:16:07 UTC
Howdy! My growlight program (http://nick-black.com/dankwiki/index.php/Growlight) uses libblkid from util-linux, which calls the CDROM_GET_CAPABILITY ioctl(). I've added support for it in the attached, tested patch. Please apply. Thanks!

Reproducible: Always

Steps to Reproduce:
1. Run program using ioctl(CDROM_GET_CAPABILITY)
2.
3.
Actual Results:  
Unhandled ioctl()

Expected Results:  
Handled ioctl()

[skynet](0) $ svn diff
Index: coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- coregrind/m_syswrap/syswrap-linux.c	(revision 12692)
+++ coregrind/m_syswrap/syswrap-linux.c	(working copy)
@@ -4211,6 +4211,8 @@
    case VKI_SCSI_IOCTL_DOORLOCK:
    case VKI_SCSI_IOCTL_DOORUNLOCK:
       
+   case VKI_CDROM_GET_CAPABILITY: /* 0x5331 */
+
    /* KVM ioctls that dont check for a numeric value as parameter */
    case VKI_KVM_S390_ENABLE_SIE:
    case VKI_KVM_S390_INITIAL_RESET:
@@ -5949,6 +5951,8 @@
       
    case VKI_CDROMPLAYMSF:
       break;
+   case VKI_CDROM_GET_CAPABILITY: /* 0x5331, overloads ioctl() return value */
+      break;
       /* The following two are probably bogus (should check args
 	 for readability).  JRS 20021117 */
    case VKI_CDROM_DRIVE_STATUS: /* 0x5326 */
Index: include/vki/vki-linux.h
===================================================================
--- include/vki/vki-linux.h	(revision 12692)
+++ include/vki/vki-linux.h	(working copy)
@@ -1813,6 +1813,7 @@
 #define VKI_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
 
 #define VKI_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
+#define VKI_CDROM_GET_CAPABILITY	0x5331  /* get "capabilities" */
 
 struct vki_cdrom_msf0		
 {
[skynet](0) $ 

BTW, I'm actually running 3.8.0-SVN, which doesn't have an entry in your versions tracker.
Comment 1 Tom Hughes 2012-07-11 12:02:19 UTC
Committed as r12726.