From patchwork Tue Jan 16 14:18:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520877 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17BDF1BDF0 for ; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jz3yhLJs" Received: by smtp.kernel.org (Postfix) with ESMTPS id ACBF2C43390; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=ha6/xN0vDoCkzTPZDV0gYF+DTD/uMmlFVR7i6CjtNZI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Jz3yhLJs27OQGf6VP1pj/eBgzvIJ0vZUkN1SvCVkwhPYg4AOxce/hogSu40L6XMWf 1xtMQjZjfAnluL3embJMNfLzKjPjqqzwwDopGHb1SYvuP01lSRS61vWOF4SlPfmepX kS0eK+ClqSPS8AA1b2ykbIUvVBFqJgS32eLuvpyMOGS9MI0fkwGRaseLg7bfjVCtYQ wP3CYnrTt/qwT0Bj6Dr0JLUauWSW4+tdZnP1H+ShUlcnT3U/egTs4IGhveaEZgcLAu vAU6CDlSdBfHmb0jB6zuCSm0YRHjeM2yX+kjAwS6l+IM4CHRntgOqStkuEBSJffF9y /QVPfK6K20W7Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93B4DC47077; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:53 +0000 Subject: [PATCH BlueZ 1/8] obexd: remove support for external plugins Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-1-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=5476; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=hQDl9d6cvK0EoFOThXZCDoMQdkPJWiUTgNVx33TDR4c=; b=H6ArQ/2X9ppuwdcI5Q/Ew8AQzhv9zulNEsUTtHg8L0tnpZH31cmTrmnkM7G3yXnoxN4KBUf/l BO0slbHoQbFACjisY8n9xPk6VycGk5sJ2bxz1BALawPRhITxM0Vk++0 X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov A while ago all the plugins were converted to built-in, although the external machinery remained - remove it. In practise, this means we no longer need to export obexd internal API (fix coming in later patch). AFACIT supporting third-party plugins was never a supported use-case. Glancing around - no Linux distros seem to ship plugins, these days. --- Makefile.obexd | 6 +---- obexd/src/obexd.h | 2 +- obexd/src/plugin.c | 73 +++++------------------------------------------------- obexd/src/plugin.h | 9 ------- 4 files changed, 8 insertions(+), 82 deletions(-) diff --git a/Makefile.obexd b/Makefile.obexd index 5d1a4ff65..2774f3aec 100644 --- a/Makefile.obexd +++ b/Makefile.obexd @@ -11,8 +11,6 @@ EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service if OBEX -obex_plugindir = $(libdir)/obex/plugins - obexd_builtin_modules = obexd_builtin_sources = obexd_builtin_nodist = @@ -89,9 +87,7 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \ obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \ - $(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \ - -DPLUGINDIR=\""$(obex_plugindir)"\" \ - -D_FILE_OFFSET_BITS=64 \ + $(ICAL_CFLAGS) -D_FILE_OFFSET_BITS=64 \ -I$(builddir)/lib -I$(builddir)/obexd/src obexd_src_obexd_CFLAGS = $(AM_CFLAGS) -fPIC diff --git a/obexd/src/obexd.h b/obexd/src/obexd.h index fe312a65b..af5265da5 100644 --- a/obexd/src/obexd.h +++ b/obexd/src/obexd.h @@ -18,7 +18,7 @@ #define OBEX_MAS (1 << 8) #define OBEX_MNS (1 << 9) -gboolean plugin_init(const char *pattern, const char *exclude); +void plugin_init(const char *pattern, const char *exclude); void plugin_cleanup(void); gboolean manager_init(void); diff --git a/obexd/src/plugin.c b/obexd/src/plugin.c index 0df9d5258..185adac78 100644 --- a/obexd/src/plugin.c +++ b/obexd/src/plugin.c @@ -37,33 +37,29 @@ static GSList *plugins = NULL; struct obex_plugin { - void *handle; struct obex_plugin_desc *desc; }; -static gboolean add_plugin(void *handle, struct obex_plugin_desc *desc) +static void add_plugin(struct obex_plugin_desc *desc) { struct obex_plugin *plugin; if (desc->init == NULL) - return FALSE; + return; plugin = g_try_new0(struct obex_plugin, 1); if (plugin == NULL) - return FALSE; + return; - plugin->handle = handle; plugin->desc = desc; if (desc->init() < 0) { g_free(plugin); - return FALSE; + return; } plugins = g_slist_append(plugins, plugin); DBG("Plugin %s loaded", desc->name); - - return TRUE; } static gboolean check_plugin(struct obex_plugin_desc *desc, @@ -95,17 +91,12 @@ static gboolean check_plugin(struct obex_plugin_desc *desc, #include "builtin.h" -gboolean plugin_init(const char *pattern, const char *exclude) +void plugin_init(const char *pattern, const char *exclude) { char **patterns = NULL; char **excludes = NULL; - GDir *dir; - const char *file; unsigned int i; - if (strlen(PLUGINDIR) == 0) - return FALSE; - if (pattern) patterns = g_strsplit_set(pattern, ":, ", -1); @@ -119,60 +110,11 @@ gboolean plugin_init(const char *pattern, const char *exclude) patterns, excludes) == FALSE) continue; - add_plugin(NULL, __obex_builtin[i]); + add_plugin(__obex_builtin[i]); } - DBG("Loading plugins %s", PLUGINDIR); - - dir = g_dir_open(PLUGINDIR, 0, NULL); - if (!dir) { - g_strfreev(patterns); - g_strfreev(excludes); - return FALSE; - } - - while ((file = g_dir_read_name(dir)) != NULL) { - struct obex_plugin_desc *desc; - void *handle; - char *filename; - - if (g_str_has_prefix(file, "lib") == TRUE || - g_str_has_suffix(file, ".so") == FALSE) - continue; - - filename = g_build_filename(PLUGINDIR, file, NULL); - - handle = dlopen(filename, PLUGINFLAG); - if (handle == NULL) { - error("Can't load plugin %s: %s", filename, - dlerror()); - g_free(filename); - continue; - } - - g_free(filename); - - desc = dlsym(handle, "obex_plugin_desc"); - if (desc == NULL) { - error("Can't load plugin description: %s", dlerror()); - dlclose(handle); - continue; - } - - if (check_plugin(desc, patterns, excludes) == FALSE) { - dlclose(handle); - continue; - } - - if (add_plugin(handle, desc) == FALSE) - dlclose(handle); - } - - g_dir_close(dir); g_strfreev(patterns); g_strfreev(excludes); - - return TRUE; } void plugin_cleanup(void) @@ -187,9 +129,6 @@ void plugin_cleanup(void) if (plugin->desc->exit) plugin->desc->exit(); - if (plugin->handle != NULL) - dlclose(plugin->handle); - g_free(plugin); } diff --git a/obexd/src/plugin.h b/obexd/src/plugin.h index 703878460..2df66c79b 100644 --- a/obexd/src/plugin.h +++ b/obexd/src/plugin.h @@ -14,16 +14,7 @@ struct obex_plugin_desc { void (*exit) (void); }; -#ifdef OBEX_PLUGIN_BUILTIN #define OBEX_PLUGIN_DEFINE(name, init, exit) \ struct obex_plugin_desc __obex_builtin_ ## name = { \ #name, init, exit \ }; -#else -#define OBEX_PLUGIN_DEFINE(name,init,exit) \ - extern struct obex_plugin_desc obex_plugin_desc \ - __attribute__ ((visibility("default"))); \ - struct obex_plugin_desc obex_plugin_desc = { \ - #name, init, exit \ - }; -#endif From patchwork Tue Jan 16 14:18:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520876 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17C101BDF1 for ; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L3lR0g0R" Received: by smtp.kernel.org (Postfix) with ESMTPS id B12B3C433F1; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=Drk706czIQB74tZtjIszLCoLbItr0C4ypGp+yRwcxvc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=L3lR0g0RS5qD3+uk+eND/+g6O35YEZAo8YopmL2bLrGkME5fB8cu3MKU02TBqhQl0 ngYHB2pNwwgBPMjRiXtAITpnThiNdmCMbYoVnvU6Mg1pOALHm6swz+UCtBXom5c4Dv 8B0as0ekPAA4l3ExHd4BPTs0DB0MGdKiY/+3x3ZGvTbo8nSLJH4bYE6BGEtuh2jP7O ft+tDkuLqI4Vqrd9Ra2D7gDrwyV1nQwAhvPO7xPozf8GRkVTm0DPZVAEU8/fKyMvrG YA6aD+j6WvAzl5K+zO0Bl1Ufhd+qMtAssYCVFFsIF2Au4tnJbvcGK/dDQGXBExxgD5 IOJ6GxMxR9cQw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DC78C47DA9; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:54 +0000 Subject: [PATCH BlueZ 2/8] build: don't export internal obexd API Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-2-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=827; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=T0AIHHzKyS8F70Lq7NH7HmKSqGQUdU/5YvZARVJoz4Y=; b=cVZdkWcGGy4IlRdvrra7YNOAuxpwA6tftTtQ53iUl2NFvD9xVbg4GPVBnzgpy7ny/HzZq1It8 KGGsoW9Ef5HCl8qdT6fqMp8Pbwdi+a0rD4VM/QrOeNF0WzLX/ZAQJZT X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov Unlike bluetoothd, obexd does not support external plugins. As such it should not export any functions. If that ever change and plugins do emerge, the symbols should be controlled via a version script. --- Makefile.obexd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.obexd b/Makefile.obexd index 2774f3aec..4e473d50b 100644 --- a/Makefile.obexd +++ b/Makefile.obexd @@ -84,7 +84,7 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \ $(ICAL_LIBS) $(DBUS_LIBS) $(LIBEBOOK_LIBS) \ $(LIBEDATASERVER_LIBS) $(GLIB_LIBS) -ldl -obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic +obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \ $(ICAL_CFLAGS) -D_FILE_OFFSET_BITS=64 \ From patchwork Tue Jan 16 14:18:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520878 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D75D1BDF7 for ; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ac1uA1Io" Received: by smtp.kernel.org (Postfix) with ESMTPS id BEEA3C43394; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=q29zwMnPHfDj+QDW3qBZFkRDk1zS2Y2PC4ZUEo65UAY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ac1uA1IoTfme7nprz5Brvt33cPXb2mP2Ld34j0dYRsVWRl4HvxnRx4DNcRmZq4Csj 2HgQUGpVCucyRk+f/Q2vlN7vRPVh2hxHvrnimyv9o/3IHESfCfV1tOy4fSLJ/p9Oub 2X6ENa6/o3c68UUuOd6qmuoDlWFBfiAPM0pNpnMCqbOh04ygb1hzcfMqVlse5JpjTC CZS32/WZg0THrEBYqcMYKkvzUVMkTqU50pFBw0dts6Q9JahQlkPE3TRmK0Qz3CzCNG A0+PNCDRbzdO/SoyQox0n0Cxx6SjIb3m48QhVGMxDpaxli+4EZmjjsxSC/8KnZETpj o4XkNYSJ3ezVg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7A30C47DB1; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:55 +0000 Subject: [PATCH BlueZ 3/8] plugins: remove external-dummy Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-3-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=1467; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=FecdMyOyGLp8uWyLNLvMT2ck23keA9dEAYQHnkbOt9M=; b=X65MrH+reLklf1XqSb/Wwl5JI9ozm3QLlvebtoV1OnKPeeTKZz0NpSHk013hqMi8VfRiZl4c/ +ax5bdQKvVFCcNe6On0jBTLAfguALkg47ls9MNTgm0X3aGVWrQ6yudZ X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov The external plugins infra is going away - remove this dummy plugin. --- Makefile.am | 8 -------- plugins/external-dummy.c | 28 ---------------------------- 2 files changed, 36 deletions(-) diff --git a/Makefile.am b/Makefile.am index e738eb3a5..ea51b25cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -293,14 +293,6 @@ builtin_ldadd = include Makefile.plugins -if MAINTAINER_MODE -plugin_LTLIBRARIES += plugins/external-dummy.la -plugins_external_dummy_la_SOURCES = plugins/external-dummy.c -plugins_external_dummy_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ - -no-undefined -plugins_external_dummy_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden -endif - pkglibexec_PROGRAMS += src/bluetoothd src_bluetoothd_SOURCES = $(builtin_sources) \ diff --git a/plugins/external-dummy.c b/plugins/external-dummy.c deleted file mode 100644 index 1c209e8b7..000000000 --- a/plugins/external-dummy.c +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "src/plugin.h" -#include "src/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_LOW, dummy_init, dummy_exit) From patchwork Tue Jan 16 14:18:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520879 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DBC21BDFB for ; Tue, 16 Jan 2024 14:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K252JN5p" Received: by smtp.kernel.org (Postfix) with ESMTPS id C7804C43399; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=0Vb7kTdb0A76WHAp/STXf4r8mTrR6YGCiQsMYcyhpGY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=K252JN5pHmW3A2bQowESKprsg9DWLHFas9hyW4dcbQiBXqJi6Nckf5c03O5l+oM2V 8WfX5WL1HhfzllIjc37OFFyJmA1BbXpFqOWcDAPSO3FzpVdPNKvBw8TXanyOe+R6h+ F+X71W7dbkgiNHVw5zdEFduHoKcStiza4dMN3YCjnwGqG1wQqM8fv+gGAtemCIyUXz cbzyg4euBsBa7LlQIjLi5iWy5mMmMiYTqq3eCEiW++TOMAoCdnq5WGwPEkSDrUDrgK PjDI4SYKBfPIk8Qq9toDJHrqQYiFs9a77Y99oqvdDJV8wWFU+a47svP+nnsY0NRH82 idA5I2CdlKybg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B16B9C47DAF; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:56 +0000 Subject: [PATCH BlueZ 4/8] plugins: convert external sixaxis plugin to builtin Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-4-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=1153; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=gF+1Vm3aKqaYd0ZkTF025smVpJMgkegfcG+hjjFJXCw=; b=kUynQFZnYf9MuFjN5dSFlklE/VFaOmgdGXGCWRH1Z4I4pirgmg2Noaf+g0QjP3ytTAm/S5dJz kFqfy1Z5LoAD3O/+OhKY1e2RZIE1SMGdpqrXYCYIOSdmKwCnttfalJO X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov Sixaxis plugin is the only external one. It's a tiny 20K binary that distros ship a separate package for. Make it a builtin, which allows distros to drop the separate package, it also enables us to remove support for external modules - both in terms of extra code and hide the internal bluetoothd API. This means that libudev.so is pulled in, which is fine since its ABI has been stable for over a decade. --- Makefile.plugins | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile.plugins b/Makefile.plugins index 5880ed0df..7cf66fd59 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -110,11 +110,9 @@ builtin_modules += battery builtin_sources += profiles/battery/battery.c if SIXAXIS -plugin_LTLIBRARIES += plugins/sixaxis.la -plugins_sixaxis_la_SOURCES = plugins/sixaxis.c -plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -plugins_sixaxis_la_LIBADD = $(UDEV_LIBS) -plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden +builtin_modules += sixaxis +builtin_sources += plugins/sixaxis.c +builtin_ldadd += $(UDEV_LIBS) endif if BAP From patchwork Tue Jan 16 14:18:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520883 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59A7E1BF25 for ; Tue, 16 Jan 2024 14:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="h8tACb1N" Received: by smtp.kernel.org (Postfix) with ESMTPS id CE9DBC433A6; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=l0qr7ptQJpDT65vXZHxOPSvrHl8dmkY+Jmu9iEadrQw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=h8tACb1NgIqfMoj3tr3EpjoHkIyyLqVFznQPAfZGC5fmcNUwCs4VeaeHrB4KoQynC fZtiVZsOkfJ1YTGwKZeKiunzl/I+/svwiYVOeOn322rPrkpT8rdnURlcF0+13nRjRf eC99USDSE6qcJcJLRQfbhaO2AGmtdbY/oOgVw7/BJGypXfNjo1AVCEpupVlje3YfFQ 05CZeskXGSmBVZ+VIAhPgIAjFCtgm7cmDATipWaSNrgGhL+E4psLH04zxAVwqmkXkT cknvMNZxlZzgUw65gatGLnN3C0MPoGRjqy9K3XGgvPAC34quESt9GhW4ROU68topJ9 dfzAkXoJZxnDw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA308C47DB3; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:57 +0000 Subject: [PATCH BlueZ 5/8] bluetoothd: remove support for external plugins Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-5-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=6086; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=AQMiHDtNeHPlogA1d4rfCFp51frNR+9TBH1r214Syp0=; b=MmUXCGIx9/DrFr+UCYskgN5zB7gu0MpcQTaNmZ/ky5EivHblRDyMaw61t1ExU3S27MWJ3/6pW iyphdCMP4+iDPbzGzGeuSbDmhy2SSe7HbXp8LiggXxCSvaA3BsEQZOy X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov With the final one converted to a builtin, we can drop the now dead code. As follow-up this will allow us to stop exposing the internal API of bluetoothd, reducing its size. --- Makefile.am | 10 +-------- src/btd.h | 2 +- src/plugin.c | 72 +++++------------------------------------------------------- src/plugin.h | 14 ------------ 4 files changed, 8 insertions(+), 90 deletions(-) diff --git a/Makefile.am b/Makefile.am index ea51b25cc..4db3a2953 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,12 +51,6 @@ EXTRA_DIST += src/bluetooth.service.in src/org.bluez.service plugindir = $(libdir)/bluetooth/plugins -if MAINTAINER_MODE -build_plugindir = $(abs_top_srcdir)/plugins/.libs -else -build_plugindir = $(plugindir) -endif - if MANPAGES man_MANS = endif @@ -337,9 +331,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \ src/libshared-glib.la \ src/bluetooth.service -src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \ - -DPLUGINDIR=\""$(build_plugindir)"\" \ - $(BACKTRACE_CFLAGS) $(builtin_cppflags) +src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) $(BACKTRACE_CFLAGS) $(builtin_cppflags) src_bluetoothd_SHORTNAME = bluetoothd builtin_files = src/builtin.h $(builtin_nodist) diff --git a/src/btd.h b/src/btd.h index b7e7ebd61..7166e2168 100644 --- a/src/btd.h +++ b/src/btd.h @@ -155,7 +155,7 @@ struct btd_opts { extern struct btd_opts btd_opts; -gboolean plugin_init(const char *enable, const char *disable); +void plugin_init(const char *enable, const char *disable); void plugin_cleanup(void); void rfkill_init(void); diff --git a/src/plugin.c b/src/plugin.c index 80990f8c3..1631f201c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -29,7 +29,6 @@ static GSList *plugins = NULL; struct bluetooth_plugin { - void *handle; gboolean active; struct bluetooth_plugin_desc *desc; }; @@ -42,33 +41,30 @@ static int compare_priority(gconstpointer a, gconstpointer b) return plugin2->desc->priority - plugin1->desc->priority; } -static gboolean add_plugin(void *handle, struct bluetooth_plugin_desc *desc) +static void add_plugin(struct bluetooth_plugin_desc *desc) { struct bluetooth_plugin *plugin; if (desc->init == NULL) - return FALSE; + return; if (g_str_equal(desc->version, VERSION) == FALSE) { error("Version mismatch for %s", desc->name); - return FALSE; + return; } DBG("Loading %s plugin", desc->name); plugin = g_try_new0(struct bluetooth_plugin, 1); if (plugin == NULL) - return FALSE; + return; - plugin->handle = handle; plugin->active = FALSE; plugin->desc = desc; __btd_enable_debug(desc->debug_start, desc->debug_stop); plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); - - return TRUE; } static gboolean enable_plugin(const char *name, char **cli_enable, @@ -99,11 +95,9 @@ static gboolean enable_plugin(const char *name, char **cli_enable, #include "src/builtin.h" -gboolean plugin_init(const char *enable, const char *disable) +void plugin_init(const char *enable, const char *disable) { GSList *list; - GDir *dir; - const char *file; char **cli_disabled, **cli_enabled; unsigned int i; @@ -128,58 +122,9 @@ gboolean plugin_init(const char *enable, const char *disable) cli_disabled)) continue; - add_plugin(NULL, __bluetooth_builtin[i]); + add_plugin(__bluetooth_builtin[i]); } - if (strlen(PLUGINDIR) == 0) - goto start; - - DBG("Loading plugins %s", PLUGINDIR); - - dir = g_dir_open(PLUGINDIR, 0, NULL); - if (!dir) - goto start; - - while ((file = g_dir_read_name(dir)) != NULL) { - struct bluetooth_plugin_desc *desc; - void *handle; - char *filename; - - if (g_str_has_prefix(file, "lib") == TRUE || - g_str_has_suffix(file, ".so") == FALSE) - continue; - - filename = g_build_filename(PLUGINDIR, file, NULL); - - handle = dlopen(filename, RTLD_NOW); - if (handle == NULL) { - error("Can't load plugin %s: %s", filename, - dlerror()); - g_free(filename); - continue; - } - - g_free(filename); - - desc = dlsym(handle, "bluetooth_plugin_desc"); - if (desc == NULL) { - error("Can't load plugin description: %s", dlerror()); - dlclose(handle); - continue; - } - - if (!enable_plugin(desc->name, cli_enabled, cli_disabled)) { - dlclose(handle); - continue; - } - - if (add_plugin(handle, desc) == FALSE) - dlclose(handle); - } - - g_dir_close(dir); - -start: for (list = plugins; list; list = list->next) { struct bluetooth_plugin *plugin = list->data; int err; @@ -200,8 +145,6 @@ start: g_strfreev(cli_enabled); g_strfreev(cli_disabled); - - return TRUE; } void plugin_cleanup(void) @@ -216,9 +159,6 @@ void plugin_cleanup(void) if (plugin->active == TRUE && plugin->desc->exit) plugin->desc->exit(); - if (plugin->handle != NULL) - dlclose(plugin->handle); - g_free(plugin); } diff --git a/src/plugin.h b/src/plugin.h index a5f92a557..7ff55e796 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -21,21 +21,7 @@ struct bluetooth_plugin_desc { void *debug_stop; }; -#ifdef BLUETOOTH_PLUGIN_BUILTIN #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \ struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \ #name, version, priority, init, exit \ }; -#else -#define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \ - extern struct btd_debug_desc __start___debug[] \ - __attribute__ ((weak, visibility("hidden"))); \ - extern struct btd_debug_desc __stop___debug[] \ - __attribute__ ((weak, visibility("hidden"))); \ - extern struct bluetooth_plugin_desc bluetooth_plugin_desc \ - __attribute__ ((visibility("default"))); \ - struct bluetooth_plugin_desc bluetooth_plugin_desc = { \ - #name, version, priority, init, exit, \ - __start___debug, __stop___debug \ - }; -#endif From patchwork Tue Jan 16 14:18:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520882 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 627281BF3E for ; Tue, 16 Jan 2024 14:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B8rhXA4d" Received: by smtp.kernel.org (Postfix) with ESMTPS id D4645C433B1; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=HaGjKnQaE5oRrjuzO//sbiIK1DOk6UP981K4Mj7QLrs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=B8rhXA4dUvmc1Yt3DiYZMhCFky8sDe8vh4yykD3hmVou7xM9XEDGLDy44F7r0/m9X 456Ebr71XomeLs1zxRwdIhpEg/I3XMUTyxm5jRkwHgWNi86Om6JEXDd6rieGyNzHRs T7z3SuSuvBJguLrlzTqDIxZOrAotFm3z0Nme887r9LfMXPLQs5ifxn5GEu1CyVv8Lp Cxe3RGSdedmw/n2F3e3NLCI9wTnajh6GBu5m1kfDRVqrKvqSe5aR/09UOqmaxmJYkA EGkUtYJIXU5ZNxhKKncNgTaLmdmdQqfvTwVOfd2KQWMjbSmGng9fzMLJgmoMAiPE/F JgaC+ns/n85qw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2FD0C47077; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:58 +0000 Subject: [PATCH BlueZ 6/8] bluetoothd: remove debug support for external plugins Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-6-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=2192; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=fafLoCDAizTJJNOrgtnDZy+R8cR/ymoouOueLgEdSPU=; b=uXHogyiuOm10zo8UiUFx8oN1FqYNC6ia1emcchVEdm1fKJydj8B+h3KSqW0DAqPpGY2OIX+iz ujo+fbHT9UFD6H21Z91hRgpwDHZhcZWwqvYIC5aKwu3bTBGbm5cL70r X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov External plugins are gone, drop the associated debug support code. --- src/log.c | 10 +++------- src/log.h | 3 +-- src/plugin.c | 2 -- src/plugin.h | 2 -- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/log.c b/src/log.c index 0155a6bba..db855d2b1 100644 --- a/src/log.c +++ b/src/log.c @@ -138,15 +138,11 @@ static gboolean is_enabled(struct btd_debug_desc *desc) return 0; } -void __btd_enable_debug(struct btd_debug_desc *start, - struct btd_debug_desc *stop) +void __btd_enable_debug(void) { struct btd_debug_desc *desc; - if (start == NULL || stop == NULL) - return; - - for (desc = start; desc < stop; desc++) { + for (desc = __start___debug; desc < __stop___debug; desc++) { if (is_enabled(desc)) desc->flags |= BTD_DEBUG_FLAG_PRINT; } @@ -167,7 +163,7 @@ void __btd_log_init(const char *debug, int detach) if (debug != NULL) enabled = g_strsplit_set(debug, ":, ", 0); - __btd_enable_debug(__start___debug, __stop___debug); + __btd_enable_debug(); bt_log_open(); diff --git a/src/log.h b/src/log.h index 1ed742a0d..303fb36df 100644 --- a/src/log.h +++ b/src/log.h @@ -36,8 +36,7 @@ struct btd_debug_desc { unsigned int flags; } __attribute__((aligned(8))); -void __btd_enable_debug(struct btd_debug_desc *start, - struct btd_debug_desc *stop); +void __btd_enable_debug(void); /** * DBG: diff --git a/src/plugin.c b/src/plugin.c index 1631f201c..e3eb12c0c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -62,8 +62,6 @@ static void add_plugin(struct bluetooth_plugin_desc *desc) plugin->active = FALSE; plugin->desc = desc; - __btd_enable_debug(desc->debug_start, desc->debug_stop); - plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); } diff --git a/src/plugin.h b/src/plugin.h index 7ff55e796..7a2d07b3d 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -17,8 +17,6 @@ struct bluetooth_plugin_desc { int priority; int (*init) (void); void (*exit) (void); - void *debug_start; - void *debug_stop; }; #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \ From patchwork Tue Jan 16 14:18:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520881 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5970A1BF24 for ; Tue, 16 Jan 2024 14:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NDbTe6RE" Received: by smtp.kernel.org (Postfix) with ESMTPS id E0301C433B2; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=VOUgU+W9sQouYjhtj03LinlC9rIyPBaoSzF3Oj3T5G8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=NDbTe6REztrpZn/IsDukGwIqYQvzvqVnlpvERp4V2e9HsTsMJ5lrYpgN9RMoOpFJw rhVoVRm87KV+ccYy7jz/K7WLBz9lT/mECjUBr8Tc0ureBkg2AoZsjQ/pEW2jwRuPCl bkw4hkqw1zSg+evepwIglZyTqS4InSFSl2tren1myLmTcW8AthHlvO2iRLggNiegG/ +Ex2P1XZkZiXrgL12JjFVvB8EKu4Y1ArEcYv2iB99VpW//f0dgJIWItIVGzGuB+hL4 soCdUlyw/7pugdAZSaYc8rhZM0KfM8TBTYrK7WAwcPGdOWIsz/cTKNWwTNx7nhhaUA mkciVOUIqGr9Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCB69C47DA9; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:18:59 +0000 Subject: [PATCH BlueZ 7/8] bluetoothd: don't export internal API Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-7-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=1432; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=U5NIyzd+tGCF6EHhbw0tLLdXoVXk3Dye+U0qia+JOu0=; b=o8nMbPxFFidp1At3vvsR198xYOmPY5IXSPve88wvXLaP0h98s/bXrMjLtl5lygPNb2tQsW/kO TiN1eE5NS2MBOASDJQtntpvaSXSTAnaBdArXQnmQSogYvWJaDfc97W3 X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov With the final external plugin gone, we can keep the API internal. --- Makefile.am | 3 --- src/bluetooth.ver | 20 -------------------- 2 files changed, 23 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4db3a2953..c421f53c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -291,7 +291,6 @@ pkglibexec_PROGRAMS += src/bluetoothd src_bluetoothd_SOURCES = $(builtin_sources) \ $(attrib_sources) $(btio_sources) \ - src/bluetooth.ver \ src/main.c src/log.h src/log.c \ src/backtrace.h src/backtrace.c \ src/rfkill.c src/btd.h src/sdpd.h \ @@ -323,8 +322,6 @@ src_bluetoothd_LDADD = lib/libbluetooth-internal.la \ src/libshared-glib.la \ $(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \ $(builtin_ldadd) -src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \ - -Wl,--version-script=$(srcdir)/src/bluetooth.ver src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \ gdbus/libgdbus-internal.la \ diff --git a/src/bluetooth.ver b/src/bluetooth.ver deleted file mode 100644 index a96fda2a1..000000000 --- a/src/bluetooth.ver +++ /dev/null @@ -1,20 +0,0 @@ -{ - global: - btd_*; - g_dbus_*; - info; - error; - debug; - baswap; - ba2str; - /* Don't break LLVM sanitizers */ - __asan*; - __dfsan*; - __lsan*; - __msan*; - __sanitizer*; - __tsan*; - __ubsan*; - local: - *; -}; From patchwork Tue Jan 16 14:19:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via B4 Relay X-Patchwork-Id: 13520880 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41A6B1BDFF for ; Tue, 16 Jan 2024 14:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E7aNg8vr" Received: by smtp.kernel.org (Postfix) with ESMTPS id E7A01C43330; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705414737; bh=mb3vibSeCho7dxgk/hsygvpcHcp9zzLKyD4RpuB1Dx8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=E7aNg8vr/qFqze/KDPJupXTLo6DDJ6pAa107u85XFQMOomNMizXnbKSJheQPLZFct IH5IeHZsFRmJnjwQg0NYQmq74MFvCkjjhdXH1N9TVsz5x7/T/I2OtXen8j77/DNIpp sJdJD5fvvMIKBPc2jD3xdmwj21qpX2aDshzz+cB6CQGKiL2C1qH9vmDf5lUrIwahds TThN7ZhlX42JrfUd+8+0cTqFUNeKOmf9fS8whXJons+aZI7AuZuGYf6uGfs9hsjJm8 IBaJLclStfE7ZVBECiK+cpiwgzgNMMQYm4EGeAY+b2+UfMkYkSd9HoEpzMqL1j9b7K BXp+Zx3qhi8BQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7453C47DA2; Tue, 16 Jan 2024 14:18:57 +0000 (UTC) From: Emil Velikov via B4 Relay Date: Tue, 16 Jan 2024 14:19:00 +0000 Subject: [PATCH BlueZ 8/8] android: export only (android) entrypoint from the modules Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240116-rm-ext-plugins-v1-8-62990fb07369@gmail.com> References: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> In-Reply-To: <20240116-rm-ext-plugins-v1-0-62990fb07369@gmail.com> To: linux-bluetooth@vger.kernel.org Cc: Emil Velikov X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1705414735; l=3016; i=emil.l.velikov@gmail.com; s=20230301; h=from:subject:message-id; bh=A9wt+5pbCxd+p0NIbARFNH3H5ujiQXTs0z8giNMkb3Y=; b=Q7HFiJKysnEzEqBfz62XULQw232U+TBobuXu2XRRDcmuxXrZN4Ah8y4Br7aNaVKEOwf2rmZ/V qjq7zG1NgwjDonv9tD6FejaTAE1a6VvvxHZXUrN6bRdBK23/XQvWCEg X-Developer-Key: i=emil.l.velikov@gmail.com; a=ed25519; pk=qeUTVTNyI3rcR2CfNNWsloTihgzmtbZo98GdxwZKCkY= X-Endpoint-Received: by B4 Relay for emil.l.velikov@gmail.com/20230301 with auth_id=35 X-Original-From: Emil Velikov Reply-To: From: Emil Velikov The android specific modules, have a designated HMI entrypoint. Hide everything else with -fvisibility=hidden. --- android/Makefile.am | 3 +++ android/hal-audio.c | 1 + android/hal-bluetooth.c | 1 + android/hal-sco.c | 1 + 4 files changed, 6 insertions(+) diff --git a/android/Makefile.am b/android/Makefile.am index 309910147..e3756e89c 100644 --- a/android/Makefile.am +++ b/android/Makefile.am @@ -96,6 +96,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \ android/hal-log.h \ android/hal-ipc.h android/hal-ipc.c \ android/hal-utils.h android/hal-utils.c +android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden android_bluetooth_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ -no-undefined @@ -195,6 +196,7 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \ android/hardware/audio_effect.h \ android/hardware/hardware.h \ android/system/audio.h +android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden android_audio_a2dp_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \ $(SBC_CFLAGS) android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt @@ -212,6 +214,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \ android/audio_utils/resampler.c \ android/audio_utils/resampler.h \ android/system/audio.h +android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden android_audio_sco_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ diff --git a/android/hal-audio.c b/android/hal-audio.c index d37d6098c..f3d9b40a6 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -1618,6 +1618,7 @@ static struct hw_module_methods_t hal_module_methods = { .open = audio_open, }; +__attribute__ ((visibility("default"))) struct audio_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index d4442e620..7d1e5ac63 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -1117,6 +1117,7 @@ static struct hw_module_methods_t bluetooth_module_methods = { .open = open_bluetooth, }; +__attribute__ ((visibility("default"))) struct hw_module_t HAL_MODULE_INFO_SYM = { .tag = HARDWARE_MODULE_TAG, .version_major = 1, diff --git a/android/hal-sco.c b/android/hal-sco.c index d7c08a68b..3d66ad357 100644 --- a/android/hal-sco.c +++ b/android/hal-sco.c @@ -1507,6 +1507,7 @@ static struct hw_module_methods_t hal_module_methods = { .open = sco_open, }; +__attribute__ ((visibility("default"))) struct audio_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG,