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

[dm-devel] ioctl HDIO_GETGEO to device mapper devpath



Hi,
I have a linux  mapper device on the host, I would like to get the start offset.
I get this by the following ioctl . Although the call succeeds but it sets the hd_geometry_rec to "0"

I checked through gdb , the ioctl call suceeds ,but sets all the field of hd_geometry to "0"

(gdb) p hd_geometry_rec
$2 = {heads = 0 '\0', sectors = 0 '\0', cylinders = 0, start = 0}

The device configuration
===================
[root localh trunk]# uname -a
Linux localh 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

[root localh trunk]# fdisk -l /dev/mapper/mpath4

Disk /dev/mapper/mpath4: 523 MB, 523960320 bytes
255 heads, 63 sectors/track, 63 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

              Device Boot      Start         End      Blocks   Id  System
/dev/mapper/mpath4p1               1          10       80293+  83  Linux
/dev/mapper/mpath4p2              11          20       80325   83  Linux
/dev/mapper/mpath4p3              21          30       80325   83  Linux
/dev/mapper/mpath4p4              31          38       64260   83  Linux
[root localh trunk]#

The Source code
============
   struct hd_geometry   hd_geometry_rec;
   unsigned int offset;

  //  Here p_ppdevname is  /dev/mapper/mpath4p4
  if ((fd = open(p_ppdevname, O_RDONLY | O_NONBLOCK)) < 0)
    {
      //Error
    }


   

         if ((sts = ioctl(fd, HDIO_GETGEO, &hd_geometry_rec)) < 0)
           {

            // Error
           }
         else
           {
               offset = (unsigned int) hd_geometry_rec.start;
           }
 

--
With best regards,
Santosh.

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