From f41325db5f16640212574a03b9a34e5ed4a884ca Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Wed, 13 Jun 2001 10:58:39 +0000 Subject: With this commit, I hereby pronounce gensetdefs past its use-by date. Replace the a.out emulation of 'struct linker_set' with something a little more flexible. now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_ and __stop_). Thanks to Richard Henderson for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind --- sys/alpha/linux/linux.h | 3 --- sys/alpha/linux/linux_sysvec.c | 11 ++++++----- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'sys/alpha/linux') diff --git a/sys/alpha/linux/linux.h b/sys/alpha/linux/linux.h index a11baaa579f2..af3f3acef230 100644 --- a/sys/alpha/linux/linux.h +++ b/sys/alpha/linux/linux.h @@ -238,7 +238,6 @@ struct linux_sigframe { /* * Pluggable ioctl handlers */ -struct linker_set; struct linux_ioctl_args; struct proc; @@ -250,9 +249,7 @@ struct linux_ioctl_handler { }; int linux_ioctl_register_handler(struct linux_ioctl_handler *h); -int linux_ioctl_register_handlers(struct linker_set *s); int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h); -int linux_ioctl_unregister_handlers(struct linker_set *s); /* * open/fcntl flags diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index f0b12497a5c0..6f93dc8f6f83 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -77,7 +77,7 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); #define SHELLMAGIC 0x2321 #endif -extern struct linker_set linux_ioctl_handler_set; +SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); void osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code); @@ -221,6 +221,7 @@ linux_elf_modevent(module_t mod, int type, void *data) { Elf64_Brandinfo **brandinfo; int error; + struct linux_ioctl_handler **lihp; error = 0; @@ -231,8 +232,8 @@ linux_elf_modevent(module_t mod, int type, void *data) if (elf_insert_brand_entry(*brandinfo) < 0) error = EINVAL; if (error == 0) { - linux_ioctl_register_handlers( - &linux_ioctl_handler_set); + SET_FOREACH(lihp, linux_ioctl_handler_set) + linux_ioctl_register_handler(*lihp); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else @@ -250,8 +251,8 @@ linux_elf_modevent(module_t mod, int type, void *data) error = EINVAL; } if (error == 0) { - linux_ioctl_unregister_handlers( - &linux_ioctl_handler_set); + SET_FOREACH(lihp, linux_ioctl_handler_set) + linux_ioctl_unregister_handler(*lihp); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else -- cgit v1.3