I meant number of sectors = "Last Sector" - ("First Sector" + "Offset") + 1
of course.
Anton
> fdisk /dev/hda
>and selecting: u (to change to units = sectors), followed by p (to display
>the partition table) and then the values of interest are "Start" and
>"End", from which the number of sectors can be calculated from.
>
>Are these "subtracted" values what is present in the "struct hd_struct
>*part" that can be found inside "struct gendisk"?
>
>Assuming that hd_struct does contain the subtracted values as described
>above, is the following procedure A) correct? and B) the best way to
>obtain them?
>
>Locate the correct gendisk structure by performing a walk of gendisk_head
>as done in drivers/block/blkpg.c::get_gendisk(kdev_t), (Could we make this
>function to not be private to blkpg.c?), then get the hd_struct for the
>partition and obtain the values from that. In code:
>
>struct gendisk *g = get_gendisk(my_super_block->s_dev)
>struct hd_struct *hd = &g->part[MINOR(my_super_block->s_dev)];
>
>wanted "subtracted" values:
> hd->start_sect
> hd->nr_sects
>
>Am I missing something? Is the meaning of the values in hd_struct
>different from what I think it is?
>
>Note: I know I can normally get the number of sectors from the boot sector
>of the partition but in this case please assume that there is no boot
>sector present or that it is corrupt or that the values in it cannot be
>relied on due to weird things done by the 'other OS'.
>
>Thanks a lot for your help in advance.
>
>Best regards,
>
> Anton
>
>--
> "Programmers never die. They do a GOSUB without RETURN." - Unknown source
>--
>Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
>Linux NTFS Maintainer
>ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
-- "Education is what remains after one has forgotten everything he learned in school." - Albert Einstein-- Anton Altaparmakov Voice: +44-(0)1223-333541(lab) / +44-(0)7712-632205(mobile) Christ's College eMail: AntonA@bigfoot.com / aia21@cam.ac.uk Cambridge CB2 3BU ICQ: 8561279 United Kingdom WWW: http://www-stu.christs.cam.ac.uk/~aia21/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/