Page MenuHomeFreeBSD

D22646.diff
No OneTemporary

D22646.diff

Index: head/sys/compat/linux/linux_file.c
===================================================================
--- head/sys/compat/linux/linux_file.c
+++ head/sys/compat/linux/linux_file.c
@@ -1107,11 +1107,8 @@
int
linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
{
- struct linux_umount_args args2;
- args2.path = args->path;
- args2.flags = 0;
- return (linux_umount(td, &args2));
+ return (kern_unmount(td, args->path, 0));
}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
@@ -1119,16 +1116,19 @@
int
linux_umount(struct thread *td, struct linux_umount_args *args)
{
- struct unmount_args bsd;
int flags;
flags = 0;
- if ((args->flags & LINUX_MNT_FORCE) != 0)
+ if ((args->flags & LINUX_MNT_FORCE) != 0) {
+ args->flags &= ~LINUX_MNT_FORCE;
flags |= MNT_FORCE;
+ }
+ if (args->flags != 0) {
+ linux_msg(td, "unsupported umount2 flags %#x", args->flags);
+ return (EINVAL);
+ }
- bsd.path = args->path;
- bsd.flags = flags;
- return (sys_unmount(td, &bsd));
+ return (kern_unmount(td, args->path, flags));
}
#endif
Index: head/sys/kern/vfs_mount.c
===================================================================
--- head/sys/kern/vfs_mount.c
+++ head/sys/kern/vfs_mount.c
@@ -1294,12 +1294,19 @@
int
sys_unmount(struct thread *td, struct unmount_args *uap)
{
+
+ return (kern_unmount(td, uap->path, uap->flags));
+}
+
+int
+kern_unmount(struct thread *td, const char *path, int flags)
+{
struct nameidata nd;
struct mount *mp;
char *pathbuf;
int error, id0, id1;
- AUDIT_ARG_VALUE(uap->flags);
+ AUDIT_ARG_VALUE(flags);
if (jailed(td->td_ucred) || usermount == 0) {
error = priv_check(td, PRIV_VFS_UNMOUNT);
if (error)
@@ -1307,12 +1314,12 @@
}
pathbuf = malloc(MNAMELEN, M_TEMP, M_WAITOK);
- error = copyinstr(uap->path, pathbuf, MNAMELEN, NULL);
+ error = copyinstr(path, pathbuf, MNAMELEN, NULL);
if (error) {
free(pathbuf, M_TEMP);
return (error);
}
- if (uap->flags & MNT_BYFSID) {
+ if (flags & MNT_BYFSID) {
AUDIT_ARG_TEXT(pathbuf);
/* Decode the filesystem ID. */
if (sscanf(pathbuf, "FSID:%d:%d", &id0, &id1) != 2) {
@@ -1359,7 +1366,7 @@
* now, so in the !MNT_BYFSID case return the more likely
* EINVAL for compatibility.
*/
- return ((uap->flags & MNT_BYFSID) ? ENOENT : EINVAL);
+ return ((flags & MNT_BYFSID) ? ENOENT : EINVAL);
}
/*
@@ -1369,7 +1376,7 @@
vfs_rel(mp);
return (EINVAL);
}
- error = dounmount(mp, uap->flags, td);
+ error = dounmount(mp, flags, td);
return (error);
}
Index: head/sys/sys/syscallsubr.h
===================================================================
--- head/sys/sys/syscallsubr.h
+++ head/sys/sys/syscallsubr.h
@@ -315,6 +315,7 @@
int kern_writev(struct thread *td, int fd, struct uio *auio);
int kern_socketpair(struct thread *td, int domain, int type, int protocol,
int *rsv);
+int kern_unmount(struct thread *td, const char *path, int flags);
/* flags for kern_sigaction */
#define KSA_OSIGSET 0x0001 /* uses osigact_t */

File Metadata

Mime Type
text/plain
Expires
Wed, May 20, 1:39 PM (2 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33348804
Default Alt Text
D22646.diff (2 KB)

Event Timeline