www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Tango FileRoots

reply Ty Tower <tytower hotmail.com.au> writes:
Jesse Phillips Wrote:

 On Sun, 02 Mar 2008 17:02:33 -0500, Ty Tower wrote:
 
 Lars Ivar Igesund Wrote:
 
 Jesse Phillips wrote:
 
 I'm interested in knowing why FileRoots.list() uses /etc/mtab for its
 root folders in linux? To my knowledge Linux only has one root and if
 anything its sub directories would be considered the roots. I just
 don't see the point of using mtab, but then again I'm looking at it
 from how file managers look at the system.

The unix root / isn't the most useful thing to ask for, thus mtab is used to show all mounted devices. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango

ftab mounts the original devices and empowers them mtab looks after the devices added later ie plugging in the usb stick or something like that is the file used in that sort of context?

it can't, it reads the file when called, so it will only get already mounted devices, a file change listener of some sort would have to be created to track later mounted devices. For me must of the mounted items in mtab are useless, but it can be easily version'd out as needed.

Probably should add (perhaps you already know) /etc/fstab Lists the filesystems mounted automatically at startup by the mount -a command (in /etc/rc or equivalent startup file). /etc/mtab A list of currently mounted file systems. Setup by boot scripts and updated by the mount command. So if you want a list of what's mounted right now mtab is the place to go
Mar 03 2008
next sibling parent reply BCS <ao pathlink.com> writes:
Reply to ty,

 So if you want a list of what's mounted right now mtab is the place to
 go
 

isn't there something in /proc that grovels in the kernel? I would rather get info from the kernel than a state file updated by some apps. (I don't have a *nux box handy to try with)
Mar 03 2008
parent reply BCS <BCS pathlink.com> writes:
Ty Tower wrote:
 BCS wrote:
 
 
Reply to ty,
isn't there something in /proc that grovels in the kernel? I would
rather get info from the kernel than a state file updated by some
apps. (I don't have a *nux box handy to try with)

Heh heh ! This is classic . Pardon my humorous response. When we grovel in the dirt we get down and dirty lying and squirming in the dirt. I don't know but you probably are saying that there is something in the kernel that returns that information as well.

Now that I have a Linux box handy... take a look at the /proc/mounts file. Mine gives this: $ cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / ext3 rw 0 0 /proc /proc proc rw 0 0 usbdevfs /proc/bus/usb usbdevfs rw 0 0 none /dev/pts devpts rw 0 0 none /dev/shm tmpfs rw 0 0 IIRC this is a file in a "fileystem" that is actually a device for reading kernel and system state. This reflects the actual current state of the system, not the last thing written to some file.
 I can't say . I am
 not that familiar with the kernel but my understanding is
 that /etc/mtab is updated by the kernel as each device is added or
 removed instantly.

Potentially someone could over wright /etc/mtab with junk. Not likely but...
 I don't think any applications act on it except
 maybe Hal.
 
 And did you mean "*nix"  as Unix/Linux box ,I think so  
 

yup
Mar 04 2008
parent reply Ty Tower <tytower hotmail.com.au> writes:
BCS Wrote:
 Now that I have a Linux box handy...
 
 take a look at the /proc/mounts file. Mine gives this:
 
 $ cat /proc/mounts
 rootfs / rootfs rw 0 0
 /dev/root / ext3 rw 0 0
 /proc /proc proc rw 0 0
 usbdevfs /proc/bus/usb usbdevfs rw 0 0
 none /dev/pts devpts rw 0 0
 none /dev/shm tmpfs rw 0 0
 
 IIRC this is a file in a "fileystem" that is actually a device for 
 reading kernel and system state. This reflects the actual current state 
 of the system, not the last thing written to some file.
 
 I can't say . I am
 not that familiar with the kernel but my understanding is
 that /etc/mtab is updated by the kernel as each device is added or
 removed instantly.

Potentially someone could over wright /etc/mtab with junk. Not likely but... > I don't think any applications act on it except
 maybe Hal.
 
 And did you mean "*nix"  as Unix/Linux box ,I think so  
 

yup

Good stuff - I am learning each day Thanks
Mar 04 2008
parent BCS <ao pathlink.com> writes:
Reply to ty,

 Good stuff - I am learning each day Thanks
 

your wecome :)
Mar 04 2008
prev sibling parent "Anders Bergh" <anders1 gmail.com> writes:
On Tue, Mar 4, 2008 at 7:04 AM, BCS <ao pathlink.com> wrote:
  isn't there something in /proc that grovels in the kernel? I would rather
  get info from the kernel than a state file updated by some apps. (I don't
  have a *nux box handy to try with)

On Linux, sure. But that wouldn't be portable at all, /proc is quite Linux-specific. Anders
Mar 04 2008