Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Feb 2023 16:17:50 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3e0c56a717d6 - main - linux(4): Use designated initializers.
Message-ID:  <202302031617.313GHoMc057516@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin:

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

commit 3e0c56a717d6af3b680463b25388c7acd7cb8844
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-02-03 16:17:15 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-02-03 16:17:15 +0000

    linux(4): Use designated initializers.
    
    MFC after:              1 week
---
 sys/compat/linux/linux_ipc.c  | 60 +++++++++++++++++--------------------------
 sys/compat/linux/linux_misc.c | 12 ++++-----
 2 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index 258917e6a969..8c40d7505da5 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -546,17 +546,14 @@ linux_semtimedop(struct thread *td, struct linux_semtimedop_args *args)
 int
 linux_semget(struct thread *td, struct linux_semget_args *args)
 {
-	struct semget_args /* {
-	key_t	key;
-	int		nsems;
-	int		semflg;
-	} */ bsd_args;
+	struct semget_args bsd_args = {
+		.key = args->key,
+		.nsems = args->nsems,
+		.semflg = args->semflg
+	};
 
 	if (args->nsems < 0)
 		return (EINVAL);
-	bsd_args.key = args->key;
-	bsd_args.nsems = args->nsems;
-	bsd_args.semflg = args->semflg;
 	return (sys_semget(td, &bsd_args));
 }
 
@@ -710,13 +707,11 @@ linux_msgrcv(struct thread *td, struct linux_msgrcv_args *args)
 int
 linux_msgget(struct thread *td, struct linux_msgget_args *args)
 {
-	struct msgget_args /* {
-		key_t	key;
-		int	msgflg;
-	} */ bsd_args;
+	struct msgget_args bsd_args = {
+		.key = args->key,
+		.msgflg = args->msgflg
+	};
 
-	bsd_args.key = args->key;
-	bsd_args.msgflg = args->msgflg;
 	return (sys_msgget(td, &bsd_args));
 }
 
@@ -802,41 +797,34 @@ linux_msgctl(struct thread *td, struct linux_msgctl_args *args)
 int
 linux_shmat(struct thread *td, struct linux_shmat_args *args)
 {
-	struct shmat_args /* {
-		int shmid;
-		void *shmaddr;
-		int shmflg;
-	} */ bsd_args;
-
-	bsd_args.shmid = args->shmid;
-	bsd_args.shmaddr = PTRIN(args->shmaddr);
-	bsd_args.shmflg = args->shmflg;
+	struct shmat_args bsd_args = {
+		.shmid = args->shmid,
+		.shmaddr = PTRIN(args->shmaddr),
+		.shmflg = args->shmflg
+	};
+
 	return (sys_shmat(td, &bsd_args));
 }
 
 int
 linux_shmdt(struct thread *td, struct linux_shmdt_args *args)
 {
-	struct shmdt_args /* {
-		void *shmaddr;
-	} */ bsd_args;
+	struct shmdt_args bsd_args = {
+		.shmaddr = PTRIN(args->shmaddr)
+	};
 
-	bsd_args.shmaddr = PTRIN(args->shmaddr);
 	return (sys_shmdt(td, &bsd_args));
 }
 
 int
 linux_shmget(struct thread *td, struct linux_shmget_args *args)
 {
-	struct shmget_args /* {
-		key_t key;
-		int size;
-		int shmflg;
-	} */ bsd_args;
-
-	bsd_args.key = args->key;
-	bsd_args.size = args->size;
-	bsd_args.shmflg = args->shmflg;
+	struct shmget_args bsd_args = {
+		.key = args->key,
+		.size = args->size,
+		.shmflg = args->shmflg
+	};
+
 	return (sys_shmget(td, &bsd_args));
 }
 
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 9c4aa1c26f9c..f9b720cfc0b8 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1044,12 +1044,12 @@ linux_common_wait(struct thread *td, idtype_t idtype, int id, int *statusp,
 int
 linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
 {
-	struct linux_wait4_args wait4_args;
-
-	wait4_args.pid = args->pid;
-	wait4_args.status = args->status;
-	wait4_args.options = args->options;
-	wait4_args.rusage = NULL;
+	struct linux_wait4_args wait4_args = {
+		.pid = args->pid,
+		.status = args->status,
+		.options = args->options,
+		.rusage = NULL,
+	};
 
 	return (linux_wait4(td, &wait4_args));
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302031617.313GHoMc057516>