Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Nov 2014 06:08:32 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r274219 - in user/dchagin/lemul/sys: amd64/linux amd64/linux32 compat/linux
Message-ID:  <201411070608.sA768WvE027178@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Fri Nov  7 06:08:32 2014
New Revision: 274219
URL: https://svnweb.freebsd.org/changeset/base/274219

Log:
  Move device handler to common module (after r268138).

Modified:
  user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c
  user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c
  user/dchagin/lemul/sys/compat/linux/linux_common.c

Modified: user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c	Fri Nov  7 04:47:46 2014	(r274218)
+++ user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c	Fri Nov  7 06:08:32 2014	(r274219)
@@ -117,7 +117,6 @@ extern char _binary_linux_locore_o_end;
 extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
 
 SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
-SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
 
 static register_t * linux_copyout_strings(struct image_params *imgp);
 static int	elf_linux_fixup(register_t **stack_base,
@@ -944,7 +943,6 @@ linux64_elf_modevent(module_t mod, int t
 	Elf64_Brandinfo **brandinfo;
 	int error;
 	struct linux_ioctl_handler **lihp;
-	struct linux_device_handler **ldhp;
 
 	error = 0;
 
@@ -957,8 +955,6 @@ linux64_elf_modevent(module_t mod, int t
 		if (error == 0) {
 			SET_FOREACH(lihp, linux_ioctl_handler_set)
 				linux_ioctl_register_handler(*lihp);
-			SET_FOREACH(ldhp, linux_device_handler_set)
-				linux_device_register_handler(*ldhp);
 			LIST_INIT(&futex_list);
 			mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF);
 			stclohz = (stathz ? stathz : hz);
@@ -981,8 +977,6 @@ linux64_elf_modevent(module_t mod, int t
 		if (error == 0) {
 			SET_FOREACH(lihp, linux_ioctl_handler_set)
 				linux_ioctl_unregister_handler(*lihp);
-			SET_FOREACH(ldhp, linux_device_handler_set)
-				linux_device_unregister_handler(*ldhp);
 			mtx_destroy(&futex_mtx);
 			if (bootverbose)
 				printf("Linux ELF exec handler removed\n");

Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c	Fri Nov  7 04:47:46 2014	(r274218)
+++ user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c	Fri Nov  7 06:08:32 2014	(r274219)
@@ -118,7 +118,6 @@ extern char _binary_linux32_locore_o_end
 extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
 
 SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
-SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
 
 static int	elf_linux_fixup(register_t **stack_base,
 		    struct image_params *iparams);
@@ -1154,7 +1153,6 @@ linux_elf_modevent(module_t mod, int typ
 	Elf32_Brandinfo **brandinfo;
 	int error;
 	struct linux_ioctl_handler **lihp;
-	struct linux_device_handler **ldhp;
 
 	error = 0;
 
@@ -1167,8 +1165,6 @@ linux_elf_modevent(module_t mod, int typ
 		if (error == 0) {
 			SET_FOREACH(lihp, linux_ioctl_handler_set)
 				linux_ioctl_register_handler(*lihp);
-			SET_FOREACH(ldhp, linux_device_handler_set)
-				linux_device_register_handler(*ldhp);
 			LIST_INIT(&futex_list);
 			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
 			stclohz = (stathz ? stathz : hz);
@@ -1191,8 +1187,6 @@ linux_elf_modevent(module_t mod, int typ
 		if (error == 0) {
 			SET_FOREACH(lihp, linux_ioctl_handler_set)
 				linux_ioctl_unregister_handler(*lihp);
-			SET_FOREACH(ldhp, linux_device_handler_set)
-				linux_device_unregister_handler(*ldhp);
 			mtx_destroy(&futex_mtx);
 			if (bootverbose)
 				printf("Linux ELF exec handler removed\n");

Modified: user/dchagin/lemul/sys/compat/linux/linux_common.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_common.c	Fri Nov  7 04:47:46 2014	(r274218)
+++ user/dchagin/lemul/sys/compat/linux/linux_common.c	Fri Nov  7 06:08:32 2014	(r274219)
@@ -38,9 +38,11 @@ __FBSDID("$FreeBSD$");
 
 #include <compat/linux/linux_emul.h>
 #include <compat/linux/linux_mib.h>
+#include <compat/linux/linux_util.h>
 
 MODULE_VERSION(linux_common, 1);
 
+SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
 
 static eventhandler_tag linux_exec_tag;
 static eventhandler_tag linux_thread_dtor_tag;
@@ -50,6 +52,7 @@ static eventhandler_tag	linux_exit_tag;
 static int
 linux_common_modevent(module_t mod, int type, void *data)
 {
+	struct linux_device_handler **ldhp;
 
 	switch(type) {
 	case MOD_LOAD:
@@ -60,9 +63,13 @@ linux_common_modevent(module_t mod, int 
 		    linux_proc_exec, NULL, 1000);
 		linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
 		    linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
+		SET_FOREACH(ldhp, linux_device_handler_set)
+			linux_device_register_handler(*ldhp);
 		break;
 	case MOD_UNLOAD:
 		linux_osd_jail_deregister();
+		SET_FOREACH(ldhp, linux_device_handler_set)
+			linux_device_unregister_handler(*ldhp);
 		EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
 		EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
 		EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);



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