linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Jose Antonio Santos Cadenas <santoscadenas@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/9] Add __btd_error_already_exists()
Date: Tue, 9 Nov 2010 15:13:17 -0200	[thread overview]
Message-ID: <20101109171317.GA29174@vigoh> (raw)
In-Reply-To: <AANLkTinK_6hrW+FJMdfoUPuq+V5EcqaXVQNd0mWu4vZR@mail.gmail.com>

Hi Jose,

* Jose Antonio Santos Cadenas <santoscadenas@gmail.com> [2010-11-09 09:22:56 +0100]:

> Hi,
> 
> 2010/11/8 Gustavo F. Padovan <padovan@profusion.mobi>:
> > ---
> >  audio/gateway.c  |    4 +---
> >  audio/media.c    |    3 +--
> >  network/server.c |    2 +-
> >  serial/proxy.c   |    3 +--
> >  src/adapter.c    |    8 ++------
> >  src/device.c     |    4 +---
> >  src/error.c      |    7 +++++++
> >  src/error.h      |    1 +
> >  8 files changed, 15 insertions(+), 17 deletions(-)
> >
> > diff --git a/audio/gateway.c b/audio/gateway.c
> > index ab7d310..ae0ee75 100644
> > --- a/audio/gateway.c
> > +++ b/audio/gateway.c
> > @@ -488,9 +488,7 @@ static DBusMessage *register_agent(DBusConnection *conn,
> >        const char *path, *name;
> >
> >        if (gw->agent)
> > -               return g_dbus_create_error(msg,
> > -                                       ERROR_INTERFACE ".AlreadyExists",
> > -                                       "Agent already exists");
> > +               return __btd_error_already_exists(msg);
> >
> >        if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
> >                                                DBUS_TYPE_INVALID))
> > diff --git a/audio/media.c b/audio/media.c
> > index 862cee6..8821ee1 100644
> > --- a/audio/media.c
> > +++ b/audio/media.c
> > @@ -318,8 +318,7 @@ static DBusMessage *register_endpoint(DBusConnection *conn, DBusMessage *msg,
> >        dbus_message_iter_next(&args);
> >
> >        if (media_adapter_find_endpoint(adapter, sender, path, NULL) != NULL)
> > -               return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
> > -                               "Endpoint already registered");
> > +               return __btd_error_already_exists(msg);
> >
> >        dbus_message_iter_recurse(&args, &props);
> >        if (dbus_message_iter_get_arg_type(&props) != DBUS_TYPE_DICT_ENTRY)
> > diff --git a/network/server.c b/network/server.c
> > index ce1fe5e..41c9ec3 100644
> > --- a/network/server.c
> > +++ b/network/server.c
> > @@ -605,7 +605,7 @@ static DBusMessage *register_server(DBusConnection *conn,
> >                return failed(msg, "Invalid UUID");
> >
> >        if (ns->record_id)
> > -               return failed(msg, "Already registered");
> > +               return __btd_error_already_exists(msg);
> >
> >        reply = dbus_message_new_method_return(msg);
> >        if (!reply)
> > diff --git a/serial/proxy.c b/serial/proxy.c
> > index 8e182b6..de82f9a 100644
> > --- a/serial/proxy.c
> > +++ b/serial/proxy.c
> > @@ -1058,8 +1058,7 @@ static DBusMessage *create_proxy(DBusConnection *conn,
> >        if (err == -EINVAL)
> >                return __btd_error_invalid_args(msg);
> >        else if (err == -EALREADY)
> > -               return g_dbus_create_error(msg, ERROR_INTERFACE ".AlreadyExist",
> > -                                               "Proxy already exists");
> > +               return __btd_error_already_exists(msg);
> >        else if (err < 0)
> >                return g_dbus_create_error(msg, ERROR_INTERFACE "Failed",
> >                                "Proxy creation failed (%s)", strerror(-err));
> > diff --git a/src/adapter.c b/src/adapter.c
> > index cc51816..ffbc943 100644
> > --- a/src/adapter.c
> > +++ b/src/adapter.c
> > @@ -1742,9 +1742,7 @@ static DBusMessage *create_device(DBusConnection *conn,
> >                return __btd_error_invalid_args(msg);
> >
> >        if (adapter_find_device(adapter, address))
> > -               return g_dbus_create_error(msg,
> > -                               ERROR_INTERFACE ".AlreadyExists",
> > -                               "Device already exists");
> > +               return __btd_error_already_exists(msg);
> >
> >        DBG("%s", address);
> >
> > @@ -1906,9 +1904,7 @@ static DBusMessage *register_agent(DBusConnection *conn, DBusMessage *msg,
> >                return NULL;
> >
> >        if (adapter->agent)
> > -               return g_dbus_create_error(msg,
> > -                               ERROR_INTERFACE ".AlreadyExists",
> > -                               "Agent already exists");
> > +               return __btd_error_already_exists(msg);
> >
> >        cap = parse_io_capability(capability);
> >        if (cap == IO_CAPABILITY_INVALID)
> > diff --git a/src/device.c b/src/device.c
> > index ef1a910..6d110dc 100644
> > --- a/src/device.c
> > +++ b/src/device.c
> > @@ -1944,9 +1944,7 @@ DBusMessage *device_create_bonding(struct btd_device *device,
> >        str = textfile_caseget(filename, dstaddr);
> >        if (str) {
> >                free(str);
> > -               return g_dbus_create_error(msg,
> > -                               ERROR_INTERFACE ".AlreadyExists",
> > -                               "Bonding already exists");
> > +               return __btd_error_already_exists(msg);
> >        }
> >
> >        /* If our IO capability is NoInputNoOutput use medium security
> > diff --git a/src/error.c b/src/error.c
> > index a30c050..e268163 100644
> > --- a/src/error.c
> > +++ b/src/error.c
> > @@ -55,3 +55,10 @@ DBusMessage *__btd_error_invalid_args(DBusMessage *msg)
> >                                        ".InvalidArguments",
> >                                        "Invalid arguments in method call");
> >  }
> > +
> > +DBusMessage *__btd_error_already_exists(DBusMessage *msg)
> 
> I also think that an additional message will be great for a better description.

I'm not seeing any case when we need that for already_exists(). All
messages were saying the same thing. We don't need them.

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

  reply	other threads:[~2010-11-09 17:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-08  6:29 [PATCH 0/9] Fixing DBus error system in BlueZ Gustavo F. Padovan
2010-11-08  6:29 ` [PATCH 1/9] Create __btd_error_invalid_args() Gustavo F. Padovan
2010-11-08  6:29   ` [PATCH 2/9] Add __btd_error_already_exists() Gustavo F. Padovan
2010-11-08  6:29     ` [PATCH 3/9] Add __btd_error_not_supported() Gustavo F. Padovan
2010-11-08  6:29       ` [PATCH 4/9] Add __btd_error_not_connected() Gustavo F. Padovan
2010-11-08  6:29         ` [PATCH 5/9] Add __btd_error_in_progress() Gustavo F. Padovan
2010-11-08  6:29           ` [PATCH 6/9] Add __btd_error_not_available() Gustavo F. Padovan
2010-11-08  6:29             ` [PATCH 7/9] Add __btd_error_busy() Gustavo F. Padovan
2010-11-08  6:29               ` [PATCH 8/9] Add __btd_error_does_not_exist() Gustavo F. Padovan
2010-11-08  6:29                 ` [PATCH 9/9] Add __btd_error_not_authorized() Gustavo F. Padovan
2010-11-09  8:22     ` [PATCH 2/9] Add __btd_error_already_exists() Jose Antonio Santos Cadenas
2010-11-09 17:13       ` Gustavo F. Padovan [this message]
2010-11-09 20:13         ` Jose Antonio Santos Cadenas
2010-11-09 20:30           ` Gustavo F. Padovan
2010-11-09 20:35             ` Jose Antonio Santos Cadenas
2010-11-09  8:20   ` [PATCH 1/9] Create __btd_error_invalid_args() Jose Antonio Santos Cadenas
2010-11-10  0:51     ` Gustavo F. Padovan
2010-11-08 12:33 ` [PATCH 0/9] Fixing DBus error system in BlueZ Johan Hedberg
2010-11-08 17:31   ` Gustavo F. Padovan
2010-11-10  5:23     ` Marcel Holtmann
2010-11-10 15:38       ` Gustavo F. Padovan

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=20101109171317.GA29174@vigoh \
    --to=padovan@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=santoscadenas@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;
as well as URLs for NNTP newsgroup(s).