Use C99 designated initializers for struct execsw

It it makes use slightly more clear and facilitates grepping.
This commit is contained in:
emaste 2018-03-13 13:09:10 +00:00
parent 3fa80706a5
commit 742eaeb102
5 changed files with 18 additions and 6 deletions

View File

@ -337,5 +337,8 @@ exec_aout_imgact(struct image_params *imgp)
/*
* Tell kern_execve.c about it, with a little help from the linker.
*/
static struct execsw aout_execsw = { exec_aout_imgact, "a.out" };
static struct execsw aout_execsw = {
.ex_imgact = exec_aout_imgact,
.ex_name = "a.out"
};
EXEC_SET(aout, aout_execsw);

View File

@ -753,5 +753,8 @@ SYSUNINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_fini, 0);
/*
* Tell kern_execve.c about it, with a little help from the linker.
*/
static struct execsw imgact_binmisc_execsw = { imgact_binmisc_exec, KMOD_NAME };
static struct execsw imgact_binmisc_execsw = {
.ex_imgact = imgact_binmisc_exec,
.ex_name = KMOD_NAME
};
EXEC_SET(imgact_binmisc, imgact_binmisc_execsw);

View File

@ -2426,8 +2426,8 @@ __elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote,
* Tell kern_execve.c about it, with a little help from the linker.
*/
static struct execsw __elfN(execsw) = {
__CONCAT(exec_, __elfN(imgact)),
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
.ex_imgact = __CONCAT(exec_, __elfN(imgact)),
.ex_name = __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
};
EXEC_SET(__CONCAT(elf, __ELF_WORD_SIZE), __elfN(execsw));

View File

@ -387,5 +387,8 @@ Flush(void *vp, u_char * ptr, u_long siz)
/*
* Tell kern_execve.c about it, with a little help from the linker.
*/
static struct execsw gzip_execsw = {exec_gzip_imgact, "gzip"};
static struct execsw gzip_execsw = {
.ex_imgact = exec_gzip_imgact,
.ex_name = "gzip"
};
EXEC_SET(execgzip, gzip_execsw);

View File

@ -255,5 +255,8 @@ exec_shell_imgact(struct image_params *imgp)
/*
* Tell kern_execve.c about it, with a little help from the linker.
*/
static struct execsw shell_execsw = { exec_shell_imgact, "#!" };
static struct execsw shell_execsw = {
.ex_imgact = exec_shell_imgact,
.ex_name = "#!"
};
EXEC_SET(shell, shell_execsw);