git: c40fee6f7d26 - main - vfs: drop the always curthread argument from kern_alternate_path

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Thu, 25 Nov 2021 22:50:49 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=c40fee6f7d26862260f0accc1dfeaa7b1328f5fd

commit c40fee6f7d26862260f0accc1dfeaa7b1328f5fd
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-11-25 21:42:42 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-11-25 22:50:42 +0000

    vfs: drop the always curthread argument from kern_alternate_path
---
 sys/compat/linux/linux_util.c | 2 +-
 sys/kern/vfs_lookup.c         | 6 ++++--
 sys/sys/syscallsubr.h         | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index 800a55be33df..35376db6063d 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -95,7 +95,7 @@ linux_emul_convpath(const char *path, enum uio_seg pathseg,
 {
 	int retval;
 
-	retval = kern_alternate_path(curthread, linux_emul_path, path, pathseg, pbuf,
+	retval = kern_alternate_path(linux_emul_path, path, pathseg, pbuf,
 	    cflag, dfd);
 
 	return (retval);
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 8cccd93152ef..6ca8ac6de6fc 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1673,14 +1673,16 @@ out_mismatch:
  * the M_TEMP bucket if one is returned.
  */
 int
-kern_alternate_path(struct thread *td, const char *prefix, const char *path,
-    enum uio_seg pathseg, char **pathbuf, int create, int dirfd)
+kern_alternate_path(const char *prefix, const char *path, enum uio_seg pathseg,
+    char **pathbuf, int create, int dirfd)
 {
+	struct thread *td;
 	struct nameidata nd, ndroot;
 	char *ptr, *buf, *cp;
 	size_t len, sz;
 	int error;
 
+	td = curthread;
 	buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
 	*pathbuf = buf;
 
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 24d2a199a272..62dde37c0c1f 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -91,7 +91,7 @@ int	kern_accessat(struct thread *td, int fd, const char *path,
 	    enum uio_seg pathseg, int flags, int mode);
 int	kern_adjtime(struct thread *td, struct timeval *delta,
 	    struct timeval *olddelta);
-int	kern_alternate_path(struct thread *td, const char *prefix, const char *path,
+int	kern_alternate_path(const char *prefix, const char *path,
 	    enum uio_seg pathseg, char **pathbuf, int create, int dirfd);
 int	kern_bindat(struct thread *td, int dirfd, int fd, struct sockaddr *sa);
 int	kern_break(struct thread *td, uintptr_t *addr);