From patchwork Fri Aug 26 12:49:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 1102182 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7QCng1d021454 for ; Fri, 26 Aug 2011 12:49:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752883Ab1HZMtl (ORCPT ); Fri, 26 Aug 2011 08:49:41 -0400 Received: from smtp205.alice.it ([82.57.200.101]:38758 "EHLO smtp205.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796Ab1HZMtk (ORCPT ); Fri, 26 Aug 2011 08:49:40 -0400 Received: from jcn (79.2.146.137) by smtp205.alice.it (8.5.124.08) (authenticated as fospite@alice.it) id 4DE6347507A8D4F8; Fri, 26 Aug 2011 14:49:38 +0200 Date: Fri, 26 Aug 2011 14:49:25 +0200 From: Antonio Ospite To: Vinicius Costa Gomes Cc: Marcel Holtmann , linux-bluetooth@vger.kernel.org, Bastien Nocera , linux-input@vger.kernel.org, Jim Paris , Ranulf Doswell , "Pascal A . Brisset" , Marcin Tolysz , Christian Birchinger , Filipe Lopes , Alan Ott , Mikko Virkkila , Simon Wood , Arc Riley Subject: Re: [PATCH BlueZ 3/4] Link to udev only when needed Message-Id: <20110826144925.7a769734ad9eda41b1206357@studenti.unina.it> In-Reply-To: <20110825170621.GB27645@samus.indt.org> References: <1312553358-26280-1-git-send-email-ospite@studenti.unina.it> <1312553358-26280-4-git-send-email-ospite@studenti.unina.it> <20110818124438.40e3e125c8de872e1320f511@studenti.unina.it> <1313709545.3373.196.camel@aeonflux> <20110819105802.b7f5eda46e58b32677fdb804@studenti.unina.it> <20110819210854.81dff694ad455da3ed0e6e96@studenti.unina.it> <20110825161454.45a0b27998f577a737a2e579@studenti.unina.it> <20110825170621.GB27645@samus.indt.org> X-Mailer: Sylpheed 3.2.0beta2 (GTK+ 2.24.5; x86_64-pc-linux-gnu) X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Mime-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 26 Aug 2011 12:49:42 +0000 (UTC) On Thu, 25 Aug 2011 14:06:21 -0300 Vinicius Costa Gomes wrote: [...] > > > diff --git a/Makefile.am b/Makefile.am > > > index 4bcff4d..ff33bf0 100644 > > > --- a/Makefile.am > > > +++ b/Makefile.am > > > @@ -230,8 +230,10 @@ builtin_sources += thermometer/main.c \ > > > endif > > > > > > if SIXAXISPLUGIN > > > -builtin_modules += sixaxis > > > -builtin_sources += plugins/sixaxis.c > > > +plugin_LTLIBRARIES += plugins/sixaxis.la > > > +plugins_sixaxis_la_SOURCES = plugins/sixaxis.c > > > +plugins_sixaxis_la_LDFLAGS = -module -avoid-version -no-undefined @UDEV_LIBS@ > > > +plugins_sixaxis_la_CFLAGS = -fvisibility=hidden @DBUS_CFLAGS@ @GLIB_CFLAGS@ @UDEV_CFLAGS@ > > > endif > > > > > > > This is not enough, the external plugin can be compiled but I can be used > > at runtime because it is using functions from src/storage.c and others, > > which seem to be embedded inside bluetoothd only, so I get: > > > > bluetoothd[23459]: Can't load plugin \ > > /home/ao2/Proj/PS3/PS3_sixaxis/bluez/plugins/.libs/playstation-peripheral.so: \ > > /home/ao2/Proj/PS3/PS3_sixaxis/bluez/plugins/.libs/playstation-peripheral.so: \ > > undefined symbol: write_device_name > > > > I could link the needed object files like storage.o and company into the > > plugin binary, but definitely this doesn't look OK. Should a shared library > > provide those "utility" functions to bluetoothd _and_ external plugins? > > > > This plugin is the first non-trivial external plugin I can see in the tree, > > so maybe this problem has never showed up before. > > The problem is the visibility of the symbols, src/bluetooth.ver defines > which symbols should[1] be visible to plugins. Every plugin should only > depend on those methods from the "core". > Indeed, adding the needed symbols to the linker script makes the plugin work: > If we want to keep the sixaxis plugin external we need to make the > symbols it need visible, but I wonder if that is right solution. > If there was a public API for plugins to use with well defined prefixes, the linking scripts could use those, I am thinking to something like: sdp_*; storage_*; device_*; dbus_*; But you bluez people have to tell me if this is the way to go and if you are willing to do that, of if I'd better have the plugin builtin for now. > [1] Seems that with builtin plugins that visibility enforcement doesn't > work, right? > This seems to be the case indeed, a bluiltin plugin can use any (non static?) symbol linked in the bluetoothd binary. Thanks, Antonio diff --git a/src/bluetooth.ver b/src/bluetooth.ver index b71c70d..11fcd33 100644 --- a/src/bluetooth.ver +++ b/src/bluetooth.ver @@ -5,6 +5,19 @@ info; error; debug; + manager_get_default_adapter; + adapter_get_address; + write_device_name; + record_from_string; + store_record; + sdp_record_free; + store_device_id; + write_trust; + dbus_bus_get; + adapter_get_device; + device_set_temporary; + device_set_name; + dbus_connection_unref; local: *; };