All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
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	[thread overview]
Message-ID: <570D661A.5080106@gmail.com> (raw)
In-Reply-To: <1460426175-25501-5-git-send-email-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

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 = msg->header;
>
> -	hdr->serial = serial;
> +	if (_dbus_message_is_gvariant(msg)) {
> +		if (_dbus_message_get_endian(msg) ==
> +				DBUS_MESSAGE_LITTLE_ENDIAN) {
> +			hdr->serial = serial;
> +			hdr->field_length = 0;
> +		} else {
> +			hdr->serial = 0;
> +			hdr->field_length = 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 = serial;
>   }
>
>   uint32_t _dbus_message_get_serial(struct l_dbus_message *msg)
>   {
>   	struct dbus_header *hdr = msg->header;
>
> +	if (_dbus_message_is_gvariant(msg) && _dbus_message_get_endian(msg) ==
> +			DBUS_MESSAGE_BIG_ENDIAN)
> +		return hdr->field_length;
> +
>   	return hdr->serial;
>   }
>

Regards,
-Denis


  reply	other threads:[~2016-04-12 21:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12  1:56 [PATCH v2 01/11] dbus: Validate field type in get_header_field Andrew Zaborowski
2016-04-12  1:56 ` [PATCH v2 02/11] dbus: Check some more return values when parsing messages Andrew Zaborowski
2016-04-12 18:53   ` Denis Kenzior
2016-04-12  1:56 ` [PATCH v2 03/11] dbus: GVariant header field identifiers are 64-bit Andrew Zaborowski
2016-04-12  1:56 ` [PATCH v2 04/11] dbus: Fix parsing GVariant header/body information Andrew Zaborowski
2016-04-12 21:15   ` Denis Kenzior
2016-04-12  1:56 ` [PATCH v2 05/11] dbus: GVariant message cookie and reply cookie are 64-bit Andrew Zaborowski
2016-04-12 21:18   ` Denis Kenzior [this message]
2016-04-12 22:00     ` Andrzej Zaborowski
2016-04-12  1:56 ` [PATCH v2 06/11] dbus: Don't rely on 1st KDBUS_ITEM_PAYLOAD_OFF being the header Andrew Zaborowski
2016-04-12  1:56 ` [PATCH v2 07/11] gvariant: Utility to build GVariant message out of header+body Andrew Zaborowski
2016-04-12 21:44   ` Denis Kenzior
2016-04-12 22:06     ` Andrzej Zaborowski
2016-04-12  1:56 ` [PATCH v2 08/11] dbus: Fix the kdbus message encoding Andrew Zaborowski
2016-04-12 21:46   ` Denis Kenzior
2016-04-12 22:10     ` Andrzej Zaborowski
2016-04-12 22:25       ` Denis Kenzior
2016-04-12 23:06         ` Andrzej Zaborowski
2016-04-12 23:11           ` Andrzej Zaborowski
2016-04-12 23:30             ` Denis Kenzior
2016-04-12 23:18           ` Denis Kenzior
2016-04-12 23:30             ` Andrzej Zaborowski
2016-04-12 23:42               ` Denis Kenzior
2016-04-13  0:14               ` Denis Kenzior
2016-04-13  0:23                 ` Andrzej Zaborowski
2016-04-12  1:56 ` [PATCH v2 09/11] dbus: Rename _dbus_header_is_valid to _dbus1_header_is_valid Andrew Zaborowski
2016-04-12  1:56 ` [PATCH v2 10/11] gvariant: Fix empty structure/array parsing and error check Andrew Zaborowski
2016-04-12  1:56 ` [PATCH v2 11/11] unit: Fix GVariant test messages Andrew Zaborowski
2016-04-12 18:51 ` [PATCH v2 01/11] dbus: Validate field type in get_header_field Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570D661A.5080106@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.