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 ' ', sectors = 0 ' ', cylinders = 0, start = 0} The device configuration===================[root@localh trunk]# uname -aLinux 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 bytes255 heads, 63 sectors/track, 63 cylindersUnits = 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. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel |
ioctl HDIO_GETGEO to device mapper devpath
On 10/14/2010 11:40 AM, Santosh Sarangi wrote:
> 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" > Yep. Device-mapper device are able to report the geometry, but you have to set it first :-) The attached patch should fix this. Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel |
ioctl HDIO_GETGEO to device mapper devpath
On mar., 2010-11-30 at 08:33 +0100, Hannes Reinecke wrote:
> On 10/14/2010 11:40 AM, Santosh Sarangi wrote: > > 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" > > > Yep. Device-mapper device are able to report the geometry, but you > have to set it first :-) > > The attached patch should fix this. > Applied. Thanks. -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel |
| All times are GMT. The time now is 11:44 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.