From 9fa8aa16a8039af645d97a3090c1558401dd7d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Fri, 25 Aug 2017 19:22:12 +0000 Subject: [PATCH] Good bye cyrusdb_sync It was used only by BDB. --- cunit/annotate.testc | 4 ++-- cunit/quota.testc | 2 +- imap/ctl_cyrusdb.c | 10 ---------- imap/ctl_mboxlist.c | 8 ++++---- imap/cyr_deny.c | 2 +- imap/mboxlist.c | 9 +++------ imap/mboxlist.h | 3 +-- imap/quota.c | 2 +- imap/quota.h | 3 +-- imap/quota_db.c | 7 ++----- imap/userdeny.h | 3 +-- imap/userdeny_db.c | 7 ++----- lib/cyrusdb.c | 11 ----------- lib/cyrusdb.h | 5 ----- lib/cyrusdb_flat.c | 1 - lib/cyrusdb_quotalegacy.c | 1 - lib/cyrusdb_skiplist.c | 1 - lib/cyrusdb_sql.c | 1 - lib/cyrusdb_twoskip.c | 1 - 19 files changed, 19 insertions(+), 62 deletions(-) diff --git a/cunit/annotate.testc b/cunit/annotate.testc index 09afcdcd32..f61648c283 100644 --- a/cunit/annotate.testc +++ b/cunit/annotate.testc @@ -1934,10 +1934,10 @@ static int set_up(void) isadmin = 0; auth_state = auth_newstate(userid); - quotadb_init(0); + quotadb_init(); quotadb_open(NULL); - mboxlist_init(0); + mboxlist_init(); mboxlist_open(NULL); memset(&mbentry, 0, sizeof(mbentry)); diff --git a/cunit/quota.testc b/cunit/quota.testc index 40626989cd..b680b8d570 100644 --- a/cunit/quota.testc +++ b/cunit/quota.testc @@ -1039,7 +1039,7 @@ static int set_up(void) cyrusdb_init(); config_quota_db = "skiplist"; - quotadb_init(0); + quotadb_init(); quotadb_open(NULL); return 0; diff --git a/imap/ctl_cyrusdb.c b/imap/ctl_cyrusdb.c index 966c350cc4..81e78370ee 100644 --- a/imap/ctl_cyrusdb.c +++ b/imap/ctl_cyrusdb.c @@ -332,17 +332,7 @@ int main(int argc, char *argv[]) break; case CHECKPOINT: - r2 = cyrusdb_sync(*dblist[i].configptr); - if (r2) { - syslog(LOG_ERR, "DBERROR: sync %s: %s", dirname, - cyrusdb_strerror(r2)); - fprintf(stderr, - "ctl_cyrusdb: unable to sync environment\n"); - } - /* ARCHIVE */ - r2 = 0; - if (!rotated) { /* rotate the backup directories -- ONE time only */ char *file; diff --git a/imap/ctl_mboxlist.c b/imap/ctl_mboxlist.c index b55bcc38f3..832ed7cd80 100644 --- a/imap/ctl_mboxlist.c +++ b/imap/ctl_mboxlist.c @@ -1002,7 +1002,7 @@ int main(int argc, char *argv[]) case CHECKPOINT: syslog(LOG_NOTICE, "checkpointing mboxlist"); - mboxlist_init(MBOXLIST_SYNC); + mboxlist_init(); mboxlist_open(NULL); mboxlist_close(); mboxlist_done(); @@ -1014,7 +1014,7 @@ int main(int argc, char *argv[]) GCC_FALLTHROUGH case DUMP: - mboxlist_init(0); + mboxlist_init(); mboxlist_open(mboxdb_fname); do_dump(op, partition, dopurge, dointermediary); @@ -1029,7 +1029,7 @@ int main(int argc, char *argv[]) break; case UNDUMP: - mboxlist_init(0); + mboxlist_init(); mboxlist_open(mboxdb_fname); do_undump(); @@ -1039,7 +1039,7 @@ int main(int argc, char *argv[]) break; case VERIFY: - mboxlist_init(0); + mboxlist_init(); mboxlist_open(mboxdb_fname); do_verify(); diff --git a/imap/cyr_deny.c b/imap/cyr_deny.c index 11a8483506..ce88d1754f 100644 --- a/imap/cyr_deny.c +++ b/imap/cyr_deny.c @@ -229,7 +229,7 @@ int main(int argc, char **argv) cyrus_init(alt_config, "cyr_deny", 0, 0); - denydb_init(0); + denydb_init(); r = denydb_open(/*create*/(mode == DENY)); if (r) { diff --git a/imap/mboxlist.c b/imap/mboxlist.c index 7623cc3e29..18012f8dbb 100644 --- a/imap/mboxlist.c +++ b/imap/mboxlist.c @@ -3834,7 +3834,7 @@ static void done_cb(void*rock __attribute__((unused))) static void init_internal() { if (!mboxlist_initialized) { - mboxlist_init(0); + mboxlist_init(); } if (!mboxlist_dbopen) { mboxlist_open(NULL); @@ -3842,11 +3842,8 @@ static void init_internal() } /* must be called after cyrus_init */ -EXPORTED void mboxlist_init(int myflags) +EXPORTED void mboxlist_init(void) { - if (myflags & MBOXLIST_SYNC) { - cyrusdb_sync(DB); - } cyrus_modules_add(done_cb, NULL); mboxlist_initialized = 1; } @@ -3865,7 +3862,7 @@ EXPORTED void mboxlist_open(const char *fname) fname = tofree; } - mboxlist_init(0); + mboxlist_init(); flags = CYRUSDB_CREATE; if (config_getswitch(IMAPOPT_IMPROVED_MBOXLIST_SORT)) { diff --git a/imap/mboxlist.h b/imap/mboxlist.h index d0a8bdc0ad..7f7b1b58c5 100644 --- a/imap/mboxlist.h +++ b/imap/mboxlist.h @@ -308,8 +308,7 @@ void mboxlist_open(const char *name); void mboxlist_close(void); /* initialize database structures */ -#define MBOXLIST_SYNC 0x02 -void mboxlist_init(int flags); +void mboxlist_init(void); /* done with database stuff */ void mboxlist_done(void); diff --git a/imap/quota.c b/imap/quota.c index ed6dbbd158..d1cdc89435 100644 --- a/imap/quota.c +++ b/imap/quota.c @@ -188,7 +188,7 @@ int main(int argc,char **argv) * Lock mailbox list to prevent mailbox creation/deletion * during work */ - mboxlist_init(0); + mboxlist_init(); mboxlist_open(NULL); quota_changelock(); diff --git a/imap/quota.h b/imap/quota.h index c8a07065e8..22992a9f0a 100644 --- a/imap/quota.h +++ b/imap/quota.h @@ -138,8 +138,7 @@ extern int quotadb_foreach(const char *prefix, size_t prefixlen, void quotadb_close(void); /* initialize database structures */ -#define QUOTADB_SYNC 0x02 -void quotadb_init(int flags); +void quotadb_init(void); /* done with database stuff */ void quotadb_done(void); diff --git a/imap/quota_db.c b/imap/quota_db.c index 7cfa170fe0..553fccbc72 100644 --- a/imap/quota_db.c +++ b/imap/quota_db.c @@ -656,7 +656,7 @@ static void done_cb(void*rock __attribute__((unused))) static void init_internal() { if (!quota_initialized) { - quotadb_init(0); + quotadb_init(); quota_initialized = 1; } if (!quota_dbopen) { @@ -665,11 +665,8 @@ static void init_internal() { } /* must be called after cyrus_init */ -EXPORTED void quotadb_init(int myflags) +EXPORTED void quotadb_init(void) { - if (myflags & QUOTADB_SYNC) { - cyrusdb_sync(QDB); - } cyrus_modules_add(done_cb, NULL); } diff --git a/imap/userdeny.h b/imap/userdeny.h index a1a207c305..2eea880358 100644 --- a/imap/userdeny.h +++ b/imap/userdeny.h @@ -63,8 +63,7 @@ int denydb_open(int create); void denydb_close(void); /* initialize database structures */ -#define DENYDB_SYNC 0x02 -void denydb_init(int flags); +void denydb_init(void); /* done with database stuff */ void denydb_done(void); diff --git a/imap/userdeny_db.c b/imap/userdeny_db.c index ca6f62754f..15c482d84b 100644 --- a/imap/userdeny_db.c +++ b/imap/userdeny_db.c @@ -348,7 +348,7 @@ static void done_cb(void*rock __attribute__((unused))) static void init_internal() { if (!denydb_initialized) { - denydb_init(0); + denydb_init(); cyrus_modules_add(done_cb, NULL); } if (!denydb) { @@ -357,11 +357,8 @@ static void init_internal() } /* must be called after cyrus_init */ -EXPORTED void denydb_init(int myflags) +EXPORTED void denydb_init(void) { - if (myflags & DENYDB_SYNC) { - cyrusdb_sync(DENYDB); - } denydb_initialized = 1; } diff --git a/lib/cyrusdb.c b/lib/cyrusdb.c index 59f6258a55..804a97050c 100644 --- a/lib/cyrusdb.c +++ b/lib/cyrusdb.c @@ -569,12 +569,6 @@ EXPORTED const char *cyrusdb_detect(const char *fname) return NULL; } -EXPORTED int cyrusdb_sync(const char *backend) -{ - struct cyrusdb_backend *db = cyrusdb_fromname(backend); - return db->sync(); -} - EXPORTED int cyrusdb_unlink(const char *backend, const char *fname, int flags) { struct cyrusdb_backend *db = cyrusdb_fromname(backend); @@ -621,11 +615,6 @@ HIDDEN int cyrusdb_generic_done(void) return 0; } -HIDDEN int cyrusdb_generic_sync(void) -{ - return 0; -} - HIDDEN int cyrusdb_generic_archive(const strarray_t *fnames, const char *dirname) { diff --git a/lib/cyrusdb.h b/lib/cyrusdb.h index e167abd450..07d0ef7ac4 100644 --- a/lib/cyrusdb.h +++ b/lib/cyrusdb.h @@ -106,9 +106,6 @@ struct cyrusdb_backend { * to reset state */ int (*done)(void); - /* checkpoints this database environment */ - int (*sync)(void); - /* archives this database environment, and specified databases * into the specified directory */ int (*archive)(const strarray_t *fnames, const char *dirname); @@ -301,7 +298,6 @@ extern int cyrusdb_compar(struct db *db, /* somewhat special case, because they don't take a DB */ -extern int cyrusdb_sync(const char *backend); extern cyrusdb_archiver *cyrusdb_getarchiver(const char *backend); extern int cyrusdb_canfetchnext(const char *backend); @@ -311,7 +307,6 @@ extern strarray_t *cyrusdb_backends(void); /* generic implementations */ int cyrusdb_generic_init(const char *dbdir, int myflags); int cyrusdb_generic_done(void); -int cyrusdb_generic_sync(void); int cyrusdb_generic_archive(const strarray_t *fnames, const char *dirname); int cyrusdb_generic_noarchive(const strarray_t *fnames, const char *dirname); int cyrusdb_generic_unlink(const char *fname, int flags); diff --git a/lib/cyrusdb_flat.c b/lib/cyrusdb_flat.c index c6320248e7..adffaea771 100644 --- a/lib/cyrusdb_flat.c +++ b/lib/cyrusdb_flat.c @@ -835,7 +835,6 @@ EXPORTED struct cyrusdb_backend cyrusdb_flat = &cyrusdb_generic_init, &cyrusdb_generic_done, - &cyrusdb_generic_sync, &cyrusdb_generic_archive, &cyrusdb_generic_unlink, diff --git a/lib/cyrusdb_quotalegacy.c b/lib/cyrusdb_quotalegacy.c index 6048821600..9fd3296720 100644 --- a/lib/cyrusdb_quotalegacy.c +++ b/lib/cyrusdb_quotalegacy.c @@ -879,7 +879,6 @@ HIDDEN struct cyrusdb_backend cyrusdb_quotalegacy = &cyrusdb_generic_init, &cyrusdb_generic_done, - &cyrusdb_generic_sync, &cyrusdb_generic_noarchive, &cyrusdb_generic_unlink, diff --git a/lib/cyrusdb_skiplist.c b/lib/cyrusdb_skiplist.c index 8768c81dbb..8d22d2cf68 100644 --- a/lib/cyrusdb_skiplist.c +++ b/lib/cyrusdb_skiplist.c @@ -2452,7 +2452,6 @@ EXPORTED struct cyrusdb_backend cyrusdb_skiplist = &myinit, &cyrusdb_generic_done, - &cyrusdb_generic_sync, &cyrusdb_generic_archive, &cyrusdb_generic_unlink, diff --git a/lib/cyrusdb_sql.c b/lib/cyrusdb_sql.c index 669811f0c3..0bf6e6a3f6 100644 --- a/lib/cyrusdb_sql.c +++ b/lib/cyrusdb_sql.c @@ -898,7 +898,6 @@ HIDDEN struct cyrusdb_backend cyrusdb_sql = &init, &done, - &cyrusdb_generic_sync, &cyrusdb_generic_noarchive, NULL, diff --git a/lib/cyrusdb_twoskip.c b/lib/cyrusdb_twoskip.c index 46c30dd946..2084fe4fe0 100644 --- a/lib/cyrusdb_twoskip.c +++ b/lib/cyrusdb_twoskip.c @@ -2404,7 +2404,6 @@ HIDDEN struct cyrusdb_backend cyrusdb_twoskip = &cyrusdb_generic_init, &cyrusdb_generic_done, - &cyrusdb_generic_sync, &cyrusdb_generic_archive, &cyrusdb_generic_unlink,