[evlog-dev] Structures and architecture
Benoit Guillon <[email protected]> Wed, 19 May 2004 10:15:01 +0200
| Newsgroups | gmane.linux.kernel.event-logging |
|---|---|
| Message-ID | <[email protected]> |
--------------8A966C30FB86002B6A75CB3F
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: Quoted-Printable
Hello,
I'm trying to use the templates feature, and first of all I just want to
say that it's a really good thing.
However I've some troubles when using it between platforms with
different endianness. Typically, I log events on PPC boards (big
endian), collected and evlviewed on an Intel PC (little endian). It
works fine when the template contains only basic types (int, string,
char, etc.) but endianess is not taken into account when the template
uses structures.
I don't know if it's a bug or a "feature" (e.g. structure cannot be
easily mapped on another architecture?) but I've just patched template.c
to make it work (in my case basic types have the same length and
alignment is the same). Since the code is a bit complex, I am not sure I
did the right thing (maybe there is a clever or a more powerful way to
fix it). I just inherited the architecture to the cloned attribute
template in the case isStruct(att) of the function populateTmpl() of
template.c:
@@ -3256,6 +3263,8 @@
att->ta_type->u.st_template);
}
st =3D att->ta_value.val_struct;
+ /* inherit the architecture */
+ st->tm_arch =3D template->tm_arch;
populateTmpl(st, notes);
if (st->tm_data_size > 0) {
att->ta_flags |=3D EVL_ATTR_EXISTS;
I haven't checked this other case, but maybe it should be done too in
function populateArrayOfStructs():
@@ -3061,6 +3068,7 @@
for (ns =3D 0; ns < nel; ns++) {
template_t *st =3D _evlCloneTemplate(att->ta_type->u.st_template);
+ st->tm_arch =3D template->tm_arch;
populateTmpl(st, notes);
if (st->tm_data_size =3D=3D 0) {
_evlFreeTemplate(st);
Bye,
--
Beno=EEt Guillon [email protected]
--------------8A966C30FB86002B6A75CB3F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7Bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<p>I'm trying to use the templates feature, and first of all I just want
to say that it's a really good thing.
<p>However I've some troubles when using it between platforms with different
endianness. Typically, I log events on PPC boards (big endian), collected
and evlviewed on an Intel PC (little endian). It works fine when the template
contains only basic types (int, string, char, etc.) but endianess is not
taken into account when the template uses structures.
<p>I don't know if it's a bug or a "feature" (e.g. structure cannot be
easily mapped on another architecture?) but I've just patched template.c
to make it work (in my case basic types have the same length and alignment
is the same). Since the code is a bit complex, I am not sure I did the
right thing (maybe there is a clever or a more powerful way to fix it).
I just inherited the architecture to the cloned attribute template in the
case isStruct(att) of the function populateTmpl() of template.c:
<p><tt>@@ -3256,6 +3263,8 @@</tt>
<br><tt> att->ta_type->u.st_template);</tt>
<br><tt> }</tt>
<br><tt> st = att->ta_value.val_struct;</tt>
<br><tt>+ /* inherit the architecture */</tt>
<br><tt>+ st->tm_arch = template->tm_arch;</tt>
<br><tt> populateTmpl(st, notes);</tt>
<br><tt> if (st->tm_data_size > 0) {</tt>
<br><tt> att->ta_flags |= EVL_ATTR_EXISTS;</tt>
<p>I haven't checked this other case, but maybe it should be done too in
function populateArrayOfStructs():
<p><tt>@@ -3061,6 +3068,7 @@</tt>
<br><tt> </tt>
<br><tt> for (ns = 0; ns < nel; ns++) {</tt>
<br><tt> template_t *st = _evlCloneTemplate(att->ta_type->u.st_template);</tt>
<br><tt>+ st->tm_arch = template->tm_arch;</tt>
<br><tt> populateTmpl(st, notes);</tt>
<br><tt> if (st->tm_data_size == 0) {</tt>
<br><tt> _evlFreeTemplate(st);</tt>
<p>Bye,
<pre>--
Benoît Guillon [email protected]
</pre>
</html>
--------------8A966C30FB86002B6A75CB3F--
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click