git: f48a68874bf4 - main - linux(4): Retire linux_semop implementation.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 06 May 2022 17:03:37 UTC
The branch main has been updated by dchagin:

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

commit f48a68874bf4503a18c0c55887a028dab0a4600f
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-05-06 17:00:13 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-05-06 17:00:13 +0000

    linux(4): Retire linux_semop implementation.
    
    In i386 Linux semop called via ipc() multiplexor, so use kern_semop
    directly from multiplexor.
    
    MFC after:              2 weeks
---
 sys/amd64/linux32/linux32_machdep.c |  7 ++-----
 sys/compat/linux/linux_ipc.c        | 17 -----------------
 sys/compat/linux/linux_ipc.h        | 12 ------------
 sys/i386/linux/linux_machdep.c      |  7 ++-----
 4 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 9dd988452a1c..baa567339689 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -255,12 +255,9 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args)
 
 	switch (args->what & 0xFFFF) {
 	case LINUX_SEMOP: {
-		struct linux_semop_args a;
 
-		a.semid = args->arg1;
-		a.tsops = PTRIN(args->ptr);
-		a.nsops = args->arg2;
-		return (linux_semop(td, &a));
+		return (kern_semop(td, args->arg1, PTRIN(args->ptr),
+		    args->arg2, NULL));
 	}
 	case LINUX_SEMGET: {
 		struct linux_semget_args a;
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index 82fe54fae65e..3e810c303a2c 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -504,23 +504,6 @@ linux_shminfo_pushdown(l_int ver, struct l_shminfo64 *linux_shminfo64,
 	}
 }
 
-int
-linux_semop(struct thread *td, struct linux_semop_args *args)
-{
-	struct semop_args /* {
-	int	semid;
-	struct	sembuf *sops;
-	int		nsops;
-	} */ bsd_args;
-
-	if (args->nsops < 1 || args->semid < 0)
-		return (EINVAL);
-	bsd_args.semid = args->semid;
-	bsd_args.sops = PTRIN(args->tsops);
-	bsd_args.nsops = args->nsops;
-	return (sys_semop(td, &bsd_args));
-}
-
 int
 linux_semget(struct thread *td, struct linux_semget_args *args)
 {
diff --git a/sys/compat/linux/linux_ipc.h b/sys/compat/linux/linux_ipc.h
index b1bd3fffa4d6..beef18a09507 100644
--- a/sys/compat/linux/linux_ipc.h
+++ b/sys/compat/linux/linux_ipc.h
@@ -82,16 +82,4 @@
 #define	LINUX_IPC_64	0x0100	/* New version (support 32-bit UIDs, bigger
 				   message sizes, etc. */
 
-#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
-
-struct linux_semop_args
-{
-	l_int		semid;
-	struct l_sembuf *tsops;
-	l_uint		nsops;
-};
-
-int linux_semop(struct thread *, struct linux_semop_args *);
-#endif	/* __i386__ || (__amd64__ && COMPAT_LINUX32) */
-
 #endif /* _LINUX_IPC_H_ */
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index dde11f22d4fe..09d4eb42c772 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -130,12 +130,9 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args)
 
 	switch (args->what & 0xFFFF) {
 	case LINUX_SEMOP: {
-		struct linux_semop_args a;
 
-		a.semid = args->arg1;
-		a.tsops = PTRIN(args->ptr);
-		a.nsops = args->arg2;
-		return (linux_semop(td, &a));
+		return (kern_semop(td, args->arg1, PTRIN(args->ptr),
+		    args->arg2, NULL));
 	}
 	case LINUX_SEMGET: {
 		struct linux_semget_args a;