Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
9c7f2ab4
Commit
9c7f2ab4
authored
Mar 27, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Layout on backup-file changed
parent
d4a64321
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
14 deletions
+92
-14
src/lib/rt/src/rt_bck_load.c
src/lib/rt/src/rt_bck_load.c
+81
-12
src/lib/rt/src/rt_bckdef.h
src/lib/rt/src/rt_bckdef.h
+11
-2
No files found.
src/lib/rt/src/rt_bck_load.c
View file @
9c7f2ab4
/*
* Proview $Id: rt_bck_load.c,v 1.
4 2005-10-21 16:11:22
claes Exp $
* Proview $Id: rt_bck_load.c,v 1.
5 2008-03-27 09:59:57
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -50,6 +50,7 @@
#include "rt_bckdef.h"
#include "rt_bck_load.h"
#include "co_dcli.h"
#include "co_cdh.h"
#if defined OS_VMS || defined OS_ELN
...
...
@@ -75,12 +76,15 @@ bck_LoadBackup ()
FILE
*
f
;
BCK_FILEHEAD_STRUCT
fh
;
/* File header */
BCK_CYCLEHEAD_STRUCT
ch
;
BCK_DATAHEAD_STRUCT
dh
;
BCK_DATAHEAD_STRUCT
dh_old
;
bck_t_dataheader
dh
;
pwr_tUInt32
c
;
pwr_tUInt32
d
;
char
*
strp
;
char
*
datap
;
char
*
namep
;
char
fname
[
200
];
pwr_tAName
objectname
;
#if defined OS_VMS || defined OS_ELN
short
msglen
;
...
...
@@ -120,9 +124,59 @@ bck_LoadBackup ()
if
(
csts
==
0
)
{
SET_ERRNO_STS
;
}
else
{
if
(
fh
.
version
!=
BCK_FILE_VERSION
)
{
errh_Error
(
"BACKUP Cannot load backup file with version %d"
,
fh
.
version
);
}
else
{
if
(
fh
.
version
<
BCK_FILE_VERSION
)
{
errh_Info
(
"BACKUP Loading old file version : %d"
,
fh
.
version
);
/* Read the cycle data. */
for
(
c
=
0
;
c
<
2
;
c
++
)
{
fseek
(
f
,
fh
.
curdata
[
c
],
0
);
fread
(
&
ch
,
sizeof
ch
,
1
,
f
);
/* Work thru the data segments */
for
(
d
=
0
;
d
<
ch
.
segments
;
d
++
)
{
csts
=
fread
(
&
dh_old
,
sizeof
dh_old
,
1
,
f
);
if
(
csts
!=
0
)
{
datap
=
malloc
(
dh_old
.
attrref
.
Size
);
csts
=
fread
(
datap
,
dh_old
.
attrref
.
Size
,
1
,
f
);
}
if
(
csts
==
0
)
{
SET_ERRNO_STS
;
break
;
}
if
(
dh_old
.
valid
)
{
/* Find object */
if
(
dh_old
.
dynamic
)
{
strp
=
strchr
(
dh_old
.
dataname
,
'.'
);
/* always is a full object! */
if
(
strp
!=
NULL
)
*
strp
=
'\0'
;
/* Just make sure... */
sts
=
gdh_CreateObject
(
dh_old
.
dataname
,
dh_old
.
class
,
dh_old
.
attrref
.
Size
,
&
objid
,
dh_old
.
attrref
.
Objid
,
0
,
pwr_cNObjid
);
if
(
strp
!=
NULL
)
*
strp
=
'.'
;
if
(
ODD
(
sts
))
sts
=
gdh_SetObjectInfo
(
dh_old
.
dataname
,
datap
,
dh_old
.
attrref
.
Size
);
}
/* Dynamic object */
else
{
sts
=
gdh_SetObjectInfoAttrref
(
&
dh_old
.
attrref
,
datap
,
dh_old
.
attrref
.
Size
);
}
}
/* valid segment */
free
(
datap
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"BACKUP error reloading %s, reason:
\n
%m"
,
dh_old
.
dataname
,
sts
);
sts
=
1
;
}
}
/* For all data segments */
if
(
EVEN
(
sts
))
break
;
/* Fatal! Get out! */
}
/* For each cycle */
}
else
if
(
fh
.
version
==
BCK_FILE_VERSION
)
{
/* Read the cycle data. */
...
...
@@ -135,6 +189,11 @@ bck_LoadBackup ()
for
(
d
=
0
;
d
<
ch
.
segments
;
d
++
)
{
csts
=
fread
(
&
dh
,
sizeof
dh
,
1
,
f
);
if
(
csts
!=
0
)
{
if
(
dh
.
namesize
>
0
)
{
namep
=
malloc
(
dh
.
namesize
+
1
);
csts
=
fread
(
namep
,
dh
.
namesize
+
1
,
1
,
f
);
}
else
namep
=
NULL
;
datap
=
malloc
(
dh
.
attrref
.
Size
);
csts
=
fread
(
datap
,
dh
.
attrref
.
Size
,
1
,
f
);
}
...
...
@@ -148,33 +207,43 @@ bck_LoadBackup ()
/* Find object */
if
(
dh
.
dynamic
)
{
strp
=
strchr
(
dh
.
dataname
,
'.'
);
/* always is a full object! */
strp
=
strchr
(
namep
,
'.'
);
/* always is a full object! */
if
(
strp
!=
NULL
)
*
strp
=
'\0'
;
/* Just make sure... */
sts
=
gdh_CreateObject
(
dh
.
dataname
,
dh
.
class
,
dh
.
attrref
.
Size
,
sts
=
gdh_CreateObject
(
namep
,
dh
.
class
,
dh
.
attrref
.
Size
,
&
objid
,
dh
.
attrref
.
Objid
,
0
,
pwr_cNObjid
);
if
(
strp
!=
NULL
)
*
strp
=
'.'
;
if
(
ODD
(
sts
))
sts
=
gdh_SetObjectInfo
(
dh
.
dataname
,
datap
,
dh
.
attrref
.
Size
);
sts
=
gdh_SetObjectInfo
(
namep
,
datap
,
dh
.
attrref
.
Size
);
}
/* Dynamic object */
else
{
sts
=
gdh_SetObjectInfoAttrref
(
&
dh
.
attrref
,
datap
,
dh
.
attrref
.
Size
);
sts
=
gdh_ObjidToName
(
dh
.
attrref
.
Objid
,
objectname
,
sizeof
(
objectname
),
cdh_mNName
);
if
(
ODD
(
sts
))
{
strcat
(
objectname
,
namep
);
sts
=
gdh_SetObjectInfo
(
objectname
,
datap
,
dh
.
attrref
.
Size
);
}
}
}
/* valid segment */
free
(
datap
);
if
(
EVEN
(
sts
))
{
errh_Error
(
"BACKUP error reloading %s, reason:
\n
%m"
,
dh
.
dataname
,
sts
);
errh_Error
(
"BACKUP error reloading %s, reason:
\n
%m"
,
namep
,
sts
);
sts
=
1
;
}
free
(
datap
);
free
(
namep
);
}
/* For all data segments */
if
(
EVEN
(
sts
))
break
;
/* Fatal! Get out! */
}
/* For each cycle */
}
/* File version format ok */
else
{
errh_Error
(
"BACKUP Cannot load backup file with version %d"
,
fh
.
version
);
}
}
/* Successful header read */
fclose
(
f
);
...
...
src/lib/rt/src/rt_bckdef.h
View file @
9c7f2ab4
/*
* Proview $Id: rt_bckdef.h,v 1.
2 2005-09-01 14:57:55
claes Exp $
* Proview $Id: rt_bckdef.h,v 1.
3 2008-03-27 09:59:57
claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -58,7 +58,7 @@
header area. The routines bck_falloc and bck_ffree are used
to allocate and free areas in this section. */
#define BCK_FILE_VERSION
4
#define BCK_FILE_VERSION
5
typedef
struct
{
...
...
@@ -99,6 +99,15 @@ typedef struct {
pwr_tString80
dataname
;
/* Name of object[.attribute] */
}
BCK_DATAHEAD_STRUCT
;
typedef
struct
{
pwr_sAttrRef
attrref
;
/* Objid for the object */
pwr_tClassId
class
;
/* Class of object */
pwr_tBoolean
valid
;
/* Validity flag */
pwr_tBoolean
dynamic
;
/* Dynamic object */
pwr_tInt16
namesize
;
/* Name of attribute [.attribute] */
}
bck_t_dataheader
;
#ifdef OS_ELN
/* Areas for synchronisation between methods and the main
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment