Clarify the SYSINIT problem by breaking SYSINIT's up into a void *

version and a const void * version.  Currently the const void * version
    simply calls the void * version ( i.e. no 'fix' is in place ).

    A solution needs to be found for the C_SYSINIT ( etc...) family of
    macros that allows const void * without generating a warning, but
    does not allow non-const void *.
This commit is contained in:
dillon 1999-01-28 17:30:51 +00:00
parent f922e89a9e
commit 789691e908
2 changed files with 37 additions and 9 deletions

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)kernel.h 8.3 (Berkeley) 1/21/94
* $Id: kernel.h,v 1.49 1999/01/14 05:48:46 jdp Exp $
* $Id: kernel.h,v 1.50 1999/01/28 00:57:54 dillon Exp $
*/
#ifndef _SYS_KERNEL_H_
@ -176,19 +176,40 @@ typedef enum sysinit_elem_type {
/*
* A system initialization call instance
*
* The subsystem
* At the moment there is one instance of sysinit. We probably do not
* want two which is why this code is if'd out, but we definitely want
* to discern SYSINIT's which take non-constant data pointers and
* SYSINIT's which take constant data pointers,
*/
struct sysinit {
unsigned int subsystem; /* subsystem identifier*/
unsigned int order; /* init order within subsystem*/
void (*func) __P((const void *)); /* init function*/
void (*func) __P((void *)); /* function */
void *udata; /* multiplexer/argument */
si_elem_t type; /* sysinit_elem_type*/
};
#if 0
struct c_sysinit {
unsigned int subsystem; /* subsystem identifier*/
unsigned int order; /* init order within subsystem*/
void (*func) __P((const void *)); /* function */
const void *udata; /* multiplexer/argument */
si_elem_t type; /* sysinit_elem_type*/
};
#endif
/*
* Default: no special processing
*
* The C_ version of SYSINIT is for data pointers to const
* data ( and functions taking data pointers to const data ).
* At the moment it is no different from SYSINIT and thus
* still results in warnings.
*
*/
#define SYSINIT(uniquifier, subsystem, order, func, ident) \
static struct sysinit uniquifier ## _sys_init = { \
@ -199,6 +220,10 @@ struct sysinit {
SI_TYPE_DEFAULT \
}; \
DATA_SET(sysinit_set,uniquifier ## _sys_init);
#define C_SYSINIT(uniquifier, subsystem, order, func, ident) \
SYSINIT(uniquifier, subsystem, order, func, ident)
/*
* Called on module unload: no special processing
*/
@ -206,12 +231,15 @@ struct sysinit {
static struct sysinit uniquifier ## _sys_uninit = { \
subsystem, \
order, \
func, \
func, \
ident, \
SI_TYPE_DEFAULT \
}; \
DATA_SET(sysuninit_set,uniquifier ## _sys_uninit)
#define C_SYSUNINIT(uniquifier, subsystem, order, func, ident) \
SYSUNINIT(uniquifier, subsystem, order, func, ident)
/*
* Call 'fork()' before calling '(*func)(ident)';
* for making a kernel 'thread' (or builtin process.)
@ -220,7 +248,7 @@ struct sysinit {
static struct sysinit uniquifier ## _sys_init = { \
subsystem, \
order, \
func, \
func, \
ident, \
SI_TYPE_KTHREAD \
}; \
@ -232,7 +260,7 @@ struct sysinit {
order, \
func, \
ident, \
SI_TYPE_KPROCESS \
SI_TYPE_KPROCESS \
}; \
DATA_SET(sysinit_set,uniquifier ## _sys_init);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.81 1999/01/27 21:50:00 dillon Exp $
* $Id: vnode.h,v 1.82 1999/01/28 00:57:54 dillon Exp $
*/
#ifndef _SYS_VNODE_H_
@ -263,8 +263,8 @@ extern int vttoif_tab[];
#define VNODEOP_SET(f) DATA_SET(MODVNOPS,f)
#else
#define VNODEOP_SET(f) \
SYSINIT(f##init, SI_SUB_VFS, SI_ORDER_SECOND, vfs_add_vnodeops, &f); \
SYSUNINIT(f##uninit, SI_SUB_VFS, SI_ORDER_SECOND, vfs_rm_vnodeops, &f);
C_SYSINIT(f##init, SI_SUB_VFS, SI_ORDER_SECOND, vfs_add_vnodeops, &f); \
C_SYSUNINIT(f##uninit, SI_SUB_VFS, SI_ORDER_SECOND, vfs_rm_vnodeops, &f);
#endif
/*