From 31b22ce0171d5f314ab71ecfdc903cd5b4abff7c Mon Sep 17 00:00:00 2001 From: ambrisko Date: Fri, 5 May 2006 16:10:45 +0000 Subject: Enhance the Linux emulation layer to make MegaRAID SAS managements tool happy. Add back in a scheme to emulate old type major/minor numbers via hooks into stat, linprocfs to return major/minors that Linux app's expect. Currently only /dev/null is always registered. Drivers can register via the Linux type shim similar to the ioctl shim but by using linux_device_register_handler/linux_device_unregister_handler functions. The structure is: struct linux_device_handler { char *bsd_driver_name; char *linux_driver_name; char *bsd_device_name; char *linux_device_name; int linux_major; int linux_minor; int linux_char_device; }; Linprocfs uses this to display the major number of the driver. The soon to be available linsysfs will use it to fill in the driver name. Linux_stat uses it to translate the major/minor into Linux type values. Note major numbers are dynamically assigned via passing in a -1 for the major number so we don't need to keep track of them. This is somewhat needed due to us switching to our devfs. MegaCli will not run until I add in the linsysfs and mfi Linux compat changes. Sponsored by: IronPort Systems --- sys/alpha/linux/linux_sysvec.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/alpha') diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index 334e252..b52f828 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -69,6 +69,7 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); #endif SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); +SET_DECLARE(linux_device_handler_set, struct linux_device_handler); void osendsig(sig_t catcher, ksiginfo_t *kp, sigset_t *mask); @@ -227,6 +228,7 @@ linux_elf_modevent(module_t mod, int type, void *data) Elf64_Brandinfo **brandinfo; int error; struct linux_ioctl_handler **lihp; + struct linux_device_handler **ldhp; error = 0; @@ -239,6 +241,8 @@ linux_elf_modevent(module_t mod, int type, void *data) 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); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else @@ -258,6 +262,8 @@ linux_elf_modevent(module_t mod, int type, void *data) 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); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else -- cgit v1.1