Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
52de3ed3
Commit
52de3ed3
authored
Dec 08, 2014
by
Thomas Jahns
🤸
Browse files
Eliminate SEPARATOR from resource serialization.
parent
f27fcb92
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/resource_handle.c
View file @
52de3ed3
...
...
@@ -538,6 +538,10 @@ reshPackResource_intern(int resH, const resOps *ops, void *buf, int buf_size, in
curr
->
res
.
v
.
ops
->
valPack
(
curr
->
res
.
v
.
val
,
buf
,
buf_size
,
position
,
context
);
}
enum
{
resHPackHeaderNInt
=
2
,
resHDeleteNInt
=
2
,
};
static
int
getPackBufferSize
(
void
*
context
)
{
...
...
@@ -546,7 +550,7 @@ static int getPackBufferSize(void *context)
int
nsp
=
namespaceGetActive
();
/* pack start marker, namespace and sererator marker */
packBufferSize
+=
3
*
(
intpacksize
=
serializeGetSize
(
1
,
DATATYPE_INT
,
context
));
packBufferSize
+=
resHPackHeaderNInt
*
(
intpacksize
=
serializeGetSize
(
1
,
DATATYPE_INT
,
context
));
/* pack resources, type marker and seperator marker */
listElem_t
*
r
=
resHList
[
nsp
].
resources
;
...
...
@@ -555,15 +559,15 @@ static int getPackBufferSize(void *context)
{
if
(
r
[
i
].
status
==
RESH_DESYNC_DELETED
)
{
packBufferSize
+=
3
*
intpacksize
;
packBufferSize
+=
resHDeleteNInt
*
intpacksize
;
}
else
if
(
r
[
i
].
status
==
RESH_DESYNC_IN_USE
)
{
xassert
(
r
[
i
].
res
.
v
.
ops
);
/*
message plus frame of 2 ints
*/
/*
packed resource plus 1 int for type
*/
packBufferSize
+=
r
[
i
].
res
.
v
.
ops
->
valGetPackSize
(
r
[
i
].
res
.
v
.
val
,
context
)
+
2
*
intpacksize
;
+
intpacksize
;
}
}
/* end marker */
...
...
@@ -584,7 +588,7 @@ void reshPackBufferDestroy ( char ** buffer )
void
reshPackBufferCreate
(
char
**
packBuffer
,
int
*
packBufferSize
,
void
*
context
)
{
int
i
,
packBufferPos
=
0
;
int
start
=
START
,
end
=
END
,
sep
=
SEPARATOR
,
type
;
int
end
=
END
;
xassert
(
packBuffer
);
...
...
@@ -596,8 +600,8 @@ void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
char
*
pB
=
*
packBuffer
=
(
char
*
)
xcalloc
(
1
,
(
size_t
)
pBSize
);
{
int
header
[
3
]
=
{
start
,
nsp
,
se
p
};
serializePack
(
header
,
3
,
DATATYPE_INT
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
int
header
[
resHPackHeaderNInt
]
=
{
START
,
ns
p
};
serializePack
(
header
,
resHPackHeaderNInt
,
DATATYPE_INT
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
}
listElem_t
*
r
=
resHList
[
nsp
].
resources
;
...
...
@@ -606,23 +610,21 @@ void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
{
if
(
r
[
i
].
status
==
RESH_DESYNC_DELETED
)
{
enum
{
del_ints
=
3
};
int
temp
[
del_ints
]
=
{
RESH_DELETE
,
namespaceIdxEncode2
(
nsp
,
i
)
,
SEPARATOR
};
serializePack
(
temp
,
del_i
nt
s
,
DATATYPE_INT
,
int
temp
[
resHDeleteNInt
]
=
{
RESH_DELETE
,
namespaceIdxEncode2
(
nsp
,
i
)
};
serializePack
(
temp
,
resHDeleteNI
nt
,
DATATYPE_INT
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
}
else
{
listElem_t
*
curr
=
r
+
i
;
xassert
(
curr
->
res
.
v
.
ops
);
type
=
curr
->
res
.
v
.
ops
->
valTxCode
();
int
type
=
curr
->
res
.
v
.
ops
->
valTxCode
();
if
(
!
type
)
continue
;
serializePack
(
&
type
,
1
,
DATATYPE_INT
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
curr
->
res
.
v
.
ops
->
valPack
(
curr
->
res
.
v
.
val
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
serializePack
(
&
sep
,
1
,
DATATYPE_INT
,
pB
,
pBSize
,
&
packBufferPos
,
context
);
}
r
[
i
].
status
&=
~
RESH_SYNC_BIT
;
}
...
...
src/resource_unpack.c
View file @
52de3ed3
...
...
@@ -83,10 +83,6 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
default:
xabort
(
"TOKEN MAPS NO VALID DATATYPE"
);
}
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
&
unpackBufferPos
,
&
token2
,
1
,
DATATYPE_INT
,
context
);
xassert
(
token2
==
SEPARATOR
);
}
for
(
int
i
=
0
;
i
<
numAssociations
;
++
i
)
{
...
...
src/resource_unpack.h
View file @
52de3ed3
...
...
@@ -15,7 +15,6 @@ enum
VLIST
=
7
,
RESH_DELETE
,
START
=
55555555
,
SEPARATOR
=
66666666
,
END
=
99999999
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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