mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
allow creation of subsystems whatever order the databases appear
This commit is contained in:
parent
3743579870
commit
c8fd4a203b
@ -46,16 +46,18 @@ struct monitorentrypriv {
|
||||
Entry *mp_children; /* pointer to first child */
|
||||
struct monitorsubsys *mp_info; /* subsystem info */
|
||||
#define mp_type mp_info->mss_type
|
||||
int mp_flags; /* flags */
|
||||
unsigned long mp_flags; /* flags */
|
||||
|
||||
#define MONITOR_F_NONE 0x00
|
||||
#define MONITOR_F_SUB 0x01 /* subentry of subsystem */
|
||||
#define MONITOR_F_PERSISTENT 0x10 /* persistent entry */
|
||||
#define MONITOR_F_PERSISTENT_CH 0x20 /* subsystem generates
|
||||
#define MONITOR_F_NONE 0x00U
|
||||
#define MONITOR_F_SUB 0x01U /* subentry of subsystem */
|
||||
#define MONITOR_F_PERSISTENT 0x10U /* persistent entry */
|
||||
#define MONITOR_F_PERSISTENT_CH 0x20U /* subsystem generates
|
||||
persistent entries */
|
||||
#define MONITOR_F_VOLATILE 0x40 /* volatile entry */
|
||||
#define MONITOR_F_VOLATILE_CH 0x80 /* subsystem generates
|
||||
#define MONITOR_F_VOLATILE 0x40U /* volatile entry */
|
||||
#define MONITOR_F_VOLATILE_CH 0x80U /* subsystem generates
|
||||
volatile entries */
|
||||
/* NOTE: flags with 0xF0000000U mask are reserved for subsystem internals */
|
||||
|
||||
int (*mp_update)( Operation *op, Entry *e );
|
||||
/* update callback
|
||||
for user-defined entries */
|
||||
@ -221,6 +223,7 @@ typedef struct monitorsubsys {
|
||||
struct berval mss_dn;
|
||||
struct berval mss_ndn;
|
||||
int mss_flags;
|
||||
#define MONITOR_F_OPENED 0x10000000U
|
||||
|
||||
#define MONITOR_HAS_VOLATILE_CH( mp ) \
|
||||
( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
|
||||
|
@ -36,8 +36,17 @@
|
||||
*/
|
||||
BackendDB *be_monitor = NULL;
|
||||
|
||||
static struct monitorsubsys **monitor_subsys = NULL;
|
||||
static int monitor_subsys_opened = 0;
|
||||
|
||||
/*
|
||||
* subsystem data
|
||||
*
|
||||
* the known subsystems are added to the subsystems
|
||||
* array at backend initialization; other subsystems
|
||||
* may be added by calling monitor_back_register_subsys()
|
||||
* before the database is opened (e.g. by other backends
|
||||
* or by overlays or modules).
|
||||
*/
|
||||
static struct monitorsubsys known_monitor_subsys[] = {
|
||||
{
|
||||
@ -163,8 +172,6 @@ init_module( int argc, char *argv[] )
|
||||
|
||||
#endif /* SLAPD_MONITOR */
|
||||
|
||||
static struct monitorsubsys **monitor_subsys = NULL;
|
||||
|
||||
int
|
||||
monitor_back_register_subsys( monitorsubsys *ms )
|
||||
{
|
||||
@ -185,6 +192,22 @@ monitor_back_register_subsys( monitorsubsys *ms )
|
||||
monitor_subsys[ i ] = ms;
|
||||
monitor_subsys[ i + 1 ] = NULL;
|
||||
|
||||
/* if a subsystem is registered __AFTER__ subsystem
|
||||
* initialization (depending on the sequence the databases
|
||||
* are listed in slapd.conf), init it */
|
||||
if ( monitor_subsys_opened ) {
|
||||
|
||||
/* FIXME: this should only be possible
|
||||
* if be_monitor is already initialized */
|
||||
assert( be_monitor );
|
||||
|
||||
if ( ms->mss_open && ( *ms->mss_open )( be_monitor, ms ) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ms->mss_flags |= MONITOR_F_OPENED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -679,7 +702,8 @@ monitor_back_db_open(
|
||||
Entry *e, **ep;
|
||||
struct monitorentrypriv *mp;
|
||||
int i;
|
||||
char buf[ BACKMONITOR_BUFSIZE ], *end_of_line;
|
||||
char buf[ BACKMONITOR_BUFSIZE ],
|
||||
*end_of_line;
|
||||
struct berval bv;
|
||||
struct tm *tms;
|
||||
#ifdef HAVE_GMTIME_R
|
||||
@ -893,8 +917,11 @@ monitor_back_db_open(
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
ms[ 0 ]->mss_flags |= MONITOR_F_OPENED;
|
||||
}
|
||||
|
||||
monitor_subsys_opened = 1;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user