From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3639016146049837173==" MIME-Version: 1.0 From: Denis Kenzior Subject: Re: [PATCH v2 05/11] dbus: GVariant message cookie and reply cookie are 64-bit Date: Tue, 12 Apr 2016 16:18:18 -0500 Message-ID: <570D661A.5080106@gmail.com> In-Reply-To: <1460426175-25501-5-git-send-email-andrew.zaborowski@intel.com> List-Id: To: ell@lists.01.org --===============3639016146049837173== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Andrew, On 04/11/2016 08:56 PM, Andrew Zaborowski wrote: > They're 64-bit but the systemd docs discourage using the upper 32 bits, > so we take advantage of that and only support cookie values that fit 32 > bits to avoid too big code changes (we use the dbus1 header layout for > the cookie storage so we'd have to move the cookie/serial out of that > header like we do with sender, path, etc.). This only tries to fix the > parsing and encoding. > --- > ell/dbus-message.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++-= ------- > 1 file changed, 52 insertions(+), 8 deletions(-) > > diff --git a/ell/dbus-message.c b/ell/dbus-message.c > index 964b925..eb47eb3 100644 > --- a/ell/dbus-message.c > +++ b/ell/dbus-message.c > @@ -111,13 +111,27 @@ void _dbus_message_set_serial(struct l_dbus_message= *msg, uint32_t serial) > { > struct dbus_header *hdr =3D msg->header; > > - hdr->serial =3D serial; > + if (_dbus_message_is_gvariant(msg)) { > + if (_dbus_message_get_endian(msg) =3D=3D > + DBUS_MESSAGE_LITTLE_ENDIAN) { > + hdr->serial =3D serial; > + hdr->field_length =3D 0; > + } else { > + hdr->serial =3D 0; > + hdr->field_length =3D serial; > + } This looks really complicated. Can we just add a union to dbus_header = instead to reflect the new GVariant serialization format? > + } else > + hdr->serial =3D serial; > } > > uint32_t _dbus_message_get_serial(struct l_dbus_message *msg) > { > struct dbus_header *hdr =3D msg->header; > > + if (_dbus_message_is_gvariant(msg) && _dbus_message_get_endian(msg) =3D= =3D > + DBUS_MESSAGE_BIG_ENDIAN) > + return hdr->field_length; > + > return hdr->serial; > } > Regards, -Denis --===============3639016146049837173==--