Lines Matching refs:dblp

45 	DB_LOG *dblp;
59 if ((ret = __os_calloc(1, sizeof(DB_LOG), &dblp)) != 0)
62 if (path != NULL && (ret = __os_strdup(path, &dblp->dir)) != 0)
65 dblp->dbenv = dbenv;
66 dblp->lfd = -1;
67 ZERO_LSN(dblp->c_lsn);
68 dblp->c_fd = -1;
78 dblp->reginfo.dbenv = dbenv;
79 dblp->reginfo.appname = DB_APP_LOG;
81 dblp->reginfo.path = NULL;
83 if ((ret = __os_strdup(path, &dblp->reginfo.path)) != 0)
85 dblp->reginfo.file = DB_DEFAULT_LOG_FILE;
86 dblp->reginfo.mode = mode;
87 dblp->reginfo.size = DEF_LOG_SIZE;
88 dblp->reginfo.dbflags = flags;
89 dblp->reginfo.flags = REGION_SIZEDEF;
90 if ((ret = __db_rattach(&dblp->reginfo)) != 0)
97 dblp->lp = dblp->reginfo.addr;
98 dblp->addr = (u_int8_t *)dblp->lp + sizeof(LOG);
101 if (F_ISSET(&dblp->reginfo, REGION_CREATED)) {
102 __db_shalloc_init(dblp->addr, DEF_LOG_SIZE - sizeof(LOG));
105 lp = dblp->lp;
121 F_SET(dblp, DB_AM_THREAD);
122 if ((ret = __db_shalloc(dblp->addr,
123 sizeof(db_mutex_t), MUTEX_ALIGNMENT, &dblp->mutexp)) != 0)
125 (void)__db_mutex_init(dblp->mutexp, 0);
132 if (F_ISSET(&dblp->reginfo, REGION_CREATED) &&
133 (ret = __log_recover(dblp)) != 0)
136 UNLOCK_LOGREGION(dblp);
137 *lpp = dblp;
140 err: if (dblp->reginfo.addr != NULL) {
141 if (dblp->mutexp != NULL)
142 __db_shalloc_free(dblp->addr, dblp->mutexp);
144 UNLOCK_LOGREGION(dblp);
145 (void)__db_rdetach(&dblp->reginfo);
146 if (F_ISSET(&dblp->reginfo, REGION_CREATED))
150 if (dblp->reginfo.path != NULL)
151 __os_freestr(dblp->reginfo.path);
152 if (dblp->dir != NULL)
153 __os_freestr(dblp->dir);
154 __os_free(dblp, sizeof(*dblp));
177 __log_recover(dblp)
178 DB_LOG *dblp;
186 lp = dblp->lp;
192 if ((ret = __log_find(dblp, 0, &cnt)) != 0)
210 if ((ret = __log_get(dblp, &lsn, &dbt, DB_SET, 0)) != 0)
218 while (__log_get(dblp, &lsn, &dbt, DB_NEXT, 1) == 0) {
234 lp->lsn.offset += dblp->c_len;
237 lp->len = dblp->c_len;
250 if ((ret = __log_get(dblp, &lsn, &dbt, DB_SET, 0)) != 0)
257 while (__log_get(dblp, &lsn, &dbt, DB_NEXT, 0) == 0) {
271 ZERO_LSN(dblp->c_lsn);
282 __db_err(dblp->dbenv,
298 __log_find(dblp, find_first, valp)
299 DB_LOG *dblp;
310 if ((ret = __log_name(dblp, 1, &p, NULL, 0)) != 0)
323 __db_err(dblp->dbenv, "%s: %s", dir, strerror(ret));
346 if (__log_valid(dblp, clv, 1) == 0)
365 __log_valid(dblp, number, set_persist)
366 DB_LOG *dblp;
376 if ((ret = __log_name(dblp,
391 __db_err(dblp->dbenv,
399 __db_err(dblp->dbenv,
406 __db_err(dblp->dbenv,
418 dblp->lp->persist.lg_max = persist.lg_max;
419 dblp->lp->persist.mode = persist.mode;
432 log_close(dblp)
433 DB_LOG *dblp;
438 LOG_PANIC_CHECK(dblp);
441 __log_close_files(dblp);
444 if (dblp->mutexp != NULL) {
445 LOCK_LOGREGION(dblp);
446 __db_shalloc_free(dblp->addr, dblp->mutexp);
447 UNLOCK_LOGREGION(dblp);
451 ret = __db_rdetach(&dblp->reginfo);
454 if (dblp->lfd != -1 && (t_ret = __os_close(dblp->lfd)) != 0 && ret == 0)
456 if (dblp->c_dbt.data != NULL)
457 __os_free(dblp->c_dbt.data, dblp->c_dbt.ulen);
458 if (dblp->c_fd != -1 &&
459 (t_ret = __os_close(dblp->c_fd)) != 0 && ret == 0)
461 if (dblp->dbentry != NULL) {
462 for (i = 0; i < dblp->dbentry_cnt; i++)
463 if (dblp->dbentry[i].name != NULL)
464 __os_freestr(dblp->dbentry[i].name);
465 __os_free(dblp->dbentry,
466 (dblp->dbentry_cnt * sizeof(DB_ENTRY)));
469 if (dblp->dir != NULL)
470 __os_freestr(dblp->dir);
472 if (dblp->reginfo.path != NULL)
473 __os_freestr(dblp->reginfo.path);
474 __os_free(dblp, sizeof(*dblp));
509 log_stat(dblp, gspp, db_malloc)
510 DB_LOG *dblp;
518 lp = dblp->lp;
520 LOG_PANIC_CHECK(dblp);
526 LOCK_LOGREGION(dblp);
543 UNLOCK_LOGREGION(dblp);