All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Emil Velikov <emil.velikov@collabora.com>
Subject: [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API
Date: Tue, 16 Jan 2024 14:00:26 +0000	[thread overview]
Message-ID: <20240116-const-v1-1-17c87978f40b@gmail.com> (raw)
In-Reply-To: <20240116-const-v1-0-17c87978f40b@gmail.com>

From: Emil Velikov <emil.velikov@collabora.com>

The data was never mutable, so there's no API/ABI breakage here.
---
 src/genbuiltin | 4 ++--
 src/log.c      | 2 +-
 src/plugin.c   | 6 +++---
 src/plugin.h   | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/genbuiltin b/src/genbuiltin
index 8b6f04761..010e4ed2f 100755
--- a/src/genbuiltin
+++ b/src/genbuiltin
@@ -2,11 +2,11 @@
 
 for i in $*
 do
-	echo "extern struct bluetooth_plugin_desc __bluetooth_builtin_$i;"
+	echo "extern const struct bluetooth_plugin_desc __bluetooth_builtin_$i;"
 done
 
 echo
-echo "static struct bluetooth_plugin_desc *__bluetooth_builtin[] = {"
+echo "static const struct bluetooth_plugin_desc *__bluetooth_builtin[] = {"
 
 for i in $*
 do
diff --git a/src/log.c b/src/log.c
index 0155a6bba..ca8ae2d0e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -123,7 +123,7 @@ extern struct btd_debug_desc __stop___debug[];
 
 static char **enabled = NULL;
 
-static gboolean is_enabled(struct btd_debug_desc *desc)
+static gboolean is_enabled(const struct btd_debug_desc *desc)
 {
 	int i;
 
diff --git a/src/plugin.c b/src/plugin.c
index 80990f8c3..69c4138f0 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -31,7 +31,7 @@ static GSList *plugins = NULL;
 struct bluetooth_plugin {
 	void *handle;
 	gboolean active;
-	struct bluetooth_plugin_desc *desc;
+	const struct bluetooth_plugin_desc *desc;
 };
 
 static int compare_priority(gconstpointer a, gconstpointer b)
@@ -42,7 +42,7 @@ 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 gboolean add_plugin(void *handle, const struct bluetooth_plugin_desc *desc)
 {
 	struct bluetooth_plugin *plugin;
 
@@ -141,7 +141,7 @@ gboolean plugin_init(const char *enable, const char *disable)
 		goto start;
 
 	while ((file = g_dir_read_name(dir)) != NULL) {
-		struct bluetooth_plugin_desc *desc;
+		const struct bluetooth_plugin_desc *desc;
 		void *handle;
 		char *filename;
 
diff --git a/src/plugin.h b/src/plugin.h
index a5f92a557..dcf54a5bf 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -23,7 +23,7 @@ struct bluetooth_plugin_desc {
 
 #ifdef BLUETOOTH_PLUGIN_BUILTIN
 #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
-		struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
+		const struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
 			#name, version, priority, init, exit \
 		};
 #else
@@ -32,9 +32,9 @@ struct bluetooth_plugin_desc {
 				__attribute__ ((weak, visibility("hidden"))); \
 		extern struct btd_debug_desc __stop___debug[] \
 				__attribute__ ((weak, visibility("hidden"))); \
-		extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
+		extern const struct bluetooth_plugin_desc bluetooth_plugin_desc \
 				__attribute__ ((visibility("default"))); \
-		struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
+		const struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
 			#name, version, priority, init, exit, \
 			__start___debug, __stop___debug \
 		};

-- 
2.43.0


WARNING: multiple messages have this Message-ID (diff)
From: Emil Velikov via B4 Relay <devnull+emil.l.velikov.gmail.com@kernel.org>
To: linux-bluetooth@vger.kernel.org
Cc: Emil Velikov <emil.velikov@collabora.com>
Subject: [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API
Date: Tue, 16 Jan 2024 14:00:26 +0000	[thread overview]
Message-ID: <20240116-const-v1-1-17c87978f40b@gmail.com> (raw)
In-Reply-To: <20240116-const-v1-0-17c87978f40b@gmail.com>

From: Emil Velikov <emil.velikov@collabora.com>

The data was never mutable, so there's no API/ABI breakage here.
---
 src/genbuiltin | 4 ++--
 src/log.c      | 2 +-
 src/plugin.c   | 6 +++---
 src/plugin.h   | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/genbuiltin b/src/genbuiltin
index 8b6f04761..010e4ed2f 100755
--- a/src/genbuiltin
+++ b/src/genbuiltin
@@ -2,11 +2,11 @@
 
 for i in $*
 do
-	echo "extern struct bluetooth_plugin_desc __bluetooth_builtin_$i;"
+	echo "extern const struct bluetooth_plugin_desc __bluetooth_builtin_$i;"
 done
 
 echo
-echo "static struct bluetooth_plugin_desc *__bluetooth_builtin[] = {"
+echo "static const struct bluetooth_plugin_desc *__bluetooth_builtin[] = {"
 
 for i in $*
 do
diff --git a/src/log.c b/src/log.c
index 0155a6bba..ca8ae2d0e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -123,7 +123,7 @@ extern struct btd_debug_desc __stop___debug[];
 
 static char **enabled = NULL;
 
-static gboolean is_enabled(struct btd_debug_desc *desc)
+static gboolean is_enabled(const struct btd_debug_desc *desc)
 {
 	int i;
 
diff --git a/src/plugin.c b/src/plugin.c
index 80990f8c3..69c4138f0 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -31,7 +31,7 @@ static GSList *plugins = NULL;
 struct bluetooth_plugin {
 	void *handle;
 	gboolean active;
-	struct bluetooth_plugin_desc *desc;
+	const struct bluetooth_plugin_desc *desc;
 };
 
 static int compare_priority(gconstpointer a, gconstpointer b)
@@ -42,7 +42,7 @@ 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 gboolean add_plugin(void *handle, const struct bluetooth_plugin_desc *desc)
 {
 	struct bluetooth_plugin *plugin;
 
@@ -141,7 +141,7 @@ gboolean plugin_init(const char *enable, const char *disable)
 		goto start;
 
 	while ((file = g_dir_read_name(dir)) != NULL) {
-		struct bluetooth_plugin_desc *desc;
+		const struct bluetooth_plugin_desc *desc;
 		void *handle;
 		char *filename;
 
diff --git a/src/plugin.h b/src/plugin.h
index a5f92a557..dcf54a5bf 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -23,7 +23,7 @@ struct bluetooth_plugin_desc {
 
 #ifdef BLUETOOTH_PLUGIN_BUILTIN
 #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
-		struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
+		const struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
 			#name, version, priority, init, exit \
 		};
 #else
@@ -32,9 +32,9 @@ struct bluetooth_plugin_desc {
 				__attribute__ ((weak, visibility("hidden"))); \
 		extern struct btd_debug_desc __stop___debug[] \
 				__attribute__ ((weak, visibility("hidden"))); \
-		extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
+		extern const struct bluetooth_plugin_desc bluetooth_plugin_desc \
 				__attribute__ ((visibility("default"))); \
-		struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
+		const struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
 			#name, version, priority, init, exit, \
 			__start___debug, __stop___debug \
 		};

-- 
2.43.0


  reply	other threads:[~2024-01-16 14:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov
2024-01-16 14:00 ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` Emil Velikov [this message]
2024-01-16 14:00   ` [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API Emil Velikov via B4 Relay
2024-01-16 18:37   ` Constify all the things bluez.test.bot
2024-01-16 14:00 ` [PATCH BlueZ 02/20] monitor: const annotate util_ltv_debugger instances and API Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 03/20] monitor: const annotate cmd/handler tables Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 04/20] monitor: const annotate misc arrays Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 05/20] monitor: const annotate intel_version_tlv_desc::type_str and API Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 06/20] monitor: const annotate type_table and related API Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 07/20] profiles: annotate immutable data as const Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 08/20] attrib: " Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 09/20] client: annotate struct option instances " Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 10/20] emulator: const annotate rfcomm_crc_table[] Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 11/20] gobex: const annotate RO arrays, use G_N_ELEMENTS Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 12/20] lib: const annotate hci_map instances and related API Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 13/20] lib: const annotate tupla instances and API Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 14/20] mesh: const annotate misc data Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 15/20] obexd: remove obex_mime_type_driver::set_io_watch Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 16/20] obexd: const obex_mime_type_driver instances and API Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 17/20] obexd: const obex_service_driver " Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 18/20] obexd: const obex_transport_driver " Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 19/20] obexd: const annotate misc immutable data Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 20/20] obexd: const annotate obex_plugin_desc entrypoint Emil Velikov
2024-01-16 14:00   ` Emil Velikov via B4 Relay
2024-01-22 23:53 ` [PATCH BlueZ 00/20] Constify all the things patchwork-bot+bluetooth

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=20240116-const-v1-1-17c87978f40b@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=emil.velikov@collabora.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.