From d27b2f811e67bf89b957d494203823930b8828b2 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 4 Feb 1999 17:33:46 +0000 Subject: [PATCH] Backout recent initialization/startup changes in prep for new frontend->backend interface. --- servers/slapd/backend.c | 28 ---------------------------- servers/slapd/config.c | 10 ---------- servers/slapd/proto-slap.h | 6 +----- servers/slapd/slap.h | 26 ++++++++++++++++---------- 4 files changed, 17 insertions(+), 53 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 6ae843d34c..be069201f9 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -54,8 +54,6 @@ new_backend( be->be_config = ldbm_back_config; be->be_init = ldbm_back_init; be->be_close = ldbm_back_close; - be->be_startup = ldbm_back_startup; - be->be_shutdown = ldbm_back_shutdown; #ifdef SLAPD_ACLGROUPS be->be_group = ldbm_back_group; #endif @@ -272,32 +270,6 @@ be_isroot_pw( Backend *be, char *ndn, struct berval *cred ) return result == 0; } -void -be_startup( void ) -{ - int i; - - for ( i = 0; i < nbackends; i++ ) { - if ( backends[i].be_startup != NULL ) { - (*backends[i].be_startup)( &backends[i] ); - } - } -} - - -void -be_shutdown( void ) -{ - int i; - - for ( i = 0; i < nbackends; i++ ) { - if ( backends[i].be_shutdown != NULL ) { - (*backends[i].be_shutdown)( &backends[i] ); - } - } -} - - void be_close( void ) { diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 06d5c4f3c4..b810460680 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -33,16 +33,8 @@ static void fp_parse_line(char *line, int *argcp, char **argv); static char *strtok_quote(char *line, char *sep); -/* the old interface for tools */ void read_config( char *fname, Backend **bep, FILE *pfp ) -{ - read_config_env( fname, bep, pfp, 0 ); -} - -/* the new interface for slapd */ -void -read_config_env( char *fname, Backend **bep, FILE *pfp, int startup ) { FILE *fp; char *line, *savefname; @@ -479,8 +471,6 @@ read_config_env( char *fname, Backend **bep, FILE *pfp, int startup ) } } fclose( fp ); - - if ( startup ) be_startup(); } static void diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 5c58ef3efd..6b38c81e92 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -65,8 +65,6 @@ int be_isroot LDAP_P(( Backend *be, char *ndn )); int be_isroot_pw LDAP_P(( Backend *be, char *ndn, struct berval *cred )); char* be_root_dn LDAP_P(( Backend *be )); void be_close LDAP_P(( void )); -void be_startup LDAP_P(( void )); -void be_shutdown LDAP_P(( void )); /* * ch_malloc.c @@ -93,7 +91,6 @@ char ** str2charray LDAP_P(( char *str, char *brkstr )); */ void read_config LDAP_P(( char *fname, Backend **bep, FILE *pfp )); -void read_config_env LDAP_P(( char *fname, Backend **bep, FILE *pfp, int up )); /* * connection.c @@ -124,6 +121,7 @@ void entry_free LDAP_P(( Entry *e )); int entry_rdwr_lock LDAP_P(( Entry *e, int rw )); int entry_rdwr_rlock LDAP_P(( Entry *e )); int entry_rdwr_wlock LDAP_P(( Entry *e )); +int entry_rdwr_trylock LDAP_P(( Entry *e, int rw )); int entry_rdwr_unlock LDAP_P(( Entry *e, int rw )); int entry_rdwr_runlock LDAP_P(( Entry *e )); int entry_rdwr_wunlock LDAP_P(( Entry *e )); @@ -314,8 +312,6 @@ extern void ldbm_back_close LDAP_P((Backend *be)); extern int ldbm_back_group LDAP_P((Backend *be, Entry *target, char *gr_ndn, char *op_ndn, char *objectclassValue, char *groupattrName )); -extern void ldbm_back_startup LDAP_P((Backend *be)); -extern void ldbm_back_shutdown LDAP_P((Backend *be)); #endif #ifdef SLAPD_PASSWD diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 527a5a5dcc..a977323860 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -51,10 +51,6 @@ LDAP_BEGIN_DECL extern int slap_debug; -#ifdef SLAPD_BDB2 -extern int bdb2i_do_timing; -#endif - struct slap_op; struct slap_conn; @@ -137,18 +133,30 @@ typedef unsigned long ID; * represents an entry in core */ typedef struct entry { + ldap_pvt_thread_rdwr_t e_rdwr; /* reader/writer lock */ + char *e_dn; /* DN of this entry */ char *e_ndn; /* normalized DN of this entry */ Attribute *e_attrs; /* list of attributes + values */ + + /* + * The ID field should only be changed before entry is + * inserted into a cache. The ID value is backend + * specific. + */ ID e_id; /* id of this entry - this should */ /* really be private to back-ldbm */ - char e_state; /* for the cache */ - - ldap_pvt_thread_rdwr_t e_rdwr; /* reader/writer lock */ -#define ENTRY_STATE_DELETED 1 + /* + * remaining fields require backend cache lock to access + * These items are specific to the LDBM backend and should + * and should be hidden. + */ + char e_state; /* for the cache */ +#define ENTRY_STATE_DELETED 1 #define ENTRY_STATE_CREATING 2 + int e_refcnt; /* # threads ref'ing this entry */ struct entry *e_lrunext; /* for cache lru list */ struct entry *e_lruprev; @@ -275,8 +283,6 @@ struct backend { void (*be_config) LDAP_P((Backend *be, char *fname, int lineno, int argc, char **argv )); void (*be_init) LDAP_P((Backend *be)); - void (*be_startup) LDAP_P((Backend *be)); - void (*be_shutdown) LDAP_P((Backend *be)); void (*be_close) LDAP_P((Backend *be)); #ifdef SLAPD_ACLGROUPS -- 2.39.5