Re: HD params

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

 



Hello,

> Is there a function, or other way, to get a harddrives geometry (heads, 
> sectors, etc...)?

You can use the gendisk interface which is declared in <linux/genhd.h>.

You can use:

struct gendisk *alloc_disk(int minors);

to obtatin the gendisk interface with the minor number of the device
(hard disk partition).

Then you need to add your disk with:

void add_disk(struct gendisk *disk);

To put the disk readonly:

void set_disk_ro(struct gendisk *disk, int flag);

Then you can add/delete partitions, look the capacity of the disk and so
on, look the declared functions in genhd.h. 

That's used in 2.5 mainly but I remember that it was added in 2.4.  I
expect that it would be usefull for you.

Regards.
-- 
Alejandro Sanchez Acosta <asanchez@gnu.org>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux