Remove unused code from linux_mount(), and make it possible to mount

any kind of filesystem instead of harcoded three.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
trasz 2015-04-18 09:49:09 +00:00
parent b8e7553702
commit befe1c29cd

View File

@ -55,10 +55,6 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
#include <ufs/ufs/extattr.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/ufsmount.h>
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@ -1078,12 +1074,10 @@ linux_pwrite(td, uap)
int
linux_mount(struct thread *td, struct linux_mount_args *args)
{
struct ufs_args ufs;
char fstypename[MFSNAMELEN];
char mntonname[MNAMELEN], mntfromname[MNAMELEN];
int error;
int fsflags;
void *fsdata;
error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1,
NULL);
@ -1104,20 +1098,10 @@ linux_mount(struct thread *td, struct linux_mount_args *args)
if (strcmp(fstypename, "ext2") == 0) {
strcpy(fstypename, "ext2fs");
fsdata = &ufs;
ufs.fspec = mntfromname;
#define DEFAULT_ROOTID -2
ufs.export.ex_root = DEFAULT_ROOTID;
ufs.export.ex_flags =
args->rwflag & LINUX_MS_RDONLY ? MNT_EXRDONLY : 0;
} else if (strcmp(fstypename, "proc") == 0) {
strcpy(fstypename, "linprocfs");
fsdata = NULL;
} else if (strcmp(fstypename, "vfat") == 0) {
strcpy(fstypename, "msdosfs");
fsdata = NULL;
} else {
return (ENODEV);
}
fsflags = 0;
@ -1137,19 +1121,11 @@ linux_mount(struct thread *td, struct linux_mount_args *args)
fsflags |= MNT_UPDATE;
}
if (strcmp(fstypename, "linprocfs") == 0) {
error = kernel_vmount(fsflags,
"fstype", fstypename,
"fspath", mntonname,
NULL);
} else if (strcmp(fstypename, "msdosfs") == 0) {
error = kernel_vmount(fsflags,
"fstype", fstypename,
"fspath", mntonname,
"from", mntfromname,
NULL);
} else
error = EOPNOTSUPP;
error = kernel_vmount(fsflags,
"fstype", fstypename,
"fspath", mntonname,
"from", mntfromname,
NULL);
return (error);
}