git: 8e4a3add99ca - main - struct kevent_freebsd11 -> struct freebsd11_kevent

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 15 Nov 2021 18:37:01 UTC
The branch main has been updated by brooks:

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

commit 8e4a3add99ca05c46bde826adcbea552d7a7d9e9
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-11-15 18:34:27 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-15 18:34:27 +0000

    struct kevent_freebsd11 -> struct freebsd11_kevent
    
    Rename to match the naming of syscalls and allow 32 to be appended
    without making an ugly name like kevent_freebsd1132.
    
    While here, make the kevent changelist argument const.
    
    Reviewed by:    kib
---
 sys/compat/freebsd32/freebsd32_misc.c | 14 +++++++-------
 sys/compat/freebsd32/syscalls.master  |  4 ++--
 sys/kern/kern_event.c                 | 10 +++++-----
 sys/kern/syscalls.master              |  6 +++---
 sys/sys/event.h                       |  4 ++--
 usr.bin/kdump/kdump.c                 |  8 ++++----
 usr.bin/truss/syscalls.c              |  4 ++--
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 08941ebc5be9..f05b63e5b0ac 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -762,7 +762,7 @@ static int
 freebsd32_kevent11_copyout(void *arg, struct kevent *kevp, int count)
 {
 	struct freebsd11_freebsd32_kevent_args *uap;
-	struct kevent32_freebsd11 ks32[KQ_NEVENTS];
+	struct freebsd11_kevent32 ks32[KQ_NEVENTS];
 	int i, error;
 
 	KASSERT(count <= KQ_NEVENTS, ("count (%d) > KQ_NEVENTS", count));
@@ -789,7 +789,7 @@ static int
 freebsd32_kevent11_copyin(void *arg, struct kevent *kevp, int count)
 {
 	struct freebsd11_freebsd32_kevent_args *uap;
-	struct kevent32_freebsd11 ks32[KQ_NEVENTS];
+	struct freebsd11_kevent32 ks32[KQ_NEVENTS];
 	int i, j, error;
 
 	KASSERT(count <= KQ_NEVENTS, ("count (%d) > KQ_NEVENTS", count));
@@ -826,7 +826,7 @@ freebsd11_freebsd32_kevent(struct thread *td,
 		.k_copyin = freebsd32_kevent11_copyin,
 	};
 #ifdef KTRACE
-	struct kevent32_freebsd11 *eventlist = uap->eventlist;
+	struct freebsd11_kevent32 *eventlist = uap->eventlist;
 #endif
 	int error;
 
@@ -841,17 +841,17 @@ freebsd11_freebsd32_kevent(struct thread *td,
 		tsp = NULL;
 #ifdef KTRACE
 	if (KTRPOINT(td, KTR_STRUCT_ARRAY))
-		ktrstructarray("kevent32_freebsd11", UIO_USERSPACE,
+		ktrstructarray("freebsd11_kevent32", UIO_USERSPACE,
 		    uap->changelist, uap->nchanges,
-		    sizeof(struct kevent32_freebsd11));
+		    sizeof(struct freebsd11_kevent32));
 #endif
 	error = kern_kevent(td, uap->fd, uap->nchanges, uap->nevents,
 	    &k_ops, tsp);
 #ifdef KTRACE
 	if (error == 0 && KTRPOINT(td, KTR_STRUCT_ARRAY))
-		ktrstructarray("kevent32_freebsd11", UIO_USERSPACE,
+		ktrstructarray("freebsd11_kevent32", UIO_USERSPACE,
 		    eventlist, td->td_retval[0],
-		    sizeof(struct kevent32_freebsd11));
+		    sizeof(struct freebsd11_kevent32));
 #endif
 	return (error);
 }
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 5cb7c059a670..3d676fa9c3c8 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -670,10 +670,10 @@
 				    gid_t *sgid); }
 362	AUE_KQUEUE	NOPROTO	{ int kqueue(void); }
 363	AUE_KEVENT	COMPAT11 { int freebsd32_kevent(int fd, \
-				    const struct kevent32_freebsd11 * \
+				    const struct freebsd11_kevent32 * \
 				    changelist, \
 				    int nchanges, \
-				    struct kevent32_freebsd11 *eventlist, \
+				    struct freebsd11_kevent32 *eventlist, \
 				    int nevents, \
 				    const struct timespec32 *timeout); }
 364	AUE_NULL	OBSOL	__cap_get_proc
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index ade71a848868..de652de6106f 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1107,7 +1107,7 @@ kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps)
 
 struct g_kevent_args {
 	int	fd;
-	void	*changelist;
+	const void *changelist;
 	int	nchanges;
 	void	*eventlist;
 	int	nevents;
@@ -1212,7 +1212,7 @@ static int
 kevent11_copyout(void *arg, struct kevent *kevp, int count)
 {
 	struct freebsd11_kevent_args *uap;
-	struct kevent_freebsd11 kev11;
+	struct freebsd11_kevent kev11;
 	int error, i;
 
 	KASSERT(count <= KQ_NEVENTS, ("count (%d) > KQ_NEVENTS", count));
@@ -1241,7 +1241,7 @@ static int
 kevent11_copyin(void *arg, struct kevent *kevp, int count)
 {
 	struct freebsd11_kevent_args *uap;
-	struct kevent_freebsd11 kev11;
+	struct freebsd11_kevent kev11;
 	int error, i;
 
 	KASSERT(count <= KQ_NEVENTS, ("count (%d) > KQ_NEVENTS", count));
@@ -1271,7 +1271,7 @@ freebsd11_kevent(struct thread *td, struct freebsd11_kevent_args *uap)
 		.arg = uap,
 		.k_copyout = kevent11_copyout,
 		.k_copyin = kevent11_copyin,
-		.kevent_size = sizeof(struct kevent_freebsd11),
+		.kevent_size = sizeof(struct freebsd11_kevent),
 	};
 	struct g_kevent_args gk_args = {
 		.fd = uap->fd,
@@ -1282,7 +1282,7 @@ freebsd11_kevent(struct thread *td, struct freebsd11_kevent_args *uap)
 		.timeout = uap->timeout,
 	};
 
-	return (kern_kevent_generic(td, &gk_args, &k_ops, "kevent_freebsd11"));
+	return (kern_kevent_generic(td, &gk_args, &k_ops, "freebsd11_kevent"));
 }
 #endif
 
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 5b5bc70fb21a..2c50bbe543ca 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1907,9 +1907,9 @@
 363	AUE_KEVENT	COMPAT11|CAPENABLED {
 		int kevent(
 		    int fd,
-		    _In_reads_opt_(nchanges) struct kevent_freebsd11 *changelist,
+		    _In_reads_opt_(nchanges) const struct freebsd11_kevent *changelist,
 		    int nchanges,
-		    _Out_writes_opt_(nevents) struct kevent_freebsd11 *eventlist,
+		    _Out_writes_opt_(nevents) struct freebsd11_kevent *eventlist,
 		    int nevents,
 		    _In_opt_ const struct timespec *timeout
 		);
@@ -3099,7 +3099,7 @@
 560	AUE_KEVENT	STD|CAPENABLED {
 		int kevent(
 		    int fd,
-		    _In_reads_opt_(nchanges) struct kevent *changelist,
+		    _In_reads_opt_(nchanges) const struct kevent *changelist,
 		    int nchanges,
 		    _Out_writes_opt_(nevents) struct kevent *eventlist,
 		    int nevents,
diff --git a/sys/sys/event.h b/sys/sys/event.h
index f1bdc7e2a80e..7d337d40c1e6 100644
--- a/sys/sys/event.h
+++ b/sys/sys/event.h
@@ -93,7 +93,7 @@ struct kevent {
 
 #if defined(_WANT_FREEBSD11_KEVENT)
 /* Older structure used in FreeBSD 11.x and older. */
-struct kevent_freebsd11 {
+struct freebsd11_kevent {
 	__uintptr_t	ident;		/* identifier for this event */
 	short		filter;		/* filter for event */
 	unsigned short	flags;
@@ -121,7 +121,7 @@ struct kevent32 {
 };
 
 #ifdef _WANT_FREEBSD11_KEVENT
-struct kevent32_freebsd11 {
+struct freebsd11_kevent32 {
 	u_int32_t	ident;		/* identifier for this event */
 	short		filter;		/* filter for event */
 	u_short		flags;
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 8b47212f88fc..611c9021cd78 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -2142,8 +2142,8 @@ ktrstructarray(struct ktr_struct_array *ksa, size_t buflen)
 				goto bad_size;
 			memcpy(&kev, data, sizeof(kev));
 			ktrkevent(&kev);
-		} else if (strcmp(name, "kevent_freebsd11") == 0) {
-			struct kevent_freebsd11 kev11;
+		} else if (strcmp(name, "freebsd11_kevent") == 0) {
+			struct freebsd11_kevent kev11;
 
 			if (ksa->struct_size != sizeof(kev11))
 				goto bad_size;
@@ -2175,8 +2175,8 @@ ktrstructarray(struct ktr_struct_array *ksa, size_t buflen)
 #endif
 			kev.udata = (void *)(uintptr_t)kev32.udata;
 			ktrkevent(&kev);
-		} else if (strcmp(name, "kevent32_freebsd11") == 0) {
-			struct kevent32_freebsd11 kev32;
+		} else if (strcmp(name, "freebsd11_kevent32") == 0) {
+			struct freebsd11_kevent32 kev32;
 
 			if (ksa->struct_size != sizeof(kev32))
 				goto bad_size;
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 128ae624cf5f..67a370b808b5 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -2111,7 +2111,7 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval,
 		break;
 	}
 	case Kevent11: {
-		struct kevent_freebsd11 *ke11;
+		struct freebsd11_kevent *ke11;
 		struct kevent ke;
 		int numevents = -1;
 		size_t bytes;
@@ -2123,7 +2123,7 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval,
 			numevents = retval[0];
 
 		if (numevents >= 0) {
-			bytes = sizeof(struct kevent_freebsd11) * numevents;
+			bytes = sizeof(struct freebsd11_kevent) * numevents;
 			if ((ke11 = malloc(bytes)) == NULL)
 				err(1,
 				    "Cannot malloc %zu bytes for kevent array",