From 7b0d017245d110ee6fd8d06e8be535e51e5b2c2e Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Tue, 16 Mar 2004 09:05:56 +0000 Subject: Use vfs_nmount() to mount linprocfs filesystems in linux_mount(); linprocfs doesn't support the old mount interface. --- sys/compat/linux/linux_file.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'sys/compat/linux/linux_file.c') diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 857c73d62bc8..ae5ad36568dc 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -732,9 +732,10 @@ linux_mount(struct thread *td, struct linux_mount_args *args) struct ufs_args ufs; char fstypename[MFSNAMELEN]; char mntonname[MNAMELEN], mntfromname[MNAMELEN]; + struct uio auio; + struct iovec iov[4]; int error; int fsflags; - const char *fstype; void *fsdata; error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1, @@ -755,7 +756,7 @@ linux_mount(struct thread *td, struct linux_mount_args *args) #endif if (strcmp(fstypename, "ext2") == 0) { - fstype = "ext2fs"; + strcpy(fstypename, "ext2fs"); fsdata = &ufs; ufs.fspec = mntfromname; #define DEFAULT_ROOTID -2 @@ -763,7 +764,7 @@ linux_mount(struct thread *td, struct linux_mount_args *args) ufs.export.ex_flags = args->rwflag & LINUX_MS_RDONLY ? MNT_EXRDONLY : 0; } else if (strcmp(fstypename, "proc") == 0) { - fstype = "linprocfs"; + strcpy(fstypename, "linprocfs"); fsdata = NULL; } else { return (ENODEV); @@ -788,7 +789,23 @@ linux_mount(struct thread *td, struct linux_mount_args *args) fsflags |= MNT_UPDATE; } - return (vfs_mount(td, fstype, mntonname, fsflags, fsdata)); + if (strcmp(fstypename, "linprocfs") == 0) { + bzero(&auio, sizeof(auio)); + auio.uio_iov = iov; + auio.uio_iovcnt = sizeof(iov) / sizeof(*iov); + auio.uio_segflg = UIO_SYSSPACE; + iov[0].iov_base = "fstype"; + iov[0].iov_len = sizeof("fstype"); + iov[1].iov_base = fstypename; + iov[1].iov_len = strlen(fstypename) + 1; + iov[2].iov_base = "fspath"; + iov[2].iov_len = sizeof("fspath"); + iov[3].iov_base = mntonname; + iov[3].iov_len = strlen(mntonname) + 1; + error = vfs_nmount(td, fsflags, &auio); + } else + error = vfs_mount(td, fstypename, mntonname, fsflags, fsdata); + return (error); } int -- cgit v1.2.3