tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mount_mfs: why chdir?



>> Perhaps, but that's equally true of every other mount operation
>> (except, to a partial extent, union mounts).  Why would mount_mfs
>> get special treatment?  I don't see any chdir call in, for example,
>> mount_ffs.

> mount_ffs applies the mount system call and exits.

> mount_mfs forks a background process that has the "memory disk"
> mapped and that terminates when you umount.

> While the chdir() isn't necessary, it avoids keeping the current
> directory busy.

Oh!  Thank you.  Yes, that makes sense.

I think it should be done _after_ the mount() call, though, or else the
path specified should first be converted into an absolute path if it
isn't already.

My use case amounted to "mount_mfs -s 8192 swap foo", "cd foo", and do
stuff.  This of course breaks because mount_mfs chdir()s to / first, so
it tries to mount on /foo, not on `pwd`/foo.

> mount does a realpath() to resolve relative mount paths, not sure
> since when..

You're talking about mount(8), not mount(2), right?  Arguably mount_mfs
should do the same, for consistency if nothing else.

I'm not sure whether I think the mount table should have "foo" or
`pwd`/foo when relative "foo" is specified.  I can see arguments each
way, though at the moment I'm inclined towards the absolute path.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index