Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

qam_auto.c

00001 /* Do not edit: automatically built by gen_rec.awk. */
00002 
00003 #include "db_config.h"
00004 
00005 #ifndef NO_SYSTEM_INCLUDES
00006 #include <sys/types.h>
00007 
00008 #include <ctype.h>
00009 #include <string.h>
00010 #endif
00011 
00012 #include "db_int.h"
00013 #include "dbinc/crypto.h"
00014 #include "dbinc/db_page.h"
00015 #include "dbinc/db_dispatch.h"
00016 #include "dbinc/db_am.h"
00017 #include "dbinc/log.h"
00018 #include "dbinc/qam.h"
00019 #include "dbinc/txn.h"
00020 
00021 /*
00022  * PUBLIC: int __qam_incfirst_log __P((DB *, DB_TXN *, DB_LSN *,
00023  * PUBLIC:     u_int32_t, db_recno_t, db_pgno_t));
00024  */
00025 int
00026 __qam_incfirst_log(dbp, txnid, ret_lsnp, flags, recno, meta_pgno)
00027         DB *dbp;
00028         DB_TXN *txnid;
00029         DB_LSN *ret_lsnp;
00030         u_int32_t flags;
00031         db_recno_t recno;
00032         db_pgno_t meta_pgno;
00033 {
00034         DBT logrec;
00035         DB_ENV *dbenv;
00036         DB_TXNLOGREC *lr;
00037         DB_LSN *lsnp, null_lsn, *rlsnp;
00038         u_int32_t uinttmp, rectype, txn_num;
00039         u_int npad;
00040         u_int8_t *bp;
00041         int is_durable, ret;
00042 
00043         dbenv = dbp->dbenv;
00044         COMPQUIET(lr, NULL);
00045 
00046         rectype = DB___qam_incfirst;
00047         npad = 0;
00048         rlsnp = ret_lsnp;
00049 
00050         ret = 0;
00051 
00052         if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
00053             F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
00054                 is_durable = 0;
00055         } else
00056                 is_durable = 1;
00057 
00058         if (txnid == NULL) {
00059                 txn_num = 0;
00060                 lsnp = &null_lsn;
00061                 null_lsn.file = null_lsn.offset = 0;
00062         } else {
00063                 if (TAILQ_FIRST(&txnid->kids) != NULL &&
00064                     (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
00065                         return (ret);
00066                 /*
00067                  * We need to assign begin_lsn while holding region mutex.
00068                  * That assignment is done inside the DbEnv->log_put call,
00069                  * so pass in the appropriate memory location to be filled
00070                  * in by the log_put code.
00071                  */
00072                 DB_SET_TXN_LSNP(txnid, &rlsnp, &lsnp);
00073                 txn_num = txnid->txnid;
00074         }
00075 
00076         DB_ASSERT(dbp->log_filename != NULL);
00077         if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
00078             (ret = __dbreg_lazy_id(dbp)) != 0)
00079                 return (ret);
00080 
00081         logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
00082             + sizeof(u_int32_t)
00083             + sizeof(u_int32_t)
00084             + sizeof(u_int32_t);
00085         if (CRYPTO_ON(dbenv)) {
00086                 npad =
00087                     ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
00088                 logrec.size += npad;
00089         }
00090 
00091         if (is_durable || txnid == NULL) {
00092                 if ((ret =
00093                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
00094                         return (ret);
00095         } else {
00096                 if ((ret = __os_malloc(dbenv,
00097                     logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
00098                         return (ret);
00099 #ifdef DIAGNOSTIC
00100                 if ((ret =
00101                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0) {
00102                         __os_free(dbenv, lr);
00103                         return (ret);
00104                 }
00105 #else
00106                 logrec.data = lr->data;
00107 #endif
00108         }
00109         if (npad > 0)
00110                 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
00111 
00112         bp = logrec.data;
00113 
00114         memcpy(bp, &rectype, sizeof(rectype));
00115         bp += sizeof(rectype);
00116 
00117         memcpy(bp, &txn_num, sizeof(txn_num));
00118         bp += sizeof(txn_num);
00119 
00120         memcpy(bp, lsnp, sizeof(DB_LSN));
00121         bp += sizeof(DB_LSN);
00122 
00123         uinttmp = (u_int32_t)dbp->log_filename->id;
00124         memcpy(bp, &uinttmp, sizeof(uinttmp));
00125         bp += sizeof(uinttmp);
00126 
00127         uinttmp = (u_int32_t)recno;
00128         memcpy(bp, &uinttmp, sizeof(uinttmp));
00129         bp += sizeof(uinttmp);
00130 
00131         uinttmp = (u_int32_t)meta_pgno;
00132         memcpy(bp, &uinttmp, sizeof(uinttmp));
00133         bp += sizeof(uinttmp);
00134 
00135         DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
00136 
00137         if (is_durable || txnid == NULL) {
00138                 if ((ret = __log_put(dbenv, rlsnp,(DBT *)&logrec,
00139                     flags | DB_LOG_NOCOPY)) == 0 && txnid != NULL) {
00140                         *lsnp = *rlsnp;
00141                         if (rlsnp != ret_lsnp)
00142                                  *ret_lsnp = *rlsnp;
00143                 }
00144         } else {
00145 #ifdef DIAGNOSTIC
00146                 /*
00147                  * Set the debug bit if we are going to log non-durable
00148                  * transactions so they will be ignored by recovery.
00149                  */
00150                 memcpy(lr->data, logrec.data, logrec.size);
00151                 rectype |= DB_debug_FLAG;
00152                 memcpy(logrec.data, &rectype, sizeof(rectype));
00153 
00154                 ret = __log_put(dbenv,
00155                     rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
00156 #else
00157                 ret = 0;
00158 #endif
00159                 STAILQ_INSERT_HEAD(&txnid->logs, lr, links);
00160                 F_SET((TXN_DETAIL *)txnid->td, TXN_DTL_INMEMORY);
00161                 LSN_NOT_LOGGED(*ret_lsnp);
00162         }
00163 
00164 #ifdef LOG_DIAGNOSTIC
00165         if (ret != 0)
00166                 (void)__qam_incfirst_print(dbenv,
00167                     (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
00168 #endif
00169 
00170 #ifdef DIAGNOSTIC
00171         __os_free(dbenv, logrec.data);
00172 #else
00173         if (is_durable || txnid == NULL)
00174                 __os_free(dbenv, logrec.data);
00175 #endif
00176         return (ret);
00177 }
00178 
00179 /*
00180  * PUBLIC: int __qam_incfirst_read __P((DB_ENV *, void *,
00181  * PUBLIC:     __qam_incfirst_args **));
00182  */
00183 int
00184 __qam_incfirst_read(dbenv, recbuf, argpp)
00185         DB_ENV *dbenv;
00186         void *recbuf;
00187         __qam_incfirst_args **argpp;
00188 {
00189         __qam_incfirst_args *argp;
00190         u_int32_t uinttmp;
00191         u_int8_t *bp;
00192         int ret;
00193 
00194         if ((ret = __os_malloc(dbenv,
00195             sizeof(__qam_incfirst_args) + sizeof(DB_TXN), &argp)) != 0)
00196                 return (ret);
00197         bp = recbuf;
00198         argp->txnid = (DB_TXN *)&argp[1];
00199 
00200         memcpy(&argp->type, bp, sizeof(argp->type));
00201         bp += sizeof(argp->type);
00202 
00203         memcpy(&argp->txnid->txnid,  bp, sizeof(argp->txnid->txnid));
00204         bp += sizeof(argp->txnid->txnid);
00205 
00206         memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
00207         bp += sizeof(DB_LSN);
00208 
00209         memcpy(&uinttmp, bp, sizeof(uinttmp));
00210         argp->fileid = (int32_t)uinttmp;
00211         bp += sizeof(uinttmp);
00212 
00213         memcpy(&uinttmp, bp, sizeof(uinttmp));
00214         argp->recno = (db_recno_t)uinttmp;
00215         bp += sizeof(uinttmp);
00216 
00217         memcpy(&uinttmp, bp, sizeof(uinttmp));
00218         argp->meta_pgno = (db_pgno_t)uinttmp;
00219         bp += sizeof(uinttmp);
00220 
00221         *argpp = argp;
00222         return (0);
00223 }
00224 
00225 /*
00226  * PUBLIC: int __qam_mvptr_log __P((DB *, DB_TXN *, DB_LSN *,
00227  * PUBLIC:     u_int32_t, u_int32_t, db_recno_t, db_recno_t, db_recno_t,
00228  * PUBLIC:     db_recno_t, DB_LSN *, db_pgno_t));
00229  */
00230 int
00231 __qam_mvptr_log(dbp, txnid, ret_lsnp, flags,
00232     opcode, old_first, new_first, old_cur, new_cur,
00233     metalsn, meta_pgno)
00234         DB *dbp;
00235         DB_TXN *txnid;
00236         DB_LSN *ret_lsnp;
00237         u_int32_t flags;
00238         u_int32_t opcode;
00239         db_recno_t old_first;
00240         db_recno_t new_first;
00241         db_recno_t old_cur;
00242         db_recno_t new_cur;
00243         DB_LSN * metalsn;
00244         db_pgno_t meta_pgno;
00245 {
00246         DBT logrec;
00247         DB_ENV *dbenv;
00248         DB_TXNLOGREC *lr;
00249         DB_LSN *lsnp, null_lsn, *rlsnp;
00250         u_int32_t uinttmp, rectype, txn_num;
00251         u_int npad;
00252         u_int8_t *bp;
00253         int is_durable, ret;
00254 
00255         dbenv = dbp->dbenv;
00256         COMPQUIET(lr, NULL);
00257 
00258         rectype = DB___qam_mvptr;
00259         npad = 0;
00260         rlsnp = ret_lsnp;
00261 
00262         ret = 0;
00263 
00264         if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
00265             F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
00266                 is_durable = 0;
00267         } else
00268                 is_durable = 1;
00269 
00270         if (txnid == NULL) {
00271                 txn_num = 0;
00272                 lsnp = &null_lsn;
00273                 null_lsn.file = null_lsn.offset = 0;
00274         } else {
00275                 if (TAILQ_FIRST(&txnid->kids) != NULL &&
00276                     (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
00277                         return (ret);
00278                 /*
00279                  * We need to assign begin_lsn while holding region mutex.
00280                  * That assignment is done inside the DbEnv->log_put call,
00281                  * so pass in the appropriate memory location to be filled
00282                  * in by the log_put code.
00283                  */
00284                 DB_SET_TXN_LSNP(txnid, &rlsnp, &lsnp);
00285                 txn_num = txnid->txnid;
00286         }
00287 
00288         DB_ASSERT(dbp->log_filename != NULL);
00289         if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
00290             (ret = __dbreg_lazy_id(dbp)) != 0)
00291                 return (ret);
00292 
00293         logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
00294             + sizeof(u_int32_t)
00295             + sizeof(u_int32_t)
00296             + sizeof(u_int32_t)
00297             + sizeof(u_int32_t)
00298             + sizeof(u_int32_t)
00299             + sizeof(u_int32_t)
00300             + sizeof(*metalsn)
00301             + sizeof(u_int32_t);
00302         if (CRYPTO_ON(dbenv)) {
00303                 npad =
00304                     ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
00305                 logrec.size += npad;
00306         }
00307 
00308         if (is_durable || txnid == NULL) {
00309                 if ((ret =
00310                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
00311                         return (ret);
00312         } else {
00313                 if ((ret = __os_malloc(dbenv,
00314                     logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
00315                         return (ret);
00316 #ifdef DIAGNOSTIC
00317                 if ((ret =
00318                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0) {
00319                         __os_free(dbenv, lr);
00320                         return (ret);
00321                 }
00322 #else
00323                 logrec.data = lr->data;
00324 #endif
00325         }
00326         if (npad > 0)
00327                 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
00328 
00329         bp = logrec.data;
00330 
00331         memcpy(bp, &rectype, sizeof(rectype));
00332         bp += sizeof(rectype);
00333 
00334         memcpy(bp, &txn_num, sizeof(txn_num));
00335         bp += sizeof(txn_num);
00336 
00337         memcpy(bp, lsnp, sizeof(DB_LSN));
00338         bp += sizeof(DB_LSN);
00339 
00340         uinttmp = (u_int32_t)opcode;
00341         memcpy(bp, &uinttmp, sizeof(uinttmp));
00342         bp += sizeof(uinttmp);
00343 
00344         uinttmp = (u_int32_t)dbp->log_filename->id;
00345         memcpy(bp, &uinttmp, sizeof(uinttmp));
00346         bp += sizeof(uinttmp);
00347 
00348         uinttmp = (u_int32_t)old_first;
00349         memcpy(bp, &uinttmp, sizeof(uinttmp));
00350         bp += sizeof(uinttmp);
00351 
00352         uinttmp = (u_int32_t)new_first;
00353         memcpy(bp, &uinttmp, sizeof(uinttmp));
00354         bp += sizeof(uinttmp);
00355 
00356         uinttmp = (u_int32_t)old_cur;
00357         memcpy(bp, &uinttmp, sizeof(uinttmp));
00358         bp += sizeof(uinttmp);
00359 
00360         uinttmp = (u_int32_t)new_cur;
00361         memcpy(bp, &uinttmp, sizeof(uinttmp));
00362         bp += sizeof(uinttmp);
00363 
00364         if (metalsn != NULL)
00365                 memcpy(bp, metalsn, sizeof(*metalsn));
00366         else
00367                 memset(bp, 0, sizeof(*metalsn));
00368         bp += sizeof(*metalsn);
00369 
00370         uinttmp = (u_int32_t)meta_pgno;
00371         memcpy(bp, &uinttmp, sizeof(uinttmp));
00372         bp += sizeof(uinttmp);
00373 
00374         DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
00375 
00376         if (is_durable || txnid == NULL) {
00377                 if ((ret = __log_put(dbenv, rlsnp,(DBT *)&logrec,
00378                     flags | DB_LOG_NOCOPY)) == 0 && txnid != NULL) {
00379                         *lsnp = *rlsnp;
00380                         if (rlsnp != ret_lsnp)
00381                                  *ret_lsnp = *rlsnp;
00382                 }
00383         } else {
00384 #ifdef DIAGNOSTIC
00385                 /*
00386                  * Set the debug bit if we are going to log non-durable
00387                  * transactions so they will be ignored by recovery.
00388                  */
00389                 memcpy(lr->data, logrec.data, logrec.size);
00390                 rectype |= DB_debug_FLAG;
00391                 memcpy(logrec.data, &rectype, sizeof(rectype));
00392 
00393                 ret = __log_put(dbenv,
00394                     rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
00395 #else
00396                 ret = 0;
00397 #endif
00398                 STAILQ_INSERT_HEAD(&txnid->logs, lr, links);
00399                 F_SET((TXN_DETAIL *)txnid->td, TXN_DTL_INMEMORY);
00400                 LSN_NOT_LOGGED(*ret_lsnp);
00401         }
00402 
00403 #ifdef LOG_DIAGNOSTIC
00404         if (ret != 0)
00405                 (void)__qam_mvptr_print(dbenv,
00406                     (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
00407 #endif
00408 
00409 #ifdef DIAGNOSTIC
00410         __os_free(dbenv, logrec.data);
00411 #else
00412         if (is_durable || txnid == NULL)
00413                 __os_free(dbenv, logrec.data);
00414 #endif
00415         return (ret);
00416 }
00417 
00418 /*
00419  * PUBLIC: int __qam_mvptr_read __P((DB_ENV *, void *, __qam_mvptr_args **));
00420  */
00421 int
00422 __qam_mvptr_read(dbenv, recbuf, argpp)
00423         DB_ENV *dbenv;
00424         void *recbuf;
00425         __qam_mvptr_args **argpp;
00426 {
00427         __qam_mvptr_args *argp;
00428         u_int32_t uinttmp;
00429         u_int8_t *bp;
00430         int ret;
00431 
00432         if ((ret = __os_malloc(dbenv,
00433             sizeof(__qam_mvptr_args) + sizeof(DB_TXN), &argp)) != 0)
00434                 return (ret);
00435         bp = recbuf;
00436         argp->txnid = (DB_TXN *)&argp[1];
00437 
00438         memcpy(&argp->type, bp, sizeof(argp->type));
00439         bp += sizeof(argp->type);
00440 
00441         memcpy(&argp->txnid->txnid,  bp, sizeof(argp->txnid->txnid));
00442         bp += sizeof(argp->txnid->txnid);
00443 
00444         memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
00445         bp += sizeof(DB_LSN);
00446 
00447         memcpy(&uinttmp, bp, sizeof(uinttmp));
00448         argp->opcode = (u_int32_t)uinttmp;
00449         bp += sizeof(uinttmp);
00450 
00451         memcpy(&uinttmp, bp, sizeof(uinttmp));
00452         argp->fileid = (int32_t)uinttmp;
00453         bp += sizeof(uinttmp);
00454 
00455         memcpy(&uinttmp, bp, sizeof(uinttmp));
00456         argp->old_first = (db_recno_t)uinttmp;
00457         bp += sizeof(uinttmp);
00458 
00459         memcpy(&uinttmp, bp, sizeof(uinttmp));
00460         argp->new_first = (db_recno_t)uinttmp;
00461         bp += sizeof(uinttmp);
00462 
00463         memcpy(&uinttmp, bp, sizeof(uinttmp));
00464         argp->old_cur = (db_recno_t)uinttmp;
00465         bp += sizeof(uinttmp);
00466 
00467         memcpy(&uinttmp, bp, sizeof(uinttmp));
00468         argp->new_cur = (db_recno_t)uinttmp;
00469         bp += sizeof(uinttmp);
00470 
00471         memcpy(&argp->metalsn, bp,  sizeof(argp->metalsn));
00472         bp += sizeof(argp->metalsn);
00473 
00474         memcpy(&uinttmp, bp, sizeof(uinttmp));
00475         argp->meta_pgno = (db_pgno_t)uinttmp;
00476         bp += sizeof(uinttmp);
00477 
00478         *argpp = argp;
00479         return (0);
00480 }
00481 
00482 /*
00483  * PUBLIC: int __qam_del_log __P((DB *, DB_TXN *, DB_LSN *,
00484  * PUBLIC:     u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_recno_t));
00485  */
00486 int
00487 __qam_del_log(dbp, txnid, ret_lsnp, flags, lsn, pgno, indx, recno)
00488         DB *dbp;
00489         DB_TXN *txnid;
00490         DB_LSN *ret_lsnp;
00491         u_int32_t flags;
00492         DB_LSN * lsn;
00493         db_pgno_t pgno;
00494         u_int32_t indx;
00495         db_recno_t recno;
00496 {
00497         DBT logrec;
00498         DB_ENV *dbenv;
00499         DB_TXNLOGREC *lr;
00500         DB_LSN *lsnp, null_lsn, *rlsnp;
00501         u_int32_t uinttmp, rectype, txn_num;
00502         u_int npad;
00503         u_int8_t *bp;
00504         int is_durable, ret;
00505 
00506         dbenv = dbp->dbenv;
00507         COMPQUIET(lr, NULL);
00508 
00509         rectype = DB___qam_del;
00510         npad = 0;
00511         rlsnp = ret_lsnp;
00512 
00513         ret = 0;
00514 
00515         if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
00516             F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
00517                 is_durable = 0;
00518         } else
00519                 is_durable = 1;
00520 
00521         if (txnid == NULL) {
00522                 txn_num = 0;
00523                 lsnp = &null_lsn;
00524                 null_lsn.file = null_lsn.offset = 0;
00525         } else {
00526                 if (TAILQ_FIRST(&txnid->kids) != NULL &&
00527                     (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
00528                         return (ret);
00529                 /*
00530                  * We need to assign begin_lsn while holding region mutex.
00531                  * That assignment is done inside the DbEnv->log_put call,
00532                  * so pass in the appropriate memory location to be filled
00533                  * in by the log_put code.
00534                  */
00535                 DB_SET_TXN_LSNP(txnid, &rlsnp, &lsnp);
00536                 txn_num = txnid->txnid;
00537         }
00538 
00539         DB_ASSERT(dbp->log_filename != NULL);
00540         if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
00541             (ret = __dbreg_lazy_id(dbp)) != 0)
00542                 return (ret);
00543 
00544         logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
00545             + sizeof(u_int32_t)
00546             + sizeof(*lsn)
00547             + sizeof(u_int32_t)
00548             + sizeof(u_int32_t)
00549             + sizeof(u_int32_t);
00550         if (CRYPTO_ON(dbenv)) {
00551                 npad =
00552                     ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
00553                 logrec.size += npad;
00554         }
00555 
00556         if (is_durable || txnid == NULL) {
00557                 if ((ret =
00558                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
00559                         return (ret);
00560         } else {
00561                 if ((ret = __os_malloc(dbenv,
00562                     logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
00563                         return (ret);
00564 #ifdef DIAGNOSTIC
00565                 if ((ret =
00566                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0) {
00567                         __os_free(dbenv, lr);
00568                         return (ret);
00569                 }
00570 #else
00571                 logrec.data = lr->data;
00572 #endif
00573         }
00574         if (npad > 0)
00575                 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
00576 
00577         bp = logrec.data;
00578 
00579         memcpy(bp, &rectype, sizeof(rectype));
00580         bp += sizeof(rectype);
00581 
00582         memcpy(bp, &txn_num, sizeof(txn_num));
00583         bp += sizeof(txn_num);
00584 
00585         memcpy(bp, lsnp, sizeof(DB_LSN));
00586         bp += sizeof(DB_LSN);
00587 
00588         uinttmp = (u_int32_t)dbp->log_filename->id;
00589         memcpy(bp, &uinttmp, sizeof(uinttmp));
00590         bp += sizeof(uinttmp);
00591 
00592         if (lsn != NULL)
00593                 memcpy(bp, lsn, sizeof(*lsn));
00594         else
00595                 memset(bp, 0, sizeof(*lsn));
00596         bp += sizeof(*lsn);
00597 
00598         uinttmp = (u_int32_t)pgno;
00599         memcpy(bp, &uinttmp, sizeof(uinttmp));
00600         bp += sizeof(uinttmp);
00601 
00602         uinttmp = (u_int32_t)indx;
00603         memcpy(bp, &uinttmp, sizeof(uinttmp));
00604         bp += sizeof(uinttmp);
00605 
00606         uinttmp = (u_int32_t)recno;
00607         memcpy(bp, &uinttmp, sizeof(uinttmp));
00608         bp += sizeof(uinttmp);
00609 
00610         DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
00611 
00612         if (is_durable || txnid == NULL) {
00613                 if ((ret = __log_put(dbenv, rlsnp,(DBT *)&logrec,
00614                     flags | DB_LOG_NOCOPY)) == 0 && txnid != NULL) {
00615                         *lsnp = *rlsnp;
00616                         if (rlsnp != ret_lsnp)
00617                                  *ret_lsnp = *rlsnp;
00618                 }
00619         } else {
00620 #ifdef DIAGNOSTIC
00621                 /*
00622                  * Set the debug bit if we are going to log non-durable
00623                  * transactions so they will be ignored by recovery.
00624                  */
00625                 memcpy(lr->data, logrec.data, logrec.size);
00626                 rectype |= DB_debug_FLAG;
00627                 memcpy(logrec.data, &rectype, sizeof(rectype));
00628 
00629                 ret = __log_put(dbenv,
00630                     rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
00631 #else
00632                 ret = 0;
00633 #endif
00634                 STAILQ_INSERT_HEAD(&txnid->logs, lr, links);
00635                 F_SET((TXN_DETAIL *)txnid->td, TXN_DTL_INMEMORY);
00636                 LSN_NOT_LOGGED(*ret_lsnp);
00637         }
00638 
00639 #ifdef LOG_DIAGNOSTIC
00640         if (ret != 0)
00641                 (void)__qam_del_print(dbenv,
00642                     (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
00643 #endif
00644 
00645 #ifdef DIAGNOSTIC
00646         __os_free(dbenv, logrec.data);
00647 #else
00648         if (is_durable || txnid == NULL)
00649                 __os_free(dbenv, logrec.data);
00650 #endif
00651         return (ret);
00652 }
00653 
00654 /*
00655  * PUBLIC: int __qam_del_read __P((DB_ENV *, void *, __qam_del_args **));
00656  */
00657 int
00658 __qam_del_read(dbenv, recbuf, argpp)
00659         DB_ENV *dbenv;
00660         void *recbuf;
00661         __qam_del_args **argpp;
00662 {
00663         __qam_del_args *argp;
00664         u_int32_t uinttmp;
00665         u_int8_t *bp;
00666         int ret;
00667 
00668         if ((ret = __os_malloc(dbenv,
00669             sizeof(__qam_del_args) + sizeof(DB_TXN), &argp)) != 0)
00670                 return (ret);
00671         bp = recbuf;
00672         argp->txnid = (DB_TXN *)&argp[1];
00673 
00674         memcpy(&argp->type, bp, sizeof(argp->type));
00675         bp += sizeof(argp->type);
00676 
00677         memcpy(&argp->txnid->txnid,  bp, sizeof(argp->txnid->txnid));
00678         bp += sizeof(argp->txnid->txnid);
00679 
00680         memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
00681         bp += sizeof(DB_LSN);
00682 
00683         memcpy(&uinttmp, bp, sizeof(uinttmp));
00684         argp->fileid = (int32_t)uinttmp;
00685         bp += sizeof(uinttmp);
00686 
00687         memcpy(&argp->lsn, bp,  sizeof(argp->lsn));
00688         bp += sizeof(argp->lsn);
00689 
00690         memcpy(&uinttmp, bp, sizeof(uinttmp));
00691         argp->pgno = (db_pgno_t)uinttmp;
00692         bp += sizeof(uinttmp);
00693 
00694         memcpy(&uinttmp, bp, sizeof(uinttmp));
00695         argp->indx = (u_int32_t)uinttmp;
00696         bp += sizeof(uinttmp);
00697 
00698         memcpy(&uinttmp, bp, sizeof(uinttmp));
00699         argp->recno = (db_recno_t)uinttmp;
00700         bp += sizeof(uinttmp);
00701 
00702         *argpp = argp;
00703         return (0);
00704 }
00705 
00706 /*
00707  * PUBLIC: int __qam_add_log __P((DB *, DB_TXN *, DB_LSN *,
00708  * PUBLIC:     u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_recno_t,
00709  * PUBLIC:     const DBT *, u_int32_t, const DBT *));
00710  */
00711 int
00712 __qam_add_log(dbp, txnid, ret_lsnp, flags, lsn, pgno, indx, recno, data,
00713     vflag, olddata)
00714         DB *dbp;
00715         DB_TXN *txnid;
00716         DB_LSN *ret_lsnp;
00717         u_int32_t flags;
00718         DB_LSN * lsn;
00719         db_pgno_t pgno;
00720         u_int32_t indx;
00721         db_recno_t recno;
00722         const DBT *data;
00723         u_int32_t vflag;
00724         const DBT *olddata;
00725 {
00726         DBT logrec;
00727         DB_ENV *dbenv;
00728         DB_TXNLOGREC *lr;
00729         DB_LSN *lsnp, null_lsn, *rlsnp;
00730         u_int32_t zero, uinttmp, rectype, txn_num;
00731         u_int npad;
00732         u_int8_t *bp;
00733         int is_durable, ret;
00734 
00735         dbenv = dbp->dbenv;
00736         COMPQUIET(lr, NULL);
00737 
00738         rectype = DB___qam_add;
00739         npad = 0;
00740         rlsnp = ret_lsnp;
00741 
00742         ret = 0;
00743 
00744         if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
00745             F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
00746                 is_durable = 0;
00747         } else
00748                 is_durable = 1;
00749 
00750         if (txnid == NULL) {
00751                 txn_num = 0;
00752                 lsnp = &null_lsn;
00753                 null_lsn.file = null_lsn.offset = 0;
00754         } else {
00755                 if (TAILQ_FIRST(&txnid->kids) != NULL &&
00756                     (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
00757                         return (ret);
00758                 /*
00759                  * We need to assign begin_lsn while holding region mutex.
00760                  * That assignment is done inside the DbEnv->log_put call,
00761                  * so pass in the appropriate memory location to be filled
00762                  * in by the log_put code.
00763                  */
00764                 DB_SET_TXN_LSNP(txnid, &rlsnp, &lsnp);
00765                 txn_num = txnid->txnid;
00766         }
00767 
00768         DB_ASSERT(dbp->log_filename != NULL);
00769         if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
00770             (ret = __dbreg_lazy_id(dbp)) != 0)
00771                 return (ret);
00772 
00773         logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
00774             + sizeof(u_int32_t)
00775             + sizeof(*lsn)
00776             + sizeof(u_int32_t)
00777             + sizeof(u_int32_t)
00778             + sizeof(u_int32_t)
00779             + sizeof(u_int32_t) + (data == NULL ? 0 : data->size)
00780             + sizeof(u_int32_t)
00781             + sizeof(u_int32_t) + (olddata == NULL ? 0 : olddata->size);
00782         if (CRYPTO_ON(dbenv)) {
00783                 npad =
00784                     ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
00785                 logrec.size += npad;
00786         }
00787 
00788         if (is_durable || txnid == NULL) {
00789                 if ((ret =
00790                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
00791                         return (ret);
00792         } else {
00793                 if ((ret = __os_malloc(dbenv,
00794                     logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
00795                         return (ret);
00796 #ifdef DIAGNOSTIC
00797                 if ((ret =
00798                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0) {
00799                         __os_free(dbenv, lr);
00800                         return (ret);
00801                 }
00802 #else
00803                 logrec.data = lr->data;
00804 #endif
00805         }
00806         if (npad > 0)
00807                 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
00808 
00809         bp = logrec.data;
00810 
00811         memcpy(bp, &rectype, sizeof(rectype));
00812         bp += sizeof(rectype);
00813 
00814         memcpy(bp, &txn_num, sizeof(txn_num));
00815         bp += sizeof(txn_num);
00816 
00817         memcpy(bp, lsnp, sizeof(DB_LSN));
00818         bp += sizeof(DB_LSN);
00819 
00820         uinttmp = (u_int32_t)dbp->log_filename->id;
00821         memcpy(bp, &uinttmp, sizeof(uinttmp));
00822         bp += sizeof(uinttmp);
00823 
00824         if (lsn != NULL)
00825                 memcpy(bp, lsn, sizeof(*lsn));
00826         else
00827                 memset(bp, 0, sizeof(*lsn));
00828         bp += sizeof(*lsn);
00829 
00830         uinttmp = (u_int32_t)pgno;
00831         memcpy(bp, &uinttmp, sizeof(uinttmp));
00832         bp += sizeof(uinttmp);
00833 
00834         uinttmp = (u_int32_t)indx;
00835         memcpy(bp, &uinttmp, sizeof(uinttmp));
00836         bp += sizeof(uinttmp);
00837 
00838         uinttmp = (u_int32_t)recno;
00839         memcpy(bp, &uinttmp, sizeof(uinttmp));
00840         bp += sizeof(uinttmp);
00841 
00842         if (data == NULL) {
00843                 zero = 0;
00844                 memcpy(bp, &zero, sizeof(u_int32_t));
00845                 bp += sizeof(u_int32_t);
00846         } else {
00847                 memcpy(bp, &data->size, sizeof(data->size));
00848                 bp += sizeof(data->size);
00849                 memcpy(bp, data->data, data->size);
00850                 bp += data->size;
00851         }
00852 
00853         uinttmp = (u_int32_t)vflag;
00854         memcpy(bp, &uinttmp, sizeof(uinttmp));
00855         bp += sizeof(uinttmp);
00856 
00857         if (olddata == NULL) {
00858                 zero = 0;
00859                 memcpy(bp, &zero, sizeof(u_int32_t));
00860                 bp += sizeof(u_int32_t);
00861         } else {
00862                 memcpy(bp, &olddata->size, sizeof(olddata->size));
00863                 bp += sizeof(olddata->size);
00864                 memcpy(bp, olddata->data, olddata->size);
00865                 bp += olddata->size;
00866         }
00867 
00868         DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
00869 
00870         if (is_durable || txnid == NULL) {
00871                 if ((ret = __log_put(dbenv, rlsnp,(DBT *)&logrec,
00872                     flags | DB_LOG_NOCOPY)) == 0 && txnid != NULL) {
00873                         *lsnp = *rlsnp;
00874                         if (rlsnp != ret_lsnp)
00875                                  *ret_lsnp = *rlsnp;
00876                 }
00877         } else {
00878 #ifdef DIAGNOSTIC
00879                 /*
00880                  * Set the debug bit if we are going to log non-durable
00881                  * transactions so they will be ignored by recovery.
00882                  */
00883                 memcpy(lr->data, logrec.data, logrec.size);
00884                 rectype |= DB_debug_FLAG;
00885                 memcpy(logrec.data, &rectype, sizeof(rectype));
00886 
00887                 ret = __log_put(dbenv,
00888                     rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
00889 #else
00890                 ret = 0;
00891 #endif
00892                 STAILQ_INSERT_HEAD(&txnid->logs, lr, links);
00893                 F_SET((TXN_DETAIL *)txnid->td, TXN_DTL_INMEMORY);
00894                 LSN_NOT_LOGGED(*ret_lsnp);
00895         }
00896 
00897 #ifdef LOG_DIAGNOSTIC
00898         if (ret != 0)
00899                 (void)__qam_add_print(dbenv,
00900                     (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
00901 #endif
00902 
00903 #ifdef DIAGNOSTIC
00904         __os_free(dbenv, logrec.data);
00905 #else
00906         if (is_durable || txnid == NULL)
00907                 __os_free(dbenv, logrec.data);
00908 #endif
00909         return (ret);
00910 }
00911 
00912 /*
00913  * PUBLIC: int __qam_add_read __P((DB_ENV *, void *, __qam_add_args **));
00914  */
00915 int
00916 __qam_add_read(dbenv, recbuf, argpp)
00917         DB_ENV *dbenv;
00918         void *recbuf;
00919         __qam_add_args **argpp;
00920 {
00921         __qam_add_args *argp;
00922         u_int32_t uinttmp;
00923         u_int8_t *bp;
00924         int ret;
00925 
00926         if ((ret = __os_malloc(dbenv,
00927             sizeof(__qam_add_args) + sizeof(DB_TXN), &argp)) != 0)
00928                 return (ret);
00929         bp = recbuf;
00930         argp->txnid = (DB_TXN *)&argp[1];
00931 
00932         memcpy(&argp->type, bp, sizeof(argp->type));
00933         bp += sizeof(argp->type);
00934 
00935         memcpy(&argp->txnid->txnid,  bp, sizeof(argp->txnid->txnid));
00936         bp += sizeof(argp->txnid->txnid);
00937 
00938         memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
00939         bp += sizeof(DB_LSN);
00940 
00941         memcpy(&uinttmp, bp, sizeof(uinttmp));
00942         argp->fileid = (int32_t)uinttmp;
00943         bp += sizeof(uinttmp);
00944 
00945         memcpy(&argp->lsn, bp,  sizeof(argp->lsn));
00946         bp += sizeof(argp->lsn);
00947 
00948         memcpy(&uinttmp, bp, sizeof(uinttmp));
00949         argp->pgno = (db_pgno_t)uinttmp;
00950         bp += sizeof(uinttmp);
00951 
00952         memcpy(&uinttmp, bp, sizeof(uinttmp));
00953         argp->indx = (u_int32_t)uinttmp;
00954         bp += sizeof(uinttmp);
00955 
00956         memcpy(&uinttmp, bp, sizeof(uinttmp));
00957         argp->recno = (db_recno_t)uinttmp;
00958         bp += sizeof(uinttmp);
00959 
00960         memset(&argp->data, 0, sizeof(argp->data));
00961         memcpy(&argp->data.size, bp, sizeof(u_int32_t));
00962         bp += sizeof(u_int32_t);
00963         argp->data.data = bp;
00964         bp += argp->data.size;
00965 
00966         memcpy(&uinttmp, bp, sizeof(uinttmp));
00967         argp->vflag = (u_int32_t)uinttmp;
00968         bp += sizeof(uinttmp);
00969 
00970         memset(&argp->olddata, 0, sizeof(argp->olddata));
00971         memcpy(&argp->olddata.size, bp, sizeof(u_int32_t));
00972         bp += sizeof(u_int32_t);
00973         argp->olddata.data = bp;
00974         bp += argp->olddata.size;
00975 
00976         *argpp = argp;
00977         return (0);
00978 }
00979 
00980 /*
00981  * PUBLIC: int __qam_delext_log __P((DB *, DB_TXN *, DB_LSN *,
00982  * PUBLIC:     u_int32_t, DB_LSN *, db_pgno_t, u_int32_t, db_recno_t,
00983  * PUBLIC:     const DBT *));
00984  */
00985 int
00986 __qam_delext_log(dbp, txnid, ret_lsnp, flags, lsn, pgno, indx, recno, data)
00987         DB *dbp;
00988         DB_TXN *txnid;
00989         DB_LSN *ret_lsnp;
00990         u_int32_t flags;
00991         DB_LSN * lsn;
00992         db_pgno_t pgno;
00993         u_int32_t indx;
00994         db_recno_t recno;
00995         const DBT *data;
00996 {
00997         DBT logrec;
00998         DB_ENV *dbenv;
00999         DB_TXNLOGREC *lr;
01000         DB_LSN *lsnp, null_lsn, *rlsnp;
01001         u_int32_t zero, uinttmp, rectype, txn_num;
01002         u_int npad;
01003         u_int8_t *bp;
01004         int is_durable, ret;
01005 
01006         dbenv = dbp->dbenv;
01007         COMPQUIET(lr, NULL);
01008 
01009         rectype = DB___qam_delext;
01010         npad = 0;
01011         rlsnp = ret_lsnp;
01012 
01013         ret = 0;
01014 
01015         if (LF_ISSET(DB_LOG_NOT_DURABLE) ||
01016             F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
01017                 is_durable = 0;
01018         } else
01019                 is_durable = 1;
01020 
01021         if (txnid == NULL) {
01022                 txn_num = 0;
01023                 lsnp = &null_lsn;
01024                 null_lsn.file = null_lsn.offset = 0;
01025         } else {
01026                 if (TAILQ_FIRST(&txnid->kids) != NULL &&
01027                     (ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
01028                         return (ret);
01029                 /*
01030                  * We need to assign begin_lsn while holding region mutex.
01031                  * That assignment is done inside the DbEnv->log_put call,
01032                  * so pass in the appropriate memory location to be filled
01033                  * in by the log_put code.
01034                  */
01035                 DB_SET_TXN_LSNP(txnid, &rlsnp, &lsnp);
01036                 txn_num = txnid->txnid;
01037         }
01038 
01039         DB_ASSERT(dbp->log_filename != NULL);
01040         if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
01041             (ret = __dbreg_lazy_id(dbp)) != 0)
01042                 return (ret);
01043 
01044         logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
01045             + sizeof(u_int32_t)
01046             + sizeof(*lsn)
01047             + sizeof(u_int32_t)
01048             + sizeof(u_int32_t)
01049             + sizeof(u_int32_t)
01050             + sizeof(u_int32_t) + (data == NULL ? 0 : data->size);
01051         if (CRYPTO_ON(dbenv)) {
01052                 npad =
01053                     ((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
01054                 logrec.size += npad;
01055         }
01056 
01057         if (is_durable || txnid == NULL) {
01058                 if ((ret =
01059                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0)
01060                         return (ret);
01061         } else {
01062                 if ((ret = __os_malloc(dbenv,
01063                     logrec.size + sizeof(DB_TXNLOGREC), &lr)) != 0)
01064                         return (ret);
01065 #ifdef DIAGNOSTIC
01066                 if ((ret =
01067                     __os_malloc(dbenv, logrec.size, &logrec.data)) != 0) {
01068                         __os_free(dbenv, lr);
01069                         return (ret);
01070                 }
01071 #else
01072                 logrec.data = lr->data;
01073 #endif
01074         }
01075         if (npad > 0)
01076                 memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
01077 
01078         bp = logrec.data;
01079 
01080         memcpy(bp, &rectype, sizeof(rectype));
01081         bp += sizeof(rectype);
01082 
01083         memcpy(bp, &txn_num, sizeof(txn_num));
01084         bp += sizeof(txn_num);
01085 
01086         memcpy(bp, lsnp, sizeof(DB_LSN));
01087         bp += sizeof(DB_LSN);
01088 
01089         uinttmp = (u_int32_t)dbp->log_filename->id;
01090         memcpy(bp, &uinttmp, sizeof(uinttmp));
01091         bp += sizeof(uinttmp);
01092 
01093         if (lsn != NULL)
01094                 memcpy(bp, lsn, sizeof(*lsn));
01095         else
01096                 memset(bp, 0, sizeof(*lsn));
01097         bp += sizeof(*lsn);
01098 
01099         uinttmp = (u_int32_t)pgno;
01100         memcpy(bp, &uinttmp, sizeof(uinttmp));
01101         bp += sizeof(uinttmp);
01102 
01103         uinttmp = (u_int32_t)indx;
01104         memcpy(bp, &uinttmp, sizeof(uinttmp));
01105         bp += sizeof(uinttmp);
01106 
01107         uinttmp = (u_int32_t)recno;
01108         memcpy(bp, &uinttmp, sizeof(uinttmp));
01109         bp += sizeof(uinttmp);
01110 
01111         if (data == NULL) {
01112                 zero = 0;
01113                 memcpy(bp, &zero, sizeof(u_int32_t));
01114                 bp += sizeof(u_int32_t);
01115         } else {
01116                 memcpy(bp, &data->size, sizeof(data->size));
01117                 bp += sizeof(data->size);
01118                 memcpy(bp, data->data, data->size);
01119                 bp += data->size;
01120         }
01121 
01122         DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
01123 
01124         if (is_durable || txnid == NULL) {
01125                 if ((ret = __log_put(dbenv, rlsnp,(DBT *)&logrec,
01126                     flags | DB_LOG_NOCOPY)) == 0 && txnid != NULL) {
01127                         *lsnp = *rlsnp;
01128                         if (rlsnp != ret_lsnp)
01129                                  *ret_lsnp = *rlsnp;
01130                 }
01131         } else {
01132 #ifdef DIAGNOSTIC
01133                 /*
01134                  * Set the debug bit if we are going to log non-durable
01135                  * transactions so they will be ignored by recovery.
01136                  */
01137                 memcpy(lr->data, logrec.data, logrec.size);
01138                 rectype |= DB_debug_FLAG;
01139                 memcpy(logrec.data, &rectype, sizeof(rectype));
01140 
01141                 ret = __log_put(dbenv,
01142                     rlsnp, (DBT *)&logrec, flags | DB_LOG_NOCOPY);
01143 #else
01144                 ret = 0;
01145 #endif
01146                 STAILQ_INSERT_HEAD(&txnid->logs, lr, links);
01147                 F_SET((TXN_DETAIL *)txnid->td, TXN_DTL_INMEMORY);
01148                 LSN_NOT_LOGGED(*ret_lsnp);
01149         }
01150 
01151 #ifdef LOG_DIAGNOSTIC
01152         if (ret != 0)
01153                 (void)__qam_delext_print(dbenv,
01154                     (DBT *)&logrec, ret_lsnp, DB_TXN_PRINT, NULL);
01155 #endif
01156 
01157 #ifdef DIAGNOSTIC
01158         __os_free(dbenv, logrec.data);
01159 #else
01160         if (is_durable || txnid == NULL)
01161                 __os_free(dbenv, logrec.data);
01162 #endif
01163         return (ret);
01164 }
01165 
01166 /*
01167  * PUBLIC: int __qam_delext_read __P((DB_ENV *, void *, __qam_delext_args **));
01168  */
01169 int
01170 __qam_delext_read(dbenv, recbuf, argpp)
01171         DB_ENV *dbenv;
01172         void *recbuf;
01173         __qam_delext_args **argpp;
01174 {
01175         __qam_delext_args *argp;
01176         u_int32_t uinttmp;
01177         u_int8_t *bp;
01178         int ret;
01179 
01180         if ((ret = __os_malloc(dbenv,
01181             sizeof(__qam_delext_args) + sizeof(DB_TXN), &argp)) != 0)
01182                 return (ret);
01183         bp = recbuf;
01184         argp->txnid = (DB_TXN *)&argp[1];
01185 
01186         memcpy(&argp->type, bp, sizeof(argp->type));
01187         bp += sizeof(argp->type);
01188 
01189         memcpy(&argp->txnid->txnid,  bp, sizeof(argp->txnid->txnid));
01190         bp += sizeof(argp->txnid->txnid);
01191 
01192         memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
01193         bp += sizeof(DB_LSN);
01194 
01195         memcpy(&uinttmp, bp, sizeof(uinttmp));
01196         argp->fileid = (int32_t)uinttmp;
01197         bp += sizeof(uinttmp);
01198 
01199         memcpy(&argp->lsn, bp,  sizeof(argp->lsn));
01200         bp += sizeof(argp->lsn);
01201 
01202         memcpy(&uinttmp, bp, sizeof(uinttmp));
01203         argp->pgno = (db_pgno_t)uinttmp;
01204         bp += sizeof(uinttmp);
01205 
01206         memcpy(&uinttmp, bp, sizeof(uinttmp));
01207         argp->indx = (u_int32_t)uinttmp;
01208         bp += sizeof(uinttmp);
01209 
01210         memcpy(&uinttmp, bp, sizeof(uinttmp));
01211         argp->recno = (db_recno_t)uinttmp;
01212         bp += sizeof(uinttmp);
01213 
01214         memset(&argp->data, 0, sizeof(argp->data));
01215         memcpy(&argp->data.size, bp, sizeof(u_int32_t));
01216         bp += sizeof(u_int32_t);
01217         argp->data.data = bp;
01218         bp += argp->data.size;
01219 
01220         *argpp = argp;
01221         return (0);
01222 }
01223 
01224 /*
01225  * PUBLIC: int __qam_init_recover __P((DB_ENV *, int (***)(DB_ENV *,
01226  * PUBLIC:     DBT *, DB_LSN *, db_recops, void *), size_t *));
01227  */
01228 int
01229 __qam_init_recover(dbenv, dtabp, dtabsizep)
01230         DB_ENV *dbenv;
01231         int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
01232         size_t *dtabsizep;
01233 {
01234         int ret;
01235 
01236         if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
01237             __qam_incfirst_recover, DB___qam_incfirst)) != 0)
01238                 return (ret);
01239         if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
01240             __qam_mvptr_recover, DB___qam_mvptr)) != 0)
01241                 return (ret);
01242         if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
01243             __qam_del_recover, DB___qam_del)) != 0)
01244                 return (ret);
01245         if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
01246             __qam_add_recover, DB___qam_add)) != 0)
01247                 return (ret);
01248         if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
01249             __qam_delext_recover, DB___qam_delext)) != 0)
01250                 return (ret);
01251         return (0);
01252 }

Generated on Sun Dec 25 12:14:44 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2