tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mount(8) enhancement
Dear folks,
there are file systems that although living in one partition/device support
multiple heads/labels to mount on that can't be expressed as a disk partition
scheme like disklabel or GPT since they all live in one partion.
A common way to mount such systems is to append the head-name to the device
like f.e.
mount /dev/dk0:bart /mnt
mount /dev/dk0%lisa /mnt
mount /dev/dk0@maggy /mnt
Or whatever scheme the FS wants or is chosen. Hammer2 supports such a scheme
in DragonflyBSD:
mount_hammer2 /dev/serno/QM00005.s1d@ROOT /mnt
mount_hammer2 -o ro /dev/serno/QM00005.s1d@2018-05-30_163833 /mnt
Our current mount(8) and all other file systems uses pathadj() from
sbin/mount/pathadj.c that is really a wrapper around realpath(3).
Passing such a name trough realpath() results in the following when passing it
trough my FS in development :
# mount -t sfs /dev/dk1/bart /mnt
dev: '/dev/dk1/bart'
dir: '/mnt'
mount_sfs: Warning: realpath /dev/dk1/bart: Not a directory
canondev: '/dev/dk1'
canondir: '/mnt'
but also
# mount -t sfs /dev/dk1@lisa /
dev: '/dev/dk1@lisa'
dir: '/'
mount_sfs: Warning: realpath /dev/dk1@lisa: No such file or directory
canondev: '/dev/dk1@lisa'
canondir: '/'
mount_sfs: Cannot mount /dev/dk1@lisa on /: Bad address
and
# mount -t sfs /dev/dk1:lisa /
dev: '/dev/dk1:lisa'
dir: '/'
mount_sfs: Warning: realpath /dev/dk1:lisa: No such file or directory
canondev: '/dev/dk1:lisa'
canondir: '/'
mount_sfs: Cannot mount /dev/dk1:lisa on /: Bad address
Note that mount(8) itself considers any mention of '%@' in a filename to be
NFS and isn't that forgiving:
# mount /dev/dk1/root /mnt
mount: cannot open `/dev/dk1/root': Not a directory
# mount /dev/dk1@root /mnt
mount_nfs: can't get net id for host "root": Temporary failure in name resolution
# mount /dev/dk1:root /mnt
mount_nfs: can't get net id for host "/dev/dk1": Temporary failure in name resolution
My proposal is to adjust
pathadj(const char *input, char *adjusted)
into
pathadj(const char *input, char *adjusted, char *tail)
It first copies the tail from the input with the tail defined as anything
after one of [$%@:&]. This does make the assumption that names with such
characters are not used in /dev/. It then calls realpath() on the truncated
input giving the desired result so the filesystem type associated with the
device can be recovered like normal and the appropriate mount_$FS can be
called with the appended tail.A
Only if this fails, a fallback is provided for Sun style NFS if the result of
realpath() is not found or is not a device; its hostname:mountpoint or
user@hostname:mountpoint will fail to locate `user' or `hostname' and if they
do exist somehow they are more like not devices.
Any objections to this scheme before I try to implement it?
With regards,
Reinoud
Home |
Main Index |
Thread Index |
Old Index