Add VBFS: VirtualBox Shared Folder File System
Refer to "man vbfs" on how to mount it.
This commit is contained in:
parent
bb4d055fa6
commit
928d76dbe8
8 changed files with 236 additions and 4 deletions
|
@ -36,6 +36,7 @@ servers/pm/pm
|
||||||
servers/procfs/procfs
|
servers/procfs/procfs
|
||||||
servers/rs/rs
|
servers/rs/rs
|
||||||
servers/sched/sched
|
servers/sched/sched
|
||||||
|
servers/vbfs/vbfs
|
||||||
servers/vfs/vfs
|
servers/vfs/vfs
|
||||||
servers/vm/vm
|
servers/vm/vm
|
||||||
servers/sched/sched
|
servers/sched/sched
|
||||||
|
|
|
@ -408,6 +408,13 @@ service hgfs
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
service vbfs
|
||||||
|
{
|
||||||
|
ipc
|
||||||
|
SYSTEM pm vfs rs vm vbox
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
service printer
|
service printer
|
||||||
{
|
{
|
||||||
io 378:4 # LPT1
|
io 378:4 # LPT1
|
||||||
|
|
|
@ -9,7 +9,7 @@ MAN= add_route.8 backup.8 badblocks.8 boot.8 btrace.8 \
|
||||||
rdate.8 readclock.8 reboot.8 repartition.8 \
|
rdate.8 readclock.8 reboot.8 repartition.8 \
|
||||||
rshd.8 screendump.8 serial-ip.8 service.8 \
|
rshd.8 screendump.8 serial-ip.8 service.8 \
|
||||||
setup.8 shutdown.8 slip.8 srccrc.8 sync.8 syslogd.8 tcpd.8 \
|
setup.8 shutdown.8 slip.8 srccrc.8 sync.8 syslogd.8 tcpd.8 \
|
||||||
unix.8 update.8 usage.8
|
unix.8 update.8 usage.8 vbfs.8
|
||||||
|
|
||||||
MLINKS += httpd.8 in.httpd.8
|
MLINKS += httpd.8 in.httpd.8
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.TH HGFS 8
|
.TH HGFS 8
|
||||||
.SH NAME
|
.SH NAME
|
||||||
hgfs \- Host/Guest File System server
|
hgfs \- VMware Host/Guest File System server
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBmount \-t hgfs \fR[\fB\-r\fR] [\fB\-o \fIoptions\fR] \fBnone \fImountpoint
|
\fBmount \-t hgfs \fR[\fB\-r\fR] [\fB\-o \fIoptions\fR] \fBnone \fImountpoint
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
@ -71,6 +71,7 @@ of HGFS is determined largely by the host. Other file system operations
|
||||||
because the file system structure as perceived by HGFS may change arbitrarily
|
because the file system structure as perceived by HGFS may change arbitrarily
|
||||||
at any time, due to modifications on the host side.
|
at any time, due to modifications on the host side.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR mount (1)
|
.BR mount (1),
|
||||||
|
.BR vbfs (8)
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
David van Moolenbroek <dcvmoole@cs.vu.nl>
|
David van Moolenbroek <dcvmoole@cs.vu.nl>
|
||||||
|
|
70
man/man8/vbfs.8
Normal file
70
man/man8/vbfs.8
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
.TH VBFS 8
|
||||||
|
.SH NAME
|
||||||
|
vbfs \- VirtualBox Shared Folder File System server
|
||||||
|
.SH SYNOPSIS
|
||||||
|
\fBmount \-t vbfs \fR[\fB\-r\fR] \fB\-o
|
||||||
|
\fBshare=\fIsharename\fR[\fB,\fIoptions\fR] \fBnone \fImountpoint
|
||||||
|
.SH DESCRIPTION
|
||||||
|
The \fBvbfs\fR server allows one to mount a VirtualBox shared folder as a file
|
||||||
|
system. This makes it possible to access selected portions of the VirtualBox
|
||||||
|
host file system when MINIX is run as a VirtualBox guest.
|
||||||
|
.PP
|
||||||
|
The above mount command will mount the vbfs file system onto the directory
|
||||||
|
\fImountpoint\fR. The \fB\-r\fR mount option makes the file system read-only;
|
||||||
|
note that shared folders may independently have been configured as read-only
|
||||||
|
on the VMware host. The \fIoptions\fR field is a string consisting of
|
||||||
|
comma-delimited \fIkey\fR or \fIkey\fB=\fIvalue\fR options.
|
||||||
|
The vbfs server can mount only one shared folder at a time, and therefore,
|
||||||
|
specifying a \fBshare\fR name is required.
|
||||||
|
The other options are optional. The following options are supported.
|
||||||
|
.TP 4
|
||||||
|
\fBshare=\fIname\fR
|
||||||
|
This required option specifies the share name to mount. It is currently not
|
||||||
|
possible to list the available share names from within MINIX3.
|
||||||
|
.TP
|
||||||
|
\fBprefix=\fIpath\fR
|
||||||
|
This option sets a path prefix that will be prepended to all file system
|
||||||
|
operations on the host system. The default is the empty path, exposing the
|
||||||
|
entire share. Leading and trailing slashes are ignored.
|
||||||
|
.TP
|
||||||
|
\fBuid=\fInumber\fR
|
||||||
|
This sets the user ID used for all the files and directories in the file
|
||||||
|
system, allowing a non-root user to be the owner. The value must be specified
|
||||||
|
as a decimal number.
|
||||||
|
The default is root (the number \fB0\fR).
|
||||||
|
.TP
|
||||||
|
\fBgid=\fInumber\fR
|
||||||
|
Likewise, sets the group ID for all files and directories.
|
||||||
|
The default is operator (the number \fB0\fR).
|
||||||
|
.TP
|
||||||
|
\fBfmask=\fInumber\fR
|
||||||
|
This option sets the file permission mask of regular files. It is specified as
|
||||||
|
an octal number. For example, a value of \fB600\fR makes all files readable and
|
||||||
|
writable by the owning user (see the "\fBuid\fR" option).
|
||||||
|
The default is \fB755\fR.
|
||||||
|
.TP
|
||||||
|
\fBdmask=\fInumber\fR
|
||||||
|
Likewise, sets the file permission mask of directories.
|
||||||
|
The default is also \fB755\fR.
|
||||||
|
.SH EXAMPLES
|
||||||
|
.TP 20
|
||||||
|
.B mount \-t vbfs -o share=myshare none /usr/myshare
|
||||||
|
# Mount the "\fImyshare\fR" shared folder on \fI/usr/myshare\fR
|
||||||
|
.TP 20
|
||||||
|
.B mount \-t vbfs \-o share=shared,prefix=foo/bar,uid=20,fmask=644 none /mnt
|
||||||
|
# Mount the "\fIfoo/bar\fR" subtree from the "\fIshared\fR" shared folder on
|
||||||
|
\fI/mnt\fR
|
||||||
|
.SH LIMITATIONS
|
||||||
|
VBFS has been designed to provide a convenient means to exchange files between
|
||||||
|
the guest and the host system, not as a complete file system implementation.
|
||||||
|
As such, it comes with many limitations. Some of these are VBFS implementation
|
||||||
|
shortcomings; some are the result of behavioral differences between the host
|
||||||
|
file system and the guest's expectations; some are the result of a mismatch
|
||||||
|
between MINIX's VFS/FS protocol and the requirements from VBFS; and finally,
|
||||||
|
some are the result of the user's ability to change the file system on the
|
||||||
|
host system at any time.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR mount (1),
|
||||||
|
.BR hgfs (8)
|
||||||
|
.SH AUTHOR
|
||||||
|
David van Moolenbroek <david@minix3.org>
|
|
@ -10,7 +10,7 @@ SUBDIR= ds init mfs pfs pm rs sched vfs vm
|
||||||
.else
|
.else
|
||||||
|
|
||||||
SUBDIR= ds ext2 hgfs inet init ipc is iso9660fs \
|
SUBDIR= ds ext2 hgfs inet init ipc is iso9660fs \
|
||||||
mfs pfs pm procfs rs sched vfs vm devman
|
mfs pfs pm procfs rs sched vbfs vfs vm devman
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|
12
servers/vbfs/Makefile
Normal file
12
servers/vbfs/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Makefile for VirtualBox Shared Folders File System (VBFS) server
|
||||||
|
PROG= vbfs
|
||||||
|
SRCS= vbfs.c
|
||||||
|
|
||||||
|
DPADD+= ${LIBSFFS} ${LIBVBOXFS} ${LIBSYS}
|
||||||
|
LDADD+= -lsffs -lvboxfs -lsys
|
||||||
|
|
||||||
|
MAN=
|
||||||
|
|
||||||
|
BINDIR?= /sbin
|
||||||
|
|
||||||
|
.include <minix.service.mk>
|
141
servers/vbfs/vbfs.c
Normal file
141
servers/vbfs/vbfs.c
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
/* This file contains the implementation of the VBFS file system server. */
|
||||||
|
/*
|
||||||
|
* The architecture of VBFS can be sketched as follows:
|
||||||
|
*
|
||||||
|
* +-------------+
|
||||||
|
* | VBFS | This file
|
||||||
|
* +-------------+
|
||||||
|
* |
|
||||||
|
* +-------------+
|
||||||
|
* | libsffs | Shared Folder File System library
|
||||||
|
* +-------------+
|
||||||
|
* |
|
||||||
|
* +-------------+
|
||||||
|
* | libvboxfs | VirtualBox File System library
|
||||||
|
* +-------------+
|
||||||
|
* |
|
||||||
|
* +-------------+
|
||||||
|
* | libsys/vbox | VBOX driver interfacing library
|
||||||
|
* +-------------+
|
||||||
|
* -------- | -------- (process boundary)
|
||||||
|
* +-------------+
|
||||||
|
* | VBOX driver | VirtualBox backdoor driver
|
||||||
|
* +-------------+
|
||||||
|
* ======== | ======== (system boundary)
|
||||||
|
* +-------------+
|
||||||
|
* | VirtualBox | The host system
|
||||||
|
* +-------------+
|
||||||
|
*
|
||||||
|
* The interfaces between the layers are defined in the following header files:
|
||||||
|
* minix/sffs.h: shared between VBFS, libsffs, and libvboxfs
|
||||||
|
* minix/vboxfs.h: shared between VBFS and libvboxfs
|
||||||
|
* minix/vbox.h: shared between libvboxfs and libsys/vbox
|
||||||
|
* minix/vboxtype.h: shared between libvboxfs, libsys/vbox, and VBOX
|
||||||
|
* minix/vboxif.h: shared between libsys/vbox and VBOX
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <minix/drivers.h>
|
||||||
|
#include <minix/sffs.h>
|
||||||
|
#include <minix/vboxfs.h>
|
||||||
|
#include <minix/optset.h>
|
||||||
|
|
||||||
|
static char share[PATH_MAX];
|
||||||
|
static struct sffs_params params;
|
||||||
|
|
||||||
|
static struct optset optset_table[] = {
|
||||||
|
{ "share", OPT_STRING, share, sizeof(share) },
|
||||||
|
{ "prefix", OPT_STRING, params.p_prefix, sizeof(params.p_prefix) },
|
||||||
|
{ "uid", OPT_INT, ¶ms.p_uid, 10 },
|
||||||
|
{ "gid", OPT_INT, ¶ms.p_gid, 10 },
|
||||||
|
{ "fmask", OPT_INT, ¶ms.p_file_mask, 8 },
|
||||||
|
{ "dmask", OPT_INT, ¶ms.p_dir_mask, 8 },
|
||||||
|
{ NULL, 0, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize this file server. Called at startup time.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
init(int UNUSED(type), sef_init_info_t *UNUSED(info))
|
||||||
|
{
|
||||||
|
const struct sffs_table *table;
|
||||||
|
int i, r, roflag;
|
||||||
|
|
||||||
|
/* Set defaults. */
|
||||||
|
share[0] = 0;
|
||||||
|
params.p_prefix[0] = 0;
|
||||||
|
params.p_uid = 0;
|
||||||
|
params.p_gid = 0;
|
||||||
|
params.p_file_mask = 0755;
|
||||||
|
params.p_dir_mask = 0755;
|
||||||
|
params.p_case_insens = FALSE;
|
||||||
|
|
||||||
|
/* We must have been given an options string. Parse the options. */
|
||||||
|
for (i = 1; i < env_argc - 1; i++)
|
||||||
|
if (!strcmp(env_argv[i], "-o"))
|
||||||
|
optset_parse(optset_table, env_argv[++i]);
|
||||||
|
|
||||||
|
/* A share name is required. */
|
||||||
|
if (!share[0]) {
|
||||||
|
printf("VBFS: no shared folder share name specified\n");
|
||||||
|
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the VBOXFS library. If this fails, exit immediately. */
|
||||||
|
r = vboxfs_init(share, &table, ¶ms.p_case_insens, &roflag);
|
||||||
|
|
||||||
|
if (r != OK) {
|
||||||
|
if (r == ENOENT)
|
||||||
|
printf("VBFS: the given share does not exist\n");
|
||||||
|
else
|
||||||
|
printf("VBFS: unable to initialize VBOXFS (%d)\n", r);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now initialize the SFFS library. */
|
||||||
|
if ((r = sffs_init("VBFS", table, ¶ms)) != OK) {
|
||||||
|
vboxfs_cleanup();
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local SEF initialization.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
sef_local_startup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Register initialization callback. */
|
||||||
|
sef_setcb_init_fresh(init);
|
||||||
|
|
||||||
|
/* Register signal callback. SFFS handles this. */
|
||||||
|
sef_setcb_signal_handler(sffs_signal);
|
||||||
|
|
||||||
|
sef_startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The main function of this file server.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Start up. */
|
||||||
|
env_setargs(argc, argv);
|
||||||
|
sef_local_startup();
|
||||||
|
|
||||||
|
/* Let SFFS do the actual work. */
|
||||||
|
sffs_loop();
|
||||||
|
|
||||||
|
/* Clean up. */
|
||||||
|
vboxfs_cleanup();
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
Loading…
Reference in a new issue