Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: linux-bluetooth@vger.kernel.org,
	par-gunnar.p.hjalmdahl@stericsson.com,
	ulrik.lauren@stericsson.com
Subject: Re: [RFC v2 2/2] Add external dummy plugin for testing
Date: Sun, 07 Aug 2011 12:56:35 +0200	[thread overview]
Message-ID: <1312714596.3373.66.camel@aeonflux> (raw)
In-Reply-To: <1312385452-9770-3-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

>  Makefile.am              |    9 +++++++++
>  acinclude.m4             |    6 ++++++
>  plugins/external-dummy.c |   42 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 57 insertions(+), 0 deletions(-)
>  create mode 100644 plugins/external-dummy.c
> 
> diff --git a/Makefile.am b/Makefile.am
> index 083ad27..b51f82e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -48,6 +48,8 @@ endif
>  plugindir = $(libdir)/bluetooth/plugins
>  
>  plugin_LTLIBRARIES =
> +plugin_LDFLAGS = -module -avoid-version -Wl,--export-dynamic \
> +			-Wl,-u__start___debug -Wl,-u__stop___debug

this part is a bit ugly. I wish we could automate it.

And what does actually take care of bluetooth_plugin_desc since that is
suppose to be the only exported symbol in the first place.

>  lib_headers = lib/bluetooth.h lib/hci.h lib/hci_lib.h lib/mgmt.h \
> @@ -258,6 +260,13 @@ builtin_modules += dbusoob
>  builtin_sources += plugins/dbusoob.c
>  endif
>  
> +if EXTERNALDUMMYPLUGIN
> +plugin_LTLIBRARIES += plugins/external-dummy.la
> +plugins_external_dummy_la_SOURCES = plugins/external-dummy.c
> +plugins_external_dummy_la_LDFLAGS = $(plugin_LDFLAGS)
> +plugins_external_dummy_la_CFLAGS = -fvisibility=hidden
> +endif
> +
>  sbin_PROGRAMS += src/bluetoothd
>  
>  src_bluetoothd_SOURCES = $(gdbus_sources) $(builtin_sources) \
> diff --git a/acinclude.m4 b/acinclude.m4
> index 3cb9459..737c000 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -216,6 +216,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
>  	dbusoob_enable=no
>  	wiimote_enable=no
>  	thermometer_enable=no
> +	external_dummy_enable=no
>  
>  	AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [disable code optimization]), [
>  		optimization_enable=${enableval}
> @@ -364,6 +365,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
>  		thermometer_enable=${enableval}
>  	])
>  
> +	AC_ARG_ENABLE(external_dummy, AC_HELP_STRING([--enable-external-dummy], [enable sample external plugin]), [
> +		external_dummy_enable=${enableval}
> +	])
> +

Please don't. This project has already too many configure options. Just
use if MAINTAINER_MODE in Makefile.am.

>  	if (test "${fortify_enable}" = "yes"); then
>  		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
>  	fi
> @@ -421,4 +426,5 @@ AC_DEFUN([AC_ARG_BLUEZ], [
>  	AM_CONDITIONAL(DBUSOOBPLUGIN, test "${dbusoob_enable}" = "yes")
>  	AM_CONDITIONAL(WIIMOTEPLUGIN, test "${wiimote_enable}" = "yes")
>  	AM_CONDITIONAL(THERMOMETERPLUGIN, test "${thermometer_enable}" = "yes")
> +	AM_CONDITIONAL(EXTERNALDUMMYPLUGIN, test "${external_dummy_enable}" = "yes")
>  ])
> diff --git a/plugins/external-dummy.c b/plugins/external-dummy.c
> new file mode 100644
> index 0000000..ff4608b
> --- /dev/null
> +++ b/plugins/external-dummy.c
> @@ -0,0 +1,42 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or
> + *  (at your option) any later version.
> + *
> + *  This program is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *  GNU General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License
> + *  along with this program; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include "plugin.h"
> +#include "log.h"
> +
> +static int dummy_init(void)
> +{
> +	DBG("");
> +
> +	return 0;
> +}
> +
> +static void dummy_exit(void)
> +{
> +	DBG("");
> +}
> +
> +BLUETOOTH_PLUGIN_DEFINE(external_dummy, VERSION,
> +		BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, dummy_init, dummy_exit)
> +

Just to be paranoid, make it PRIORITY_LOW ;)

Regards

Marcel



  reply	other threads:[~2011-08-07 10:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 15:30 [RFC v2 0/2] Fix debug messages logging from non-built-in plugins Szymon Janc
2011-08-03 15:30 ` [RFC v2 1/2] " Szymon Janc
2011-08-07 11:02   ` Marcel Holtmann
2011-08-09 10:39     ` Szymon Janc
2011-08-09 11:02       ` Marcel Holtmann
2011-08-03 15:30 ` [RFC v2 2/2] Add external dummy plugin for testing Szymon Janc
2011-08-07 10:56   ` Marcel Holtmann [this message]
2011-08-09 10:39     ` Szymon Janc

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=1312714596.3373.66.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=par-gunnar.p.hjalmdahl@stericsson.com \
    --cc=szymon.janc@tieto.com \
    --cc=ulrik.lauren@stericsson.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