Skip to content

Commit

Permalink
rename to twom_db_open
Browse files Browse the repository at this point in the history
  • Loading branch information
brong committed Jan 22, 2025
1 parent dbe58d6 commit 5a5a8b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/cyrusdb_twom.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static void _delayed_checkpoint(void *rock)
twom_init init = TWOM_INIT;
init.error = _twom_error_callback;
init.flags = drock->flags;
int r = _errormap(twom_fname_open_db(drock->fname, &init, &db, NULL));
int r = _errormap(twom_db_open(drock->fname, &init, &db, NULL));
if (r == CYRUSDB_NOTFOUND) {
syslog(LOG_INFO, "twom: no file to delayed checkpoint for %s",
drock->fname);
Expand Down Expand Up @@ -185,15 +185,15 @@ static int myopen(const char *fname, int flags, struct dbengine **ret, struct tx
}
if (flags & CYRUSDB_CREATE)
init.flags |= TWOM_CREATE;
int tmr = twom_fname_open_db(fname, &init, &tmdb, tidptr ? &tmtxn : NULL);
int tmr = twom_db_open(fname, &init, &tmdb, tidptr ? &tmtxn : NULL);
if (tmr == TWOM_NOTFOUND && (flags & CYRUSDB_CREATE)) {
int r = cyrus_mkdir(fname, 0755);
if (r < 0) {
xsyslog(LOG_ERR, "IOERROR: twom cyrus_mkdir failed",
"filename=<%s>", fname);
return r;
}
tmr = twom_fname_open_db(fname, &init, &tmdb, tidptr ? &tmtxn : NULL);
tmr = twom_db_open(fname, &init, &tmdb, tidptr ? &tmtxn : NULL);
}
if (!tmr) {
*ret = (struct dbengine *)tmdb;
Expand Down
3 changes: 2 additions & 1 deletion lib/twom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2395,7 +2395,8 @@ static int consistent1(struct twom_txn *txn, struct tm_loc *loc)
// the same process, we don't have flock shenanigans, because flock state
// is process-wise, not file-descriptor specific, so it's not safe to just
// open the file in separate objects and lock it separately.
int twom_fname_open_db(const char *fname, struct twom_open_data *setup, struct twom_db **ret, struct twom_txn **txnp)
int twom_db_open(const char *fname, struct twom_open_data *setup,
struct twom_db **ret, struct twom_txn **txnp)
{
struct twom_db *mydb;
int r = 0;
Expand Down
6 changes: 3 additions & 3 deletions lib/twom.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ typedef struct twom_open_data twom_init;
#define TWOM_INIT { 0, NULL, NULL, NULL }

// database operations
extern int twom_fname_open_db(const char *fname, struct twom_open_data *setup,
struct twom_db **dbptr,
struct twom_txn **tidptr);
extern int twom_db_open(const char *fname, struct twom_open_data *setup,
struct twom_db **dbptr,
struct twom_txn **tidptr);
extern int twom_db_close(struct twom_db **dbptr);

// non-transactional operations
Expand Down

0 comments on commit 5a5a8b7

Please sign in to comment.