* [PATCH BlueZ 2/9] mesh: keyring: constify
2025-06-27 7:57 [PATCH BlueZ 1/9] doc: mesh-api: minor copy&paste fix Christian Eggers
@ 2025-06-27 7:57 ` Christian Eggers
2025-06-27 7:57 ` [PATCH BlueZ 3/9] mesh: mesh-config: constify Christian Eggers
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Christian Eggers @ 2025-06-27 7:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Eggers
---
mesh/keyring.c | 4 ++--
mesh/keyring.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mesh/keyring.c b/mesh/keyring.c
index cb091e15b613..3a09876777fd 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -67,7 +67,7 @@ static int open_key_file(struct mesh_node *node, const char *key_dir,
}
bool keyring_put_net_key(struct mesh_node *node, uint16_t net_idx,
- struct keyring_net_key *key)
+ const struct keyring_net_key *key)
{
bool result = false;
int fd;
@@ -191,7 +191,7 @@ bool keyring_finalize_app_keys(struct mesh_node *node, uint16_t net_idx)
}
bool keyring_put_remote_dev_key(struct mesh_node *node, uint16_t unicast,
- uint8_t count, uint8_t dev_key[16])
+ uint8_t count, const uint8_t dev_key[16])
{
const char *node_path;
char key_file[PATH_MAX];
diff --git a/mesh/keyring.h b/mesh/keyring.h
index efc499ac267e..e2088edfde14 100644
--- a/mesh/keyring.h
+++ b/mesh/keyring.h
@@ -23,7 +23,7 @@ struct keyring_app_key {
};
bool keyring_put_net_key(struct mesh_node *node, uint16_t net_idx,
- struct keyring_net_key *key);
+ const struct keyring_net_key *key);
bool keyring_get_net_key(struct mesh_node *node, uint16_t net_idx,
struct keyring_net_key *key);
bool keyring_del_net_key(struct mesh_node *node, uint16_t net_idx);
@@ -36,7 +36,7 @@ bool keyring_del_app_key(struct mesh_node *node, uint16_t app_idx);
bool keyring_get_remote_dev_key(struct mesh_node *node, uint16_t unicast,
uint8_t dev_key[16]);
bool keyring_put_remote_dev_key(struct mesh_node *node, uint16_t unicast,
- uint8_t count, uint8_t dev_key[16]);
+ uint8_t count, const uint8_t dev_key[16]);
bool keyring_del_remote_dev_key(struct mesh_node *node, uint16_t unicast,
uint8_t count);
bool keyring_del_remote_dev_key_all(struct mesh_node *node, uint16_t unicast);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH BlueZ 3/9] mesh: mesh-config: constify
2025-06-27 7:57 [PATCH BlueZ 1/9] doc: mesh-api: minor copy&paste fix Christian Eggers
2025-06-27 7:57 ` [PATCH BlueZ 2/9] mesh: keyring: constify Christian Eggers
@ 2025-06-27 7:57 ` Christian Eggers
2025-06-27 7:58 ` [PATCH BlueZ 4/9] mesh: util: constify Christian Eggers
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Christian Eggers @ 2025-06-27 7:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Eggers
removing 2 prototypes where an implementation never existed
---
mesh/mesh-config-json.c | 14 +++++++-------
mesh/mesh-config.h | 20 ++++++++------------
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
index 86e7d87e482e..5ad4d832a05a 100644
--- a/mesh/mesh-config-json.c
+++ b/mesh/mesh-config-json.c
@@ -739,7 +739,7 @@ bool mesh_config_net_key_del(struct mesh_config *cfg, uint16_t idx)
return save_config(jnode, cfg->node_dir_path);
}
-bool mesh_config_write_device_key(struct mesh_config *cfg, uint8_t *key)
+bool mesh_config_write_device_key(struct mesh_config *cfg, const uint8_t *key)
{
if (!cfg || !add_key_value(cfg->jnode, deviceKey, key))
return false;
@@ -747,7 +747,7 @@ bool mesh_config_write_device_key(struct mesh_config *cfg, uint8_t *key)
return save_config(cfg->jnode, cfg->node_dir_path);
}
-bool mesh_config_write_candidate(struct mesh_config *cfg, uint8_t *key)
+bool mesh_config_write_candidate(struct mesh_config *cfg, const uint8_t *key)
{
if (!cfg || !add_key_value(cfg->jnode, deviceCan, key))
return false;
@@ -782,7 +782,7 @@ bool mesh_config_finalize_candidate(struct mesh_config *cfg)
return save_config(cfg->jnode, cfg->node_dir_path);
}
-bool mesh_config_write_token(struct mesh_config *cfg, uint8_t *token)
+bool mesh_config_write_token(struct mesh_config *cfg, const uint8_t *token)
{
if (!cfg || !add_u64_value(cfg->jnode, "token", token))
return false;
@@ -2005,7 +2005,7 @@ bool mesh_config_net_key_set_phase(struct mesh_config *cfg, uint16_t idx,
bool mesh_config_model_pub_add(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
- struct mesh_config_pub *pub)
+ const struct mesh_config_pub *pub)
{
json_object *jnode, *jmodel, *jpub, *jrtx;
bool res;
@@ -2146,7 +2146,7 @@ void mesh_config_comp_page_del(struct mesh_config *cfg, uint8_t page)
}
bool mesh_config_comp_page_add(struct mesh_config *cfg, uint8_t page,
- uint8_t *data, uint16_t size)
+ const uint8_t *data, uint16_t size)
{
json_object *jnode, *jstring, *jarray = NULL;
char *buf;
@@ -2187,7 +2187,7 @@ bool mesh_config_comp_page_add(struct mesh_config *cfg, uint8_t page,
bool mesh_config_model_sub_add(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
- struct mesh_config_sub *sub)
+ const struct mesh_config_sub *sub)
{
json_object *jnode, *jmodel, *jstring, *jarray = NULL;
int ele_idx, len;
@@ -2239,7 +2239,7 @@ bool mesh_config_model_sub_add(struct mesh_config *cfg, uint16_t ele_addr,
bool mesh_config_model_sub_del(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
- struct mesh_config_sub *sub)
+ const struct mesh_config_sub *sub)
{
json_object *jnode, *jmodel, *jarray;
char buf[33];
diff --git a/mesh/mesh-config.h b/mesh/mesh-config.h
index 3cb20b85d5c3..b320116fa8dc 100644
--- a/mesh/mesh-config.h
+++ b/mesh/mesh-config.h
@@ -128,15 +128,11 @@ struct mesh_config *mesh_config_create(const char *cfgdir_name,
bool mesh_config_write_net_transmit(struct mesh_config *cfg, uint8_t cnt,
uint16_t interval);
-bool mesh_config_write_device_key(struct mesh_config *cfg, uint8_t *key);
-bool mesh_config_write_candidate(struct mesh_config *cfg, uint8_t *key);
+bool mesh_config_write_device_key(struct mesh_config *cfg, const uint8_t *key);
+bool mesh_config_write_candidate(struct mesh_config *cfg, const uint8_t *key);
bool mesh_config_read_candidate(struct mesh_config *cfg, uint8_t *key);
bool mesh_config_finalize_candidate(struct mesh_config *cfg);
-bool mesh_config_write_token(struct mesh_config *cfg, uint8_t *token);
-bool mesh_config_write_network_key(struct mesh_config *cfg, uint16_t idx,
- uint8_t *key, uint8_t *new_key, int phase);
-bool mesh_config_write_app_key(struct mesh_config *cfg, uint16_t net_idx,
- uint16_t app_idx, uint8_t *key, uint8_t *new_key);
+bool mesh_config_write_token(struct mesh_config *cfg, const uint8_t *token);
bool mesh_config_write_seq_number(struct mesh_config *cfg, uint32_t seq,
bool cache);
bool mesh_config_write_unicast(struct mesh_config *cfg, uint16_t unicast);
@@ -150,7 +146,7 @@ bool mesh_config_write_mode(struct mesh_config *cfg, const char *keyword,
bool mesh_config_write_mode_ex(struct mesh_config *cfg, const char *keyword,
int value, bool save);
bool mesh_config_comp_page_add(struct mesh_config *cfg, uint8_t page,
- uint8_t *data, uint16_t size);
+ const uint8_t *data, uint16_t size);
void mesh_config_comp_page_del(struct mesh_config *cfg, uint8_t page);
bool mesh_config_model_binding_add(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
@@ -159,16 +155,16 @@ bool mesh_config_model_binding_del(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
uint16_t app_idx);
bool mesh_config_model_pub_add(struct mesh_config *cfg, uint16_t ele_addr,
- uint32_t mod_id, bool vendor,
- struct mesh_config_pub *pub);
+ uint32_t mod_id, bool vendor,
+ const struct mesh_config_pub *pub);
bool mesh_config_model_pub_del(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor);
bool mesh_config_model_sub_add(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
- struct mesh_config_sub *sub);
+ const struct mesh_config_sub *sub);
bool mesh_config_model_sub_del(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor,
- struct mesh_config_sub *sub);
+ const struct mesh_config_sub *sub);
bool mesh_config_model_sub_del_all(struct mesh_config *cfg, uint16_t ele_addr,
uint32_t mod_id, bool vendor);
bool mesh_config_model_pub_enable(struct mesh_config *cfg, uint16_t ele_addr,
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH BlueZ 5/9] mesh: mesh_net_transport_send: simplify
2025-06-27 7:57 [PATCH BlueZ 1/9] doc: mesh-api: minor copy&paste fix Christian Eggers
` (2 preceding siblings ...)
2025-06-27 7:58 ` [PATCH BlueZ 4/9] mesh: util: constify Christian Eggers
@ 2025-06-27 7:58 ` Christian Eggers
2025-06-27 9:34 ` [BlueZ,1/9] doc: mesh-api: minor copy&paste fix bluez.test.bot
4 siblings, 0 replies; 7+ messages in thread
From: Christian Eggers @ 2025-06-27 7:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Christian Eggers
No need for internal copy of 'seq'.
---
mesh/net.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mesh/net.c b/mesh/net.c
index cc862dade5ae..f26a63f178c2 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -3411,7 +3411,6 @@ void mesh_net_transport_send(struct mesh_net *net, uint32_t net_key_id,
uint16_t dst, const uint8_t *msg,
uint16_t msg_len)
{
- uint32_t use_seq = seq;
uint8_t pkt_len;
uint8_t pkt[30];
bool result = false;
@@ -3463,13 +3462,13 @@ void mesh_net_transport_send(struct mesh_net *net, uint32_t net_key_id,
return;
net_key_id = subnet->net_key_tx;
- use_seq = mesh_net_next_seq_num(net);
+ seq = mesh_net_next_seq_num(net);
if (result || (dst >= net->src_addr && dst <= net->last_addr))
return;
}
- if (!mesh_crypto_packet_build(true, ttl, use_seq, src, dst, msg[0],
+ if (!mesh_crypto_packet_build(true, ttl, seq, src, dst, msg[0],
false, 0, false, false, 0, 0, 0, msg + 1,
msg_len - 1, pkt + 1, &pkt_len))
return;
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread