Handle the HDIO_GETGEO ioctl. Secondary problem found from bug #109780.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4290 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 7984f30..94b5c71 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -3495,6 +3495,9 @@
       break;
 
       /* Hard disks */
+   case VKI_HDIO_GETGEO: /* 0x0301 */
+      PRE_MEM_WRITE( "ioctl(HDIO_GETGEO)", ARG3, sizeof(struct vki_hd_geometry));
+      break;
    case VKI_HDIO_GET_IDENTITY: /* 0x030d */
       PRE_MEM_WRITE( "ioctl(HDIO_GET_IDENTITY)", ARG3,
                      VKI_SIZEOF_STRUCT_HD_DRIVEID );
@@ -4167,6 +4170,9 @@
       break;
 
       /* Hard disks */
+   case VKI_HDIO_GETGEO: /* 0x0301 */
+      POST_MEM_WRITE(ARG3, sizeof(struct vki_hd_geometry));
+      break;
    case VKI_HDIO_GET_IDENTITY: /* 0x030d */
       POST_MEM_WRITE(ARG3, VKI_SIZEOF_STRUCT_HD_DRIVEID );
       break;
diff --git a/include/vki-linux.h b/include/vki-linux.h
index e4c859c..a7010f8 100644
--- a/include/vki-linux.h
+++ b/include/vki-linux.h
@@ -1721,6 +1721,14 @@
 // From linux-2.6.8.1/include/linux/hdreg.h
 //----------------------------------------------------------------------
 
+struct vki_hd_geometry {
+      unsigned char heads;
+      unsigned char sectors;
+      unsigned short cylinders;
+      unsigned long start;
+};
+
+#define VKI_HDIO_GETGEO		0x0301	/* get device geometry */
 #define VKI_HDIO_GET_IDENTITY	0x030d	/* get IDE identification info */
 
 // [[Nb: done like this because the original type is a huge struct that will