Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH BlueZ 1/8] gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL
Date: Sun, 23 Dec 2012 15:35:14 -0800	[thread overview]
Message-ID: <1356305714.29264.37.camel@aeonflux> (raw)
In-Reply-To: <CABBYNZJCA6ompsqzjPcBT-=z20QgrL_ynGR2aDsN=q3rknt=vw@mail.gmail.com>

Hi Luiz,

> >> This flag can be used to mark methods as experimental, the marked
> >> methods with this flag can be enabled by setting the environment variable
> >> GDBUS_EXPERIMENTAL=1
> >> ---
> >>  gdbus/gdbus.h  | 21 ++++++++++++++++++---
> >>  gdbus/object.c | 17 +++++++++++++++++
> >>  2 files changed, 35 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
> >> index 0e5c012..00fbb1c 100644
> >> --- a/gdbus/gdbus.h
> >> +++ b/gdbus/gdbus.h
> >> @@ -89,9 +89,10 @@ typedef void (* GDBusSecurityFunction) (DBusConnection *connection,
> >>                                               GDBusPendingReply pending);
> >>
> >>  enum GDBusMethodFlags {
> >> -     G_DBUS_METHOD_FLAG_DEPRECATED = (1 << 0),
> >> -     G_DBUS_METHOD_FLAG_NOREPLY    = (1 << 1),
> >> -     G_DBUS_METHOD_FLAG_ASYNC      = (1 << 2),
> >> +     G_DBUS_METHOD_FLAG_DEPRECATED   = (1 << 0),
> >> +     G_DBUS_METHOD_FLAG_NOREPLY      = (1 << 1),
> >> +     G_DBUS_METHOD_FLAG_ASYNC        = (1 << 2),
> >> +     G_DBUS_METHOD_FLAG_EXPERIMENTAL = (1 << 3),
> >>  };
> >>
> >>  enum GDBusSignalFlags {
> >> @@ -173,6 +174,20 @@ struct GDBusSecurityTable {
> >>       .function = _function, \
> >>       .flags = G_DBUS_METHOD_FLAG_ASYNC | G_DBUS_METHOD_FLAG_DEPRECATED
> >>
> >> +#define GDBUS_EXPERIMENTAL_METHOD(_name, _in_args, _out_args, _function) \
> >> +     .name = _name, \
> >> +     .in_args = _in_args, \
> >> +     .out_args = _out_args, \
> >> +     .function = _function, \
> >> +     .flags = G_DBUS_METHOD_FLAG_EXPERIMENTAL
> >> +
> >> +#define GDBUS_EXPERIMENTAL_ASYNC_METHOD(_name, _in_args, _out_args, _function) \
> >> +     .name = _name, \
> >> +     .in_args = _in_args, \
> >> +     .out_args = _out_args, \
> >> +     .function = _function, \
> >> +     .flags = G_DBUS_METHOD_FLAG_ASYNC | G_DBUS_METHOD_FLAG_EXPERIMENTAL
> >> +
> >>  #define GDBUS_NOREPLY_METHOD(_name, _in_args, _out_args, _function) \
> >>       .name = _name, \
> >>       .in_args = _in_args, \
> >> diff --git a/gdbus/object.c b/gdbus/object.c
> >> index 776d35e..30dbbc2 100644
> >> --- a/gdbus/object.c
> >> +++ b/gdbus/object.c
> >> @@ -129,6 +129,14 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
> >>                                               G_DBUS_METHOD_FLAG_DEPRECATED;
> >>               gboolean noreply = method->flags &
> >>                                               G_DBUS_METHOD_FLAG_NOREPLY;
> >> +             gboolean experimental = method->flags &
> >> +                                     G_DBUS_METHOD_FLAG_EXPERIMENTAL;
> >> +
> >> +             if (experimental) {
> >> +                     const char *env = g_getenv("GDBUS_EXPERIMENTAL");
> >> +                     if (g_strcmp0(env, "1") != 0)
> >> +                             continue;
> >> +             }
> >
> > actually since this is a library, doing it this way is a bad idea.
> 
> I thought it was a common practice to use environment variables with
> libraries to change certain defaults, glib does that with things like
> G_SLICE=always-malloc, and it is quite convenient since you can change
> easily without recompiling.

GLib does this, but we never did this. GAtChat, GDHCP, GWeb etc.
provided a function to enable it. The hooking up to environment variable
is then the responsibility of the main program.

> > Lets do something like g_dbus_enable_experimental(DBusConnection)
> 
> But this is not really per connection, anyway doing so you have to
> handle this directly on the application code which IMO is not as
> convenient.

Making this per connection would be pretty convenient if you are
connected to more than one bus.

Regards

Marcel



  reply	other threads:[~2012-12-23 23:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-23 20:15 [PATCH BlueZ 1/8] gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 2/8] gdbus: Introduce G_DBUS_SIGNAL_FLAG_EXPERIMENTAL Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 3/8] gdbus: Introduce G_DBUS_PROPERTY_FLAG_EXPERIMENTAL Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 4/8] gdbus: Check if the interface being registered is valid Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 5/8] gdbus: Call check_signals when sending signals with g_dbus_send_message Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 6/8] media: Enable RegisterPlayer and UnregisterPlayer methods as experimental Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 7/8] player: Enable MediaPlayer1 interface " Luiz Augusto von Dentz
2012-12-23 20:15 ` [PATCH BlueZ 8/8] AVRCP: Fix not checking for media_player_controller_create Luiz Augusto von Dentz
2012-12-23 20:58 ` [PATCH BlueZ 1/8] gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL Marcel Holtmann
2012-12-23 22:06   ` Luiz Augusto von Dentz
2012-12-23 23:35     ` Marcel Holtmann [this message]
2012-12-24  0:12       ` Luiz Augusto von Dentz
2012-12-27  8:42         ` Luiz Augusto von Dentz
2012-12-27 17:49           ` Marcel Holtmann

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=1356305714.29264.37.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox