* [PATCH BlueZ 00/20] Constify all the things
@ 2024-01-16 14:00 Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API Emil Velikov via B4 Relay
` (20 more replies)
0 siblings, 21 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
Hello list,
Here is series#2 of the paper cut fixes. Here we annotate a handful of
the data as constant alongside updating all the respective APIs.
There's nothing particularly existing or controversial here, despite the
size of the series. That said, I'm not 100% sure that all code-paths
have been (runtime) tested.
As always - any input will be appreciated.
Thanks
Emil
---
Emil Velikov (20):
src: const annotate the bluetooth plugin API
monitor: const annotate util_ltv_debugger instances and API
monitor: const annotate cmd/handler tables
monitor: const annotate misc arrays
monitor: const annotate intel_version_tlv_desc::type_str and API
monitor: const annotate type_table and related API
profiles: annotate immutable data as const
attrib: annotate immutable data as const
client: annotate struct option instances as const
emulator: const annotate rfcomm_crc_table[]
gobex: const annotate RO arrays, use G_N_ELEMENTS
lib: const annotate hci_map instances and related API
lib: const annotate tupla instances and API
mesh: const annotate misc data
obexd: remove obex_mime_type_driver::set_io_watch
obexd: const obex_mime_type_driver instances and API
obexd: const obex_service_driver instances and API
obexd: const obex_transport_driver instances and API
obexd: const annotate misc immutable data
obexd: const annotate obex_plugin_desc entrypoint
attrib/gatttool.c | 8 +++---
attrib/interactive.c | 2 +-
client/mgmt.c | 42 ++++++++++++++++----------------
emulator/bthost.c | 2 +-
gobex/gobex.c | 8 +++---
lib/hci.c | 42 ++++++++++++++++----------------
lib/hci_lib.h | 4 +--
lib/sdp.c | 20 +++++++--------
mesh/agent.c | 4 +--
monitor/att.c | 54 ++++++++++++++++++++---------------------
monitor/avctp.c | 2 +-
monitor/intel.c | 28 ++++++++++-----------
monitor/l2cap.c | 2 +-
monitor/rfcomm.c | 2 +-
monitor/sdp.c | 10 ++++----
obexd/client/manager.c | 6 ++---
obexd/client/map.c | 4 +--
obexd/client/mns.c | 8 +++---
obexd/plugins/bluetooth.c | 6 ++---
obexd/plugins/filesystem.c | 8 +++---
obexd/plugins/ftp.c | 2 +-
obexd/plugins/irmc.c | 4 +--
obexd/plugins/mas.c | 18 +++++++-------
obexd/plugins/opp.c | 2 +-
obexd/plugins/pbap.c | 8 +++---
obexd/plugins/pcsuite.c | 4 +--
obexd/plugins/phonebook-ebook.c | 2 +-
obexd/plugins/syncevolution.c | 4 +--
obexd/src/genbuiltin | 4 +--
obexd/src/main.c | 2 +-
obexd/src/mimetype.c | 26 +++++++-------------
obexd/src/mimetype.h | 12 +++++----
obexd/src/obex-priv.h | 4 +--
obexd/src/obex.c | 18 +++++++-------
obexd/src/plugin.c | 8 +++---
obexd/src/plugin.h | 4 +--
obexd/src/server.c | 10 ++++----
obexd/src/server.h | 2 +-
obexd/src/service.c | 20 +++++++--------
obexd/src/service.h | 6 ++---
obexd/src/transport.c | 14 +++++------
obexd/src/transport.h | 6 ++---
profiles/audio/avctp.c | 2 +-
profiles/audio/avrcp.c | 8 +++---
profiles/audio/media.c | 6 ++---
profiles/audio/sink.c | 2 +-
profiles/audio/source.c | 2 +-
profiles/audio/transport.c | 12 ++++-----
profiles/health/hdp_util.c | 15 ++++++------
profiles/iap/main.c | 2 +-
src/genbuiltin | 4 +--
src/log.c | 2 +-
src/plugin.c | 6 ++---
src/plugin.h | 6 ++---
54 files changed, 251 insertions(+), 258 deletions(-)
---
base-commit: 770ad5614e7e8074133e6f563495ce4822f63fe4
change-id: 20240116-const-bc91df591e93
Best regards,
--
Emil Velikov <emil.l.velikov@gmail.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
@ 2024-01-16 14:00 ` 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 via B4 Relay
` (19 subsequent siblings)
20 siblings, 1 reply; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
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
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 02/20] monitor: const annotate util_ltv_debugger instances and API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (18 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
monitor/att.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/monitor/att.c b/monitor/att.c
index 9db273223..51a5a759c 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -683,7 +683,7 @@ static void print_ltv(const char *str, void *user_data)
}
static bool print_ase_lv(const struct l2cap_frame *frame, const char *label,
- struct util_ltv_debugger *decoder, size_t decoder_len)
+ const struct util_ltv_debugger *decoder, size_t decoder_len)
{
struct bt_hci_lv_data *lv;
@@ -705,7 +705,7 @@ static bool print_ase_lv(const struct l2cap_frame *frame, const char *label,
}
static bool print_ase_cc(const struct l2cap_frame *frame, const char *label,
- struct util_ltv_debugger *decoder, size_t decoder_len)
+ const struct util_ltv_debugger *decoder, size_t decoder_len)
{
return print_ase_lv(frame, label, decoder, decoder_len);
}
@@ -813,7 +813,7 @@ done:
print_hex_field(" Data", frame.data, frame.size);
}
-struct util_ltv_debugger ase_metadata_table[] = {
+static const struct util_ltv_debugger ase_metadata_table[] = {
UTIL_LTV_DEBUG(0x01, ase_debug_preferred_context),
UTIL_LTV_DEBUG(0x02, ase_debug_context),
UTIL_LTV_DEBUG(0x03, ase_debug_program_info),
@@ -994,7 +994,7 @@ done:
print_hex_field(" Data", frame.data, frame.size);
}
-struct util_ltv_debugger pac_cap_table[] = {
+static const struct util_ltv_debugger pac_cap_table[] = {
UTIL_LTV_DEBUG(0x01, pac_decode_freq),
UTIL_LTV_DEBUG(0x02, pac_decode_duration),
UTIL_LTV_DEBUG(0x03, pac_decode_channels),
@@ -1336,7 +1336,7 @@ done:
print_hex_field(" Data", frame.data, frame.size);
}
-struct util_ltv_debugger ase_cc_table[] = {
+static const struct util_ltv_debugger ase_cc_table[] = {
UTIL_LTV_DEBUG(0x01, ase_debug_freq),
UTIL_LTV_DEBUG(0x02, ase_debug_duration),
UTIL_LTV_DEBUG(0x03, ase_debug_location),
@@ -2769,7 +2769,7 @@ static const struct big_enc_decoder {
static bool print_subgroup_lv(const struct l2cap_frame *frame,
const char *label,
- struct util_ltv_debugger *debugger,
+ const struct util_ltv_debugger *debugger,
size_t debugger_len)
{
struct bt_hci_lv_data *lv;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 03/20] monitor: const annotate cmd/handler tables
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 01/20] src: const annotate the bluetooth plugin API Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 02/20] monitor: const annotate util_ltv_debugger instances and API Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (17 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
monitor/att.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/monitor/att.c b/monitor/att.c
index 51a5a759c..d016e58df 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -1710,7 +1710,7 @@ static bool ase_release_cmd(const struct l2cap_frame *frame)
.func = _func, \
}
-struct ase_cmd {
+static const struct ase_cmd {
const char *desc;
bool (*func)(const struct l2cap_frame *frame);
} ase_cmd_table[] = {
@@ -1732,7 +1732,7 @@ struct ase_cmd {
ASE_CMD(0x08, "Release", ase_release_cmd),
};
-static struct ase_cmd *ase_get_cmd(uint8_t op)
+static const struct ase_cmd *ase_get_cmd(uint8_t op)
{
if (op > ARRAY_SIZE(ase_cmd_table))
return NULL;
@@ -1743,7 +1743,7 @@ static struct ase_cmd *ase_get_cmd(uint8_t op)
static void print_ase_cmd(const struct l2cap_frame *frame)
{
uint8_t op, num, i;
- struct ase_cmd *cmd;
+ const struct ase_cmd *cmd;
if (!l2cap_frame_get_u8((void *)frame, &op)) {
print_text(COLOR_ERROR, "opcode: invalid size");
@@ -1911,7 +1911,7 @@ static bool print_ase_cp_rsp_reason(const struct l2cap_frame *frame)
static void print_ase_cp_rsp(const struct l2cap_frame *frame)
{
uint8_t op, num, i;
- struct ase_cmd *cmd;
+ const struct ase_cmd *cmd;
if (!l2cap_frame_get_u8((void *)frame, &op)) {
print_text(COLOR_ERROR, " opcode: invalid size");
@@ -2161,7 +2161,7 @@ static bool vcs_absolute_cmd(const struct l2cap_frame *frame)
.func = _func, \
}
-struct vcs_cmd {
+static const struct vcs_cmd {
const char *desc;
bool (*func)(const struct l2cap_frame *frame);
} vcs_cmd_table[] = {
@@ -2181,7 +2181,7 @@ struct vcs_cmd {
VCS_CMD(0x06, "Mute", vcs_config_cmd),
};
-static struct vcs_cmd *vcs_get_cmd(uint8_t op)
+static const struct vcs_cmd *vcs_get_cmd(uint8_t op)
{
if (op > ARRAY_SIZE(vcs_cmd_table))
return NULL;
@@ -2192,7 +2192,7 @@ static struct vcs_cmd *vcs_get_cmd(uint8_t op)
static void print_vcs_cmd(const struct l2cap_frame *frame)
{
uint8_t op;
- struct vcs_cmd *cmd;
+ const struct vcs_cmd *cmd;
if (!l2cap_frame_get_u8((void *)frame, &op)) {
print_text(COLOR_ERROR, "opcode: invalid size");
@@ -3135,7 +3135,7 @@ static void bcast_audio_scan_cp_remove_src_cmd(const struct l2cap_frame *frame)
print_field(" Source_ID: %u", id);
}
-struct bcast_audio_scan_cp_cmd {
+static const struct bcast_audio_scan_cp_cmd {
const char *desc;
void (*func)(const struct l2cap_frame *frame);
} bcast_audio_scan_cp_cmd_table[] = {
@@ -3157,7 +3157,7 @@ struct bcast_audio_scan_cp_cmd {
bcast_audio_scan_cp_remove_src_cmd),
};
-static struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)
+static const struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)
{
if (op > ARRAY_SIZE(bcast_audio_scan_cp_cmd_table))
return NULL;
@@ -3168,7 +3168,7 @@ static struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)
static void print_bcast_audio_scan_cp_cmd(const struct l2cap_frame *frame)
{
uint8_t op;
- struct bcast_audio_scan_cp_cmd *cmd;
+ const struct bcast_audio_scan_cp_cmd *cmd;
if (!l2cap_frame_get_u8((void *)frame, &op)) {
print_text(COLOR_ERROR, "Opcode: invalid size");
@@ -3340,7 +3340,7 @@ static void bgr_features_read(const struct l2cap_frame *frame)
.notify = _notify \
}
-struct gatt_handler {
+static const struct gatt_handler {
bt_uuid_t uuid;
void (*read)(const struct l2cap_frame *frame);
void (*write)(const struct l2cap_frame *frame);
@@ -3392,7 +3392,7 @@ struct gatt_handler {
GMAS
};
-static struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
+static const struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
{
size_t i;
@@ -3400,7 +3400,7 @@ static struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
return NULL;
for (i = 0; i < ARRAY_SIZE(gatt_handlers); i++) {
- struct gatt_handler *handler = &gatt_handlers[i];
+ const struct gatt_handler *handler = &gatt_handlers[i];
if (!bt_uuid_cmp(&handler->uuid, uuid))
return handler;
@@ -3409,7 +3409,7 @@ static struct gatt_handler *get_handler_uuid(const bt_uuid_t *uuid)
return NULL;
}
-static struct gatt_handler *get_handler(struct gatt_db_attribute *attr)
+static const struct gatt_handler *get_handler(struct gatt_db_attribute *attr)
{
return get_handler_uuid(gatt_db_attribute_get_type(attr));
}
@@ -3580,7 +3580,7 @@ static void queue_read(const struct l2cap_frame *frame, bt_uuid_t *uuid,
struct att_conn_data *data;
struct att_read *read;
struct gatt_db_attribute *attr = NULL;
- struct gatt_handler *handler;
+ const struct gatt_handler *handler;
if (handle) {
attr = get_attribute(frame, handle, false);
@@ -3761,7 +3761,7 @@ static void print_write(const struct l2cap_frame *frame, uint16_t handle,
size_t len)
{
struct gatt_db_attribute *attr;
- struct gatt_handler *handler;
+ const struct gatt_handler *handler;
print_handle(frame, handle, false);
@@ -3837,7 +3837,7 @@ static void print_notify(const struct l2cap_frame *frame, uint16_t handle,
size_t len)
{
struct gatt_db_attribute *attr;
- struct gatt_handler *handler;
+ const struct gatt_handler *handler;
struct l2cap_frame clone;
print_handle(frame, handle, true);
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 04/20] monitor: const annotate misc arrays
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (2 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 03/20] monitor: const annotate cmd/handler tables Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (16 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
monitor/att.c | 8 ++++----
monitor/avctp.c | 2 +-
monitor/intel.c | 2 +-
monitor/l2cap.c | 2 +-
monitor/rfcomm.c | 2 +-
monitor/sdp.c | 4 ++--
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/monitor/att.c b/monitor/att.c
index d016e58df..ac0d881fd 100644
--- a/monitor/att.c
+++ b/monitor/att.c
@@ -2581,7 +2581,7 @@ static void media_state_notify(const struct l2cap_frame *frame)
print_media_state(frame);
}
-struct media_cp_opcode {
+static const struct media_cp_opcode {
uint8_t opcode;
const char *opcode_str;
} media_cp_opcode_table[] = {
@@ -2739,7 +2739,7 @@ static void content_control_id_read(const struct l2cap_frame *frame)
static const struct pa_sync_state_decoder {
uint8_t code;
- char *value;
+ const char *value;
} pa_sync_state_decoders[] = {
{ 0x00, "Not synchronized to PA" },
{ 0x01, "SyncInfo Request" },
@@ -2750,7 +2750,7 @@ static const struct pa_sync_state_decoder {
static const struct cp_pa_sync_state_decoder {
uint8_t code;
- char *value;
+ const char *value;
} cp_pa_sync_state_decoders[] = {
{ 0x00, "Do not synchronize to PA" },
{ 0x01, "Synchronize to PA - PAST available" },
@@ -2759,7 +2759,7 @@ static const struct cp_pa_sync_state_decoder {
static const struct big_enc_decoder {
uint8_t code;
- char *value;
+ const char *value;
} big_enc_decoders[] = {
{ 0x00, "Not encrypted" },
{ 0x01, "Broadcast_Code required" },
diff --git a/monitor/avctp.c b/monitor/avctp.c
index fb2628282..c59e93b20 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1802,7 +1802,7 @@ response:
}
-static struct {
+static const struct {
const char *str;
bool reserved;
} features_table[] = {
diff --git a/monitor/intel.c b/monitor/intel.c
index 0191987d4..1b2414290 100644
--- a/monitor/intel.c
+++ b/monitor/intel.c
@@ -1798,7 +1798,7 @@ static const struct vendor_evt vendor_prefix_evt_table[] = {
{ }
};
-const uint8_t intel_vendor_prefix[] = {0x87, 0x80};
+static const uint8_t intel_vendor_prefix[] = {0x87, 0x80};
#define INTEL_VENDOR_PREFIX_SIZE sizeof(intel_vendor_prefix)
/*
diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index 8f3d8e65b..dff183bd0 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -718,7 +718,7 @@ static void print_config_result(uint16_t result)
print_field("Result: %s (0x%4.4x)", str, le16_to_cpu(result));
}
-static struct {
+static const struct {
uint8_t type;
uint8_t len;
const char *str;
diff --git a/monitor/rfcomm.c b/monitor/rfcomm.c
index 02300a8b5..a855152c6 100644
--- a/monitor/rfcomm.c
+++ b/monitor/rfcomm.c
@@ -32,7 +32,7 @@
#include "sdp.h"
#include "rfcomm.h"
-static char *cr_str[] = {
+static const char *cr_str[] = {
"RSP",
"CMD"
};
diff --git a/monitor/sdp.c b/monitor/sdp.c
index daf9a9da8..2c69dc83b 100644
--- a/monitor/sdp.c
+++ b/monitor/sdp.c
@@ -167,7 +167,7 @@ static struct {
{ }
};
-static struct {
+static const struct {
uint8_t index;
uint8_t bits;
uint8_t size;
@@ -322,7 +322,7 @@ static uint32_t get_bytes(const uint8_t *data, uint32_t size)
return 0;
}
-static struct {
+static const struct {
uint16_t id;
const char *str;
} attribute_table[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 05/20] monitor: const annotate intel_version_tlv_desc::type_str and API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (3 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 04/20] monitor: const annotate misc arrays Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (15 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
monitor/intel.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/monitor/intel.c b/monitor/intel.c
index 1b2414290..0de864d8a 100644
--- a/monitor/intel.c
+++ b/monitor/intel.c
@@ -171,25 +171,25 @@ struct intel_version_tlv {
};
static void print_version_tlv_u32(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): 0x%8.8x", type_str, tlv->type, get_le32(tlv->val));
}
static void print_version_tlv_u16(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): 0x%4.4x", type_str, tlv->type, get_le16(tlv->val));
}
static void print_version_tlv_u8(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): 0x%2.2x", type_str, tlv->type, get_u8(tlv->val));
}
static void print_version_tlv_enabled(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): %s(%u)", type_str, tlv->type,
tlv->val[0] ? "Enabled" : "Disabled",
@@ -197,7 +197,7 @@ static void print_version_tlv_enabled(const struct intel_version_tlv *tlv,
}
static void print_version_tlv_img_type(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
const char *str;
@@ -217,34 +217,34 @@ static void print_version_tlv_img_type(const struct intel_version_tlv *tlv,
}
static void print_version_tlv_timestamp(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): %u-%u", type_str, tlv->type,
tlv->val[1], tlv->val[0]);
}
static void print_version_tlv_min_fw(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): %u-%u.%u", type_str, tlv->type,
tlv->val[0], tlv->val[1], 2000 + tlv->val[2]);
}
static void print_version_tlv_otp_bdaddr(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
packet_print_addr(type_str, tlv->val, 0x00);
}
static void print_version_tlv_unknown(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
print_field("%s(%u): ", type_str, tlv->type);
packet_hexdump(tlv->val, tlv->len);
}
static void print_version_tlv_mfg(const struct intel_version_tlv *tlv,
- char *type_str)
+ const char *type_str)
{
uint16_t mfg_id = get_le16(tlv->val);
@@ -254,8 +254,8 @@ static void print_version_tlv_mfg(const struct intel_version_tlv *tlv,
static const struct intel_version_tlv_desc {
uint8_t type;
- char *type_str;
- void (*func)(const struct intel_version_tlv *tlv, char *type_str);
+ const char *type_str;
+ void (*func)(const struct intel_version_tlv *tlv, const char *type_str);
} intel_version_tlv_table[] = {
{ 16, "CNVi TOP", print_version_tlv_u32 },
{ 17, "CNVr TOP", print_version_tlv_u32 },
@@ -365,7 +365,7 @@ static void read_version_rsp(uint16_t index, const void *data, uint8_t size)
static void read_version_cmd(uint16_t index, const void *data, uint8_t size)
{
- char *str;
+ const char *str;
uint8_t type;
/* This is the legacy read version command format and no further action
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 06/20] monitor: const annotate type_table and related API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (4 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 05/20] monitor: const annotate intel_version_tlv_desc::type_str and API Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (14 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
monitor/sdp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/monitor/sdp.c b/monitor/sdp.c
index 2c69dc83b..5fe4f2979 100644
--- a/monitor/sdp.c
+++ b/monitor/sdp.c
@@ -148,9 +148,9 @@ static void print_boolean(uint8_t indent, const uint8_t *data, uint32_t size)
#define SIZES(args...) ((uint8_t[]) { args, 0xff } )
-static struct {
+static const struct {
uint8_t value;
- uint8_t *sizes;
+ const uint8_t *sizes;
bool recurse;
const char *str;
void (*print) (uint8_t indent, const uint8_t *data, uint32_t size);
@@ -184,7 +184,7 @@ static const struct {
{ }
};
-static bool valid_size(uint8_t size, uint8_t *sizes)
+static bool valid_size(uint8_t size, const uint8_t *sizes)
{
int i;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 07/20] profiles: annotate immutable data as const
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (5 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 06/20] monitor: const annotate type_table and related API Emil Velikov via B4 Relay
@ 2024-01-16 14:00 ` Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 08/20] attrib: " Emil Velikov via B4 Relay
` (13 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
profiles/audio/avctp.c | 2 +-
profiles/audio/avrcp.c | 8 ++++----
profiles/audio/media.c | 6 +++---
profiles/audio/sink.c | 2 +-
profiles/audio/source.c | 2 +-
profiles/audio/transport.c | 12 ++++++------
profiles/health/hdp_util.c | 15 +++++++--------
profiles/iap/main.c | 2 +-
8 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 6f64f162b..8ad146df1 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -228,7 +228,7 @@ struct avctp_browsing_pdu_handler {
GDestroyNotify destroy;
};
-static struct {
+static const struct {
const char *name;
uint8_t avc;
uint16_t uinput;
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index dda9a303f..439fa27a9 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -290,7 +290,7 @@ struct control_pdu_handler {
uint8_t transaction);
};
-static struct {
+static const struct {
uint8_t feature_bit;
uint8_t avc;
} passthrough_map[] = {
@@ -361,7 +361,7 @@ static unsigned int avctp_id = 0;
static uint8_t default_features[16];
/* Company IDs supported by this device */
-static uint32_t company_ids[] = {
+static const uint32_t company_ids[] = {
IEEEID_BTSIG,
};
@@ -2118,7 +2118,7 @@ failed:
pdu->param_len = cpu_to_be16(1);
}
-static struct browsing_pdu_handler {
+static const struct browsing_pdu_handler {
uint8_t pdu_id;
void (*func) (struct avrcp *session, struct avrcp_browsing_header *pdu,
uint8_t transaction);
@@ -2147,7 +2147,7 @@ static size_t handle_browsing_pdu(struct avctp *conn,
size_t operand_count, void *user_data)
{
struct avrcp *session = user_data;
- struct browsing_pdu_handler *handler;
+ const struct browsing_pdu_handler *handler;
struct avrcp_browsing_header *pdu = (void *) operands;
DBG("AVRCP Browsing PDU 0x%02X, len 0x%04X", pdu->pdu_id,
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 1faa1c289..edaff7867 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1420,7 +1420,7 @@ static bool experimental_bcast_sink_ep_supported(struct btd_adapter *adapter)
return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
}
-static struct media_endpoint_init {
+static const struct media_endpoint_init {
const char *uuid;
bool (*func)(struct media_endpoint *endpoint, int *err);
bool (*supported)(struct btd_adapter *adapter);
@@ -1456,7 +1456,7 @@ media_endpoint_create(struct media_adapter *adapter,
int *err)
{
struct media_endpoint *endpoint;
- struct media_endpoint_init *init;
+ const struct media_endpoint_init *init;
size_t i;
bool succeeded = false;
@@ -3244,7 +3244,7 @@ static gboolean supported_uuids(const GDBusPropertyTable *property,
DBUS_TYPE_STRING_AS_STRING, &entry);
for (i = 0; i < ARRAY_SIZE(init_table); i++) {
- struct media_endpoint_init *init = &init_table[i];
+ const struct media_endpoint_init *init = &init_table[i];
if (init->supported(adapter->btd_adapter))
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 56c491778..a547dcb41 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -62,7 +62,7 @@ struct sink_state_callback {
static GSList *sink_callbacks = NULL;
-static char *str_state[] = {
+static const char *str_state[] = {
"SINK_STATE_DISCONNECTED",
"SINK_STATE_CONNECTING",
"SINK_STATE_CONNECTED",
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index c6009d0ea..9fac352c8 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -61,7 +61,7 @@ struct source_state_callback {
static GSList *source_callbacks = NULL;
-static char *str_state[] = {
+static const char *str_state[] = {
"SOURCE_STATE_DISCONNECTED",
"SOURCE_STATE_CONNECTING",
"SOURCE_STATE_CONNECTED",
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index a4696154a..dd7d0e0a2 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -55,7 +55,7 @@ typedef enum {
TRANSPORT_STATE_SUSPENDING, /* Release in progress */
} transport_state_t;
-static char *str_state[] = {
+static const char *str_state[] = {
"TRANSPORT_STATE_IDLE",
"TRANSPORT_STATE_PENDING",
"TRANSPORT_STATE_REQUESTING",
@@ -124,7 +124,7 @@ struct media_transport {
uint16_t imtu; /* Transport input mtu */
uint16_t omtu; /* Transport output mtu */
transport_state_t state;
- struct media_transport_ops *ops;
+ const struct media_transport_ops *ops;
void *data;
};
@@ -1749,7 +1749,7 @@ static void *transport_bap_init(struct media_transport *transport, void *stream)
#define BAP_BC_OPS(_uuid) \
BAP_OPS(_uuid, transport_bap_bc_properties, NULL, NULL)
-static struct media_transport_ops transport_ops[] = {
+static const struct media_transport_ops transport_ops[] = {
A2DP_OPS(A2DP_SOURCE_UUID, transport_a2dp_src_init,
transport_a2dp_src_set_volume,
transport_a2dp_src_destroy),
@@ -1762,12 +1762,12 @@ static struct media_transport_ops transport_ops[] = {
BAP_BC_OPS(BAA_SERVICE_UUID),
};
-static struct media_transport_ops *media_transport_find_ops(const char *uuid)
+static const struct media_transport_ops *media_transport_find_ops(const char *uuid)
{
size_t i;
for (i = 0; i < ARRAY_SIZE(transport_ops); i++) {
- struct media_transport_ops *ops = &transport_ops[i];
+ const struct media_transport_ops *ops = &transport_ops[i];
if (!strcasecmp(uuid, ops->uuid))
return ops;
@@ -1784,7 +1784,7 @@ struct media_transport *media_transport_create(struct btd_device *device,
{
struct media_endpoint *endpoint = data;
struct media_transport *transport;
- struct media_transport_ops *ops;
+ const struct media_transport_ops *ops;
static int fd = 0;
transport = g_new0(struct media_transport, 1);
diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
index ab3b78f6a..ad3702f01 100644
--- a/profiles/health/hdp_util.c
+++ b/profiles/health/hdp_util.c
@@ -42,7 +42,7 @@ typedef gboolean (*parse_item_f)(DBusMessageIter *iter, gpointer user_data,
GError **err);
struct dict_entry_func {
- char *key;
+ const char *key;
parse_item_f func;
};
@@ -67,7 +67,7 @@ struct get_dcpsm_data {
GDestroyNotify destroy;
};
-static gboolean parse_dict_entry(struct dict_entry_func dict_context[],
+static gboolean parse_dict_entry(const struct dict_entry_func dict_context[],
DBusMessageIter *iter,
GError **err,
gpointer user_data)
@@ -75,7 +75,6 @@ static gboolean parse_dict_entry(struct dict_entry_func dict_context[],
DBusMessageIter entry;
char *key;
int ctype, i;
- struct dict_entry_func df;
dbus_message_iter_recurse(iter, &entry);
ctype = dbus_message_iter_get_arg_type(&entry);
@@ -88,9 +87,9 @@ static gboolean parse_dict_entry(struct dict_entry_func dict_context[],
dbus_message_iter_get_basic(&entry, &key);
dbus_message_iter_next(&entry);
/* Find function and call it */
- for (i = 0, df = dict_context[0]; df.key; i++, df = dict_context[i]) {
- if (g_ascii_strcasecmp(df.key, key) == 0)
- return df.func(&entry, user_data, err);
+ for (i = 0; dict_context[i].key; i++) {
+ if (g_ascii_strcasecmp(dict_context[i].key, key) == 0)
+ return dict_context[i].func(&entry, user_data, err);
}
g_set_error(err, HDP_ERROR, HDP_DIC_ENTRY_PARSE_ERROR,
@@ -98,7 +97,7 @@ static gboolean parse_dict_entry(struct dict_entry_func dict_context[],
return FALSE;
}
-static gboolean parse_dict(struct dict_entry_func dict_context[],
+static gboolean parse_dict(const struct dict_entry_func dict_context[],
DBusMessageIter *iter,
GError **err,
gpointer user_data)
@@ -273,7 +272,7 @@ static gboolean parse_chan_type(DBusMessageIter *iter, gpointer data,
return TRUE;
}
-static struct dict_entry_func dict_parser[] = {
+static const struct dict_entry_func dict_parser[] = {
{"DataType", parse_data_type},
{"Role", parse_role},
{"Description", parse_desc},
diff --git a/profiles/iap/main.c b/profiles/iap/main.c
index 9a04f5cc0..054ff600e 100644
--- a/profiles/iap/main.c
+++ b/profiles/iap/main.c
@@ -398,7 +398,7 @@ static guint setup_signalfd(void)
static gboolean option_version = FALSE;
-static GOptionEntry options[] = {
+static const GOptionEntry options[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
"Show version information and exit" },
{ NULL },
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 08/20] attrib: annotate immutable data as const
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (6 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 07/20] profiles: annotate immutable data as const Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (12 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
attrib/gatttool.c | 8 ++++----
attrib/interactive.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 2d03875b0..4309d20b1 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -454,7 +454,7 @@ static gboolean parse_uuid(const char *key, const char *value,
return TRUE;
}
-static GOptionEntry primary_char_options[] = {
+static const GOptionEntry primary_char_options[] = {
{ "start", 's' , 0, G_OPTION_ARG_INT, &opt_start,
"Starting handle (optional)", "0x0001" },
{ "end", 'e' , 0, G_OPTION_ARG_INT, &opt_end,
@@ -464,7 +464,7 @@ static GOptionEntry primary_char_options[] = {
{ NULL },
};
-static GOptionEntry char_rw_options[] = {
+static const GOptionEntry char_rw_options[] = {
{ "handle", 'a' , 0, G_OPTION_ARG_INT, &opt_handle,
"Read/Write characteristic by handle (required)", "0x0001" },
{ "value", 'n' , 0, G_OPTION_ARG_STRING, &opt_value,
@@ -473,7 +473,7 @@ static GOptionEntry char_rw_options[] = {
{NULL},
};
-static GOptionEntry gatt_options[] = {
+static const GOptionEntry gatt_options[] = {
{ "primary", 0, 0, G_OPTION_ARG_NONE, &opt_primary,
"Primary Service Discovery", NULL },
{ "characteristics", 0, 0, G_OPTION_ARG_NONE, &opt_characteristics,
@@ -494,7 +494,7 @@ static GOptionEntry gatt_options[] = {
{ NULL },
};
-static GOptionEntry options[] = {
+static const GOptionEntry options[] = {
{ "adapter", 'i', 0, G_OPTION_ARG_STRING, &opt_src,
"Specify local adapter interface", "hciX" },
{ "device", 'b', 0, G_OPTION_ARG_STRING, &opt_dst,
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 171b95738..c0262e87c 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -760,7 +760,7 @@ static void cmd_mtu(int argcp, char **argvp)
gatt_exchange_mtu(attrib, opt_mtu, exchange_mtu_cb, NULL);
}
-static struct {
+static const struct {
const char *cmd;
void (*func)(int argcp, char **argvp);
const char *params;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 09/20] client: annotate struct option instances as const
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (7 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 08/20] attrib: " Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (11 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
client/mgmt.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/client/mgmt.c b/client/mgmt.c
index e9ebb3d93..6fd43887d 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -2203,7 +2203,7 @@ static void get_flags_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option get_flags_options[] = {
+static const struct option get_flags_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -2272,7 +2272,7 @@ static void set_flags_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option set_flags_options[] = {
+static const struct option set_flags_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ "flags", 1, 0, 'f' },
@@ -2678,7 +2678,7 @@ static void disconnect_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option disconnect_options[] = {
+static const struct option disconnect_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -2783,7 +2783,7 @@ static void find_service_rsp(uint8_t status, uint16_t len, const void *param,
discovery = true;
}
-static struct option find_service_options[] = {
+static const struct option find_service_options[] = {
{ "help", no_argument, 0, 'h' },
{ "le-only", no_argument, 0, 'l' },
{ "bredr-only", no_argument, 0, 'b' },
@@ -2880,7 +2880,7 @@ static void find_rsp(uint8_t status, uint16_t len, const void *param,
discovery = true;
}
-static struct option find_options[] = {
+static const struct option find_options[] = {
{ "help", 0, 0, 'h' },
{ "le-only", 1, 0, 'l' },
{ "bredr-only", 1, 0, 'b' },
@@ -2952,7 +2952,7 @@ static void stop_find_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option stop_find_options[] = {
+static const struct option stop_find_options[] = {
{ "help", 0, 0, 'h' },
{ "le-only", 1, 0, 'l' },
{ "bredr-only", 1, 0, 'b' },
@@ -3074,7 +3074,7 @@ static void register_pair_callbacks(struct mgmt *mgmt, uint16_t index)
passkey_notify, mgmt, NULL);
}
-static struct option pair_options[] = {
+static const struct option pair_options[] = {
{ "help", 0, 0, 'h' },
{ "capability", 1, 0, 'c' },
{ "type", 1, 0, 't' },
@@ -3169,7 +3169,7 @@ static void cancel_pair_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option cancel_pair_options[] = {
+static const struct option cancel_pair_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -3251,7 +3251,7 @@ static void unpair_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option unpair_options[] = {
+static const struct option unpair_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -3378,7 +3378,7 @@ static void irks_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option irks_options[] = {
+static const struct option irks_options[] = {
{ "help", 0, 0, 'h' },
{ "local", 1, 0, 'l' },
{ "file", 1, 0, 'f' },
@@ -3492,7 +3492,7 @@ static void block_rsp(uint16_t op, uint16_t id, uint8_t status, uint16_t len,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option block_options[] = {
+static const struct option block_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -3736,7 +3736,7 @@ static void remote_oob_rsp(uint8_t status, uint16_t len, const void *param,
print("Remote OOB data added for %s (%u)", addr, rp->type);
}
-static struct option remote_oob_opt[] = {
+static const struct option remote_oob_opt[] = {
{ "help", 0, 0, '?' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -3979,7 +3979,7 @@ static void conn_info_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option conn_info_options[] = {
+static const struct option conn_info_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -4150,7 +4150,7 @@ static void add_device_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option add_device_options[] = {
+static const struct option add_device_options[] = {
{ "help", 0, 0, 'h' },
{ "action", 1, 0, 'a' },
{ "type", 1, 0, 't' },
@@ -4223,7 +4223,7 @@ static void remove_device_rsp(uint8_t status, uint16_t len, const void *param,
bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
-static struct option del_device_options[] = {
+static const struct option del_device_options[] = {
{ "help", 0, 0, 'h' },
{ "type", 1, 0, 't' },
{ 0, 0, 0, 0 }
@@ -4477,7 +4477,7 @@ static void advsize_usage(void)
"\t -n, --local-name \"local-name\" flag");
}
-static struct option advsize_options[] = {
+static const struct option advsize_options[] = {
{ "help", 0, 0, 'h' },
{ "connectable", 0, 0, 'c' },
{ "general-discov", 0, 0, 'g' },
@@ -4597,7 +4597,7 @@ static void add_adv_usage(void)
"\tadd-adv -u 180d -u 180f -d 080954657374204C45 1");
}
-static struct option add_adv_options[] = {
+static const struct option add_adv_options[] = {
{ "help", 0, 0, 'h' },
{ "uuid", 1, 0, 'u' },
{ "adv-data", 1, 0, 'd' },
@@ -4935,7 +4935,7 @@ static void add_ext_adv_params_usage(void)
"\tadd-ext-adv-params -r 0x801 -x 0x802 -P 2M -g 1");
}
-static struct option add_ext_adv_params_options[] = {
+static const struct option add_ext_adv_params_options[] = {
{ "help", 0, 0, 'h' },
{ "duration", 1, 0, 'd' },
{ "timeout", 1, 0, 't' },
@@ -5113,7 +5113,7 @@ static void add_ext_adv_data_usage(void)
"\tadd-ext-adv-data -u 180d -u 180f -d 080954657374204C45 1");
}
-static struct option add_ext_adv_data_options[] = {
+static const struct option add_ext_adv_data_options[] = {
{ "help", 0, 0, 'h' },
{ "uuid", 1, 0, 'u' },
{ "adv-data", 1, 0, 'd' },
@@ -5557,7 +5557,7 @@ static bool str2pattern(struct mgmt_adv_pattern *pattern, const char *str)
return true;
}
-static struct option add_monitor_rssi_options[] = {
+static const struct option add_monitor_rssi_options[] = {
{ "help", 0, 0, 'h' },
{ "high-threshold", 1, 0, 'R' },
{ "low-threshold", 1, 0, 'r' },
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 10/20] emulator: const annotate rfcomm_crc_table[]
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (8 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 09/20] client: annotate struct option instances " Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (10 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
emulator/bthost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/emulator/bthost.c b/emulator/bthost.c
index c7d59eefc..8c40fce90 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -59,7 +59,7 @@
/* RFCOMM FCS calculation */
#define CRC(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]])
-static unsigned char rfcomm_crc_table[256] = {
+static const unsigned char rfcomm_crc_table[256] = {
0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b,
0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69,
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 11/20] gobex: const annotate RO arrays, use G_N_ELEMENTS
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (9 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 10/20] emulator: const annotate rfcomm_crc_table[] Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (9 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
gobex/gobex.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gobex/gobex.c b/gobex/gobex.c
index e9b89cead..8924e059f 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -122,7 +122,7 @@ struct setpath_data {
guint8 constants;
} __attribute__ ((packed));
-static struct error_code {
+static const struct error_code {
guint8 code;
const char *name;
} obex_errors[] = {
@@ -169,7 +169,7 @@ static struct error_code {
const char *g_obex_strerror(guint8 err_code)
{
- struct error_code *error;
+ const struct error_code *error;
for (error = obex_errors; error->name != NULL; error++) {
if (error->code == err_code)
@@ -1423,7 +1423,7 @@ failed:
return FALSE;
}
-static GDebugKey keys[] = {
+static const GDebugKey keys[] = {
{ "error", G_OBEX_DEBUG_ERROR },
{ "command", G_OBEX_DEBUG_COMMAND },
{ "transfer", G_OBEX_DEBUG_TRANSFER },
@@ -1443,7 +1443,7 @@ GObex *g_obex_new(GIOChannel *io, GObexTransportType transport_type,
const char *env = g_getenv("GOBEX_DEBUG");
if (env) {
- gobex_debug = g_parse_debug_string(env, keys, 7);
+ gobex_debug = g_parse_debug_string(env, keys, G_N_ELEMENTS(keys));
g_setenv("G_MESSAGES_DEBUG", "gobex", FALSE);
} else
gobex_debug = G_OBEX_DEBUG_NONE;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 12/20] lib: const annotate hci_map instances and related API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (10 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 11/20] gobex: const annotate RO arrays, use G_N_ELEMENTS Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (8 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
client/mgmt.c | 2 +-
lib/hci.c | 42 +++++++++++++++++++++---------------------
lib/hci_lib.h | 4 ++--
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/client/mgmt.c b/client/mgmt.c
index 6fd43887d..62167727c 100644
--- a/client/mgmt.c
+++ b/client/mgmt.c
@@ -1484,7 +1484,7 @@ static void ext_index_rsp(uint8_t status, uint16_t len, const void *param,
for (i = 0; i < count; i++) {
uint16_t index = le16_to_cpu(rp->entry[i].index);
- char *busstr = hci_bustostr(rp->entry[i].bus);
+ const char *busstr = hci_bustostr(rp->entry[i].bus);
switch (rp->entry[i].type) {
case 0x00:
diff --git a/lib/hci.c b/lib/hci.c
index bd735a440..937e65d48 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -42,7 +42,7 @@ typedef struct {
unsigned int val;
} hci_map;
-static char *hci_bit2str(hci_map *m, unsigned int val)
+static char *hci_bit2str(const hci_map *m, unsigned int val)
{
char *str = malloc(120);
char *ptr = str;
@@ -59,10 +59,10 @@ static char *hci_bit2str(hci_map *m, unsigned int val)
return str;
}
-static int hci_str2bit(hci_map *map, char *str, unsigned int *val)
+static int hci_str2bit(const hci_map *map, char *str, unsigned int *val)
{
char *t, *ptr;
- hci_map *m;
+ const hci_map *m;
int set;
if (!str || !(str = ptr = strdup(str)))
@@ -83,7 +83,7 @@ static int hci_str2bit(hci_map *map, char *str, unsigned int *val)
return set;
}
-static char *hci_uint2str(hci_map *m, unsigned int val)
+static char *hci_uint2str(const hci_map *m, unsigned int val)
{
char *str = malloc(50);
char *ptr = str;
@@ -102,10 +102,10 @@ static char *hci_uint2str(hci_map *m, unsigned int val)
return str;
}
-static int hci_str2uint(hci_map *map, char *str, unsigned int *val)
+static int hci_str2uint(const hci_map *map, char *str, unsigned int *val)
{
char *t, *ptr;
- hci_map *m;
+ const hci_map *m;
int set = 0;
if (!str)
@@ -127,7 +127,7 @@ static int hci_str2uint(hci_map *map, char *str, unsigned int *val)
return set;
}
-char *hci_bustostr(int bus)
+const char *hci_bustostr(int bus)
{
switch (bus) {
case HCI_VIRTUAL:
@@ -157,7 +157,7 @@ char *hci_bustostr(int bus)
}
}
-char *hci_dtypetostr(int type)
+const char *hci_dtypetostr(int type)
{
return hci_bustostr(type & 0x0f);
}
@@ -175,7 +175,7 @@ char *hci_typetostr(int type)
}
/* HCI dev flags mapping */
-static hci_map dev_flags_map[] = {
+static const hci_map dev_flags_map[] = {
{ "UP", HCI_UP },
{ "INIT", HCI_INIT },
{ "RUNNING", HCI_RUNNING },
@@ -192,7 +192,7 @@ char *hci_dflagstostr(uint32_t flags)
{
char *str = bt_malloc(50);
char *ptr = str;
- hci_map *m = dev_flags_map;
+ const hci_map *m = dev_flags_map;
if (!str)
return NULL;
@@ -211,7 +211,7 @@ char *hci_dflagstostr(uint32_t flags)
}
/* HCI packet type mapping */
-static hci_map pkt_type_map[] = {
+static const hci_map pkt_type_map[] = {
{ "DM1", HCI_DM1 },
{ "DM3", HCI_DM3 },
{ "DM5", HCI_DM5 },
@@ -230,7 +230,7 @@ static hci_map pkt_type_map[] = {
{ NULL }
};
-static hci_map sco_ptype_map[] = {
+static const hci_map sco_ptype_map[] = {
{ "HV1", 0x0001 },
{ "HV2", 0x0002 },
{ "HV3", 0x0004 },
@@ -265,7 +265,7 @@ int hci_strtoscoptype(char *str, unsigned int *val)
}
/* Link policy mapping */
-static hci_map link_policy_map[] = {
+static const hci_map link_policy_map[] = {
{ "NONE", 0 },
{ "RSWITCH", HCI_LP_RSWITCH },
{ "HOLD", HCI_LP_HOLD },
@@ -285,7 +285,7 @@ int hci_strtolp(char *str, unsigned int *val)
}
/* Link mode mapping */
-static hci_map link_mode_map[] = {
+static const hci_map link_mode_map[] = {
{ "NONE", 0 },
{ "ACCEPT", HCI_LM_ACCEPT },
{ "CENTRAL", HCI_LM_MASTER },
@@ -332,7 +332,7 @@ int hci_strtolm(char *str, unsigned int *val)
}
/* Command mapping */
-static hci_map commands_map[] = {
+static const hci_map commands_map[] = {
{ "Inquiry", 0 },
{ "Inquiry Cancel", 1 },
{ "Periodic Inquiry Mode", 2 },
@@ -605,7 +605,7 @@ char *hci_cmdtostr(unsigned int cmd)
char *hci_commandstostr(uint8_t *commands, char *pref, int width)
{
unsigned int maxwidth = width - 3;
- hci_map *m;
+ const hci_map *m;
char *off, *ptr, *str;
int size = 10;
@@ -645,7 +645,7 @@ char *hci_commandstostr(uint8_t *commands, char *pref, int width)
}
/* Version mapping */
-static hci_map ver_map[] = {
+static const hci_map ver_map[] = {
{ "1.0b", 0x00 },
{ "1.1", 0x01 },
{ "1.2", 0x02 },
@@ -683,7 +683,7 @@ int lmp_strtover(char *str, unsigned int *ver)
return hci_str2uint(ver_map, str, ver);
}
-static hci_map pal_map[] = {
+static const hci_map pal_map[] = {
{ "3.0", 0x01 },
{ NULL }
};
@@ -699,7 +699,7 @@ int pal_strtover(char *str, unsigned int *ver)
}
/* LMP features mapping */
-static hci_map lmp_features_map[8][9] = {
+static const hci_map lmp_features_map[8][9] = {
{ /* Byte 0 */
{ "<3-slot packets>", LMP_3SLOT }, /* Bit 0 */
{ "<5-slot packets>", LMP_5SLOT }, /* Bit 1 */
@@ -794,7 +794,7 @@ char *lmp_featurestostr(uint8_t *features, char *pref, int width)
int i, size = 10;
for (i = 0; i < 8; i++) {
- hci_map *m = lmp_features_map[i];
+ const hci_map *m = lmp_features_map[i];
while (m->str) {
if (m->val & features[i])
@@ -816,7 +816,7 @@ char *lmp_featurestostr(uint8_t *features, char *pref, int width)
off = ptr;
for (i = 0; i < 8; i++) {
- hci_map *m = lmp_features_map[i];
+ const hci_map *m = lmp_features_map[i];
while (m->str) {
if (m->val & features[i]) {
diff --git a/lib/hci_lib.h b/lib/hci_lib.h
index 6b1a548b5..baf3d3e12 100644
--- a/lib/hci_lib.h
+++ b/lib/hci_lib.h
@@ -132,9 +132,9 @@ int hci_le_read_remote_features(int dd, uint16_t handle, uint8_t *features, int
int hci_for_each_dev(int flag, int(*func)(int dd, int dev_id, long arg), long arg);
int hci_get_route(bdaddr_t *bdaddr);
-char *hci_bustostr(int bus);
+const char *hci_bustostr(int bus);
char *hci_typetostr(int type);
-char *hci_dtypetostr(int type);
+const char *hci_dtypetostr(int type);
char *hci_dflagstostr(uint32_t flags);
char *hci_ptypetostr(unsigned int ptype);
int hci_strtoptype(char *str, unsigned int *val);
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 13/20] lib: const annotate tupla instances and API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (11 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 12/20] lib: const annotate hci_map instances and related API Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (7 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
lib/sdp.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/sdp.c b/lib/sdp.c
index dfc06b6df..5475c7eba 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -47,7 +47,7 @@
#define SDPDBG(fmt...)
#endif
-static uint128_t bluetooth_base_uuid = {
+static const uint128_t bluetooth_base_uuid = {
.data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }
};
@@ -65,10 +65,10 @@ static int sdp_gen_buffer(sdp_buf_t *buf, sdp_data_t *d);
/* Message structure. */
struct tupla {
int index;
- char *str;
+ const char *str;
};
-static struct tupla Protocol[] = {
+static const struct tupla Protocol[] = {
{ SDP_UUID, "SDP" },
{ UDP_UUID, "UDP" },
{ RFCOMM_UUID, "RFCOMM" },
@@ -97,7 +97,7 @@ static struct tupla Protocol[] = {
{ 0 }
};
-static struct tupla ServiceClass[] = {
+static const struct tupla ServiceClass[] = {
{ SDP_SERVER_SVCLASS_ID, "SDP Server" },
{ BROWSE_GRP_DESC_SVCLASS_ID, "Browse Group Descriptor" },
{ PUBLIC_BROWSE_GROUP, "Public Browse Group" },
@@ -176,9 +176,9 @@ static struct tupla ServiceClass[] = {
#define Profile ServiceClass
-static char *string_lookup(struct tupla *pt0, int index)
+static const char *string_lookup(const struct tupla *pt0, int index)
{
- struct tupla *pt;
+ const struct tupla *pt;
for (pt = pt0; pt->index; pt++)
if (pt->index == index)
@@ -187,7 +187,7 @@ static char *string_lookup(struct tupla *pt0, int index)
return "";
}
-static char *string_lookup_uuid(struct tupla *pt0, const uuid_t *uuid)
+static const char *string_lookup_uuid(const struct tupla *pt0, const uuid_t *uuid)
{
uuid_t tmp_uuid;
@@ -209,9 +209,9 @@ static char *string_lookup_uuid(struct tupla *pt0, const uuid_t *uuid)
* Prints into a string the Protocol UUID
* coping a maximum of n characters.
*/
-static int uuid2str(struct tupla *message, const uuid_t *uuid, char *str, size_t n)
+static int uuid2str(const struct tupla *message, const uuid_t *uuid, char *str, size_t n)
{
- char *str2;
+ const char *str2;
if (!uuid) {
snprintf(str, n, "NULL");
@@ -2763,7 +2763,7 @@ uuid_t *sdp_uuid_to_uuid128(const uuid_t *uuid)
*/
int sdp_uuid128_to_uuid(uuid_t *uuid)
{
- uint128_t *b = &bluetooth_base_uuid;
+ const uint128_t *b = &bluetooth_base_uuid;
uint128_t *u = &uuid->value.uuid128;
uint32_t data;
unsigned int i;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 14/20] mesh: const annotate misc data
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (12 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 13/20] lib: const annotate tupla instances and API Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (6 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
mesh/agent.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mesh/agent.c b/mesh/agent.c
index 5058d0d8d..2f9697a33 100644
--- a/mesh/agent.c
+++ b/mesh/agent.c
@@ -61,7 +61,7 @@ struct oob_info {
uint16_t mask;
};
-static struct prov_action cap_table[] = {
+static const struct prov_action cap_table[] = {
{"blink", 0x0001, 0x0000, 1},
{"beep", 0x0002, 0x0000, 1},
{"vibrate", 0x0004, 0x0000, 1},
@@ -73,7 +73,7 @@ static struct prov_action cap_table[] = {
{"in-alpha", 0x0000, 0x0008, 8}
};
-static struct oob_info oob_table[] = {
+static const struct oob_info oob_table[] = {
{"other", 0x0001},
{"uri", 0x0002},
{"machine-code-2d", 0x0004},
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 15/20] obexd: remove obex_mime_type_driver::set_io_watch
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (13 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 14/20] mesh: const annotate misc data Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (5 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
All the drivers use the default function, where the register function
modifies what should be a constant vtable.
Instead let's remove the indirection, export and use the function as
applicable.
Since we have set and reset, export both functions and cleanup the
users.
---
obexd/src/mimetype.c | 12 ++----------
obexd/src/mimetype.h | 6 ++++--
obexd/src/obex.c | 12 ++++++------
3 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/obexd/src/mimetype.c b/obexd/src/mimetype.c
index 212f24b18..cf6e15dc6 100644
--- a/obexd/src/mimetype.c
+++ b/obexd/src/mimetype.c
@@ -73,7 +73,7 @@ static struct io_watch *find_io_watch(void *object)
return NULL;
}
-static void reset_io_watch(void *object)
+void obex_object_reset_io_watch(void *object)
{
struct io_watch *watch;
@@ -85,16 +85,11 @@ static void reset_io_watch(void *object)
g_free(watch);
}
-static int set_io_watch(void *object, obex_object_io_func func,
+int obex_object_set_io_watch(void *object, obex_object_io_func func,
void *user_data)
{
struct io_watch *watch;
- if (func == NULL) {
- reset_io_watch(object);
- return 0;
- }
-
watch = find_io_watch(object);
if (watch)
return -EPERM;
@@ -181,9 +176,6 @@ int obex_mime_type_driver_register(struct obex_mime_type_driver *driver)
return -EPERM;
}
- if (driver->set_io_watch == NULL)
- driver->set_io_watch = set_io_watch;
-
DBG("driver %p mimetype %s registered", driver, driver->mimetype);
drivers = g_slist_append(drivers, driver);
diff --git a/obexd/src/mimetype.h b/obexd/src/mimetype.h
index e1c14f405..55ddded08 100644
--- a/obexd/src/mimetype.h
+++ b/obexd/src/mimetype.h
@@ -28,8 +28,6 @@ struct obex_mime_type_driver {
int (*copy) (const char *name, const char *destname);
int (*move) (const char *name, const char *destname);
int (*remove) (const char *name);
- int (*set_io_watch) (void *object, obex_object_io_func func,
- void *user_data);
};
int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
@@ -40,3 +38,7 @@ struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
unsigned int who_size);
void obex_object_set_io_flags(void *object, int flags, int err);
+
+void obex_object_reset_io_watch(void *object);
+int obex_object_set_io_watch(void *object, obex_object_io_func func,
+ void *user_data);
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 3a68fd66c..4bf5ad124 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -119,7 +119,7 @@ static void os_reset_session(struct obex_session *os)
os_session_mark_aborted(os);
if (os->object) {
- os->driver->set_io_watch(os->object, NULL, NULL);
+ obex_object_reset_io_watch(os->object);
os->driver->close(os->object);
if (os->aborted && os->cmd == G_OBEX_OP_PUT && os->path &&
os->driver->remove)
@@ -357,7 +357,7 @@ static gssize driver_read(struct obex_session *os, void *buf, gsize size)
if (len == -ENOSTR)
return 0;
if (len == -EAGAIN)
- os->driver->set_io_watch(os->object, handle_async_io,
+ obex_object_set_io_watch(os->object, handle_async_io,
os);
}
@@ -395,7 +395,7 @@ static void transfer_complete(GObex *obex, GError *err, gpointer user_data)
if (os->object && os->driver && os->driver->flush) {
if (os->driver->flush(os->object) == -EAGAIN) {
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io,
+ obex_object_set_io_watch(os->object, handle_async_io,
os);
return;
}
@@ -525,7 +525,7 @@ static gboolean recv_data(const void *buf, gsize size, gpointer user_data)
if (ret == -EAGAIN) {
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io, os);
+ obex_object_set_io_watch(os->object, handle_async_io, os);
return TRUE;
}
@@ -699,7 +699,7 @@ int obex_get_stream_start(struct obex_session *os, const char *filename)
return err;
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io, os);
+ obex_object_set_io_watch(os->object, handle_async_io, os);
return 0;
}
@@ -772,7 +772,7 @@ static gboolean check_put(GObex *obex, GObexPacket *req, void *user_data)
break;
case -EAGAIN:
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io, os);
+ obex_object_set_io_watch(os->object, handle_async_io, os);
return TRUE;
default:
os_set_response(os, ret);
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 16/20] obexd: const obex_mime_type_driver instances and API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (14 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 15/20] obexd: remove obex_mime_type_driver::set_io_watch Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (4 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
obexd/client/mns.c | 2 +-
obexd/plugins/filesystem.c | 8 ++++----
obexd/plugins/irmc.c | 2 +-
obexd/plugins/mas.c | 16 ++++++++--------
obexd/plugins/pbap.c | 6 +++---
obexd/plugins/pcsuite.c | 2 +-
obexd/plugins/syncevolution.c | 2 +-
obexd/src/mimetype.c | 14 +++++++-------
obexd/src/mimetype.h | 6 +++---
obexd/src/obex-priv.h | 2 +-
10 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/obexd/client/mns.c b/obexd/client/mns.c
index e52505642..3b2ae1076 100644
--- a/obexd/client/mns.c
+++ b/obexd/client/mns.c
@@ -356,7 +356,7 @@ static struct obex_service_driver mns = {
.disconnect = mns_disconnect,
};
-static struct obex_mime_type_driver mime_event_report = {
+static const struct obex_mime_type_driver mime_event_report = {
.target = MNS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/MAP-event-report",
diff --git a/obexd/plugins/filesystem.c b/obexd/plugins/filesystem.c
index 09bff8ad0..f52927541 100644
--- a/obexd/plugins/filesystem.c
+++ b/obexd/plugins/filesystem.c
@@ -642,7 +642,7 @@ done:
return err;
}
-static struct obex_mime_type_driver file = {
+static const struct obex_mime_type_driver file = {
.open = filesystem_open,
.close = filesystem_close,
.read = filesystem_read,
@@ -652,7 +652,7 @@ static struct obex_mime_type_driver file = {
.copy = filesystem_copy,
};
-static struct obex_mime_type_driver capability = {
+static const struct obex_mime_type_driver capability = {
.target = FTP_TARGET,
.target_size = FTP_TARGET_SIZE,
.mimetype = "x-obex/capability",
@@ -661,7 +661,7 @@ static struct obex_mime_type_driver capability = {
.read = capability_read,
};
-static struct obex_mime_type_driver folder = {
+static const struct obex_mime_type_driver folder = {
.target = FTP_TARGET,
.target_size = FTP_TARGET_SIZE,
.mimetype = "x-obex/folder-listing",
@@ -670,7 +670,7 @@ static struct obex_mime_type_driver folder = {
.read = folder_read,
};
-static struct obex_mime_type_driver pcsuite = {
+static const struct obex_mime_type_driver pcsuite = {
.target = FTP_TARGET,
.target_size = FTP_TARGET_SIZE,
.who = PCSUITE_WHO,
diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
index cd143e7a3..e85cf70a1 100644
--- a/obexd/plugins/irmc.c
+++ b/obexd/plugins/irmc.c
@@ -419,7 +419,7 @@ static ssize_t irmc_read(void *object, void *buf, size_t count)
return len;
}
-static struct obex_mime_type_driver irmc_driver = {
+static const struct obex_mime_type_driver irmc_driver = {
.target = IRMC_TARGET,
.target_size = IRMC_TARGET_SIZE,
.open = irmc_open,
diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index 5d00bc563..f0eaf6d82 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
@@ -793,7 +793,7 @@ static struct obex_service_driver mas = {
.disconnect = mas_disconnect,
};
-static struct obex_mime_type_driver mime_map = {
+static const struct obex_mime_type_driver mime_map = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = NULL,
@@ -803,7 +803,7 @@ static struct obex_mime_type_driver mime_map = {
.write = any_write,
};
-static struct obex_mime_type_driver mime_message = {
+static const struct obex_mime_type_driver mime_message = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/message",
@@ -813,7 +813,7 @@ static struct obex_mime_type_driver mime_message = {
.write = any_write,
};
-static struct obex_mime_type_driver mime_folder_listing = {
+static const struct obex_mime_type_driver mime_folder_listing = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-obex/folder-listing",
@@ -824,7 +824,7 @@ static struct obex_mime_type_driver mime_folder_listing = {
.write = any_write,
};
-static struct obex_mime_type_driver mime_msg_listing = {
+static const struct obex_mime_type_driver mime_msg_listing = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/MAP-msg-listing",
@@ -835,7 +835,7 @@ static struct obex_mime_type_driver mime_msg_listing = {
.write = any_write,
};
-static struct obex_mime_type_driver mime_notification_registration = {
+static const struct obex_mime_type_driver mime_notification_registration = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/MAP-NotificationRegistration",
@@ -845,7 +845,7 @@ static struct obex_mime_type_driver mime_notification_registration = {
.write = any_write,
};
-static struct obex_mime_type_driver mime_message_status = {
+static const struct obex_mime_type_driver mime_message_status = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/messageStatus",
@@ -855,7 +855,7 @@ static struct obex_mime_type_driver mime_message_status = {
.write = any_write,
};
-static struct obex_mime_type_driver mime_message_update = {
+static const struct obex_mime_type_driver mime_message_update = {
.target = MAS_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/MAP-messageUpdate",
@@ -865,7 +865,7 @@ static struct obex_mime_type_driver mime_message_update = {
.write = any_write,
};
-static struct obex_mime_type_driver *map_drivers[] = {
+static const struct obex_mime_type_driver *map_drivers[] = {
&mime_map,
&mime_message,
&mime_folder_listing,
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index ab5236316..b363c673b 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -929,7 +929,7 @@ static ssize_t vobject_vcard_read(void *object, void *buf, size_t count)
return string_read(obj->buffer, buf, count);
}
-static struct obex_mime_type_driver mime_pull = {
+static const struct obex_mime_type_driver mime_pull = {
.target = PBAP_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/phonebook",
@@ -939,7 +939,7 @@ static struct obex_mime_type_driver mime_pull = {
.get_next_header = vobject_pull_get_next_header,
};
-static struct obex_mime_type_driver mime_list = {
+static const struct obex_mime_type_driver mime_list = {
.target = PBAP_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/vcard-listing",
@@ -949,7 +949,7 @@ static struct obex_mime_type_driver mime_list = {
.get_next_header = vobject_list_get_next_header,
};
-static struct obex_mime_type_driver mime_vcard = {
+static const struct obex_mime_type_driver mime_vcard = {
.target = PBAP_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "x-bt/vcard",
diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
index f5a9d9ae8..d4a0394af 100644
--- a/obexd/plugins/pcsuite.c
+++ b/obexd/plugins/pcsuite.c
@@ -467,7 +467,7 @@ static int backup_flush(void *object)
return 0;
}
-static struct obex_mime_type_driver backup = {
+static const struct obex_mime_type_driver backup = {
.target = FTP_TARGET,
.target_size = TARGET_SIZE,
.mimetype = "application/vnd.nokia-backup",
diff --git a/obexd/plugins/syncevolution.c b/obexd/plugins/syncevolution.c
index 88744f28a..f0387b986 100644
--- a/obexd/plugins/syncevolution.c
+++ b/obexd/plugins/syncevolution.c
@@ -427,7 +427,7 @@ static ssize_t synce_write(void *object, const void *buf, size_t count)
return -EAGAIN;
}
-static struct obex_mime_type_driver synce_driver = {
+static const struct obex_mime_type_driver synce_driver = {
.target = SYNCML_TARGET,
.target_size = SYNCML_TARGET_SIZE,
.open = synce_open,
diff --git a/obexd/src/mimetype.c b/obexd/src/mimetype.c
index cf6e15dc6..462d4ba2f 100644
--- a/obexd/src/mimetype.c
+++ b/obexd/src/mimetype.c
@@ -104,7 +104,7 @@ int obex_object_set_io_watch(void *object, obex_object_io_func func,
return 0;
}
-static struct obex_mime_type_driver *find_driver(const uint8_t *target,
+static const struct obex_mime_type_driver *find_driver(const uint8_t *target,
unsigned int target_size,
const char *mimetype, const uint8_t *who,
unsigned int who_size)
@@ -112,7 +112,7 @@ static struct obex_mime_type_driver *find_driver(const uint8_t *target,
GSList *l;
for (l = drivers; l; l = l->next) {
- struct obex_mime_type_driver *driver = l->data;
+ const struct obex_mime_type_driver *driver = l->data;
if (memncmp0(target, target_size, driver->target, driver->target_size))
continue;
@@ -134,12 +134,12 @@ static struct obex_mime_type_driver *find_driver(const uint8_t *target,
return NULL;
}
-struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
+const struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
unsigned int target_size,
const char *mimetype, const uint8_t *who,
unsigned int who_size)
{
- struct obex_mime_type_driver *driver;
+ const struct obex_mime_type_driver *driver;
driver = find_driver(target, target_size, mimetype, who, who_size);
if (driver == NULL) {
@@ -162,7 +162,7 @@ struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
return driver;
}
-int obex_mime_type_driver_register(struct obex_mime_type_driver *driver)
+int obex_mime_type_driver_register(const struct obex_mime_type_driver *driver)
{
if (!driver) {
error("Invalid driver");
@@ -178,12 +178,12 @@ int obex_mime_type_driver_register(struct obex_mime_type_driver *driver)
DBG("driver %p mimetype %s registered", driver, driver->mimetype);
- drivers = g_slist_append(drivers, driver);
+ drivers = g_slist_append(drivers, (gpointer)driver);
return 0;
}
-void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver)
+void obex_mime_type_driver_unregister(const struct obex_mime_type_driver *driver)
{
if (!g_slist_find(drivers, driver)) {
error("Unable to unregister: No such driver %p", driver);
diff --git a/obexd/src/mimetype.h b/obexd/src/mimetype.h
index 55ddded08..35346bb46 100644
--- a/obexd/src/mimetype.h
+++ b/obexd/src/mimetype.h
@@ -30,9 +30,9 @@ struct obex_mime_type_driver {
int (*remove) (const char *name);
};
-int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
-void obex_mime_type_driver_unregister(struct obex_mime_type_driver *driver);
-struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
+int obex_mime_type_driver_register(const struct obex_mime_type_driver *driver);
+void obex_mime_type_driver_unregister(const struct obex_mime_type_driver *driver);
+const struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
unsigned int target_size,
const char *mimetype, const uint8_t *who,
unsigned int who_size);
diff --git a/obexd/src/obex-priv.h b/obexd/src/obex-priv.h
index db409e7e4..994144678 100644
--- a/obexd/src/obex-priv.h
+++ b/obexd/src/obex-priv.h
@@ -38,7 +38,7 @@ struct obex_session {
struct obex_server *server;
gboolean checked;
GObex *obex;
- struct obex_mime_type_driver *driver;
+ const struct obex_mime_type_driver *driver;
gboolean headers_sent;
};
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 17/20] obexd: const obex_service_driver instances and API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (15 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 16/20] obexd: const obex_mime_type_driver instances and API Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (3 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
obexd/client/mns.c | 2 +-
obexd/plugins/bluetooth.c | 4 ++--
obexd/plugins/ftp.c | 2 +-
obexd/plugins/irmc.c | 2 +-
obexd/plugins/mas.c | 2 +-
obexd/plugins/opp.c | 2 +-
obexd/plugins/pbap.c | 2 +-
obexd/plugins/pcsuite.c | 2 +-
obexd/plugins/syncevolution.c | 2 +-
obexd/src/obex-priv.h | 2 +-
obexd/src/server.c | 2 +-
obexd/src/service.c | 20 ++++++++++----------
obexd/src/service.h | 6 +++---
13 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/obexd/client/mns.c b/obexd/client/mns.c
index 3b2ae1076..702cf0367 100644
--- a/obexd/client/mns.c
+++ b/obexd/client/mns.c
@@ -346,7 +346,7 @@ static ssize_t event_report_write(void *obj, const void *buf, size_t count)
return count;
}
-static struct obex_service_driver mns = {
+static const struct obex_service_driver mns = {
.name = "Message Notification server",
.service = OBEX_MNS,
.target = MNS_TARGET,
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index d232d3fd5..bcf6e1998 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -41,7 +41,7 @@
struct bluetooth_profile {
struct obex_server *server;
- struct obex_service_driver *driver;
+ const struct obex_service_driver *driver;
char *uuid;
char *path;
};
@@ -355,7 +355,7 @@ static void *bluetooth_start(struct obex_server *server, int *err)
const GSList *l;
for (l = server->drivers; l; l = l->next) {
- struct obex_service_driver *driver = l->data;
+ const struct obex_service_driver *driver = l->data;
struct bluetooth_profile *profile;
const char *uuid;
diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c
index 4b04bab06..874fe2b8b 100644
--- a/obexd/plugins/ftp.c
+++ b/obexd/plugins/ftp.c
@@ -494,7 +494,7 @@ static void ftp_reset(struct obex_session *os, void *user_data)
manager_emit_transfer_completed(ftp->transfer);
}
-static struct obex_service_driver ftp = {
+static const struct obex_service_driver ftp = {
.name = "File Transfer server",
.service = OBEX_FTP,
.target = FTP_TARGET,
diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
index e85cf70a1..cab97b620 100644
--- a/obexd/plugins/irmc.c
+++ b/obexd/plugins/irmc.c
@@ -427,7 +427,7 @@ static const struct obex_mime_type_driver irmc_driver = {
.read = irmc_read,
};
-static struct obex_service_driver irmc = {
+static const struct obex_service_driver irmc = {
.name = "IRMC Sync server",
.service = OBEX_IRMC,
.target = IRMC_TARGET,
diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index f0eaf6d82..10b972d65 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
@@ -781,7 +781,7 @@ static void *notification_registration_open(const char *name, int oflag,
return mas;
}
-static struct obex_service_driver mas = {
+static const struct obex_service_driver mas = {
.name = "Message Access server",
.service = OBEX_MAS,
.target = MAS_TARGET,
diff --git a/obexd/plugins/opp.c b/obexd/plugins/opp.c
index 860161303..777f5f8ed 100644
--- a/obexd/plugins/opp.c
+++ b/obexd/plugins/opp.c
@@ -155,7 +155,7 @@ static void opp_reset(struct obex_session *os, void *user_data)
manager_emit_transfer_completed(user_data);
}
-static struct obex_service_driver driver = {
+static const struct obex_service_driver driver = {
.name = "Object Push server",
.service = OBEX_OPP,
.connect = opp_connect,
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index b363c673b..4175f9de8 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -634,7 +634,7 @@ static int pbap_chkput(struct obex_session *os, void *user_data)
return -EBADR;
}
-static struct obex_service_driver pbap = {
+static const struct obex_service_driver pbap = {
.name = "Phonebook Access server",
.service = OBEX_PBAP,
.target = PBAP_TARGET,
diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
index d4a0394af..752074c08 100644
--- a/obexd/plugins/pcsuite.c
+++ b/obexd/plugins/pcsuite.c
@@ -231,7 +231,7 @@ static void pcsuite_disconnect(struct obex_session *os, void *user_data)
g_free(pcsuite);
}
-static struct obex_service_driver pcsuite = {
+static const struct obex_service_driver pcsuite = {
.name = "Nokia OBEX PC Suite Services",
.service = OBEX_PCSUITE,
.channel = PCSUITE_CHANNEL,
diff --git a/obexd/plugins/syncevolution.c b/obexd/plugins/syncevolution.c
index f0387b986..ae3dc48c4 100644
--- a/obexd/plugins/syncevolution.c
+++ b/obexd/plugins/syncevolution.c
@@ -436,7 +436,7 @@ static const struct obex_mime_type_driver synce_driver = {
.write = synce_write,
};
-static struct obex_service_driver synce = {
+static const struct obex_service_driver synce = {
.name = "OBEX server for SyncML, using SyncEvolution",
.service = OBEX_SYNCEVOLUTION,
.channel = SYNCEVOLUTION_CHANNEL,
diff --git a/obexd/src/obex-priv.h b/obexd/src/obex-priv.h
index 994144678..d2c62a596 100644
--- a/obexd/src/obex-priv.h
+++ b/obexd/src/obex-priv.h
@@ -33,7 +33,7 @@ struct obex_session {
void *object;
gboolean aborted;
int err;
- struct obex_service_driver *service;
+ const struct obex_service_driver *service;
void *service_data;
struct obex_server *server;
gboolean checked;
diff --git a/obexd/src/server.c b/obexd/src/server.c
index a8fc45092..eef149272 100644
--- a/obexd/src/server.c
+++ b/obexd/src/server.c
@@ -82,7 +82,7 @@ int obex_server_init(void)
}
for (l = drivers; l; l = l->next) {
- struct obex_service_driver *driver = l->data;
+ const struct obex_service_driver *driver = l->data;
init_server(driver->service, transports);
}
diff --git a/obexd/src/service.c b/obexd/src/service.c
index 0f4e420e8..332d61939 100644
--- a/obexd/src/service.c
+++ b/obexd/src/service.c
@@ -26,14 +26,14 @@
static GSList *drivers = NULL;
-struct obex_service_driver *obex_service_driver_find(GSList *drivers,
+const struct obex_service_driver *obex_service_driver_find(GSList *drivers,
const uint8_t *target, unsigned int target_size,
const uint8_t *who, unsigned int who_size)
{
GSList *l;
for (l = drivers; l; l = l->next) {
- struct obex_service_driver *driver = l->data;
+ const struct obex_service_driver *driver = l->data;
/* who is optional, so only check for it if not NULL */
if (who != NULL && memncmp0(who, who_size, driver->who,
@@ -57,10 +57,10 @@ GSList *obex_service_driver_list(uint16_t services)
return drivers;
for (l = drivers; l && services; l = l->next) {
- struct obex_service_driver *driver = l->data;
+ const struct obex_service_driver *driver = l->data;
if (driver->service & services) {
- list = g_slist_append(list, driver);
+ list = g_slist_append(list, (gpointer)driver);
services &= ~driver->service;
}
}
@@ -68,12 +68,12 @@ GSList *obex_service_driver_list(uint16_t services)
return list;
}
-static struct obex_service_driver *find_driver(uint16_t service)
+static const struct obex_service_driver *find_driver(uint16_t service)
{
GSList *l;
for (l = drivers; l; l = l->next) {
- struct obex_service_driver *driver = l->data;
+ const struct obex_service_driver *driver = l->data;
if (driver->service == service)
return driver;
@@ -82,7 +82,7 @@ static struct obex_service_driver *find_driver(uint16_t service)
return NULL;
}
-int obex_service_driver_register(struct obex_service_driver *driver)
+int obex_service_driver_register(const struct obex_service_driver *driver)
{
if (!driver) {
error("Invalid driver");
@@ -99,14 +99,14 @@ int obex_service_driver_register(struct obex_service_driver *driver)
/* Drivers that support who has priority */
if (driver->who)
- drivers = g_slist_prepend(drivers, driver);
+ drivers = g_slist_prepend(drivers, (gpointer)driver);
else
- drivers = g_slist_append(drivers, driver);
+ drivers = g_slist_append(drivers, (gpointer)driver);
return 0;
}
-void obex_service_driver_unregister(struct obex_service_driver *driver)
+void obex_service_driver_unregister(const struct obex_service_driver *driver)
{
if (!g_slist_find(drivers, driver)) {
error("Unable to unregister: No such driver %p", driver);
diff --git a/obexd/src/service.h b/obexd/src/service.h
index e3aee3bf3..8d9f70558 100644
--- a/obexd/src/service.h
+++ b/obexd/src/service.h
@@ -32,9 +32,9 @@ struct obex_service_driver {
void (*reset) (struct obex_session *os, void *user_data);
};
-int obex_service_driver_register(struct obex_service_driver *driver);
-void obex_service_driver_unregister(struct obex_service_driver *driver);
+int obex_service_driver_register(const struct obex_service_driver *driver);
+void obex_service_driver_unregister(const struct obex_service_driver *driver);
GSList *obex_service_driver_list(uint16_t services);
-struct obex_service_driver *obex_service_driver_find(GSList *drivers,
+const struct obex_service_driver *obex_service_driver_find(GSList *drivers,
const uint8_t *target, unsigned int target_size,
const uint8_t *who, unsigned int who_size);
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 18/20] obexd: const obex_transport_driver instances and API
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (16 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 17/20] obexd: const obex_service_driver " Emil Velikov via B4 Relay
@ 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 via B4 Relay
` (2 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
obexd/plugins/bluetooth.c | 2 +-
obexd/src/obex.c | 4 ++--
obexd/src/server.c | 8 ++++----
obexd/src/server.h | 2 +-
obexd/src/transport.c | 14 +++++++-------
obexd/src/transport.h | 6 +++---
6 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index bcf6e1998..51afdc9d0 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -416,7 +416,7 @@ static int bluetooth_getsockname(GIOChannel *io, char **name)
return 0;
}
-static struct obex_transport_driver driver = {
+static const struct obex_transport_driver driver = {
.name = "bluetooth",
.start = bluetooth_start,
.getpeername = bluetooth_getpeername,
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 4bf5ad124..526861f40 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -1085,7 +1085,7 @@ ssize_t obex_get_non_header_data(struct obex_session *os,
int obex_getpeername(struct obex_session *os, char **name)
{
- struct obex_transport_driver *transport = os->server->transport;
+ const struct obex_transport_driver *transport = os->server->transport;
if (transport == NULL || transport->getpeername == NULL)
return -ENOTSUP;
@@ -1095,7 +1095,7 @@ int obex_getpeername(struct obex_session *os, char **name)
int obex_getsockname(struct obex_session *os, char **name)
{
- struct obex_transport_driver *transport = os->server->transport;
+ const struct obex_transport_driver *transport = os->server->transport;
if (transport == NULL || transport->getsockname == NULL)
return -ENOTSUP;
diff --git a/obexd/src/server.c b/obexd/src/server.c
index eef149272..0dca728d2 100644
--- a/obexd/src/server.c
+++ b/obexd/src/server.c
@@ -34,12 +34,12 @@
static GSList *servers = NULL;
-static void init_server(uint16_t service, GSList *transports)
+static void init_server(uint16_t service, const GSList *transports)
{
- GSList *l;
+ const GSList *l;
for (l = transports; l; l = l->next) {
- struct obex_transport_driver *transport = l->data;
+ const struct obex_transport_driver *transport = l->data;
struct obex_server *server;
int err;
@@ -66,7 +66,7 @@ static void init_server(uint16_t service, GSList *transports)
int obex_server_init(void)
{
GSList *drivers;
- GSList *transports;
+ const GSList *transports;
GSList *l;
drivers = obex_service_driver_list(0);
diff --git a/obexd/src/server.h b/obexd/src/server.h
index c31236ec0..ec063ae2e 100644
--- a/obexd/src/server.h
+++ b/obexd/src/server.h
@@ -10,7 +10,7 @@
*/
struct obex_server {
- struct obex_transport_driver *transport;
+ const struct obex_transport_driver *transport;
void *transport_data;
GSList *drivers;
};
diff --git a/obexd/src/transport.c b/obexd/src/transport.c
index 4b5895e5d..234a0e004 100644
--- a/obexd/src/transport.c
+++ b/obexd/src/transport.c
@@ -27,13 +27,13 @@
static GSList *drivers = NULL;
-static struct obex_transport_driver *obex_transport_driver_find(
+static const struct obex_transport_driver *obex_transport_driver_find(
const char *name)
{
- GSList *l;
+ const GSList *l;
for (l = drivers; l; l = l->next) {
- struct obex_transport_driver *driver = l->data;
+ const struct obex_transport_driver *driver = l->data;
if (g_strcmp0(name, driver->name) == 0)
return driver;
@@ -42,12 +42,12 @@ static struct obex_transport_driver *obex_transport_driver_find(
return NULL;
}
-GSList *obex_transport_driver_list(void)
+const GSList *obex_transport_driver_list(void)
{
return drivers;
}
-int obex_transport_driver_register(struct obex_transport_driver *driver)
+int obex_transport_driver_register(const struct obex_transport_driver *driver)
{
if (!driver) {
error("Invalid driver");
@@ -62,12 +62,12 @@ int obex_transport_driver_register(struct obex_transport_driver *driver)
DBG("driver %p transport %s registered", driver, driver->name);
- drivers = g_slist_prepend(drivers, driver);
+ drivers = g_slist_prepend(drivers, (gpointer)driver);
return 0;
}
-void obex_transport_driver_unregister(struct obex_transport_driver *driver)
+void obex_transport_driver_unregister(const struct obex_transport_driver *driver)
{
if (!g_slist_find(drivers, driver)) {
error("Unable to unregister: No such driver %p", driver);
diff --git a/obexd/src/transport.h b/obexd/src/transport.h
index 3a16b7620..fe79432cf 100644
--- a/obexd/src/transport.h
+++ b/obexd/src/transport.h
@@ -17,6 +17,6 @@ struct obex_transport_driver {
void (*stop) (void *data);
};
-int obex_transport_driver_register(struct obex_transport_driver *driver);
-void obex_transport_driver_unregister(struct obex_transport_driver *driver);
-GSList *obex_transport_driver_list(void);
+int obex_transport_driver_register(const struct obex_transport_driver *driver);
+void obex_transport_driver_unregister(const struct obex_transport_driver *driver);
+const GSList *obex_transport_driver_list(void);
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 19/20] obexd: const annotate misc immutable data
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (17 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 18/20] obexd: const obex_transport_driver " Emil Velikov via B4 Relay
@ 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 via B4 Relay
2024-01-22 23:53 ` [PATCH BlueZ 00/20] Constify all the things patchwork-bot+bluetooth
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
obexd/client/manager.c | 6 +++---
obexd/client/map.c | 4 ++--
obexd/client/mns.c | 4 ++--
obexd/plugins/phonebook-ebook.c | 2 +-
obexd/src/main.c | 2 +-
obexd/src/obex.c | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/obexd/client/manager.c b/obexd/client/manager.c
index 75f1bfb04..ad1fbb04a 100644
--- a/obexd/client/manager.c
+++ b/obexd/client/manager.c
@@ -241,7 +241,7 @@ static const GDBusMethodTable client_methods[] = {
static DBusConnection *conn = NULL;
-static struct obc_module {
+static const struct obc_module {
const char *name;
int (*init) (void);
void (*exit) (void);
@@ -258,7 +258,7 @@ static struct obc_module {
int client_manager_init(void)
{
DBusError derr;
- struct obc_module *module;
+ const struct obc_module *module;
dbus_error_init(&derr);
@@ -289,7 +289,7 @@ int client_manager_init(void)
void client_manager_exit(void)
{
- struct obc_module *module;
+ const struct obc_module *module;
if (conn == NULL)
return;
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 74828cddb..513dcaf14 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1060,7 +1060,7 @@ static void parse_protected(struct map_msg *msg, const char *value)
MAP_MSG_INTERFACE, "Protected");
}
-static struct map_msg_parser {
+static const struct map_msg_parser {
const char *name;
void (*func) (struct map_msg *msg, const char *value);
} msg_parsers[] = {
@@ -1120,7 +1120,7 @@ static void msg_element(GMarkupParseContext *ctxt, const char *element,
&msg->path);
for (i = 0, key = names[i]; key; key = names[++i]) {
- struct map_msg_parser *parser;
+ const struct map_msg_parser *parser;
for (parser = msg_parsers; parser && parser->name; parser++) {
if (strcasecmp(key, parser->name) == 0) {
diff --git a/obexd/client/mns.c b/obexd/client/mns.c
index 702cf0367..c7f86afdc 100644
--- a/obexd/client/mns.c
+++ b/obexd/client/mns.c
@@ -233,7 +233,7 @@ static void parse_event_report_priority(struct map_event *event,
event->priority = g_strdup(value);
}
-static struct map_event_report_parser {
+static const struct map_event_report_parser {
const char *name;
void (*func) (struct map_event *event, const char *value);
} event_report_parsers[] = {
@@ -262,7 +262,7 @@ static void event_report_element(GMarkupParseContext *ctxt,
return;
for (i = 0, key = names[i]; key; key = names[++i]) {
- struct map_event_report_parser *parser;
+ const struct map_event_report_parser *parser;
for (parser = event_report_parsers; parser && parser->name;
parser++) {
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index 29ec9d213..e509dd29a 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
@@ -55,7 +55,7 @@ struct query_context {
gboolean canceled;
};
-static char *attribute_mask[] = {
+static const char *attribute_mask[] = {
/* 0 */ "VERSION",
"FN",
"N",
diff --git a/obexd/src/main.c b/obexd/src/main.c
index d950883f0..151574afa 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
@@ -138,7 +138,7 @@ static gboolean parse_debug(const char *key, const char *value,
return TRUE;
}
-static GOptionEntry options[] = {
+static const GOptionEntry options[] = {
{ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, parse_debug,
"Enable debug information output", "DEBUG" },
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 526861f40..98d6245a4 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -55,7 +55,7 @@ struct auth_header {
} __attribute__ ((packed));
/* Possible commands */
-static struct {
+static const struct {
int cmd;
const char *name;
} obex_command[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH BlueZ 20/20] obexd: const annotate obex_plugin_desc entrypoint
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (18 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 19/20] obexd: const annotate misc immutable data Emil Velikov via B4 Relay
@ 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
20 siblings, 0 replies; 23+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-16 14:00 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
From: Emil Velikov <emil.velikov@collabora.com>
---
obexd/src/genbuiltin | 4 ++--
obexd/src/plugin.c | 8 ++++----
obexd/src/plugin.h | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/obexd/src/genbuiltin b/obexd/src/genbuiltin
index 39f773527..e60b5189a 100755
--- a/obexd/src/genbuiltin
+++ b/obexd/src/genbuiltin
@@ -2,11 +2,11 @@
for i in $*
do
- echo "extern struct obex_plugin_desc __obex_builtin_$i;"
+ echo "extern const struct obex_plugin_desc __obex_builtin_$i;"
done
echo
-echo "static struct obex_plugin_desc *__obex_builtin[] = {"
+echo "static const struct obex_plugin_desc *__obex_builtin[] = {"
for i in $*
do
diff --git a/obexd/src/plugin.c b/obexd/src/plugin.c
index 0df9d5258..a3eb24753 100644
--- a/obexd/src/plugin.c
+++ b/obexd/src/plugin.c
@@ -38,10 +38,10 @@ static GSList *plugins = NULL;
struct obex_plugin {
void *handle;
- struct obex_plugin_desc *desc;
+ const struct obex_plugin_desc *desc;
};
-static gboolean add_plugin(void *handle, struct obex_plugin_desc *desc)
+static gboolean add_plugin(void *handle, const struct obex_plugin_desc *desc)
{
struct obex_plugin *plugin;
@@ -66,7 +66,7 @@ static gboolean add_plugin(void *handle, struct obex_plugin_desc *desc)
return TRUE;
}
-static gboolean check_plugin(struct obex_plugin_desc *desc,
+static gboolean check_plugin(const struct obex_plugin_desc *desc,
char **patterns, char **excludes)
{
if (excludes) {
@@ -132,7 +132,7 @@ gboolean plugin_init(const char *pattern, const char *exclude)
}
while ((file = g_dir_read_name(dir)) != NULL) {
- struct obex_plugin_desc *desc;
+ const struct obex_plugin_desc *desc;
void *handle;
char *filename;
diff --git a/obexd/src/plugin.h b/obexd/src/plugin.h
index 703878460..a91746cbc 100644
--- a/obexd/src/plugin.h
+++ b/obexd/src/plugin.h
@@ -16,14 +16,14 @@ struct obex_plugin_desc {
#ifdef OBEX_PLUGIN_BUILTIN
#define OBEX_PLUGIN_DEFINE(name, init, exit) \
- struct obex_plugin_desc __obex_builtin_ ## name = { \
+ const 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 = { \
+ const struct obex_plugin_desc obex_plugin_desc = { \
#name, init, exit \
};
#endif
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* RE: Constify all the things
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 ` bluez.test.bot
0 siblings, 0 replies; 23+ messages in thread
From: bluez.test.bot @ 2024-01-16 18:37 UTC (permalink / raw)
To: linux-bluetooth, devnull+emil.l.velikov.gmail.com
[-- Attachment #1: Type: text/plain, Size: 12775 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=817220
---Test result---
Test Summary:
CheckPatch FAIL 6.32 seconds
GitLint PASS 3.96 seconds
BuildEll PASS 23.78 seconds
BluezMake PASS 712.63 seconds
MakeCheck PASS 12.07 seconds
MakeDistcheck PASS 158.82 seconds
CheckValgrind PASS 219.94 seconds
CheckSmatch WARNING 325.30 seconds
bluezmakeextell PASS 105.45 seconds
IncrementalBuild PASS 13281.67 seconds
ScanBuild WARNING 928.49 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,01/20] src: const annotate the bluetooth plugin API
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#119: FILE: src/plugin.c:45:
+static gboolean add_plugin(void *handle, const struct bluetooth_plugin_desc *desc)
WARNING:LONG_LINE: line length of 85 exceeds 80 columns
#141: FILE: src/plugin.h:26:
+ const struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#150: FILE: src/plugin.h:35:
+ extern const struct bluetooth_plugin_desc bluetooth_plugin_desc \
/github/workspace/src/src/13520846.patch total: 0 errors, 3 warnings, 64 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520846.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,02/20] monitor: const annotate util_ltv_debugger instances and API
WARNING:LONG_LINE: line length of 84 exceeds 80 columns
#75: FILE: monitor/att.c:686:
+ const struct util_ltv_debugger *decoder, size_t decoder_len)
WARNING:LONG_LINE: line length of 84 exceeds 80 columns
#84: FILE: monitor/att.c:708:
+ const struct util_ltv_debugger *decoder, size_t decoder_len)
/github/workspace/src/src/13520847.patch total: 0 errors, 2 warnings, 48 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520847.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,03/20] monitor: const annotate cmd/handler tables
WARNING:LONG_LINE: line length of 84 exceeds 80 columns
#146: FILE: monitor/att.c:3160:
+static const struct bcast_audio_scan_cp_cmd *bcast_audio_scan_cp_get_cmd(uint8_t op)
/github/workspace/src/src/13520848.patch total: 0 errors, 1 warnings, 136 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520848.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,04/20] monitor: const annotate misc arrays
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#158: FILE: monitor/rfcomm.c:35:
+static const char *cr_str[] = {
/github/workspace/src/src/13520855.patch total: 0 errors, 1 warnings, 80 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520855.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,07/20] profiles: annotate immutable data as const
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#165: FILE: profiles/audio/sink.c:65:
+static const char *str_state[] = {
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#178: FILE: profiles/audio/source.c:64:
+static const char *str_state[] = {
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#191: FILE: profiles/audio/transport.c:58:
+static const char *str_state[] = {
WARNING:LONG_LINE: line length of 83 exceeds 80 columns
#218: FILE: profiles/audio/transport.c:1765:
+static const struct media_transport_ops *media_transport_find_ops(const char *uuid)
/github/workspace/src/src/13520849.patch total: 0 errors, 4 warnings, 185 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520849.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,11/20] gobex: const annotate RO arrays, use G_N_ELEMENTS
WARNING:LONG_LINE: line length of 90 exceeds 80 columns
#102: FILE: gobex/gobex.c:1446:
+ gobex_debug = g_parse_debug_string(env, keys, G_N_ELEMENTS(keys));
/github/workspace/src/src/13520860.patch total: 0 errors, 1 warnings, 32 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520860.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,13/20] lib: const annotate tupla instances and API
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#117: FILE: lib/sdp.c:190:
+static const char *string_lookup_uuid(const struct tupla *pt0, const uuid_t *uuid)
WARNING:LONG_LINE: line length of 89 exceeds 80 columns
#126: FILE: lib/sdp.c:212:
+static int uuid2str(const struct tupla *message, const uuid_t *uuid, char *str, size_t n)
/github/workspace/src/src/13520857.patch total: 0 errors, 2 warnings, 66 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520857.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,16/20] obexd: const obex_mime_type_driver instances and API
WARNING:LONG_LINE: line length of 85 exceeds 80 columns
#301: FILE: obexd/src/mimetype.c:137:
+const struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#331: FILE: obexd/src/mimetype.c:186:
+void obex_mime_type_driver_unregister(const struct obex_mime_type_driver *driver)
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#347: FILE: obexd/src/mimetype.h:34:
+void obex_mime_type_driver_unregister(const struct obex_mime_type_driver *driver);
WARNING:LONG_LINE: line length of 85 exceeds 80 columns
#348: FILE: obexd/src/mimetype.h:35:
+const struct obex_mime_type_driver *obex_mime_type_driver_find(const uint8_t *target,
/github/workspace/src/src/13520859.patch total: 0 errors, 4 warnings, 224 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520859.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,18/20] obexd: const obex_transport_driver instances and API
WARNING:LONG_LINE: line length of 81 exceeds 80 columns
#195: FILE: obexd/src/transport.c:70:
+void obex_transport_driver_unregister(const struct obex_transport_driver *driver)
WARNING:LONG_LINE: line length of 82 exceeds 80 columns
#211: FILE: obexd/src/transport.h:21:
+void obex_transport_driver_unregister(const struct obex_transport_driver *driver);
/github/workspace/src/src/13520863.patch total: 0 errors, 2 warnings, 108 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520863.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
[BlueZ,19/20] obexd: const annotate misc immutable data
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#154: FILE: obexd/plugins/phonebook-ebook.c:58:
+static const char *attribute_mask[] = {
/github/workspace/src/src/13520864.patch total: 0 errors, 1 warnings, 80 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13520864.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/att.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/l2cap.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.attrib/gatttool.c:235:23: warning: Variable length array is used.attrib/interactive.c: note: in included file (through /usr/include/readline/readline.h):attrib/interactive.c:174:27: warning: non-ANSI function declaration of function 'disconnect_io'attrib/interactive.c:299:23: warning: Variable length array is used.emulator/bthost.c:584:28: warning: Variable length array is used.emulator/bthost.c:741:28: warning: Variable length array is used.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
obexd/src/obex.c:123:3: warning: Access to field 'close' results in a dereference of a null pointer (loaded from field 'driver')
os->driver->close(os->object);
^~~~~~~~~~~~~~~~~
1 warning generated.profiles/health/hdp_util.c:1052:2: warning: Use of memory after it is freed
conn_data->func(conn_data->data, gerr);
^~~~~~~~~~~~~~~
1 warning generated.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH BlueZ 00/20] Constify all the things
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
` (19 preceding siblings ...)
2024-01-16 14:00 ` [PATCH BlueZ 20/20] obexd: const annotate obex_plugin_desc entrypoint Emil Velikov via B4 Relay
@ 2024-01-22 23:53 ` patchwork-bot+bluetooth
20 siblings, 0 replies; 23+ messages in thread
From: patchwork-bot+bluetooth @ 2024-01-22 23:53 UTC (permalink / raw)
To: Emil Velikov via B4 Relay; +Cc: linux-bluetooth, emil.velikov
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 16 Jan 2024 14:00:25 +0000 you wrote:
> Hello list,
>
> Here is series#2 of the paper cut fixes. Here we annotate a handful of
> the data as constant alongside updating all the respective APIs.
>
> There's nothing particularly existing or controversial here, despite the
> size of the series. That said, I'm not 100% sure that all code-paths
> have been (runtime) tested.
>
> [...]
Here is the summary with links:
- [BlueZ,01/20] src: const annotate the bluetooth plugin API
(no matching commit)
- [BlueZ,02/20] monitor: const annotate util_ltv_debugger instances and API
(no matching commit)
- [BlueZ,03/20] monitor: const annotate cmd/handler tables
(no matching commit)
- [BlueZ,04/20] monitor: const annotate misc arrays
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4630f3fba0fc
- [BlueZ,05/20] monitor: const annotate intel_version_tlv_desc::type_str and API
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5380e63a80f2
- [BlueZ,06/20] monitor: const annotate type_table and related API
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f8e0270a7a73
- [BlueZ,07/20] profiles: annotate immutable data as const
(no matching commit)
- [BlueZ,08/20] attrib: annotate immutable data as const
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a8543fd2b062
- [BlueZ,09/20] client: annotate struct option instances as const
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=20864af937f3
- [BlueZ,10/20] emulator: const annotate rfcomm_crc_table[]
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4d88fd2fabd6
- [BlueZ,11/20] gobex: const annotate RO arrays, use G_N_ELEMENTS
(no matching commit)
- [BlueZ,12/20] lib: const annotate hci_map instances and related API
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=af552cd906a0
- [BlueZ,13/20] lib: const annotate tupla instances and API
(no matching commit)
- [BlueZ,14/20] mesh: const annotate misc data
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a9393b2e9eec
- [BlueZ,15/20] obexd: remove obex_mime_type_driver::set_io_watch
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8e88f8cecaa8
- [BlueZ,16/20] obexd: const obex_mime_type_driver instances and API
(no matching commit)
- [BlueZ,17/20] obexd: const obex_service_driver instances and API
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ae8f9c956069
- [BlueZ,18/20] obexd: const obex_transport_driver instances and API
(no matching commit)
- [BlueZ,19/20] obexd: const annotate misc immutable data
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ac1d2369b29a
- [BlueZ,20/20] obexd: const annotate obex_plugin_desc entrypoint
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e0c64a2031e2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2024-01-22 23:53 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16 14:00 [PATCH BlueZ 00/20] Constify all the things Emil Velikov via B4 Relay
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 via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 03/20] monitor: const annotate cmd/handler tables Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 04/20] monitor: const annotate misc arrays 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 via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 06/20] monitor: const annotate type_table and related API Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 07/20] profiles: annotate immutable data as const Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 08/20] attrib: " Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 09/20] client: annotate struct option instances " Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 10/20] emulator: const annotate rfcomm_crc_table[] 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 via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 12/20] lib: const annotate hci_map instances and related API Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 13/20] lib: const annotate tupla instances and API Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 14/20] mesh: const annotate misc data 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 via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 16/20] obexd: const obex_mime_type_driver instances and API Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 17/20] obexd: const obex_service_driver " Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 18/20] obexd: const obex_transport_driver " Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 19/20] obexd: const annotate misc immutable data Emil Velikov via B4 Relay
2024-01-16 14:00 ` [PATCH BlueZ 20/20] obexd: const annotate obex_plugin_desc entrypoint Emil Velikov via B4 Relay
2024-01-22 23:53 ` [PATCH BlueZ 00/20] Constify all the things patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).