Module Name: src Committed By: pgoyette Date: Sun Feb 3 08:02:25 UTC 2019
Modified Files: src/sys/dev/raidframe: rf_compat32.c rf_compat50.c rf_compat50_mod.h rf_compat80.c rf_compat80_mod.h rf_netbsdkintf.c src/sys/kern: compat_stub.c src/sys/modules: Makefile src/sys/modules/raid: Makefile src/sys/sys: compat_stub.h param.h Added Files: src/sys/modules/compat_netbsd32_raid: Makefile Log Message: Don't include the raidframe compat code in the main raid module, the compat code lives in their own compat_raid_xx modules, which will now be autoloaded if needed. While here, extract the compat_netbsd32_raid code into its own module, too. Welcome to 8.99.34 To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/raidframe/rf_compat32.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_compat50.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/raidframe/rf_compat50_mod.h \ src/sys/dev/raidframe/rf_compat80_mod.h cvs rdiff -u -r1.7 -r1.8 src/sys/dev/raidframe/rf_compat80.c cvs rdiff -u -r1.360 -r1.361 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.6 -r1.7 src/sys/kern/compat_stub.c cvs rdiff -u -r1.216 -r1.217 src/sys/modules/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/compat_netbsd32_raid/Makefile cvs rdiff -u -r1.2 -r1.3 src/sys/modules/raid/Makefile cvs rdiff -u -r1.9 -r1.10 src/sys/sys/compat_stub.h cvs rdiff -u -r1.581 -r1.582 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/raidframe/rf_compat32.c diff -u src/sys/dev/raidframe/rf_compat32.c:1.1 src/sys/dev/raidframe/rf_compat32.c:1.2 --- src/sys/dev/raidframe/rf_compat32.c:1.1 Thu Jan 18 00:32:49 2018 +++ src/sys/dev/raidframe/rf_compat32.c Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat32.c,v 1.1 2018/01/18 00:32:49 mrg Exp $ */ +/* $NetBSD: rf_compat32.c,v 1.2 2019/02/03 08:02:24 pgoyette Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -31,6 +31,8 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/module.h> +#include <sys/compat_stub.h> #include <dev/raidframe/raidframeio.h> #include <dev/raidframe/raidframevar.h> @@ -113,3 +115,37 @@ rf_config_netbsd32(void *data, RF_Config RF_Free(cfg32, sizeof(RF_Config_t32)); return rv; } + +static void +raidframe_netbsd32_init(void) +{ + + MODULE_SET_HOOK(raidframe_netbsd32_config_hook, "raid32", + rf_config_netbsd32); +} + +static void +raidframe_netbsd32_fini(void) +{ + + MODULE_UNSET_HOOK(raidframe_netbsd32_config_hook); +} + +MODULE(MODULE_CLASS_EXEC, compat_netbsd32_raid, "raid,compat_netbsd32"); + +static int +compat_netbsd32_raid_modcmd(modcmd_t cmd, void *arg) +{ + + switch (cmd) { + case MODULE_CMD_INIT: + raidframe_netbsd32_init(); + return 0; + case MODULE_CMD_FINI: + raidframe_netbsd32_fini(); + return 0; + default: + return ENOTTY; + } +} + Index: src/sys/dev/raidframe/rf_compat50.c diff -u src/sys/dev/raidframe/rf_compat50.c:1.6 src/sys/dev/raidframe/rf_compat50.c:1.7 --- src/sys/dev/raidframe/rf_compat50.c:1.6 Thu Jan 31 12:31:50 2019 +++ src/sys/dev/raidframe/rf_compat50.c Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat50.c,v 1.6 2019/01/31 12:31:50 christos Exp $ */ +/* $NetBSD: rf_compat50.c,v 1.7 2019/02/03 08:02:24 pgoyette Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -240,14 +240,14 @@ raidframe_ioctl_50(u_long cmd, int initt return EPASSTHROUGH; } -void +static void raidframe_50_init(void) { MODULE_SET_HOOK(raidframe_ioctl_50_hook, "raid50", raidframe_ioctl_50); } -void +static void raidframe_50_fini(void) { Index: src/sys/dev/raidframe/rf_compat50_mod.h diff -u src/sys/dev/raidframe/rf_compat50_mod.h:1.3 src/sys/dev/raidframe/rf_compat50_mod.h:1.4 --- src/sys/dev/raidframe/rf_compat50_mod.h:1.3 Thu Jan 31 12:31:50 2019 +++ src/sys/dev/raidframe/rf_compat50_mod.h Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat50_mod.h,v 1.3 2019/01/31 12:31:50 christos Exp $ */ +/* $NetBSD: rf_compat50_mod.h,v 1.4 2019/02/03 08:02:24 pgoyette Exp $ */ /*- @@ -33,9 +33,6 @@ #ifndef _RF_COMPAT50_MOD_H_ #define _RF_COMPAT50_MOD_H_ -void raidframe_50_fini(void); -void raidframe_50_init(void); - int raidframe_ioctl_50(u_long, int, RF_Raid_t *, int, void *, RF_Config_t **); #endif /* _RF_COMPAT50_MOD_H_ */ Index: src/sys/dev/raidframe/rf_compat80_mod.h diff -u src/sys/dev/raidframe/rf_compat80_mod.h:1.3 src/sys/dev/raidframe/rf_compat80_mod.h:1.4 --- src/sys/dev/raidframe/rf_compat80_mod.h:1.3 Thu Jan 31 12:31:50 2019 +++ src/sys/dev/raidframe/rf_compat80_mod.h Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80_mod.h,v 1.3 2019/01/31 12:31:50 christos Exp $ */ +/* $NetBSD: rf_compat80_mod.h,v 1.4 2019/02/03 08:02:24 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,7 +38,4 @@ struct RF_Config_s; int raidframe_ioctl_80(u_long, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **); -void raidframe_80_init(void); -void raidframe_80_fini(void); - #endif /* _RF_COMPAT80_MOD_H_ */ Index: src/sys/dev/raidframe/rf_compat80.c diff -u src/sys/dev/raidframe/rf_compat80.c:1.7 src/sys/dev/raidframe/rf_compat80.c:1.8 --- src/sys/dev/raidframe/rf_compat80.c:1.7 Thu Jan 31 12:31:50 2019 +++ src/sys/dev/raidframe/rf_compat80.c Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_compat80.c,v 1.7 2019/01/31 12:31:50 christos Exp $ */ +/* $NetBSD: rf_compat80.c,v 1.8 2019/02/03 08:02:24 pgoyette Exp $ */ /* * Copyright (c) 2017 Matthew R. Green @@ -265,14 +265,14 @@ raidframe_ioctl_80(u_long cmd, int initt return EPASSTHROUGH; } -void +static void raidframe_80_init(void) { MODULE_SET_HOOK(raidframe_ioctl_80_hook, "raid80", raidframe_ioctl_80); } -void +static void raidframe_80_fini(void) { Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.360 src/sys/dev/raidframe/rf_netbsdkintf.c:1.361 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.360 Tue Jan 29 09:28:50 2019 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.360 2019/01/29 09:28:50 pgoyette Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.361 2019/02/03 08:02:24 pgoyette Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,11 +101,9 @@ ***********************************************************/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.360 2019/01/29 09:28:50 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.361 2019/02/03 08:02:24 pgoyette Exp $"); #ifdef _KERNEL_OPT -#include "opt_compat_netbsd.h" -#include "opt_compat_netbsd32.h" #include "opt_raid_autoconfig.h" #endif @@ -150,11 +148,12 @@ __KERNEL_RCSID(0, "$NetBSD: rf_netbsdkin #include "rf_parityscan.h" #include "rf_threadstuff.h" -#include "rf_compat50.h" - #include "rf_compat80.h" -#ifdef COMPAT_NETBSD32 +#ifdef _LP64 +#ifndef COMPAT_NETBSD32 +#define COMPAT_NETBSD32 +#endif #include "rf_compat32.h" #endif @@ -1113,11 +1112,9 @@ raidioctl(dev_t dev, u_long cmd, void *d case RAIDFRAME_PARITYMAP_GET_DISABLE: case RAIDFRAME_PARITYMAP_SET_DISABLE: case RAIDFRAME_PARITYMAP_SET_PARAMS: -#ifdef COMPAT_NETBSD32 #ifdef _LP64 case RAIDFRAME_GET_INFO32: #endif -#endif if ((rs->sc_flags & RAIDF_INITED) == 0) return (ENXIO); } @@ -1132,6 +1129,7 @@ raidioctl(dev_t dev, u_long cmd, void *d * * If compat code returns EAGAIN, we need to finish via config * * Otherwise the cmd has been handled and we just return */ + module_autoload("compat_raid_50", MODULE_CLASS_EXEC); MODULE_CALL_HOOK(raidframe_ioctl_50_hook, (cmd, (rs->sc_flags & RAIDF_INITED),raidPtr, unit, data, &k_cfg), enosys(), retcode); @@ -1142,6 +1140,7 @@ raidioctl(dev_t dev, u_long cmd, void *d else if (retcode != EPASSTHROUGH) return retcode; + module_autoload("compat_raid_80", MODULE_CLASS_EXEC); MODULE_CALL_HOOK(raidframe_ioctl_80_hook, (cmd, (rs->sc_flags & RAIDF_INITED),raidPtr, unit, data, &k_cfg), enosys(), retcode); @@ -1163,11 +1162,9 @@ raidioctl(dev_t dev, u_long cmd, void *d /* configure the system */ case RAIDFRAME_CONFIGURE: -#ifdef COMPAT_NETBSD32 #ifdef _LP64 case RAIDFRAME_CONFIGURE32: #endif -#endif if (raidPtr->valid) { /* There is a valid RAID set running on this unit! */ @@ -1182,14 +1179,13 @@ raidioctl(dev_t dev, u_long cmd, void *d if (k_cfg == NULL) { return (ENOMEM); } -#ifdef COMPAT_NETBSD32 #ifdef _LP64 if (cmd == RAIDFRAME_CONFIGURE32 && (l->l_proc->p_flag & PK_32) != 0) - retcode = rf_config_netbsd32(data, k_cfg); + MODULE_CALL_HOOK(raidframe_netbsd32_config_hook, + (data, k_cfg), enosys(), retcode); else #endif -#endif { u_cfg = *((RF_Config_t **) data); retcode = copyin(u_cfg, k_cfg, sizeof(RF_Config_t)); @@ -1321,7 +1317,7 @@ raidioctl(dev_t dev, u_long cmd, void *d printf("raid%d: Num Columns: %d\n", raidid, clabel->num_columns); printf("raid%d: Clean: %d\n", raidid, clabel->clean); printf("raid%d: Status: %d\n", raidid, clabel->status); -#endif +#endif /* DEBUG */ clabel->row = 0; column = clabel->column; @@ -1337,7 +1333,7 @@ raidioctl(dev_t dev, u_long cmd, void *d clabel, sizeof(*clabel)); raidflush_component_label(raidPtr, column); return (0); -#endif +#endif /* 0 */ case RAIDFRAME_INIT_LABELS: clabel = (RF_ComponentLabel_t *) data; @@ -1491,24 +1487,21 @@ raidioctl(dev_t dev, u_long cmd, void *d return(retcode); case RAIDFRAME_GET_INFO: -#ifdef COMPAT_NETBSD32 #ifdef _LP64 case RAIDFRAME_GET_INFO32: -#endif -#endif +#endif /* LP64 */ RF_Malloc(d_cfg, sizeof(RF_DeviceConfig_t), (RF_DeviceConfig_t *)); if (d_cfg == NULL) return (ENOMEM); retcode = rf_get_info(raidPtr, d_cfg); if (retcode == 0) { -#ifdef COMPAT_NETBSD32 #ifdef _LP64 - if (cmd == RAIDFRAME_GET_INFO32) + if (raidframe_netbsd32_config_hook.hooked && + cmd == RAIDFRAME_GET_INFO32) ucfgp = NETBSD32PTR64(*(netbsd32_pointer_t *)data); else -#endif -#endif +#endif /* _LP64 */ ucfgp = *(RF_DeviceConfig_t **)data; retcode = copyout(d_cfg, ucfgp, sizeof(RF_DeviceConfig_t)); } Index: src/sys/kern/compat_stub.c diff -u src/sys/kern/compat_stub.c:1.6 src/sys/kern/compat_stub.c:1.7 --- src/sys/kern/compat_stub.c:1.6 Tue Jan 29 09:28:50 2019 +++ src/sys/kern/compat_stub.c Sun Feb 3 08:02:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.c,v 1.6 2019/01/29 09:28:50 pgoyette Exp $ */ +/* $NetBSD: compat_stub.c,v 1.7 2019/02/03 08:02:24 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -114,6 +114,7 @@ struct ocryptof_50_hook_t ocryptof_50_ho */ struct raidframe_ioctl_50_hook_t raidframe_ioctl_50_hook; struct raidframe_ioctl_80_hook_t raidframe_ioctl_80_hook; +struct raidframe_netbsd32_config_hook_t raidframe_netbsd32_config_hook; /* * puffs compatability Index: src/sys/modules/Makefile diff -u src/sys/modules/Makefile:1.216 src/sys/modules/Makefile:1.217 --- src/sys/modules/Makefile:1.216 Sun Jan 27 02:08:43 2019 +++ src/sys/modules/Makefile Sun Feb 3 08:02:25 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.216 2019/01/27 02:08:43 pgoyette Exp $ +# $NetBSD: Makefile,v 1.217 2019/02/03 08:02:25 pgoyette Exp $ .include <bsd.own.mk> @@ -290,6 +290,7 @@ SUBDIR+= compat_netbsd32_sysvipc SUBDIR+= compat_netbsd32_sysvipc_10 SUBDIR+= compat_netbsd32_sysvipc_14 SUBDIR+= compat_netbsd32_sysvipc_50 +SUBDIR+= compat_netbsd32_raid .endif .if ${MACHINE_ARCH} == "x86_64" Index: src/sys/modules/raid/Makefile diff -u src/sys/modules/raid/Makefile:1.2 src/sys/modules/raid/Makefile:1.3 --- src/sys/modules/raid/Makefile:1.2 Thu Jan 18 00:32:48 2018 +++ src/sys/modules/raid/Makefile Sun Feb 3 08:02:25 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2018/01/18 00:32:48 mrg Exp $ +# $NetBSD: Makefile,v 1.3 2019/02/03 08:02:25 pgoyette Exp $ .include "../Makefile.inc" @@ -27,8 +27,7 @@ SRCS+= rf_raid4.c rf_raid5. SRCS+= rf_reconbuffer.c rf_reconmap.c rf_reconstruct.c SRCS+= rf_reconutil.c rf_revent.c rf_shutdown.c SRCS+= rf_sstf.c rf_states.c rf_stripelocks.c -SRCS+= rf_strutils.c rf_utils.c rf_compat50.c -SRCS+= rf_compat80.c +SRCS+= rf_strutils.c rf_utils.c CPPFLAGS+= -DRAID_AUTOCONFIG=1 @@ -42,15 +41,13 @@ CPPFLAGS+= -DRF_INCLUDE_INTERDECLUSTER=1 CPPFLAGS+= -DRF_INCLUDE_PARITY_DECLUSTERING=1 CPPFLAGS+= -DRF_INCLUDE_PARITY_DECLUSTERING_DS=1 -CPPFLAGS+= -DCOMPAT_50 -CPPFLAGS+= -DCOMPAT_80 - -.if ${MACHINE_CPU} == "sparc64" || \ - ${MACHINE_CPU} == "x86_64" || \ - ${MACHINE_CPU} == "mips64" -SRCS+= rf_compat32.c -CPPFLAGS+= -DCOMPAT_NETBSD32 -.endif +#XXX +#.if ${MACHINE_CPU} == "sparc64" || \ +# ${MACHINE_CPU} == "x86_64" || \ +# ${MACHINE_CPU} == "mips64" +#SRCS+= rf_compat32.c +#CPPFLAGS+= -DCOMPAT_NETBSD32 +#.endif .include <bsd.kmodule.mk> Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.9 src/sys/sys/compat_stub.h:1.10 --- src/sys/sys/compat_stub.h:1.9 Thu Jan 31 12:31:50 2019 +++ src/sys/sys/compat_stub.h Sun Feb 3 08:02:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.9 2019/01/31 12:31:50 christos Exp $ */ +/* $NetBSD: compat_stub.h,v 1.10 2019/02/03 08:02:25 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -130,10 +130,14 @@ MODULE_HOOK(ocryptof_50_hook, int, (stru struct RF_Config_s; struct RF_Raid_s; +struct RF_Config_s; MODULE_HOOK(raidframe_ioctl_50_hook, int, (u_long, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **)); MODULE_HOOK(raidframe_ioctl_80_hook, int, (u_long, int, struct RF_Raid_s *, int, void *, struct RF_Config_s **)); +MODULE_HOOK(raidframe_netbsd32_config_hook, int, + (void *, struct RF_Config_s *)); + /* * puffs compatibility Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.581 src/sys/sys/param.h:1.582 --- src/sys/sys/param.h:1.581 Thu Jan 31 22:07:46 2019 +++ src/sys/sys/param.h Sun Feb 3 08:02:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.581 2019/01/31 22:07:46 pgoyette Exp $ */ +/* $NetBSD: param.h,v 1.582 2019/02/03 08:02:25 pgoyette Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 899003300 /* NetBSD 8.99.33 */ +#define __NetBSD_Version__ 899003400 /* NetBSD 8.99.34 */ #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) Added files: Index: src/sys/modules/compat_netbsd32_raid/Makefile diff -u /dev/null src/sys/modules/compat_netbsd32_raid/Makefile:1.1 --- /dev/null Sun Feb 3 08:02:25 2019 +++ src/sys/modules/compat_netbsd32_raid/Makefile Sun Feb 3 08:02:25 2019 @@ -0,0 +1,13 @@ +# $NetBSD: Makefile,v 1.1 2019/02/03 08:02:25 pgoyette Exp $ + +.include "../Makefile.inc" + +KMOD= compat_netbsd32_raid + +.PATH: ${S}/dev/raidframe + +CPPFLAGS+= -DCOMPAT_NETBSD32 + +SRCS+= rf_compat32.c + +.include <bsd.kmodule.mk>