Commit 9df66bc7 authored by Claes Sjofors's avatar Claes Sjofors

Backup fix for reading old V4.6 versions of backup file

parent ec9b7473
......@@ -146,8 +146,10 @@ bck_LoadBackup ()
errh_Info("BACKUP Loading old file version : %d", fh.version);
/* Read the cycle data. */
BCK_FILEHEAD_STRUCT_V6 *fhp_v6 = (BCK_FILEHEAD_STRUCT_V6 *)&fh;
for (c=0; c<2; c++) {
fseek(f, fh.curdata [c], 0);
fseek(f, fhp_v6->curdata [c], 0);
fread(&ch_old, sizeof ch_old, 1, f);
/* Work thru the data segments */
......@@ -197,14 +199,16 @@ bck_LoadBackup ()
} else if (fh.version == BCK_FILE_VERSION - 1) {
/* Read the cycle data. */
BCK_FILEHEAD_STRUCT_V6 *fhp_v6 = (BCK_FILEHEAD_STRUCT_V6 *)&fh;
BCK_CYCLEHEAD_STRUCT_V6 ch_v6;
for (c=0; c<2; c++) {
fseek(f, fh.curdata [c], 0);
fread(&ch_old, sizeof ch_old, 1, f);
fseek(f, fhp_v6->curdata [c], 0);
fread(&ch_v6, sizeof ch_v6, 1, f);
/* Work thru the data segments */
for (d=0; d<ch_old.segments; d++) {
for (d=0; d<ch_v6.segments; d++) {
csts = fread(&dh, sizeof dh, 1, f);
if (csts != 0) {
if (dh.namesize > 0) {
......
......@@ -41,6 +41,7 @@
#endif
#include "pwr.h"
#include "rt_net.h"
/* Trace flag: Define BCK_TRACE for trace printouts */
......@@ -93,15 +94,38 @@ typedef struct {
} BCK_FILEHEAD_STRUCT;
/* File header for Version 6 and previous */
typedef struct {
pwr_tInt32 version; /* File layout version */
net_sTime creationtime; /* Time when file was created */
net_sTime updatetime [2]; /* Time when header was last updated */
pwr_tInt32 curdata [2]; /* backup data 0 for fast cycle, and */
/* 1 for slow. Contains file address */
pwr_tInt32 cursize [2]; /* size in bytes of curdata areas */
/* Node identification */
pwr_tNodeId nodidx; /* node index that produced the file */
} BCK_FILEHEAD_STRUCT_V6;
/* Each data section starts with a cycle header. */
typedef struct {
pwr_tTime objtime; /* Time up to which new objects are included */
net_sTime objtime; /* Time up to which new objects are included */
pwr_tUInt32 length; /* Length of section including this header */
pwr_tUInt16 cycle; /* 0=fast, 1=slow */
pwr_tUInt16 segments; /* # of segments in section */
} BCK_CYCLEHEAD_STRUCT;
typedef struct {
net_sTime objtime; /* Time up to which new objects are included */
pwr_tUInt32 length; /* Length of section including this header */
pwr_tUInt16 cycle; /* 0=fast, 1=slow */
pwr_tUInt32 segments; /* # of segments in section */
} BCK_CYCLEHEAD_STRUCT_V6;
typedef struct {
pwr_tTime objtime; /* Time up to which new objects are included */
pwr_tUInt32 length; /* Length of section including this header */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment