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
3eb56ba4
Commit
3eb56ba4
authored
Apr 25, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New backup file version
parent
23caf521
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
7 deletions
+81
-7
src/lib/rt/src/rt_bck_load.c
src/lib/rt/src/rt_bck_load.c
+72
-5
src/lib/rt/src/rt_bckdef.h
src/lib/rt/src/rt_bckdef.h
+9
-2
No files found.
src/lib/rt/src/rt_bck_load.c
View file @
3eb56ba4
/*
* Proview $Id: rt_bck_load.c,v 1.
7 2008-04-16 08:35:01
claes Exp $
* Proview $Id: rt_bck_load.c,v 1.
8 2008-04-25 11:27:17
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -75,7 +75,8 @@ bck_LoadBackup ()
pwr_sClass_Backup_Conf
*
backup_confp
;
/* Backup_Conf object pointer */
FILE
*
f
;
BCK_FILEHEAD_STRUCT
fh
;
/* File header */
BCK_CYCLEHEAD_STRUCT
ch
;
BCK_CYCLEHEAD_STRUCT
ch_old
;
bck_t_cycleheader
ch
;
BCK_DATAHEAD_STRUCT
dh_old
;
bck_t_writeheader
dh
;
pwr_tUInt32
c
;
...
...
@@ -124,17 +125,17 @@ bck_LoadBackup ()
if
(
csts
==
0
)
{
SET_ERRNO_STS
;
}
else
{
if
(
fh
.
version
<
BCK_FILE_VERSION
)
{
if
(
fh
.
version
<
BCK_FILE_VERSION
-
1
)
{
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
);
fread
(
&
ch
_old
,
sizeof
ch_old
,
1
,
f
);
/* Work thru the data segments */
for
(
d
=
0
;
d
<
ch
.
segments
;
d
++
)
{
for
(
d
=
0
;
d
<
ch
_old
.
segments
;
d
++
)
{
csts
=
fread
(
&
dh_old
,
sizeof
dh_old
,
1
,
f
);
if
(
csts
!=
0
)
{
datap
=
malloc
(
dh_old
.
attrref
.
Size
);
...
...
@@ -173,6 +174,72 @@ bck_LoadBackup ()
sts
=
1
;
}
}
/* For all data segments */
if
(
EVEN
(
sts
))
break
;
/* Fatal! Get out! */
}
/* For each cycle */
}
else
if
(
fh
.
version
==
BCK_FILE_VERSION
-
1
)
{
/* Read the cycle data. */
for
(
c
=
0
;
c
<
2
;
c
++
)
{
fseek
(
f
,
fh
.
curdata
[
c
],
0
);
fread
(
&
ch_old
,
sizeof
ch_old
,
1
,
f
);
/* Work thru the data segments */
for
(
d
=
0
;
d
<
ch_old
.
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
.
size
);
csts
=
fread
(
datap
,
dh
.
size
,
1
,
f
);
}
if
(
csts
==
0
)
{
SET_ERRNO_STS
;
break
;
}
if
(
dh
.
valid
)
{
/* Find object */
if
(
dh
.
dynamic
)
{
strp
=
strchr
(
namep
,
'.'
);
/* always is a full object! */
if
(
strp
!=
NULL
)
*
strp
=
'\0'
;
/* Just make sure... */
sts
=
gdh_CreateObject
(
namep
,
dh
.
class
,
dh
.
size
,
&
objid
,
dh
.
objid
,
0
,
pwr_cNObjid
);
if
(
strp
!=
NULL
)
*
strp
=
'.'
;
if
(
ODD
(
sts
))
sts
=
gdh_SetObjectInfo
(
namep
,
datap
,
dh
.
size
);
strncpy
(
objectname
,
namep
,
pwr_cSizAName
);
}
/* Dynamic object */
else
{
sts
=
gdh_ObjidToName
(
dh
.
objid
,
objectname
,
sizeof
(
objectname
),
cdh_mNName
);
if
(
ODD
(
sts
))
{
strcat
(
objectname
,
namep
);
sts
=
gdh_SetObjectInfo
(
objectname
,
datap
,
dh
.
size
);
}
}
}
/* valid segment */
if
(
EVEN
(
sts
))
{
errh_Error
(
"BACKUP error reloading %s, reason:
\n
%m"
,
objectname
,
sts
);
sts
=
1
;
}
free
(
datap
);
free
(
namep
);
}
/* For all data segments */
if
(
EVEN
(
sts
))
break
;
/* Fatal! Get out! */
}
/* For each cycle */
...
...
src/lib/rt/src/rt_bckdef.h
View file @
3eb56ba4
/*
* Proview $Id: rt_bckdef.h,v 1.
4 2008-03-31 13:47:00
claes Exp $
* Proview $Id: rt_bckdef.h,v 1.
5 2008-04-25 11:27:17
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund 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
5
#define BCK_FILE_VERSION
6
typedef
struct
{
...
...
@@ -84,6 +84,13 @@ typedef struct {
pwr_tUInt16
segments
;
/* # of segments in section */
}
BCK_CYCLEHEAD_STRUCT
;
typedef
struct
{
pwr_tTime
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_t_cycleheader
;
/* Each data section area is divided in a number of segments,
each containing information pointed out by a single backup
object. The segment starts with a header which contains the
...
...
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