Add support for mounting single files in nullfs
authorDoug Rabson <dfr@FreeBSD.org>
Wed, 23 Nov 2022 14:51:13 +0000 (14:51 +0000)
committerDoug Rabson <dfr@FreeBSD.org>
Mon, 19 Dec 2022 16:46:13 +0000 (16:46 +0000)
commit521fbb722c33663cf00a83bca70ad7cb790687b3
treefe2bed0dd21c809d9072450ed503982f2072b783
parent78d35459a2586da024ac18e8768b44893c7184e7
Add support for mounting single files in nullfs

The main use-case for this is to support mounting config files and
secrets into OCI containers. My current workaround copies the files into
the container which is messy and risks secrets leaking into container
images if the cleanup fails.

This adds a VFCF flag to indicate whether the filesystem supports file
mounts and allows fspath to be either a directory or a file if the flag
is set.

Test Plan:
$ sudo mkdir -p /mnt
$ sudo touch /mnt/foo
$ sudo mount -t nullfs /COPYRIGHT /mnt/foo

Reviewed by:    mjg, kib
Tested by:      pho
sys/fs/nullfs/null_vfsops.c
sys/kern/vfs_mount.c
sys/sys/mount.h