From: Pierangelo Masarati Date: Fri, 11 Apr 2003 23:08:16 +0000 (+0000) Subject: pass Operation instead of private info X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~391 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=29c2594fe48b5aaea14956bc6bfc66ecc147d912;p=openldap pass Operation instead of private info --- diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index a16f8fb7d9..dd63038570 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -191,12 +191,12 @@ struct monitorsubsys { /* initialize entry and subentries */ int ( *mss_init )( BackendDB * ); /* update existing dynamic entry and subentries */ - int ( *mss_update )( struct monitorinfo *, Entry * ); + int ( *mss_update )( Operation *, Entry * ); /* create new dynamic subentries */ - int ( *mss_create )( struct monitorinfo *, + int ( *mss_create )( Operation *, struct berval *ndn, Entry *, Entry ** ); /* modify entry and subentries */ - int ( *mss_modify )( struct monitorinfo *, Entry *, + int ( *mss_modify )( Operation *, Entry *, Modifications *modlist ); }; @@ -221,9 +221,9 @@ extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e )); * update */ -extern int monitor_entry_update LDAP_P(( struct monitorinfo *mi, Entry *e )); -extern int monitor_entry_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep )); -extern int monitor_entry_modify LDAP_P(( struct monitorinfo *mi, Entry *e, Modifications *modlist )); +extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e )); +extern int monitor_entry_create LDAP_P(( Operation *op, struct berval *ndn, Entry *e_parent, Entry **ep )); +extern int monitor_entry_modify LDAP_P(( Operation *op, Entry *e, Modifications *modlist )); LDAP_END_DECL diff --git a/servers/slapd/back-monitor/conn.c b/servers/slapd/back-monitor/conn.c index 538396434e..acb4919729 100644 --- a/servers/slapd/back-monitor/conn.c +++ b/servers/slapd/back-monitor/conn.c @@ -200,10 +200,11 @@ monitor_subsys_conn_init( int monitor_subsys_conn_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; long n = -1; assert( mi ); @@ -348,12 +349,13 @@ conn_create( int monitor_subsys_conn_create( - struct monitorinfo *mi, + Operation *op, struct berval *ndn, Entry *e_parent, Entry **ep ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; Connection *c; int connindex; struct monitorentrypriv *mp; diff --git a/servers/slapd/back-monitor/entry.c b/servers/slapd/back-monitor/entry.c index c764fd8100..626d6280ab 100644 --- a/servers/slapd/back-monitor/entry.c +++ b/servers/slapd/back-monitor/entry.c @@ -38,10 +38,11 @@ int monitor_entry_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; struct monitorentrypriv *mp; assert( mi != NULL ); @@ -52,7 +53,7 @@ monitor_entry_update( if ( mp->mp_info && mp->mp_info->mss_update ) { - return ( *mp->mp_info->mss_update )( mi, e ); + return ( *mp->mp_info->mss_update )( op, e ); } return( 0 ); @@ -60,12 +61,13 @@ monitor_entry_update( int monitor_entry_create( - struct monitorinfo *mi, + Operation *op, struct berval *ndn, Entry *e_parent, Entry **ep ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; struct monitorentrypriv *mp; assert( mi != NULL ); @@ -76,7 +78,7 @@ monitor_entry_create( mp = ( struct monitorentrypriv * )e_parent->e_private; if ( mp->mp_info && mp->mp_info->mss_create ) { - return ( *mp->mp_info->mss_create )( mi, ndn, e_parent, ep ); + return ( *mp->mp_info->mss_create )( op, ndn, e_parent, ep ); } return( 0 ); @@ -84,11 +86,12 @@ monitor_entry_create( int monitor_entry_modify( - struct monitorinfo *mi, + Operation *op, Entry *e, Modifications *modlist ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; struct monitorentrypriv *mp; assert( mi != NULL ); @@ -98,7 +101,7 @@ monitor_entry_modify( mp = ( struct monitorentrypriv * )e->e_private; if ( mp->mp_info && mp->mp_info->mss_modify ) { - return ( *mp->mp_info->mss_modify )( mi, e, modlist ); + return ( *mp->mp_info->mss_modify )( op, e, modlist ); } return( 0 ); diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index fdcb40cfd4..c75567d853 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -268,7 +268,7 @@ monitor_back_db_init( dn.bv_val = SLAPD_MONITOR_DN; dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1; - rc = dnNormalize2( NULL, &dn, &ndn ); + rc = dnNormalize2( NULL, &dn, &ndn, NULL ); if( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, CRIT, @@ -313,7 +313,7 @@ monitor_back_db_init( dn.bv_val = ch_calloc( sizeof( char ), dn.bv_len + 1 ); strcpy( dn.bv_val, "cn=" ); strcat( dn.bv_val, monitor_subsys[ i ].mss_name ); - rc = dnPretty2( NULL, &dn, &monitor_subsys[ i ].mss_rdn ); + rc = dnPretty2( NULL, &dn, &monitor_subsys[ i ].mss_rdn, NULL ); free( dn.bv_val ); if ( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING @@ -333,7 +333,7 @@ monitor_back_db_init( strcpy( dn.bv_val , monitor_subsys[ i ].mss_rdn.bv_val ); strcat( dn.bv_val, "," SLAPD_MONITOR_DN ); rc = dnPrettyNormal( NULL, &dn, &monitor_subsys[ i ].mss_dn, - &monitor_subsys[ i ].mss_ndn ); + &monitor_subsys[ i ].mss_ndn, NULL ); free( dn.bv_val ); if ( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING @@ -424,7 +424,7 @@ monitor_back_db_init( } else { bv.bv_len = strlen( Versionstr ); } - if ( attr_merge_normalize_one( e, monitor_ad_desc, &bv ) ) { + if ( attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ) ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, CRIT, "unable to add description to '%s' entry\n", diff --git a/servers/slapd/back-monitor/log.c b/servers/slapd/back-monitor/log.c index 12860b5cac..eae5411860 100644 --- a/servers/slapd/back-monitor/log.c +++ b/servers/slapd/back-monitor/log.c @@ -144,7 +144,7 @@ monitor_subsys_log_init( int monitor_subsys_log_modify( - struct monitorinfo *mi, + Operation *op, Entry *e, Modifications *modlist ) @@ -211,14 +211,12 @@ monitor_subsys_log_modify( const char *text; static char textbuf[1024]; -#if 0 /* need op */ /* check for abandon */ if ( op->o_abandon ) { rc = SLAPD_ABANDON; goto cleanup; } -#endif /* check that the entry still obeys the schema */ rc = entry_schema_check( be_monitor, e, save_attrs, diff --git a/servers/slapd/back-monitor/modify.c b/servers/slapd/back-monitor/modify.c index 8aa426ecc2..43315a7627 100644 --- a/servers/slapd/back-monitor/modify.c +++ b/servers/slapd/back-monitor/modify.c @@ -83,7 +83,7 @@ monitor_back_modify( Operation *op, SlapReply *rs ) if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) { rc = LDAP_INSUFFICIENT_ACCESS; } else { - rc = monitor_entry_modify( mi, e, op->oq_modify.rs_modlist ); + rc = monitor_entry_modify( op, e, op->oq_modify.rs_modlist ); } rs->sr_err = rc; diff --git a/servers/slapd/back-monitor/operation.c b/servers/slapd/back-monitor/operation.c index 571a2a0f77..60fdd92535 100644 --- a/servers/slapd/back-monitor/operation.c +++ b/servers/slapd/back-monitor/operation.c @@ -369,10 +369,11 @@ monitor_subsys_ops_init( int monitor_subsys_ops_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; long n = -1; char *dn; diff --git a/servers/slapd/back-monitor/proto-back-monitor.h b/servers/slapd/back-monitor/proto-back-monitor.h index 01d44ab01e..42d455ccc1 100644 --- a/servers/slapd/back-monitor/proto-back-monitor.h +++ b/servers/slapd/back-monitor/proto-back-monitor.h @@ -58,42 +58,44 @@ int monitor_subsys_database_init LDAP_P(( BackendDB *be )); * threads */ int monitor_subsys_thread_init LDAP_P(( BackendDB *be )); -int monitor_subsys_thread_update LDAP_P(( struct monitorinfo *mi, Entry *e )); +int monitor_subsys_thread_update LDAP_P(( Operation *op, Entry *e )); /* * connections */ int monitor_subsys_conn_init LDAP_P(( BackendDB *be )); -int monitor_subsys_conn_update LDAP_P(( struct monitorinfo *mi, Entry *e )); -int monitor_subsys_conn_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep )); +int monitor_subsys_conn_update LDAP_P(( Operation *op, Entry *e )); +int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn, + Entry *e_parent, Entry **ep )); /* * read waiters */ -int monitor_subsys_readw_update LDAP_P(( struct monitorinfo *mi, Entry *e )); +int monitor_subsys_readw_update LDAP_P(( Operation *op, Entry *e )); /* * write waiters */ -int monitor_subsys_writew_update LDAP_P(( struct monitorinfo *mi, Entry *e )); +int monitor_subsys_writew_update LDAP_P(( Operation *op, Entry *e )); /* * log */ int monitor_subsys_log_init LDAP_P(( BackendDB *be )); -int monitor_subsys_log_modify LDAP_P(( struct monitorinfo *mi, Entry *e, Modifications *modlist )); +int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e, + Modifications *modlist )); /* * operations */ int monitor_subsys_ops_init LDAP_P(( BackendDB *be )); -int monitor_subsys_ops_update LDAP_P(( struct monitorinfo *mi, Entry *e )); +int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e )); /* * sent */ int monitor_subsys_sent_init LDAP_P(( BackendDB *be )); -int monitor_subsys_sent_update LDAP_P(( struct monitorinfo *mi, Entry *e )); +int monitor_subsys_sent_update LDAP_P(( Operation *op, Entry *e )); /* * listener @@ -104,8 +106,9 @@ int monitor_subsys_listener_init LDAP_P(( BackendDB *be )); * time */ int monitor_subsys_time_init LDAP_P(( BackendDB *be )); -int monitor_subsys_time_update LDAP_P(( struct monitorinfo *mi, Entry *e )); +int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e )); LDAP_END_DECL -#endif +#endif /* _PROTO_BACK_LDBM */ + diff --git a/servers/slapd/back-monitor/rww.c b/servers/slapd/back-monitor/rww.c index 108546009d..a51e92f53a 100644 --- a/servers/slapd/back-monitor/rww.c +++ b/servers/slapd/back-monitor/rww.c @@ -38,33 +38,34 @@ #include "slap.h" #include "back-monitor.h" -static int monitor_subsys_readw_update_internal( struct monitorinfo *mi, Entry *e, int rw ); +static int monitor_subsys_readw_update_internal( Operation *op, Entry *e, int rw ); int monitor_subsys_readw_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { - return monitor_subsys_readw_update_internal( mi, e, 0 ); + return monitor_subsys_readw_update_internal( op, e, 0 ); } int monitor_subsys_writew_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { - return monitor_subsys_readw_update_internal( mi, e, 1 ); + return monitor_subsys_readw_update_internal( op, e, 1 ); } static int monitor_subsys_readw_update_internal( - struct monitorinfo *mi, + Operation *op, Entry *e, int rw ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; Connection *c; int connindex; int nconns, nwritewaiters, nreadwaiters; diff --git a/servers/slapd/back-monitor/search.c b/servers/slapd/back-monitor/search.c index 6d7587c9fe..b61ae54255 100644 --- a/servers/slapd/back-monitor/search.c +++ b/servers/slapd/back-monitor/search.c @@ -44,14 +44,6 @@ static int monitor_send_children( - /* - Backend *be, - Connection *conn, - Operation *op, - Filter *filter, - AttributeName *attrs, - int attrsonly, - */ Operation *op, SlapReply *rs, Entry *e_parent, @@ -69,7 +61,7 @@ monitor_send_children( e_ch = NULL; if ( MONITOR_HAS_VOLATILE_CH( mp ) ) { - monitor_entry_create( mi, NULL, e_parent, &e_ch ); + monitor_entry_create( op, NULL, e_parent, &e_ch ); } monitor_cache_release( mi, e_parent ); @@ -107,7 +99,7 @@ monitor_send_children( for ( ; e != NULL; ) { mp = ( struct monitorentrypriv * )e->e_private; - monitor_entry_update( mi, e ); + monitor_entry_update( op, e ); rc = test_filter( op, e, op->oq_search.rs_filter ); if ( rc == LDAP_COMPARE_TRUE ) { @@ -171,7 +163,7 @@ monitor_back_search( Operation *op, SlapReply *rs ) rs->sr_attrs = op->oq_search.rs_attrs; switch ( op->oq_search.rs_scope ) { case LDAP_SCOPE_BASE: - monitor_entry_update( mi, e ); + monitor_entry_update( op, e ); rc = test_filter( op, e, op->oq_search.rs_filter ); if ( rc == LDAP_COMPARE_TRUE ) { rs->sr_entry = e; @@ -191,7 +183,7 @@ monitor_back_search( Operation *op, SlapReply *rs ) break; case LDAP_SCOPE_SUBTREE: - monitor_entry_update( mi, e ); + monitor_entry_update( op, e ); rc = test_filter( op, e, op->oq_search.rs_filter ); if ( rc == LDAP_COMPARE_TRUE ) { rs->sr_entry = e; diff --git a/servers/slapd/back-monitor/sent.c b/servers/slapd/back-monitor/sent.c index 972331fd97..2e17b84d9b 100644 --- a/servers/slapd/back-monitor/sent.c +++ b/servers/slapd/back-monitor/sent.c @@ -307,10 +307,11 @@ monitor_subsys_sent_init( int monitor_subsys_sent_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; long n = -1; assert( mi ); diff --git a/servers/slapd/back-monitor/thread.c b/servers/slapd/back-monitor/thread.c index 1008d61db8..7e49177cc5 100644 --- a/servers/slapd/back-monitor/thread.c +++ b/servers/slapd/back-monitor/thread.c @@ -84,14 +84,17 @@ monitor_subsys_thread_init( int monitor_subsys_thread_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; Attribute *a; struct berval *b = NULL; char buf[1024]; + assert( mi != NULL ); + snprintf( buf, sizeof( buf ), "backload=%d", ldap_pvt_thread_pool_backload( &connection_pool ) ); diff --git a/servers/slapd/back-monitor/time.c b/servers/slapd/back-monitor/time.c index 1dfe0ae82f..83dbdf8511 100644 --- a/servers/slapd/back-monitor/time.c +++ b/servers/slapd/back-monitor/time.c @@ -216,10 +216,11 @@ monitor_subsys_time_init( int monitor_subsys_time_update( - struct monitorinfo *mi, + Operation *op, Entry *e ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; char stmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ], ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ]; struct tm *stm, *ctm;