qam_upgrade.c

Go to the documentation of this file.
00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1996, 1997, 1998, 1999, 2000
00005  *      Sleepycat Software.  All rights reserved.
00006  */
00007 #include "config.h"
00008 
00009 #ifndef lint
00010 static const char revid[] = "$Id: qam__upgrade_8c-source.html,v 1.1 2008/06/08 10:21:47 sebdiaz Exp $";
00011 #endif /* not lint */
00012 
00013 #ifndef NO_SYSTEM_INCLUDES
00014 #include <sys/types.h>
00015 
00016 #include <errno.h>
00017 #include <limits.h>
00018 #include <string.h>
00019 #endif
00020 
00021 #include "db_int.h"
00022 #include "db_page.h"
00023 #include "db_swap.h"
00024 #include "db_am.h"
00025 #include "db_upgrade.h"
00026 #include "qam_ext.h"
00027 
00028 /*
00029  * CDB___qam_31_qammeta --
00030  *      Upgrade the database from version 1 to version 2.
00031  *
00032  * PUBLIC: int CDB___qam_31_qammeta __P((DB *, char *, u_int8_t *));
00033  */
00034 int
00035 CDB___qam_31_qammeta(dbp, real_name, buf)
00036         DB *dbp;
00037         char *real_name;
00038         u_int8_t *buf;
00039 {
00040         QMETA31 *newmeta;
00041         QMETA30 *oldmeta;
00042 
00043         COMPQUIET(dbp, NULL);
00044         COMPQUIET(real_name, NULL);
00045 
00046         newmeta = (QMETA31 *)buf;
00047         oldmeta = (QMETA30 *)buf;
00048 
00049         /*
00050          * Copy the fields to their new locations.
00051          * They may overlap so start at the bottom and use memmove().
00052          */
00053         newmeta->rec_page = oldmeta->rec_page;
00054         newmeta->re_pad = oldmeta->re_pad;
00055         newmeta->re_len = oldmeta->re_len;
00056         newmeta->cur_recno = oldmeta->cur_recno;
00057         newmeta->first_recno = oldmeta->first_recno;
00058         newmeta->start = oldmeta->start;
00059         memmove(newmeta->dbmeta.uid,
00060             oldmeta->dbmeta.uid, sizeof(oldmeta->dbmeta.uid));
00061         newmeta->dbmeta.flags = oldmeta->dbmeta.flags;
00062         newmeta->dbmeta.record_count = 0;
00063         newmeta->dbmeta.key_count = 0;
00064         ZERO_LSN(newmeta->dbmeta.alloc_lsn);
00065 
00066         /* Update the version. */
00067         newmeta->dbmeta.version = 2;
00068 
00069         return (0);
00070 }

Generated on Sun Jun 8 10:56:39 2008 for GNUmifluz by  doxygen 1.5.5