Commit 2fcaa15b authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

First rounds of backend/database flag cleanup

parent 4122a9dd
......@@ -75,17 +75,6 @@ bdb_db_init( BackendDB *be )
0, 0, 0 );
#endif
/* indicate system schema supported */
be->be_flags |=
SLAP_BFLAG_INCREMENT |
#ifdef BDB_SUBENTRIES
SLAP_BFLAG_SUBENTRIES |
#endif
#ifdef BDB_ALIASES
SLAP_BFLAG_ALIASES |
#endif
SLAP_BFLAG_REFERRALS;
/* allocate backend-database-specific stuff */
bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
......@@ -118,8 +107,7 @@ int
bdb_bt_compare(
DB *db,
const DBT *usrkey,
const DBT *curkey
)
const DBT *curkey )
{
unsigned char *u, *c;
int i, x;
......@@ -585,8 +573,7 @@ int init_module( int argc, char *argv[] ) {
int
bdb_initialize(
BackendInfo *bi
)
BackendInfo *bi )
{
static char *controls[] = {
LDAP_CONTROL_ASSERT,
......@@ -600,8 +587,6 @@ bdb_initialize(
NULL
};
bi->bi_controls = controls;
/* initialize the underlying database system */
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_initialize\n", 0, 0, 0 );
......@@ -610,6 +595,18 @@ bdb_initialize(
0, 0, 0 );
#endif
bi->bi_flags |=
SLAP_BFLAG_INCREMENT |
#ifdef BDB_SUBENTRIES
SLAP_BFLAG_SUBENTRIES |
#endif
#ifdef BDB_ALIASES
SLAP_BFLAG_ALIASES |
#endif
SLAP_BFLAG_REFERRALS;
bi->bi_controls = controls;
{ /* version check */
int major, minor, patch;
char *version = db_version( &major, &minor, &patch );
......
......@@ -52,6 +52,14 @@ ldbm_back_initialize(
bi->bi_controls = controls;
bi->bi_flags |=
SLAP_BFLAG_INCREMENT |
#ifdef LDBM_SUBENTRIES
SLAP_BFLAG_SUBENTRIES |
#endif
SLAP_BFLAG_ALIASES |
SLAP_BFLAG_REFERRALS;
bi->bi_open = ldbm_back_open;
bi->bi_config = NULL;
bi->bi_close = ldbm_back_close;
......@@ -140,15 +148,6 @@ ldbm_back_db_init(
{
struct ldbminfo *li;
/* indicate system schema supported */
be->be_flags |=
SLAP_BFLAG_INCREMENT |
#ifdef LDBM_SUBENTRIES
SLAP_BFLAG_SUBENTRIES |
#endif
SLAP_BFLAG_ALIASES |
SLAP_BFLAG_REFERRALS;
/* allocate backend-database-specific stuff */
li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) );
......
......@@ -562,7 +562,7 @@ glue_sub_init( )
if (SLAP_GLUE_SUBORDINATE ( b1 ) ) {
/* The last database cannot be a subordinate of noone */
if (i == nBackendDB - 1) {
b1->be_flags ^= SLAP_BFLAG_GLUE_SUBORDINATE;
SLAP_DBFLAGS(b1) ^= SLAP_DBFLAG_GLUE_SUBORDINATE;
}
continue;
}
......@@ -581,7 +581,7 @@ glue_sub_init( )
continue;
}
cont--;
be->be_flags |= SLAP_BFLAG_GLUE_LINKED;
SLAP_DBFLAGS(be) |= SLAP_DBFLAG_GLUE_LINKED;
if (gi == NULL) {
/* We create a copy of the superior's be
* structure, pointing to all of its original
......@@ -590,7 +590,7 @@ glue_sub_init( )
* is used whenever we have operations to pass
* down to the real database.
*/
b1->be_flags |= SLAP_BFLAG_GLUE_INSTANCE;
SLAP_DBFLAGS(b1) |= SLAP_DBFLAG_GLUE_INSTANCE;
gi = (glueinfo *)ch_malloc(sizeof(glueinfo));
gi->nodes = 0;
gi->bd = *b1;
......
......@@ -960,7 +960,7 @@ read_config( const char *fname, int depth )
return 1;
} else {
be->be_flags |= SLAP_BFLAG_GLUE_SUBORDINATE;
be->be_flags |= SLAP_DBFLAG_GLUE_SUBORDINATE;
num_subordinates++;
}
......@@ -2156,13 +2156,13 @@ read_config( const char *fname, int depth )
}
if ( strcasecmp( cargv[1], "on" ) == 0 ) {
if ( be ) {
be->be_flags &= ~SLAP_BFLAG_NOLASTMOD;
be->be_flags &= ~SLAP_DBFLAG_NOLASTMOD;
} else {
lastmod = 1;
}
} else {
if ( be ) {
be->be_flags |= SLAP_BFLAG_NOLASTMOD;
be->be_flags |= SLAP_DBFLAG_NOLASTMOD;
} else {
lastmod = 0;
}
......@@ -2913,7 +2913,7 @@ add_syncrepl(
si->si_provideruri == NULL ? "(null)" : si->si_provideruri, 0, 0 );
#endif
if ( !si->si_schemachecking ) {
be->be_flags |= SLAP_BFLAG_NO_SCHEMA_CHECK;
be->be_flags |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
}
si->si_be = be;
LDAP_STAILQ_INSERT_TAIL( &be->be_syncinfo, si, si_next );
......
......@@ -1829,7 +1829,7 @@ proxy_cache_init(
qm = (query_manager*)ch_malloc(sizeof(query_manager));
cm->db = *be;
cm->db.be_flags |= SLAP_BFLAG_NO_SCHEMA_CHECK;
SLAP_DBFLAGS(&cm->db) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
cm->db.be_private = NULL;
cm->qm = qm;
cm->numattrsets = 0;
......
......@@ -124,7 +124,7 @@ root_dse_info(
/* no suffix! */
continue;
}
if ( SLAP_MONITOR( backends[i].be_flags )) {
if ( SLAP_MONITOR( &backends[i] )) {
vals[0] = backends[i].be_suffix[0];
nvals[0] = backends[i].be_nsuffix[0];
if( attr_merge( e, ad_monitorContext, vals, nvals ) ) {
......
......@@ -1445,33 +1445,24 @@ struct slap_backend_db {
#define be_entry_modify bd_info->bi_tool_entry_modify
#endif
#define SLAP_BFLAG_NOLASTMOD 0x0001U
#define SLAP_BFLAG_NO_SCHEMA_CHECK 0x0002U
#define SLAP_BFLAG_GLUE_INSTANCE 0x0010U /* a glue backend */
#define SLAP_BFLAG_GLUE_SUBORDINATE 0x0020U /* child of a glue hierarchy */
#define SLAP_BFLAG_GLUE_LINKED 0x0040U /* child is connected to parent */
#define SLAP_BFLAG_MONITOR 0x0080U /* a monitor backend */
#define SLAP_BFLAG_INCREMENT 0x0100U
#define SLAP_BFLAG_ALIASES 0x1000U
#define SLAP_BFLAG_REFERRALS 0x2000U
#define SLAP_BFLAG_SUBENTRIES 0x4000U
#define SLAP_BFLAG_DYNAMIC 0x8000U
/* Database flags */
#define SLAP_DBFLAG_NOLASTMOD 0x0001U
#define SLAP_DBFLAG_NO_SCHEMA_CHECK 0x0002U
#define SLAP_DBFLAG_GLUE_INSTANCE 0x0010U /* a glue backend */
#define SLAP_DBFLAG_GLUE_SUBORDINATE 0x0020U /* child of a glue hierarchy */
#define SLAP_DBFLAG_GLUE_LINKED 0x0040U /* child is connected to parent */
slap_mask_t be_flags;
#define SLAP_LASTMOD(be) (!((be)->be_flags & SLAP_BFLAG_NOLASTMOD))
#define SLAP_NO_SCHEMA_CHECK(be) (((be)->be_flags & SLAP_BFLAG_NO_SCHEMA_CHECK))
#define SLAP_GLUE_INSTANCE(be) ((be)->be_flags & SLAP_BFLAG_GLUE_INSTANCE)
#define SLAP_GLUE_SUBORDINATE(be) \
((be)->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE)
#define SLAP_GLUE_LINKED(be) ((be)->be_flags & SLAP_BFLAG_GLUE_LINKED)
#define SLAP_MONITOR(be) ((be)->be_flags & SLAP_BFLAG_MONITOR)
#define SLAP_INCREMENT(be) ((be)->be_flags & SLAP_BFLAG_INCREMENT)
#define SLAP_ALIASES(be) ((be)->be_flags & SLAP_BFLAG_ALIASES)
#define SLAP_REFERRALS(be) ((be)->be_flags & SLAP_BFLAG_REFERRALS)
#define SLAP_SUBENTRIES(be) ((be)->be_flags & SLAP_BFLAG_SUBENTRIES)
#define SLAP_DYNAMIC(be) ((be)->be_flags & SLAP_BFLAG_DYNAMIC)
#define SLAP_DBFLAGS(be) ((be)->be_flags)
#define SLAP_NOLASTMOD(be) (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD)
#define SLAP_LASTMOD(be) (!SLAP_NOLASTMOD(be))
#define SLAP_NO_SCHEMA_CHECK(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_NO_SCHEMA_CHECK)
#define SLAP_GLUE_INSTANCE(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_INSTANCE)
#define SLAP_GLUE_SUBORDINATE(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_SUBORDINATE)
#define SLAP_GLUE_LINKED(be) \
(SLAP_DBFLAGS(be) & SLAP_DBFLAG_GLUE_LINKED)
slap_mask_t be_restrictops; /* restriction operations */
#define SLAP_RESTRICT_OP_ADD 0x0001U
......@@ -1532,19 +1523,22 @@ struct slap_backend_db {
struct slap_limits **be_limits; /* regex-based size and time limits */
AccessControl *be_acl; /* access control list for this backend */
slap_access_t be_dfltaccess; /* access given if no acl matches */
/* Replica Information */
struct slap_replica_info **be_replica; /* replicas of this backend (in master) */
char *be_replogfile; /* replication log file (in master) */
struct berval be_update_ndn; /* allowed to make changes (in replicas) */
BerVarray be_update_refs; /* where to refer modifying clients to */
char *be_realm;
void *be_private; /* anything the backend database needs */
void *be_pb; /* Netscape plugin */
LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry ) be_pending_csn_list;
ldap_pvt_thread_mutex_t be_pcl_mutex;
struct berval be_context_csn;
ldap_pvt_thread_mutex_t be_context_csn_mutex;
LDAP_STAILQ_HEAD( be_si, syncinfo_s ) be_syncinfo; /* For syncrepl */
char *be_realm;
void *be_pb; /* Netscape plugin */
void *be_private; /* anything the backend database needs */
};
struct slap_conn;
......@@ -1813,6 +1807,22 @@ struct slap_backend_info {
#define SLAP_INDEX_ADD_OP 0x0001
#define SLAP_INDEX_DELETE_OP 0x0002
slap_mask_t bi_flags; /* backend flags */
#define SLAP_BFLAG_MONITOR 0x0001U /* a monitor backend */
#define SLAP_BFLAG_INCREMENT 0x0100U
#define SLAP_BFLAG_ALIASES 0x1000U
#define SLAP_BFLAG_REFERRALS 0x2000U
#define SLAP_BFLAG_SUBENTRIES 0x4000U
#define SLAP_BFLAG_DYNAMIC 0x8000U
#define SLAP_BFLAGS(be) ((be)->bd_info->bi_flags)
#define SLAP_MONITOR(be) (SLAP_BFLAGS(be) & SLAP_BFLAG_MONITOR)
#define SLAP_INCREMENT(be) (SLAP_BFLAGS(be) & SLAP_BFLAG_INCREMENT)
#define SLAP_ALIASES(be) (SLAP_BFLAGS(be) & SLAP_BFLAG_ALIASES)
#define SLAP_REFERRALS(be) (SLAP_BFLAGS(be) & SLAP_BFLAG_REFERRALS)
#define SLAP_SUBENTRIES(be) (SLAP_BFLAGS(be) & SLAP_BFLAG_SUBENTRIES)
#define SLAP_DYNAMIC(be) (SLAP_BFLAGS(be) & SLAP_BFLAG_DYNAMIC)
char **bi_controls; /* supported controls */
unsigned int bi_nDB; /* number of databases of this type */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment