[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] I think I'm going to rewrite mount.c.
From:       Rob Landley <rob () landley ! net>
Date:       2005-01-23 9:45:38
Message-ID: 200501230445.38447.rob () landley ! net
[Download RAW message or body]

I think I'm going to rewrite mount.c to make it suck less.  I've pondered this 
for a while, but now it broke in a way that cost me six hours to track down 
what was wrong.

Bind mounts don't work if all entries in /proc/filesystems are nodev, unless 
you explicitly specify a type.  (Or unless you have an /etc/filesystems 
(which is an obsolete relic now we've got /proc/filesystems) and it either 
lists a filesystem you don't have or lists a nodev filesystem without saying 
it's nodev.)

I.E. I compiled user mode linux (2.6.11-rc1-mm2 actually works, finally), 
compiled out all the filesystems except hostfs, and booted it with a hostfs 
root.  (I.E. ./vmlinux rw rootfstype=hostfs rootflags=/home/landley/build 
init=/bin/sh).  UML is really fun to play with, by the way.

Once in UML, I "mount -t proc /proc /proc" which means /proc/filesystems has 
all nodev filesystems, meaning the "auto" logic in busybox mount.c will never 
actually try any filesystems before failing.

This is fun interacting with bind mounts, since a bind mount doesn't care what 
the type you feed it is.  (Try it.  mkdir tmp/walrus; mount -t vfat -o 
bind /proc tmp/walrus , it works just fine.)  But without specifying a type, 
it'll never make the _attempt_ unless you have a blockdev backed 
filesystem...

I've meant to rewrite all this for a while, and back pre-1.0 I think I 
actually did at one point.  Probably long lost, but I can do it again.  The 
busybox mount.c file is a bit of a mess.

Anyway, just thought I'd mention it.  I can patch the problem by either A) 
specifying -t rutabega in my script, B) patching the current mount.c to go 
ahead and mount with type "auto" or something when you feed it -o bind or -o 
move.

But if I'm going to touch this code, I might as well rewrite it.  It could be 
a lot smaller, simpler, and easier to read...

You have been warned.

Rob


_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic