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
ec9c2ef0
Commit
ec9c2ef0
authored
Jun 26, 2009
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Template for upgrade program remade
parent
7229c04b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
0 deletions
+154
-0
wb/exe/wb_upgrade/src/os_linux/hw_x86/makefile.no
wb/exe/wb_upgrade/src/os_linux/hw_x86/makefile.no
+12
-0
wb/exe/wb_upgrade/src/os_linux/link_rule.mk
wb/exe/wb_upgrade/src/os_linux/link_rule.mk
+12
-0
wb/exe/wb_upgrade/src/wb_upgrade.cpp
wb/exe/wb_upgrade/src/wb_upgrade.cpp
+130
-0
No files found.
wb/exe/wb_upgrade/src/os_linux/hw_x86/makefile.no
0 → 100644
View file @
ec9c2ef0
include
$(pwre_dir_symbols)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
wb/exe/wb_upgrade/src/os_linux/link_rule.mk
0 → 100644
View file @
ec9c2ef0
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ldxx)
$(elinkflags)
$(domap)
-o
$(export_exe)
\
$(export_obj)
$(objects)
$(wb_msg_eobjs)
$(rt_msg_eobjs)
\
$(pwr_eobj)
/rt_io_user.o
$(pwr_obj)
/wb_provider.o
\
-L
/usr/local/BerkeleyDB.4.0/lib
\
-lpwr_wb
-lpwr_rt
-lpwr_ge
-lpwr_flow
-lpwr_glow
-lpwr_co
\
-lpwr_msg_dummy
-lantlr
\
-lrpcsvc
-lpthread
-lm
-lrt
-ldb_cxx
-lz
$(linkmysql)
endif
wb/exe/wb_upgrade/src/wb_upgrade.c
→
wb/exe/wb_upgrade/src/wb_upgrade.c
pp
View file @
ec9c2ef0
...
...
@@ -29,140 +29,102 @@
BaseClasses-Drive */
#include <stdlib.h>
#include <iostream>
#include "pwr.h"
#include "pwr_class.h"
#include "wb_ldh.h"
#include "wb_foe.h"
#include "wb_trv.h"
#include "wb_foe_macros.h"
#include "wb_foe_msg.h"
#include "wb_env.h"
#include "wb_volume.h"
#include "wb_session.h"
#include "wb_object.h"
#include "pwr_baseclasses.h"
#define CHECK_STS \
if ( EVEN(sts)) \
{ \
error_msg( sts); \
exit(sts); \
}
static
void
usage
()
{
printf
(
"
\n
Usage: wb_upgrade -v 'volumename'
\n\n
"
);
}
static
int
set_object_mask
(
pwr_tObjid
Objdid
,
ldh_tSesContext
ldhses
,
unsigned
long
dum0
,
unsigned
long
dum1
,
unsigned
long
dum2
,
unsigned
long
dum3
);
static
int
set_mask
(
ldh_tSesContext
ldhses
,
pwr_tClassId
classid
);
static
int
doc_count
=
0
;
static
int
set_object_mask
(
pwr_tObjid
Objdid
,
ldh_tSesContext
ldhses
,
unsigned
long
dum0
,
unsigned
long
dum1
,
unsigned
long
dum2
,
unsigned
long
dum3
)
static
void
process
(
wb_session
&
session
,
wb_object
&
o
)
{
pwr_sPlcNode
*
nodebuffer
;
int
sts
,
size
;
pwr_eClass
class
;
pwr_sPlcNode
plcnode
;
sts
=
ldh_GetObjectBuffer
(
ldhses
,
Objdid
,
"DevBody"
,
"PlcNode"
,
&
class
,
(
char
**
)
&
nodebuffer
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
o
.
cid
()
==
pwr_cClass_csub
)
{
printf
(
"Object: %s
\n
"
,
o
.
longName
().
c_str
());
sts
=
ldh_SetObjectPar
(
ldhses
,
Objdid
,
"DevBody"
,
"DocumentOrientation"
,
(
char
*
)
&
nodebuffer
->
mask
[
1
],
4
);
if
(
EVEN
(
sts
))
return
sts
;
wb_attribute
a
=
session
.
attribute
(
o
.
oid
(),
"DevBody"
,
"PlcNode"
);
if
(
!
a
)
exit
(
0
);
sts
=
ldh_SetObjectPar
(
ldhses
,
Objdid
,
"DevBody"
,
"DocumentSize"
,
(
char
*
)
&
nodebuffer
->
mask
[
0
],
4
);
if
(
EVEN
(
sts
))
return
sts
;
a
.
value
(
&
plcnode
);
XtFree
(
(
char
*
)
nodebuffer
);
printf
(
"subwindow: %d, woid: %u,%u
\n
"
,
plcnode
.
subwindow
,
plcnode
.
subwind_oid
[
0
].
vid
,
plcnode
.
subwind_oid
[
0
].
oix
);
doc_count
++
;
return
FOE__SUCCESS
;
}
wb_object
c
=
o
.
first
();
if
(
c
&&
c
.
cid
()
==
pwr_cClass_windowplc
)
{
plcnode
.
subwind_oid
[
0
].
vid
=
c
.
oid
().
vid
;
plcnode
.
subwind_oid
[
0
].
oix
=
c
.
oid
().
oix
;
static
int
set_mask
(
ldh_tSesContext
ldhses
,
pwr_tClassId
classid
)
{
int
sts
;
pwr_tClassId
class
[
2
]
=
{
0
,
0
};
doc_count
=
0
;
class
[
0
]
=
classid
;
printf
(
"subwindow: %d, woid: %u,%u
\n
"
,
plcnode
.
subwindow
,
plcnode
.
subwind_oid
[
0
].
vid
,
plcnode
.
subwind_oid
[
0
].
oix
);
/* Get all objects */
sts
=
trv_get_objects_hier_class_name
(
ldhses
,
pwr_cNObjid
,
class
,
0
,
&
set_object_mask
,
ldhses
,
0
,
0
,
0
,
0
);
if
(
EVEN
(
sts
))
return
sts
;
session
.
writeAttribute
(
a
,
&
plcnode
,
sizeof
(
plcnode
));
if
(
!
a
)
cout
<<
"** Write error"
<<
endl
;
}
}
printf
(
"-- %d Document objects converted
\n
"
,
doc_count
);
return
FOE__SUCCESS
;
for
(
wb_object
c
=
o
.
first
();
c
.
oddSts
();
c
=
c
.
after
())
{
process
(
session
,
c
);
}
}
int
main
()
int
main
(
int
argc
,
char
*
argv
[]
)
{
ldh_tWBContext
wbctx
;
ldh_tSesContext
ldhses
;
int
sts
;
pwr_tVolumeId
volid
;
ldh_tVolContext
volctx
;
char
name
[
80
];
pwr_tClassId
class
;
int
size
;
/* Open session */
sts
=
ldh_OpenWB
(
&
wbctx
,
0
,
0
);
CHECK_STS
;
sts
=
ldh_GetVolumeList
(
wbctx
,
&
volid
);
while
(
ODD
(
sts
)
)
{
sts
=
ldh_GetVolumeClass
(
wbctx
,
volid
,
&
class
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_VolumeIdToName
(
wbctx
,
volid
,
name
,
sizeof
(
name
),
&
size
);
CHECK_STS
;
printf
(
"-- Processing volume %s
\n
"
,
name
);
if
(
class
==
pwr_eClass_RootVolume
)
{
sts
=
ldh_AttachVolume
(
wbctx
,
volid
,
&
volctx
);
CHECK_STS
;
sts
=
ldh_OpenSession
(
&
ldhses
,
volctx
,
ldh_eAccess_ReadWrite
,
ldh_eUtility_Pwr
);
CHECK_STS
;
sts
=
set_mask
(
ldhses
,
pwr_cClass_Document
);
CHECK_STS
;
sts
=
set_mask
(
ldhses
,
pwr_cClass_DocUser1
);
CHECK_STS
;
sts
=
set_mask
(
ldhses
,
pwr_cClass_DocUser2
);
CHECK_STS
;
sts
=
ldh_SaveSession
(
ldhses
);
CHECK_STS
;
sts
=
ldh_CloseSession
(
ldhses
);
CHECK_STS
;
sts
=
ldh_DetachVolume
(
wbctx
,
volctx
);
CHECK_STS
;
}
sts
=
ldh_GetNextVolume
(
wbctx
,
volid
,
&
volid
);
}
return
0
;
pwr_tObjName
volume
;
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
argv
[
i
][
0
]
==
'-'
)
{
switch
(
argv
[
i
][
1
])
{
case
'h'
:
usage
();
exit
(
0
);
case
'v'
:
if
(
i
+
1
>=
argc
)
{
usage
();
exit
(
0
);
}
strncpy
(
volume
,
argv
[
i
+
1
],
sizeof
(
volume
));
i
++
;
break
;
default:
printf
(
"Unknown argument: %s
\n
"
,
argv
[
i
]);
usage
();
exit
(
0
);
}
}
}
wb_env
env
;
env
.
load
(
volume
);
wb_volume
vol
;
for
(
vol
=
env
.
volume
();
vol
.
oddSts
();
vol
.
next
())
{
if
(
vol
.
cid
()
==
pwr_eClass_RootVolume
||
vol
.
cid
()
==
pwr_eClass_SubVolume
||
vol
.
cid
()
==
pwr_eClass_SharedVolume
)
{
break
;
}
}
if
(
vol
.
evenSts
())
exit
(
vol
.
sts
());
wb_session
session
(
vol
);
if
(
!
session
.
access
(
ldh_eAccess_ReadWrite
))
{
cout
<<
"** No write access"
<<
endl
;
exit
(
0
);
}
wb_object
o
;
for
(
o
=
session
.
object
();
o
.
oddSts
();
o
=
o
.
after
())
{
process
(
session
,
o
);
}
session
.
commit
();
}
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