diff options
author | jbj <devnull@localhost> | 2002-08-14 16:31:49 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-08-14 16:31:49 +0000 |
commit | d481ba55c02407124c499c7800ea556786137bc5 (patch) | |
tree | e0d3fdb7906ae3290f019999e0661cfc5b1b3f58 /db/examples_c/ex_apprec/ex_apprec_template | |
parent | 9114d6ffea4ee330874ebc8febe225ce0e891eac (diff) | |
download | librpm-tizen-d481ba55c02407124c499c7800ea556786137bc5.tar.gz librpm-tizen-d481ba55c02407124c499c7800ea556786137bc5.tar.bz2 librpm-tizen-d481ba55c02407124c499c7800ea556786137bc5.zip |
Initial revision
CVS patchset: 5630
CVS date: 2002/08/14 16:31:49
Diffstat (limited to 'db/examples_c/ex_apprec/ex_apprec_template')
-rw-r--r-- | db/examples_c/ex_apprec/ex_apprec_template | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/db/examples_c/ex_apprec/ex_apprec_template b/db/examples_c/ex_apprec/ex_apprec_template new file mode 100644 index 000000000..e67ccb6d8 --- /dev/null +++ b/db/examples_c/ex_apprec/ex_apprec_template @@ -0,0 +1,75 @@ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc/db_page.h" +#include "dbinc/ex_apprec.h" +#include "dbinc/log.h" + +/* + * ex_apprec_mkdir_recover -- + * Recovery function for mkdir. + * + * PUBLIC: int ex_apprec_mkdir_recover + * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); + */ +int +ex_apprec_mkdir_recover(dbenv, dbtp, lsnp, op, info) + DB_ENV *dbenv; + DBT *dbtp; + DB_LSN *lsnp; + db_recops op; + void *info; +{ + ex_apprec_mkdir_args *argp; + DB *file_dbp; + DBC *dbc; + DB_MPOOLFILE *mpf; + PAGE *pagep; + int cmp_n, cmp_p, modified, ret; + + REC_PRINT(ex_apprec_mkdir_print); + REC_INTRO(ex_apprec_mkdir_read, 1); + + if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) + if (DB_REDO(op)) { + if ((ret = mpf->get(mpf, + &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) + goto out; + } else { + *lsnp = argp->prev_lsn; + ret = 0; + goto out; + } + + modified = 0; + cmp_n = log_compare(lsnp, &LSN(pagep)); + + /* + * Use this when there is something like "pagelsn" in the argp + * structure. Sometimes, you might need to compare meta-data + * lsn's instead. + * + * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); + */ + if (cmp_p == 0 && DB_REDO(op)) { + /* Need to redo update described. */ + modified = 1; + } else if (cmp_n == 0 && !DB_REDO(op)) { + /* Need to undo update described. */ + modified = 1; + } + if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) + goto out; + + *lsnp = argp->prev_lsn; + ret = 0; + +out: REC_CLOSE; +} + |