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 1/3] dbus: Add AddMatch and RemoveMatch support
Date: Thu, 12 Feb 2015 21:00:30 -0600	[thread overview]
Message-ID: <54DD68CE.7060101@gmail.com> (raw)
In-Reply-To: <1423741733-26743-2-git-send-email-jukka.rissanen@linux.intel.com>

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

Hi Jukka,

On 02/12/2015 05:48 AM, Jukka Rissanen wrote:
> We do not check for errors as they are typically unrecoverable
> in this case and in most cases ignored anyway.
>
> This is the comment from libdbus API documentation for
> dbus_bus_add_match() about error checking:
>
> "If you pass NULL for the error, this function will not block;
> the match thus won't be added until you flush the connection,
> and if there's an error adding the match you won't find out
> about it. This is generally acceptable, since the possible
> errors (including a lack of resources in the bus, the connection
> having exceeded its quota of active match rules, or the match
> rule being unparseable) are generally unrecoverable."
> ---
>   ell/dbus.c | 26 ++++++++++++++++++++++++++
>   ell/dbus.h |  4 ++++
>   2 files changed, 30 insertions(+)
>
> diff --git a/ell/dbus.c b/ell/dbus.c
> index 4c4ba2d..96a1230 100644
> --- a/ell/dbus.c
> +++ b/ell/dbus.c
> @@ -1227,3 +1227,29 @@ LIB_EXPORT bool l_dbus_unregister_interface(struct l_dbus *dbus,
>
>   	return _dbus_object_tree_unregister(dbus->tree, path, interface);
>   }
> +
> +static void send_match(struct l_dbus *dbus, const char *rule,
> +						const char *method)
> +{
> +	struct l_dbus_message *message;
> +
> +	message = l_dbus_message_new_method_call(dbus,
> +						DBUS_SERVICE_DBUS,
> +						DBUS_PATH_DBUS,
> +						DBUS_INTERFACE_DBUS,
> +						method);
> +
> +	l_dbus_message_set_arguments(message, "s", rule);
> +
> +	send_message(dbus, false, message, NULL, NULL, NULL);
> +}
> +
> +LIB_EXPORT void l_dbus_bus_add_match(struct l_dbus *dbus, const char *rule)

These functions should not be exported / become private.

> +{
> +	send_match(dbus, rule, "AddMatch");
> +}
> +
> +LIB_EXPORT void l_dbus_bus_remove_match(struct l_dbus *dbus, const char *rule)
> +{

As above

> +	send_match(dbus, rule, "RemoveMatch");
> +}
> diff --git a/ell/dbus.h b/ell/dbus.h
> index a6ad109..d5890a5 100644
> --- a/ell/dbus.h
> +++ b/ell/dbus.h
> @@ -196,6 +196,10 @@ bool l_dbus_register_interface(struct l_dbus *dbus,
>   				l_dbus_destroy_func_t destroy);
>   bool l_dbus_unregister_interface(struct l_dbus *dbus, const char *path,
>   					const char *interface);
> +
> +void l_dbus_bus_add_match(struct l_dbus *dbus, const char *rule);
> +void l_dbus_bus_remove_match(struct l_dbus *dbus, const char *rule);
> +
>   #ifdef __cplusplus
>   }
>   #endif
>

Regards,
-Denis

  reply	other threads:[~2015-02-13  3:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 11:48 [PATCH v2 0/3] Add DBus disconnect watch support Jukka Rissanen
2015-02-12 11:48 ` [PATCH v2 1/3] dbus: Add AddMatch and RemoveMatch support Jukka Rissanen
2015-02-13  3:00   ` Denis Kenzior [this message]
2015-02-12 11:48 ` [PATCH v2 2/3] dbus: Add disconnect watch support Jukka Rissanen
2015-02-13  3:25   ` Denis Kenzior
2015-02-13  8:26     ` Jukka Rissanen
2015-02-13 14:01       ` Denis Kenzior
2015-02-13 14:23         ` Jukka Rissanen
2015-02-13 15:05           ` Denis Kenzior
2015-02-16 10:22             ` Jukka Rissanen
2015-02-12 11:48 ` [PATCH v2 3/3] unit: dbus: Add test for disconnect watch API Jukka Rissanen
2015-02-13  3:36   ` Denis Kenzior
2015-02-13  8:40     ` Jukka Rissanen
2015-02-13 14:10       ` Denis Kenzior
2015-02-13 14:29         ` Jukka Rissanen
2015-02-13 15:09           ` Denis Kenzior
2015-02-16 10:53             ` Jukka Rissanen
2015-02-16 15:58               ` 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=54DD68CE.7060101@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.