Page MenuHomeFreeBSD

D22646.id67043.diff
No OneTemporary

D22646.id67043.diff

Index: sys/compat/linux/linux_file.c
===================================================================
--- sys/compat/linux/linux_file.c
+++ sys/compat/linux/linux_file.c
@@ -1065,11 +1065,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) */
@@ -1077,16 +1074,13 @@
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)
flags |= MNT_FORCE;
- bsd.path = args->path;
- bsd.flags = flags;
- return (sys_unmount(td, &bsd));
+ return (kern_unmount(td, args->path, flags));
}
#endif
Index: sys/kern/vfs_mount.c
===================================================================
--- sys/kern/vfs_mount.c
+++ 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: sys/sys/syscallsubr.h
===================================================================
--- sys/sys/syscallsubr.h
+++ 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, Nov 26, 9:56 PM (2 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26232282
Default Alt Text
D22646.id67043.diff (2 KB)

Event Timeline