Commit e4736342 authored by claes's avatar claes

Changed layout of backup-file again.

parent 5c5015e4
/* /*
* Proview $Id: rt_bck.c,v 1.11 2008-03-27 09:58:21 claes Exp $ * Proview $Id: rt_bck.c,v 1.12 2008-03-31 13:47:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -120,7 +120,7 @@ pdebug () ...@@ -120,7 +120,7 @@ pdebug ()
typedef struct { typedef struct {
BCK_CYCLEHEAD_STRUCT cyclehead; BCK_CYCLEHEAD_STRUCT cyclehead;
struct { struct {
bck_t_dataheader datahead; bck_t_writeheader datahead;
char data [1]; char data [1];
} segment [1]; } segment [1];
} BCK_WRTBLK_STRUCT; } BCK_WRTBLK_STRUCT;
...@@ -901,7 +901,7 @@ bck_insert_listentry ( ...@@ -901,7 +901,7 @@ bck_insert_listentry (
blep->next = blhp->first; blep->next = blhp->first;
blhp->first = blep; blhp->first = blep;
blhp->cyclehead.length += sizeof(bck_t_dataheader) + attrref->Size + blhp->cyclehead.length += sizeof(bck_t_writeheader) + attrref->Size +
blep->datablk.head.namesize + 1; blep->datablk.head.namesize + 1;
blhp->cyclehead.segments++; blhp->cyclehead.segments++;
...@@ -1179,7 +1179,7 @@ void *bck_coll_process ( ...@@ -1179,7 +1179,7 @@ void *bck_coll_process (
BCK_WRTBLK_STRUCT *wrtblk; BCK_WRTBLK_STRUCT *wrtblk;
BCK_LISTHEAD *bcklist; BCK_LISTHEAD *bcklist;
BCK_LISTENTRY *blep; BCK_LISTENTRY *blep;
bck_t_dataheader *dhp; bck_t_writeheader *dhp;
char *p; /* data pointer */ char *p; /* data pointer */
pwr_tUInt32 sts; pwr_tUInt32 sts;
pwr_sClass_Backup *bckp; pwr_sClass_Backup *bckp;
...@@ -1288,9 +1288,13 @@ void *bck_coll_process ( ...@@ -1288,9 +1288,13 @@ void *bck_coll_process (
/* Copy data header */ /* Copy data header */
dhp = (bck_t_dataheader *)p; /* dhp points to data header */ dhp = (bck_t_writeheader *)p; /* dhp points to data header */
p += sizeof *dhp; /* p points to data part */ p += sizeof *dhp; /* p points to data part */
*dhp = blep->datablk.head; dhp->objid = blep->datablk.head.attrref.Objid;
dhp->class = blep->datablk.head.class;
dhp->dynamic = blep->datablk.head.dynamic;
dhp->namesize = blep->datablk.head.namesize;
dhp->size = blep->datablk.head.attrref.Size;
/* Write name */ /* Write name */
...@@ -1312,7 +1316,7 @@ void *bck_coll_process ( ...@@ -1312,7 +1316,7 @@ void *bck_coll_process (
} /* Backup object is still there */ } /* Backup object is still there */
UNLOCK; UNLOCK;
p += dhp->attrref.Size; p += dhp->size;
blep = blep->next; blep = blep->next;
} }
......
/* /*
* Proview $Id: rt_bck_load.c,v 1.5 2008-03-27 09:59:57 claes Exp $ * Proview $Id: rt_bck_load.c,v 1.6 2008-03-31 13:47:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -77,7 +77,7 @@ bck_LoadBackup () ...@@ -77,7 +77,7 @@ bck_LoadBackup ()
BCK_FILEHEAD_STRUCT fh; /* File header */ BCK_FILEHEAD_STRUCT fh; /* File header */
BCK_CYCLEHEAD_STRUCT ch; BCK_CYCLEHEAD_STRUCT ch;
BCK_DATAHEAD_STRUCT dh_old; BCK_DATAHEAD_STRUCT dh_old;
bck_t_dataheader dh; bck_t_writeheader dh;
pwr_tUInt32 c; pwr_tUInt32 c;
pwr_tUInt32 d; pwr_tUInt32 d;
char *strp; char *strp;
...@@ -194,8 +194,8 @@ bck_LoadBackup () ...@@ -194,8 +194,8 @@ bck_LoadBackup ()
csts = fread(namep, dh.namesize + 1, 1, f); csts = fread(namep, dh.namesize + 1, 1, f);
} else } else
namep = NULL; namep = NULL;
datap = malloc(dh.attrref.Size); datap = malloc(dh.size);
csts = fread(datap, dh.attrref.Size, 1, f); csts = fread(datap, dh.size, 1, f);
} }
if (csts == 0) { if (csts == 0) {
SET_ERRNO_STS; SET_ERRNO_STS;
...@@ -210,20 +210,20 @@ bck_LoadBackup () ...@@ -210,20 +210,20 @@ bck_LoadBackup ()
strp = strchr(namep, '.'); /* always is a full object! */ strp = strchr(namep, '.'); /* always is a full object! */
if (strp != NULL) *strp = '\0'; /* Just make sure... */ if (strp != NULL) *strp = '\0'; /* Just make sure... */
sts = gdh_CreateObject(namep, dh.class, dh.attrref.Size, sts = gdh_CreateObject(namep, dh.class, dh.size,
&objid, dh.attrref.Objid, 0, pwr_cNObjid); &objid, dh.objid, 0, pwr_cNObjid);
if (strp != NULL) *strp = '.'; if (strp != NULL) *strp = '.';
if (ODD (sts)) if (ODD (sts))
sts = gdh_SetObjectInfo(namep, datap, dh.attrref.Size); sts = gdh_SetObjectInfo(namep, datap, dh.size);
} /* Dynamic object */ } /* Dynamic object */
else { else {
sts = gdh_ObjidToName (dh.attrref.Objid, objectname, sizeof(objectname), sts = gdh_ObjidToName (dh.objid, objectname, sizeof(objectname),
cdh_mNName); cdh_mNName);
if (ODD(sts)) { if (ODD(sts)) {
strcat(objectname, namep); strcat(objectname, namep);
sts = gdh_SetObjectInfo(objectname, datap, dh.attrref.Size); sts = gdh_SetObjectInfo(objectname, datap, dh.size);
} }
} }
} /* valid segment */ } /* valid segment */
......
/* /*
* Proview $Id: rt_bckdef.h,v 1.3 2008-03-27 09:59:57 claes Exp $ * Proview $Id: rt_bckdef.h,v 1.4 2008-03-31 13:47:00 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -107,6 +107,15 @@ typedef struct { ...@@ -107,6 +107,15 @@ typedef struct {
pwr_tInt16 namesize; /* Name of attribute [.attribute] */ pwr_tInt16 namesize; /* Name of attribute [.attribute] */
} bck_t_dataheader; } bck_t_dataheader;
typedef struct {
pwr_tObjid objid; /* Objid for the object */
pwr_tClassId class; /* Class of object */
pwr_tBoolean valid; /* Validity flag */
pwr_tBoolean dynamic; /* Dynamic object */
pwr_tInt16 namesize; /* Size of name of attribute [.attribute] */
pwr_tUInt32 size; /* Size of data */
} bck_t_writeheader;
#ifdef OS_ELN #ifdef OS_ELN
......
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