[Toybox] getmountlist - enhancement
Rob Landley
rob at landley.net
Sun Apr 28 22:30:10 PDT 2013
On 04/26/2013 04:45:27 AM, Ashwini Sharma wrote:
> Hi Rob,
>
> Can you change the getmountlist to accept the file path from user,
> as to
> in which file he is interested.
>
> As of now you bind it to read only /proc/mounts, giving the option
> will
> make it usable for /etc/fstab or /etc/mtab
I'm not sure this is useful for /etc/fstab, because it doesn't record
all the getmntent fields (no mnt_opts, mnt_freq, or mnt_passno). And
half of what it does is collect stat() and statvfs() info on each mount
point, which isn't useful for fstab because they're not necessarily
mounted yet.
As for /etc/mtab: it's obsolete as anything but a symlink to
/proc/self/mounts. What's mounted can vary per-process (the first part
of containers support, process-local mount namespaces, went into
Linus's tree around ten years ago), and can be updated from places that
can't access any given file (if you mount something in a chroot then
exit, it's not in the host's /etc/mtab but it's still mounted).
The kernel knows what is mounted. A single global /etc/mtab can't get
it right, except as a symlink to /proc/mounts. So adding code to toybox
to maintain an /etc/mtab is of no interest to me.
(If you want to argue that the kernel's procfs should be cleaned up and
pared down, I'm all for it. Especially now that we have union mounts
and can separate the process directories, /proc/sys, and the rest into
separate filesystems. But that's a separate project.)
Rob
1367213410.0
More information about the Toybox
mailing list