dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* ioctl HDIO_GETGEO to device mapper devpath
@ 2010-10-14  9:40 Santosh Sarangi
  2010-11-30  7:33 ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Santosh Sarangi @ 2010-10-14  9:40 UTC (permalink / raw)
  To: dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 1606 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 2297 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-01  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-14  9:40 ioctl HDIO_GETGEO to device mapper devpath Santosh Sarangi
2010-11-30  7:33 ` Hannes Reinecke
2010-12-01  8:58   ` Christophe Varoqui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).