Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F176309697
D26959.id78779.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D26959.id78779.diff
View Options
Index: sys/compat/linux/linux_file.c
===================================================================
--- sys/compat/linux/linux_file.c
+++ sys/compat/linux/linux_file.c
@@ -1119,13 +1119,15 @@
int
linux_mount(struct thread *td, struct linux_mount_args *args)
{
- char fstypename[MFSNAMELEN];
- char *mntonname, *mntfromname;
+ struct mntarg *ma = NULL;
+ char *fstypename, *mntonname, *mntfromname, *data;
int error, fsflags;
+ fstypename = malloc(MNAMELEN, M_TEMP, M_WAITOK);
mntonname = malloc(MNAMELEN, M_TEMP, M_WAITOK);
mntfromname = malloc(MNAMELEN, M_TEMP, M_WAITOK);
- error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1,
+ data = NULL;
+ error = copyinstr(args->filesystemtype, fstypename, MNAMELEN - 1,
NULL);
if (error != 0)
goto out;
@@ -1146,6 +1148,31 @@
strcpy(fstypename, "linprocfs");
} else if (strcmp(fstypename, "vfat") == 0) {
strcpy(fstypename, "msdosfs");
+ } else if (strcmp(fstypename, "fuse") == 0) {
+ char *fuse_options, *fuse_option, *fuse_name;
+
+ if (strcmp(mntfromname, "fuse") == 0)
+ strcpy(mntfromname, "/dev/fuse");
+
+ strcpy(fstypename, "fusefs");
+ data = malloc(MNAMELEN, M_TEMP, M_WAITOK);
+ error = copyinstr(args->data, data, MNAMELEN - 1, NULL);
+ if (error != 0)
+ goto out;
+
+ fuse_options = data;
+ while ((fuse_option = strsep(&fuse_options, ",")) != NULL) {
+ fuse_name = strsep(&fuse_option, "=");
+ if (fuse_name == NULL || fuse_option == NULL)
+ goto out;
+ ma = mount_arg(ma, fuse_name, fuse_option, -1);
+ }
+
+ /*
+ * The FUSE server uses Linux errno values instead of FreeBSD
+ * ones; add a flag to tell fuse(4) to do errno translation.
+ */
+ ma = mount_arg(ma, "linux_errnos", "1", -1);
}
fsflags = 0;
@@ -1163,14 +1190,15 @@
if (args->rwflag & LINUX_MS_REMOUNT)
fsflags |= MNT_UPDATE;
- error = kernel_vmount(fsflags,
- "fstype", fstypename,
- "fspath", mntonname,
- "from", mntfromname,
- NULL);
+ ma = mount_arg(ma, "fstype", fstypename, -1);
+ ma = mount_arg(ma, "fspath", mntonname, -1);
+ ma = mount_arg(ma, "from", mntfromname, -1);
+ error = kernel_mount(ma, fsflags);
out:
+ free(fstypename, M_TEMP);
free(mntonname, M_TEMP);
free(mntfromname, M_TEMP);
+ free(data, M_TEMP);
return (error);
}
Index: sys/fs/fuse/fuse_device.c
===================================================================
--- sys/fs/fuse/fuse_device.c
+++ sys/fs/fuse/fuse_device.c
@@ -451,6 +451,15 @@
if ((err = uiomove(&ohead, sizeof(struct fuse_out_header), uio)) != 0)
return (err);
+ if (data->linux_errnos != 0 && ohead.error != 0) {
+ // XXX: Linuxulator needs to export a function to do this.
+ printf("%s: error %d\n", __func__, ohead.error);
+ if (ohead.error == -38) {
+ ohead.error = -ENOSYS;
+ printf("%s: -> %d\n", __func__, ohead.error);
+ }
+ }
+
/*
* We check header information (which is redundant) and compare it
* with what we see. If we see some inconsistency we discard the
Index: sys/fs/fuse/fuse_ipc.h
===================================================================
--- sys/fs/fuse/fuse_ipc.h
+++ sys/fs/fuse/fuse_ipc.h
@@ -217,6 +217,7 @@
struct selinfo ks_rsel;
int daemon_timeout;
+ int linux_errnos;
unsigned time_gran;
uint64_t notimpl;
uint64_t mnt_flag;
Index: sys/fs/fuse/fuse_vfsops.c
===================================================================
--- sys/fs/fuse/fuse_vfsops.c
+++ sys/fs/fuse/fuse_vfsops.c
@@ -300,6 +300,7 @@
uint64_t mntopts, __mntopts;
uint32_t max_read;
+ int linux_errnos;
int daemon_timeout;
int fd;
@@ -312,6 +313,7 @@
subtype = NULL;
max_read = ~0;
+ linux_errnos = 0;
err = 0;
mntopts = 0;
__mntopts = 0;
@@ -337,6 +339,7 @@
FUSE_FLAGOPT(intr, FSESS_INTR);
(void)vfs_scanopt(opts, "max_read=", "%u", &max_read);
+ (void)vfs_scanopt(opts, "linux_errnos", "%d", &linux_errnos);
if (vfs_scanopt(opts, "timeout=", "%u", &daemon_timeout) == 1) {
if (daemon_timeout < FUSE_MIN_DAEMON_TIMEOUT)
daemon_timeout = FUSE_MIN_DAEMON_TIMEOUT;
@@ -411,6 +414,7 @@
data->dataflags |= mntopts;
data->max_read = max_read;
data->daemon_timeout = daemon_timeout;
+ data->linux_errnos = linux_errnos;
data->mnt_flag = mp->mnt_flag & MNT_UPDATEMASK;
FUSE_UNLOCK();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 18, 8:00 PM (17 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41012935
Default Alt Text
D26959.id78779.diff (4 KB)
Attached To
Mode
D26959: Linuxulator fusefs support
Attached
Detach File
Event Timeline
Log In to Comment