partitions
Hi all,
Is there any global variables or list in the kernel space that I can find out which partitions are available in the system? Please give pointer of information.
regards,
David
Hello David , /proc/partitions ? Hth , JimL
Quoted 6 lines · David Chow
Hi all,
Is there any global variables or list in the kernel space that I can find out which partitions are available in the system? Please give pointer of information.
regards,
David
+------------------------------------------------------------------+
| James W. Laferriere | System Techniques | Give me VMS |
| Network Engineer | P.O. Box 854 | Give me Linux |
| [email protected] | Coudersport PA 16915 | only on AXP |
+------------------------------------------------------------------+On Wed, 24 Jul 2002, Mr. James W. Laferriere wrote:
| Hello David , /proc/partitions ? Hth , JimL | | On Thu, 25 Jul 2002, David Chow wrote: | > Hi all, | > Is there any global variables or list in the kernel space that I can | > find out which partitions are available in the system? Please give | > pointer of information.
um, I wouldn't call /proc/partitions "in the kernel space." However, someone could clone the code that produces /proc/partitions in kernel space.
in drivers/block/genhd.c::get_partition_list() [at least in 2.4.18/19]
Signature · 1 line
~Randy
Quoted 2 lines · David Chow
Is there any global variables or list in the kernel space that I can find out which partitions are available in the system?
Look at the struct gendisk chain.
Quoted 6 lines · Andries Brouwer
Quoted 2 lines · David Chow
Is there any global variables or list in the kernel space that I can find out which partitions are available in the system?
Look at the struct gendisk chain.
... and you will get a random set of things. E.g. you might very well find a gendisk shared by hda (with its partitions) and hdb (either unpartitioned disk or a CDROM; no way to tell which one it is). OTOH, you will not find a SCSI CDROM. You will find IDE-floppy. You will not find paride one. You will find a very odd gendisk for RAID devices (even though they are not partitioned). You will not find one for loop or nbd.
IOW, contents of /proc/partitions or (soon to be late) gendisk chain is random - any code that relies on it to give you a meaningful set of devices is buggered.
BTW, going through /proc/partitions and blindly opening all devices you see is _NOT_ a good idea - it will show you absent devices if there is something with the same major and higher minor. Why? Beats me.
Basically, gendisks are crap. Why on the earth they were created as per-major objects instead of per-disk ones is a mistery, but whatever reason it had, it had acted as serious source of mess. For many years. Right now I'm cleaning that mess up in 2.5 and I have nothing nice to say about the bright guys responsible for its creation. Sorry.
Quoted 5 lines · Alexander Viro
Basically, gendisks are crap. Why on the earth they were created as per-major objects instead of per-disk ones is a mistery, but whatever reason it had, it had acted as serious source of mess. For many years. Right now I'm cleaning that mess up in 2.5 and I have nothing nice to say about the bright guys responsible for its creation. Sorry.
[amused] Good to see that you now understand that permanent disk data is not stored in a struct block_device and that the way to removal of the arrays is nearly independent of struct block_device and instead dependent on a replacement of struct gendisk.
[berating] However, your annoyed words are not fair to Drew Eckhardt. Ten years ago, when he created struct gendisk, most of the problems you mention did not exist yet.
Quoted 16 lines · Andries Brouwer
Quoted 5 lines · Alexander Viro
Basically, gendisks are crap. Why on the earth they were created as per-major objects instead of per-disk ones is a mistery, but whatever reason it had, it had acted as serious source of mess. For many years. Right now I'm cleaning that mess up in 2.5 and I have nothing nice to say about the bright guys responsible for its creation. Sorry.
[amused] Good to see that you now understand that permanent disk data is not stored in a struct
block_deviceand that the way to removal of the arrays is nearly independent of structblock_deviceand instead dependent on a replacement of struct gendisk.
Quoted 3 lines
[berating] However, your annoyed words are not fair to Drew Eckhardt. Ten years ago, when he created struct gendisk, most of the problems you mention did not exist yet.
Thanks for advice, it seems there are no standard solutions right? It depends on what sort of device we are looking for... I think I rather concentrate on finding local partitioncs, ide or scsi. But the case of ide-floppy is in a gray area. I certainly don't want to make use of such slow disk.
regards,
David