pass Operation instead of private info

This commit is contained in:
Pierangelo Masarati 2003-04-11 23:08:16 +00:00
parent 465a50cffc
commit 29c2594fe4
13 changed files with 59 additions and 54 deletions

View File

@ -191,12 +191,12 @@ struct monitorsubsys {
/* initialize entry and subentries */ /* initialize entry and subentries */
int ( *mss_init )( BackendDB * ); int ( *mss_init )( BackendDB * );
/* update existing dynamic entry and subentries */ /* update existing dynamic entry and subentries */
int ( *mss_update )( struct monitorinfo *, Entry * ); int ( *mss_update )( Operation *, Entry * );
/* create new dynamic subentries */ /* create new dynamic subentries */
int ( *mss_create )( struct monitorinfo *, int ( *mss_create )( Operation *,
struct berval *ndn, Entry *, Entry ** ); struct berval *ndn, Entry *, Entry ** );
/* modify entry and subentries */ /* modify entry and subentries */
int ( *mss_modify )( struct monitorinfo *, Entry *, int ( *mss_modify )( Operation *, Entry *,
Modifications *modlist ); Modifications *modlist );
}; };
@ -221,9 +221,9 @@ extern int monitor_cache_release LDAP_P(( struct monitorinfo *mi, Entry *e ));
* update * update
*/ */
extern int monitor_entry_update LDAP_P(( struct monitorinfo *mi, Entry *e )); extern int monitor_entry_update LDAP_P(( Operation *op, Entry *e ));
extern int monitor_entry_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep )); extern int monitor_entry_create LDAP_P(( Operation *op, 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_modify LDAP_P(( Operation *op, Entry *e, Modifications *modlist ));
LDAP_END_DECL LDAP_END_DECL

View File

@ -200,10 +200,11 @@ monitor_subsys_conn_init(
int int
monitor_subsys_conn_update( monitor_subsys_conn_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
long n = -1; long n = -1;
assert( mi ); assert( mi );
@ -348,12 +349,13 @@ conn_create(
int int
monitor_subsys_conn_create( monitor_subsys_conn_create(
struct monitorinfo *mi, Operation *op,
struct berval *ndn, struct berval *ndn,
Entry *e_parent, Entry *e_parent,
Entry **ep Entry **ep
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
Connection *c; Connection *c;
int connindex; int connindex;
struct monitorentrypriv *mp; struct monitorentrypriv *mp;

View File

@ -38,10 +38,11 @@
int int
monitor_entry_update( monitor_entry_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp; struct monitorentrypriv *mp;
assert( mi != NULL ); assert( mi != NULL );
@ -52,7 +53,7 @@ monitor_entry_update(
if ( mp->mp_info && mp->mp_info->mss_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 ); return( 0 );
@ -60,12 +61,13 @@ monitor_entry_update(
int int
monitor_entry_create( monitor_entry_create(
struct monitorinfo *mi, Operation *op,
struct berval *ndn, struct berval *ndn,
Entry *e_parent, Entry *e_parent,
Entry **ep Entry **ep
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp; struct monitorentrypriv *mp;
assert( mi != NULL ); assert( mi != NULL );
@ -76,7 +78,7 @@ monitor_entry_create(
mp = ( struct monitorentrypriv * )e_parent->e_private; mp = ( struct monitorentrypriv * )e_parent->e_private;
if ( mp->mp_info && mp->mp_info->mss_create ) { 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 ); return( 0 );
@ -84,11 +86,12 @@ monitor_entry_create(
int int
monitor_entry_modify( monitor_entry_modify(
struct monitorinfo *mi, Operation *op,
Entry *e, Entry *e,
Modifications *modlist Modifications *modlist
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
struct monitorentrypriv *mp; struct monitorentrypriv *mp;
assert( mi != NULL ); assert( mi != NULL );
@ -98,7 +101,7 @@ monitor_entry_modify(
mp = ( struct monitorentrypriv * )e->e_private; mp = ( struct monitorentrypriv * )e->e_private;
if ( mp->mp_info && mp->mp_info->mss_modify ) { 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 ); return( 0 );

View File

@ -268,7 +268,7 @@ monitor_back_db_init(
dn.bv_val = SLAPD_MONITOR_DN; dn.bv_val = SLAPD_MONITOR_DN;
dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1; dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
rc = dnNormalize2( NULL, &dn, &ndn ); rc = dnNormalize2( NULL, &dn, &ndn, NULL );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT, LDAP_LOG( OPERATION, CRIT,
@ -313,7 +313,7 @@ monitor_back_db_init(
dn.bv_val = ch_calloc( sizeof( char ), dn.bv_len + 1 ); dn.bv_val = ch_calloc( sizeof( char ), dn.bv_len + 1 );
strcpy( dn.bv_val, "cn=" ); strcpy( dn.bv_val, "cn=" );
strcat( dn.bv_val, monitor_subsys[ i ].mss_name ); 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 ); free( dn.bv_val );
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
@ -333,7 +333,7 @@ monitor_back_db_init(
strcpy( dn.bv_val , monitor_subsys[ i ].mss_rdn.bv_val ); strcpy( dn.bv_val , monitor_subsys[ i ].mss_rdn.bv_val );
strcat( dn.bv_val, "," SLAPD_MONITOR_DN ); strcat( dn.bv_val, "," SLAPD_MONITOR_DN );
rc = dnPrettyNormal( NULL, &dn, &monitor_subsys[ i ].mss_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 ); free( dn.bv_val );
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
@ -424,7 +424,7 @@ monitor_back_db_init(
} else { } else {
bv.bv_len = strlen( Versionstr ); 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 #ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT, LDAP_LOG( OPERATION, CRIT,
"unable to add description to '%s' entry\n", "unable to add description to '%s' entry\n",

View File

@ -144,7 +144,7 @@ monitor_subsys_log_init(
int int
monitor_subsys_log_modify( monitor_subsys_log_modify(
struct monitorinfo *mi, Operation *op,
Entry *e, Entry *e,
Modifications *modlist Modifications *modlist
) )
@ -211,14 +211,12 @@ monitor_subsys_log_modify(
const char *text; const char *text;
static char textbuf[1024]; static char textbuf[1024];
#if 0 /* need op */
/* check for abandon */ /* check for abandon */
if ( op->o_abandon ) { if ( op->o_abandon ) {
rc = SLAPD_ABANDON; rc = SLAPD_ABANDON;
goto cleanup; goto cleanup;
} }
#endif
/* check that the entry still obeys the schema */ /* check that the entry still obeys the schema */
rc = entry_schema_check( be_monitor, e, save_attrs, rc = entry_schema_check( be_monitor, e, save_attrs,

View File

@ -83,7 +83,7 @@ monitor_back_modify( Operation *op, SlapReply *rs )
if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) { if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) {
rc = LDAP_INSUFFICIENT_ACCESS; rc = LDAP_INSUFFICIENT_ACCESS;
} else { } 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; rs->sr_err = rc;

View File

@ -369,10 +369,11 @@ monitor_subsys_ops_init(
int int
monitor_subsys_ops_update( monitor_subsys_ops_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
long n = -1; long n = -1;
char *dn; char *dn;

View File

@ -58,42 +58,44 @@ int monitor_subsys_database_init LDAP_P(( BackendDB *be ));
* threads * threads
*/ */
int monitor_subsys_thread_init LDAP_P(( BackendDB *be )); 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 * connections
*/ */
int monitor_subsys_conn_init LDAP_P(( BackendDB *be )); 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_update LDAP_P(( Operation *op, Entry *e ));
int monitor_subsys_conn_create LDAP_P(( struct monitorinfo *mi, struct berval *ndn, Entry *e_parent, Entry **ep )); int monitor_subsys_conn_create LDAP_P(( Operation *op, struct berval *ndn,
Entry *e_parent, Entry **ep ));
/* /*
* read waiters * 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 * 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 * log
*/ */
int monitor_subsys_log_init LDAP_P(( BackendDB *be )); 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 * operations
*/ */
int monitor_subsys_ops_init LDAP_P(( BackendDB *be )); 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 * sent
*/ */
int monitor_subsys_sent_init LDAP_P(( BackendDB *be )); 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 * listener
@ -104,8 +106,9 @@ int monitor_subsys_listener_init LDAP_P(( BackendDB *be ));
* time * time
*/ */
int monitor_subsys_time_init LDAP_P(( BackendDB *be )); 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 LDAP_END_DECL
#endif #endif /* _PROTO_BACK_LDBM */

View File

@ -38,33 +38,34 @@
#include "slap.h" #include "slap.h"
#include "back-monitor.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 int
monitor_subsys_readw_update( monitor_subsys_readw_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
return monitor_subsys_readw_update_internal( mi, e, 0 ); return monitor_subsys_readw_update_internal( op, e, 0 );
} }
int int
monitor_subsys_writew_update( monitor_subsys_writew_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
return monitor_subsys_readw_update_internal( mi, e, 1 ); return monitor_subsys_readw_update_internal( op, e, 1 );
} }
static int static int
monitor_subsys_readw_update_internal( monitor_subsys_readw_update_internal(
struct monitorinfo *mi, Operation *op,
Entry *e, Entry *e,
int rw int rw
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
Connection *c; Connection *c;
int connindex; int connindex;
int nconns, nwritewaiters, nreadwaiters; int nconns, nwritewaiters, nreadwaiters;

View File

@ -44,14 +44,6 @@
static int static int
monitor_send_children( monitor_send_children(
/*
Backend *be,
Connection *conn,
Operation *op,
Filter *filter,
AttributeName *attrs,
int attrsonly,
*/
Operation *op, Operation *op,
SlapReply *rs, SlapReply *rs,
Entry *e_parent, Entry *e_parent,
@ -69,7 +61,7 @@ monitor_send_children(
e_ch = NULL; e_ch = NULL;
if ( MONITOR_HAS_VOLATILE_CH( mp ) ) { 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 ); monitor_cache_release( mi, e_parent );
@ -107,7 +99,7 @@ monitor_send_children(
for ( ; e != NULL; ) { for ( ; e != NULL; ) {
mp = ( struct monitorentrypriv * )e->e_private; 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 ); rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) { if ( rc == LDAP_COMPARE_TRUE ) {
@ -171,7 +163,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
rs->sr_attrs = op->oq_search.rs_attrs; rs->sr_attrs = op->oq_search.rs_attrs;
switch ( op->oq_search.rs_scope ) { switch ( op->oq_search.rs_scope ) {
case LDAP_SCOPE_BASE: case LDAP_SCOPE_BASE:
monitor_entry_update( mi, e ); monitor_entry_update( op, e );
rc = test_filter( op, e, op->oq_search.rs_filter ); rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) { if ( rc == LDAP_COMPARE_TRUE ) {
rs->sr_entry = e; rs->sr_entry = e;
@ -191,7 +183,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
break; break;
case LDAP_SCOPE_SUBTREE: case LDAP_SCOPE_SUBTREE:
monitor_entry_update( mi, e ); monitor_entry_update( op, e );
rc = test_filter( op, e, op->oq_search.rs_filter ); rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) { if ( rc == LDAP_COMPARE_TRUE ) {
rs->sr_entry = e; rs->sr_entry = e;

View File

@ -307,10 +307,11 @@ monitor_subsys_sent_init(
int int
monitor_subsys_sent_update( monitor_subsys_sent_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
long n = -1; long n = -1;
assert( mi ); assert( mi );

View File

@ -84,14 +84,17 @@ monitor_subsys_thread_init(
int int
monitor_subsys_thread_update( monitor_subsys_thread_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
Attribute *a; Attribute *a;
struct berval *b = NULL; struct berval *b = NULL;
char buf[1024]; char buf[1024];
assert( mi != NULL );
snprintf( buf, sizeof( buf ), "backload=%d", snprintf( buf, sizeof( buf ), "backload=%d",
ldap_pvt_thread_pool_backload( &connection_pool ) ); ldap_pvt_thread_pool_backload( &connection_pool ) );

View File

@ -216,10 +216,11 @@ monitor_subsys_time_init(
int int
monitor_subsys_time_update( monitor_subsys_time_update(
struct monitorinfo *mi, Operation *op,
Entry *e Entry *e
) )
{ {
struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
char stmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ], char stmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ],
ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ]; ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
struct tm *stm, *ctm; struct tm *stm, *ctm;