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
511210c9
Commit
511210c9
authored
Dec 22, 2016
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Neth, new request to get all instances for a specific class on a remote node
parent
fc0de9ca
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
381 additions
and
1 deletion
+381
-1
src/exe/rt_neth/src/rt_neth.c
src/exe/rt_neth/src/rt_neth.c
+87
-1
src/lib/rt/src/rt_cvolc.c
src/lib/rt/src/rt_cvolc.c
+57
-0
src/lib/rt/src/rt_cvolc.h
src/lib/rt/src/rt_cvolc.h
+11
-0
src/lib/rt/src/rt_gdh.c
src/lib/rt/src/rt_gdh.c
+102
-0
src/lib/rt/src/rt_gdh.h
src/lib/rt/src/rt_gdh.h
+17
-0
src/lib/rt/src/rt_net.x
src/lib/rt/src/rt_net.x
+107
-0
No files found.
src/exe/rt_neth/src/rt_neth.c
View file @
511210c9
...
...
@@ -70,6 +70,7 @@
#include "rt_cbuf.h"
#include "rt_pwr_msg.h"
#include "co_timelog.h"
#include "co_array.h"
/* Declare routines used by main. */
...
...
@@ -102,6 +103,7 @@ static void volumesR (qcom_sGet*);
static
void
volumes7
(
qcom_sGet
*
);
static
void
serverConnect
(
qcom_sGet
*
);
static
void
fileList
(
qcom_sGet
*
);
static
void
classList
(
qcom_sGet
*
);
#if 0
static void linkEvent (pwr_tUInt32, net_eEvent);
static void sendIdAck (gdb_sNode*);
...
...
@@ -149,6 +151,8 @@ static char *cMsg[net_eMsg_end] = {
"getCircBufferR"
,
"updateCircBuffer"
,
"updateCircBufferR"
,
"classList"
,
"classListR"
,
"net_eMsg_"
,
"volumes7"
};
...
...
@@ -190,6 +194,8 @@ static void (*fromApplication[net_eMsg_end])(qcom_sGet *) = {
bugError
,
/* net_eMsg_getCircBufferR, will never reach neth. */
cbuf_UpdateCircBufferMsg
,
/* net_eMsg_updateCircBuffer */
bugError
,
/* net_eMsg_updateCircBufferR, will never reach neth. */
classList
,
/* net_eMsg_classList */
bugError
,
/* net_eMsg_classListR, will never reach neth */
bugError
,
/* net_eMsg_ */
volumes7
};
...
...
@@ -1581,3 +1587,83 @@ fileList (
net_Reply
(
&
sts
,
get
,
&
put
,
0
);
}
static
void
classList
(
qcom_sGet
*
get
)
{
net_sClassList
*
mp
=
get
->
data
;
net_sClassListR
*
rmp
;
gdb_sNode
*
np
;
pwr_tStatus
sts
;
pwr_tUInt32
size
;
qcom_sPut
put
;
int
i
;
pwr_tOid
oid
;
int
listcnt
;
array_tCtx
arr
;
pwr_tAttrRef
aref
;
gdb_ScopeLock
{
np
=
hash_Search
(
&
sts
,
gdbroot
->
nid_ht
,
&
mp
->
hdr
.
nid
);
}
gdb_ScopeUnlock
;
if
(
gdbroot
->
db
->
log
.
b
.
id
)
{
errh_Info
(
"Sending 'classList' to %s (%s)"
,
np
->
name
,
cdh_NodeIdToString
(
NULL
,
np
->
nid
,
0
,
0
));
}
array_Init
(
&
arr
,
sizeof
(
pwr_tAttrRef
),
20
);
listcnt
=
0
;
if
(
mp
->
attrobjects
)
{
for
(
i
=
0
;
i
<
mp
->
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassListAttrRef
(
mp
->
cid
[
i
],
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
mp
->
cid
[
i
],
&
aref
,
&
aref
))
{
array_Add
(
arr
,
&
aref
);
listcnt
++
;
}
}
}
else
{
for
(
i
=
0
;
i
<
mp
->
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassList
(
mp
->
cid
[
i
],
&
oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
aref
=
cdh_ObjidToAref
(
oid
);
array_Add
(
arr
,
&
aref
);
listcnt
++
;
}
}
}
if
(
listcnt
==
0
)
size
=
sizeof
(
*
rmp
);
else
size
=
sizeof
(
*
rmp
)
+
(
listcnt
-
1
)
*
sizeof
(
pwr_tAttrRef
);
size
=
(
size
+
3
)
&
~
3
;
/* Size up to nearest multiple of 4. */
rmp
=
net_Alloc
(
&
sts
,
&
put
,
size
,
net_eMsg_classListR
);
if
(
rmp
==
NULL
)
{
errh_Error
(
"Failed to allocate 'classList' to %s (%s)"
,
np
->
name
,
cdh_NodeIdToString
(
NULL
,
np
->
nid
,
0
,
0
));
return
;
}
rmp
->
sts
=
sts
;
if
(
EVEN
(
sts
)
||
listcnt
==
0
)
{
rmp
->
listcnt
=
0
;
}
else
{
rmp
->
listcnt
=
listcnt
;
memcpy
(
rmp
->
classlist
,
arr
->
a
,
listcnt
*
sizeof
(
pwr_tAttrRef
));
}
array_Close
(
arr
);
net_Reply
(
&
sts
,
get
,
&
put
,
0
);
}
src/lib/rt/src/rt_cvolc.c
View file @
511210c9
...
...
@@ -588,3 +588,60 @@ cvolc_FileList (
net_Free
(
NULL
,
rsp
);
}
void
cvolc_ClassList
(
pwr_tStatus
*
sts
,
pwr_tNid
nid
,
int
cidcnt
,
pwr_tCid
*
cid
,
int
attrobjects
,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
)
{
gdb_sNode
*
np
=
NULL
;
net_sClassList
*
mp
;
net_sClassListR
*
rsp
;
qcom_sQid
tgt
;
qcom_sPut
put
;
qcom_sGet
get
;
gdb_sVolume
*
vp
=
NULL
;
np
=
hash_Search
(
sts
,
gdbroot
->
nid_ht
,
&
nid
);
if
(
np
==
NULL
)
pwr_ReturnVoid
(
sts
,
GDH__NOSUCHNODE
);
vp
=
hash_Search
(
sts
,
gdbroot
->
vid_ht
,
&
np
->
nid
);
if
(
vp
==
NULL
)
pwr_ReturnVoid
(
sts
,
GDH__NOSUCHVOL
);
if
(
!
vp
->
l
.
flags
.
b
.
isMounted
)
pwr_ReturnVoid
(
sts
,
GDH__NOTMOUNTED
);
if
(
!
(
vp
->
l
.
flags
.
m
&
gdb_mLo_global
))
pwr_ReturnVoid
(
sts
,
GDH__NOTMOUNTED
);
tgt
=
np
->
handler
;
mp
=
net_Alloc
(
sts
,
&
put
,
sizeof
(
*
mp
)
+
(
cidcnt
-
1
)
*
sizeof
(
pwr_tCid
),
net_eMsg_classList
);
if
(
mp
==
NULL
)
return
;
memcpy
(
mp
->
cid
,
cid
,
cidcnt
*
sizeof
(
pwr_tCid
));
mp
->
cidcnt
=
cidcnt
;
mp
->
attrobjects
=
attrobjects
;
rsp
=
net_Request
(
sts
,
&
tgt
,
&
put
,
&
get
,
net_eMsg_classListR
,
0
,
0
);
if
(
EVEN
(
*
sts
))
return
;
if
(
EVEN
(
rsp
->
sts
))
{
*
sts
=
rsp
->
sts
;
net_Free
(
NULL
,
rsp
);
return
;
}
*
listcnt
=
rsp
->
listcnt
;
*
classlist
=
calloc
(
rsp
->
listcnt
,
sizeof
(
pwr_tAttrRef
));
memcpy
(
*
classlist
,
rsp
->
classlist
,
rsp
->
listcnt
*
sizeof
(
pwr_tAttrRef
));
net_Free
(
NULL
,
rsp
);
}
src/lib/rt/src/rt_cvolc.h
View file @
511210c9
...
...
@@ -117,4 +117,15 @@ cvolc_FileList (
int
*
filecnt
);
void
cvolc_ClassList
(
pwr_tStatus
*
sts
,
pwr_tNid
nid
,
int
cidcnt
,
pwr_tCid
*
cid
,
int
attrobjects
,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
);
#endif
src/lib/rt/src/rt_gdh.c
View file @
511210c9
...
...
@@ -53,6 +53,7 @@
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#include "co_array.h"
#include "rt_gdh_msg.h"
#include "rt_hash_msg.h"
#include "rt_pwr_msg.h"
...
...
@@ -5138,3 +5139,104 @@ pwr_tStatus gdh_GetNextSubClass( pwr_tCid cid, pwr_tCid psubcid, pwr_tCid *subci
return
GDH__NOSUCHCLASS
;
}
pwr_tStatus
gdh_GetGlobalClassList
(
int
cidcnt
,
pwr_tCid
*
cid
,
int
attrobjects
,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
)
{
pwr_tStatus
sts
;
qcom_sNode
mynode
,
node
;
pwr_tNid
nid
;
array_tCtx
arr
;
pwr_tAttrRef
*
clist
;
int
ccnt
;
int
i
;
pwr_tObjid
oid
;
pwr_tAttrRef
aref
;
array_Init
(
&
arr
,
sizeof
(
pwr_tAttrRef
),
20
);
/* Add local objects */
if
(
attrobjects
)
{
for
(
i
=
0
;
i
<
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassListAttrRef
(
cid
[
i
],
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
cid
[
i
],
&
aref
,
&
aref
))
{
array_Add
(
arr
,
&
aref
);
}
}
}
else
{
for
(
i
=
0
;
i
<
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassList
(
cid
[
i
],
&
oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
aref
=
cdh_ObjidToAref
(
oid
);
array_Add
(
arr
,
&
aref
);
}
}
}
qcom_MyNode
(
&
sts
,
&
mynode
);
for
(
nid
=
qcom_cNNid
;
qcom_NextNode
(
&
sts
,
&
node
,
nid
);
nid
=
node
.
nid
)
{
if
(
node
.
nid
==
mynode
.
nid
)
continue
;
cvolc_ClassList
(
&
sts
,
node
.
nid
,
cidcnt
,
cid
,
attrobjects
,
&
clist
,
&
ccnt
);
if
(
EVEN
(
sts
))
continue
;
array_MAdd
(
arr
,
clist
,
ccnt
);
}
if
(
array_Size
(
arr
))
*
classlist
=
array_CopyArray
(
arr
);
else
{
*
classlist
=
0
;
sts
=
GDH__NOSUCHOBJ
;
}
*
listcnt
=
array_Size
(
arr
);
array_Close
(
arr
);
return
GDH__SUCCESS
;
}
pwr_tStatus
gdh_GetLocalClassList
(
int
cidcnt
,
pwr_tCid
*
cid
,
int
attrobjects
,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
)
{
pwr_tStatus
sts
;
array_tCtx
arr
;
int
i
;
pwr_tObjid
oid
;
pwr_tAttrRef
aref
;
array_Init
(
&
arr
,
sizeof
(
pwr_tAttrRef
),
20
);
/* Add local objects */
if
(
attrobjects
)
{
for
(
i
=
0
;
i
<
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassListAttrRef
(
cid
[
i
],
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
cid
[
i
],
&
aref
,
&
aref
))
{
array_Add
(
arr
,
&
aref
);
}
}
}
else
{
for
(
i
=
0
;
i
<
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassList
(
cid
[
i
],
&
oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
aref
=
cdh_ObjidToAref
(
oid
);
array_Add
(
arr
,
&
aref
);
}
}
}
if
(
array_Size
(
arr
))
*
classlist
=
array_CopyArray
(
arr
);
else
{
*
classlist
=
0
;
sts
=
GDH__NOSUCHOBJ
;
}
*
listcnt
=
array_Size
(
arr
);
array_Close
(
arr
);
return
GDH__SUCCESS
;
}
src/lib/rt/src/rt_gdh.h
View file @
511210c9
...
...
@@ -845,6 +845,23 @@ gdh_GetNextSubClass(
pwr_tCid
*
subcid
);
pwr_tStatus
gdh_GetGlobalClassList
(
int
cidcnt
,
pwr_tCid
*
cid
,
int
attrobjects
,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
);
pwr_tStatus
gdh_GetLocalClassList
(
int
cidcnt
,
pwr_tCid
*
cid
,
int
attrobjects
,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
);
/** @} */
...
...
src/lib/rt/src/rt_net.x
View file @
511210c9
...
...
@@ -115,6 +115,9 @@ enum net_eMsg {
net_eMsg_updateCircBuffer,
net_eMsg_updateCircBufferR,
net_eMsg_classList,
net_eMsg_classListR,
net_eMsg_, /* Not a valid message */
net_eMsg_volumes7, /* Version 7. Internal only */
...
...
@@ -1544,6 +1547,110 @@ struct net_sUpdateCircBuffer {
%}
#endif
#ifdef RPC_HDR
%
%
%typedef struct {
% net_sMessage hdr;
% pwr_tUInt32 cidcnt;
% pwr_tUInt32 attrobjects;
% pwr_tClassId cid[1];
%} net_sClassList;
%
%bool_t xdr_net_sClassList(XDR *xdrs, net_sClassList *objp);
%
#elif defined RPC_XDR
%
%bool_t
%xdr_net_sClassList(XDR *xdrs, net_sClassList *objp)
%{
% int cidcnt;
% int i;
%
% if (xdrs->x_op == XDR_DECODE) {
% cidcnt = (int) ntohl(objp->cidcnt);
% } else {
% cidcnt = objp->cidcnt;
% }
%
% if (!xdr_net_sMessage(xdrs, &objp->hdr)) {
% return (FALSE);
% }
%
% if (!xdr_pwr_tUInt32(xdrs, &objp->cidcnt )) {
% return (FALSE);
% }
% if (!xdr_pwr_tUInt32(xdrs, &objp->attrobjects )) {
% return (FALSE);
% }
% for ( i = 0; i < cidcnt; i++) {
% if (!xdr_pwr_tClassId(xdrs, &objp->cid[i]))
% return (FALSE);
% }
% return (TRUE);
%
%}
#endif
#ifdef RPC_HDR
%
%
%typedef struct {
% net_sMessage hdr; /**< Header */
% pwr_tStatus sts; /**< Status */
% pwr_tUInt32 listcnt; /**< Number of objects found. */
% pwr_sAttrRef classlist[1]; /**< List of instances */
%} net_sClassListR;
%
%bool_t xdr_net_sClassListR(XDR *xdrs, net_sClassListR *objp);
%
#elif defined RPC_XDR
%
%bool_t
%xdr_net_sClassListR(XDR *xdrs, net_sClassListR *objp)
%{
% int listcnt;
% pwr_tStatus sts;
% int i;
%
% if (xdrs->x_op == XDR_DECODE) {
% listcnt = (int) ntohl(objp->listcnt);
% sts = (int) ntohl(objp->sts);
% } else {
% listcnt = objp->listcnt;
% sts = objp->sts;
% }
%
% if (!xdr_net_sMessage(xdrs, &objp->hdr)) {
% return (FALSE);
% }
% if (!xdr_pwr_tStatus(xdrs, &objp->sts)) {
% return (FALSE);
% }
%
% if (EVEN(sts)) {
% listcnt = 0;
% if (!xdr_pwr_tUInt32(xdrs, (unsigned int *)&listcnt)) {
% return (FALSE);
% }
% return (TRUE);
% }
%
%
% if (!xdr_pwr_tUInt32(xdrs, &objp->listcnt )) {
% return (FALSE);
% }
% for ( i = 0; i < listcnt; i++) {
% if (!xdr_pwr_sAttrRef(xdrs, &objp->classlist[i])) {
% return (FALSE);
% }
% }
% return (TRUE);
%
%}
#endif
...
...
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