Page MenuHomeFreeBSD

D39438.1783665156.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D39438.1783665156.diff

diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -526,29 +526,27 @@
static int
linprocfs_domtab(PFS_FILL_ARGS)
{
- struct nameidata nd;
- const char *lep, *mntto, *mntfrom, *fstype;
+ const char *mntto, *mntfrom, *fstype;
char *dlep, *flep;
+ struct vnode *vp;
+ struct pwd *pwd;
size_t lep_len;
int error;
struct statfs *buf, *sp;
size_t count;
- /* resolve symlinks etc. in the emulation tree prefix */
/*
- * Ideally, this would use the current chroot rather than some
- * hardcoded path.
+ * Resolve emulation tree prefix
*/
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path);
+ pwd = pwd_hold(td);
+ vp = pwd->pwd_adir;
+
flep = NULL;
- error = namei(&nd);
- lep = linux_emul_path;
- if (error == 0) {
- if (vn_fullpath(nd.ni_vp, &dlep, &flep) == 0)
- lep = dlep;
- vrele(nd.ni_vp);
- }
- lep_len = strlen(lep);
+ error = vn_fullpath_global(vp, &dlep, &flep);
+ pwd_drop(pwd);
+ if (error != 0)
+ return (error);
+ lep_len = strlen(dlep);
buf = NULL;
error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count,
@@ -567,7 +565,7 @@
}
/* determine mount point */
- if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/')
+ if (strncmp(mntto, dlep, lep_len) == 0 && mntto[lep_len] == '/')
mntto += lep_len;
sbuf_printf(sb, "%s %s %s ", mntfrom, mntto, fstype);
@@ -584,28 +582,26 @@
static int
linprocfs_doprocmountinfo(PFS_FILL_ARGS)
{
- struct nameidata nd;
const char *mntfrom, *mntto, *fstype;
- const char *lep;
char *dlep, *flep;
struct statfs *buf, *sp;
size_t count, lep_len;
+ struct vnode *vp;
+ struct pwd *pwd;
int error;
/*
- * Ideally, this would use the current chroot rather than some
- * hardcoded path.
+ * Resolve emulation tree prefix
*/
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path);
+ pwd = pwd_hold(td);
+ vp = pwd->pwd_adir;
+
flep = NULL;
- error = namei(&nd);
- lep = linux_emul_path;
- if (error == 0) {
- if (vn_fullpath(nd.ni_vp, &dlep, &flep) == 0)
- lep = dlep;
- vrele(nd.ni_vp);
- }
- lep_len = strlen(lep);
+ error = vn_fullpath_global(vp, &dlep, &flep);
+ pwd_drop(pwd);
+ if (error != 0)
+ return (error);
+ lep_len = strlen(dlep);
buf = NULL;
error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count,
@@ -620,7 +616,7 @@
continue;
}
- if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/')
+ if (strncmp(mntto, dlep, lep_len) == 0 && mntto[lep_len] == '/')
mntto += lep_len;
#if 0
/*
diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -41,8 +41,6 @@
MALLOC_DECLARE(M_LINUX);
MALLOC_DECLARE(M_EPOLL);
-extern char linux_emul_path[];
-
int linux_pwd_onexec(struct thread *td);
#define DUMMY(s) \
diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile
--- a/sys/modules/linux/Makefile
+++ b/sys/modules/linux/Makefile
@@ -76,7 +76,6 @@
.if ${MACHINE_CPUARCH} == "i386"
EXPORT_SYMS=
-EXPORT_SYMS+= linux_emul_path
EXPORT_SYMS+= linux_get_osname
EXPORT_SYMS+= linux_get_osrelease
EXPORT_SYMS+= linux_ioctl_register_handler
diff --git a/sys/modules/linux_common/Makefile b/sys/modules/linux_common/Makefile
--- a/sys/modules/linux_common/Makefile
+++ b/sys/modules/linux_common/Makefile
@@ -16,7 +16,6 @@
.endif
EXPORT_SYMS=
-EXPORT_SYMS+= linux_emul_path
EXPORT_SYMS+= linux_get_osname
EXPORT_SYMS+= linux_get_osrelease
EXPORT_SYMS+= linux_use_real_ifname

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 10, 6:32 AM (12 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29053029
Default Alt Text
D39438.1783665156.diff (3 KB)

Event Timeline