Instead of using mount/umount syscalls, have a file that exists
per-directory named, say, ..mount. Then, to mount /dev/sda at /home,
you issue the command
echo "/dev/sda rw" > /home/..mount
(Almost the same syntax as mtab.) The OS takes action (upon modification
of the ..mounts file) and attempts the mount. Reading back the file
if the mount suceeded, otherwise it would be null if there is an error.
To unmount the file system, remove that line from the ..mounts file.
Now, if you want to do layered mounts, a la plan 9, you could search
from the top line through the last line. Say you had a directory,
/programs. You want to make a union of directories together, so you
make /programs/..mounts look like:
Since /home/root/bin rw is read-write, any newly written files in
/programs really go in /home/root/bin. But you see files from each of
the four directories (unless they have duplicate names, then higher in
the list takes precedence) due to the unioning.
Why do this? A few reasons: one could set unix permissions/acl's on the
..mounts file--you could easily let non-root users perform mount
operations on certain directories. Then you don't need mount and
unmount commands as well.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/