Skip to contentSkip to conversation

fs: Add VirtualBox guest shared folder (vboxsf) support

PATCH Superseded Hans de Goede 1 participant 1 message Feb 6, 2018

Subsystems (2)

v5 of 19 Superseded Latest is v19 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 fs: Add VirtualBox guest shared folder (vboxsf) support

VirtualBox hosts can share folders with guests, this commit adds a VFS driver implementing the Linux-guest side of this, allowing folders exported by the host to be mounted under Linux.

This driver depends on the guest <-> host IPC functions exported by the vboxguest driver.

---
Changes in v5:
-Honor CONFIG_NLS_DEFAULT (reported-by [email protected])

Changes in v4:
-Drop "name=..." mount option, instead use the dev_name argument to the
mount syscall, to keep compatibility with existing fstab entries
-Fix "nls=%" match_table_t entry to "nls=%s"

Changes in v3:
-Use text only mount options, instead of a custom data struct -Stop caching full path in inode data, if parents gets renamed it will change -Fixed negative dentries handling
-Dropped the force_reread flag for dirs, not sure what it was actually for
but it is no good, doing a re-read on unlink of a file will lead to another file being skipped if the caller has already iterated over the entry for the unlinked file.
-Use file_inode(), file_dentry() and d_inode() helpers
-Prefix any non object-private symbols with vboxsf_ so as to not pollute
the global namespace when builtin
-Add MAINTAINERS entry
-Misc. cleanups

Changes in v2:
-Removed various unused wrapper functions
-Don't use i_private, instead defined alloc_inode and destroy_inode
methods and use container_of.
-Drop obsolete comment referencing people to
http://www.atnf.csiro.au/people/rgooch/linux/vfs.txt
-move the single symlink op of from lnkops.c to file.c
-Use SPDX license headers
-Replace SHFLROOT / SHFLHANDLE defines with normal types -Removed unnecessary S_ISREG checks
-Got rid of bounce_buffer in regops, instead add a "user" flag to
vboxsf_read / vboxsf_write, re-using the existing __user address support in the vboxguest module
-Make vboxsf_wrappers return regular linux errno values
-Use i_size_write to update size on writing
-Convert doxygen style comments to kerneldoc style comments

---
 MAINTAINERS                 |   6 +
 fs/Kconfig                  |   1 +
 fs/Makefile                 |   1 +
 fs/vboxsf/Kconfig           |  10 +
 fs/vboxsf/Makefile          |   3 +
 fs/vboxsf/dir.c             | 575 +++++++++++++++++++++++++++
 fs/vboxsf/file.c            | 414 ++++++++++++++++++++
 fs/vboxsf/shfl_hostintf.h   | 919 ++++++++++++++++++++++++++++++++++++++++++++
 fs/vboxsf/super.c           | 433 +++++++++++++++++++++
 fs/vboxsf/utils.c           | 536 ++++++++++++++++++++++++++
 fs/vboxsf/vboxsf_wrappers.c | 370 ++++++++++++++++++
 fs/vboxsf/vfsmod.h          | 133 +++++++
 12 files changed, 3401 insertions(+)
 create mode 100644 fs/vboxsf/Kconfig
 create mode 100644 fs/vboxsf/Makefile
 create mode 100644 fs/vboxsf/dir.c
 create mode 100644 fs/vboxsf/file.c
 create mode 100644 fs/vboxsf/shfl_hostintf.h
 create mode 100644 fs/vboxsf/super.c
 create mode 100644 fs/vboxsf/utils.c
 create mode 100644 fs/vboxsf/vboxsf_wrappers.c
 create mode 100644 fs/vboxsf/vfsmod.h
MAINTAINERS +6 -0
index f247a069983c..f24b6bf8c361 100644
@@ -14570,6 +14570,12 @@ F:	include/linux/vbox_utils.h
 F:	include/uapi/linux/vbox*.h
 F:	drivers/virt/vboxguest/
 
+VIRTUAL BOX SHARED FOLDER VFS DRIVER:
+M:	Hans de Goede <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	fs/vboxsf/*
+
 VIRTUAL SERIO DEVICE DRIVER
 M:	Stephen Chandler Paul <[email protected]>
 S:	Maintained
fs/Kconfig +1 -0
index 7aee6d699fd6..7f80ad1cf591 100644
@@ -248,6 +248,7 @@ source "fs/pstore/Kconfig"
 source "fs/sysv/Kconfig"
 source "fs/ufs/Kconfig"
 source "fs/exofs/Kconfig"
+source "fs/vboxsf/Kconfig"
 
 endif # MISC_FILESYSTEMS
 
fs/Makefile +1 -0
index ef772f1eaff8..3057830f112a 100644
@@ -129,3 +129,4 @@ obj-y				+= exofs/ # Multiple modules
 obj-$(CONFIG_CEPH_FS)		+= ceph/
 obj-$(CONFIG_PSTORE)		+= pstore/
 obj-$(CONFIG_EFIVAR_FS)		+= efivarfs/
+obj-$(CONFIG_VBOXSF_FS)		+= vboxsf/
fs/vboxsf/Kconfig new file +10 -0
new file mode 100644
index 000000000000..b034698121ea
@@ -0,0 +1,10 @@
+config VBOXSF_FS
+	tristate "VirtualBox guest shared folder (vboxsf) support"
+	depends on VBOXGUEST
+	select NLS
+	help
+	  VirtualBox hosts can share folders with guests, this driver
+	  implements the Linux-guest side of this allowing folders exported
+	  by the host to be mounted under Linux.
+
+	  If you want to use shared folders in VirtualBox guests, answer Y or M.
fs/vboxsf/Makefile new file +3 -0
new file mode 100644
index 000000000000..fcbd488f9eec
@@ -0,0 +1,3 @@
+obj-$(CONFIG_VBOXSF_FS) += vboxsf.o
+
+vboxsf-objs := dir.o file.o utils.o vboxsf_wrappers.o super.o
fs/vboxsf/dir.c new file +575 -0

575 lines not on this page · raw message

fs/vboxsf/file.c new file +414 -0

414 lines not on this page · raw message

fs/vboxsf/shfl_hostintf.h new file +919 -0

919 lines not on this page · raw message

fs/vboxsf/super.c new file +433 -0

433 lines not on this page · raw message

fs/vboxsf/utils.c new file +536 -0

536 lines not on this page · raw message

fs/vboxsf/vboxsf_wrappers.c new file +370 -0

87 lines not on this page · raw message

fs/vboxsf/vfsmod.h new file +133 -0

133 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.14.3

Part of the diff is not shown here. View the raw message.