public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* how to map "/dev/root" to "/proc/partitions" entry in user prog?
@ 2002-05-14 21:12 Jeff Meininger
  2002-05-14 21:26 ` Miquel van Smoorenburg
  2002-05-15 15:33 ` Martin Schewe
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Meininger @ 2002-05-14 21:12 UTC (permalink / raw)
  To: linux-kernel


In a user program, you can read /proc/partitions to determine what disks 
and partitions are available, and you can read /proc/mounts to see which 
of them are mounted, and where.

However, on many configurations, /proc/mounts will list "/dev/root" 
instead of the corresponding entry in /proc/partitions (such as /dev/hda1 
or /dev/ide/host0/...).

How can I reliably map /dev/root to the corresponding entry in 
/proc/partitions?  Is there some /proc thing I'm missing, or is there an 
ioctl that can give me the information I'm looking for?

The only way I've been able to do this so far is to read in the output of
the "mount" command, or read fstab or mtab.  Reading fstab or mtab is
unreliable, because they don't necessarily contain accurate information.  
Parsing the output of "mount" seems kludgy, and introduces a lot of
complexity because it might list /dev/hda1 instead of
/dev/ide/host0/.../part1, thus requiring an additional layer of mapping.  
Plus, the "mount" command might not be available at all.

Whether devfs is running or not, I just want to be able to figure out
which device in /proc/partitions corresponds to /dev/root.

Thanks very much for your help!!
Please Cc me in your response.

-Jeff Meininger


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

end of thread, other threads:[~2002-05-15 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-14 21:12 how to map "/dev/root" to "/proc/partitions" entry in user prog? Jeff Meininger
2002-05-14 21:26 ` Miquel van Smoorenburg
2002-05-15 15:39   ` Denis Vlasenko
2002-05-15 15:33 ` Martin Schewe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox