Bashing my head against mount again...
Rob Landley
rob at landley.net
Tue Jan 10 04:17:10 UTC 2006
Ok, threw the mount.c I've been working on into a backup file and started over
from a fresh copy of that's in svn. Let's try this again.
I need to get -a to work right, and since I started trying to fix it other
people have noticed the problems (see bugs 281, 534, 606, and 607).
The fundamental problem is mount has to maintain more than one set of flags
for -a to have a chance. The information entered from the command line
(flags, fstype, overrides like -r) needs to be merged with the corresponding
information read from fstab, but in the -a case the command line data needs
to be re-applied separately to each set of fstab information. And that means
there has to be two copies of everything. Possibly I should collect all that
crap together into a structure for clarity, if that won't bloat the code too
badly.
A second problem is that this area of the code is complicated by the gotos.
Unfortunately, I can't move singlemount() out into a separate function and
still expect the compiler to sanely optimize away everything I've got it
optimizing away, such as the stuff useMtab is a guard for. It turns out that
gcc can't do constant propogation between functions or through global (even
static) variables. Maybe with unit-at-a-time it would do that right, but I
can't rely on that yet. Possibly I can add extra ENABLE guards to get the
correct result; I've been tinkering for a while. But one of the bug entries
wanted to know why everything was such a big mess of gotos? Humoring the
optimizer to produce small code.
A related issue is that -o remount doesn't work right. For remount, we need
to read from mtab instead of fstab, and for the single mount case we need to
take the _last_ hit instead of the first. (What happens when multiple
filesystems are overmounted on the same mount point and you remount one of
the overmounted ones? I have no idea; if I had more time I'd fiddle with it
to find out, but right now I just want to make the darn thing work).
You may have noticed mount -a is a little harder than average to test
thoroughly on one's laptop...
I _could_ just patch the bugs people have noticed and call it a night, but
that doesn't fix the actual _problem_. Grrr...
Rob
--
Steve Ballmer: Innovation! Inigo Montoya: You keep using that word.
I do not think it means what you think it means.
More information about the busybox
mailing list