Re: [RFC v2 2/2] Add external dummy plugin for testing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.

As explained in last email, this could be automated with some trigger function
that would dereference those pointer. With combination with 
__attribute__((constructor/destructor)) this could be quite automatic..
I'll investigate this and send V3 shortly.

> >  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.

OK.

> 
> >  	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 ;)

OK :)

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux