From 3f24301fff9c544dfe2b89c5737bc3cdf94ef9a9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 27 Nov 2023 14:43:10 +0100 Subject: include: Rename layer.layer_name to layer.name The layer_info had a member layer_name which is a bit redundant. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/ipcp.h | 2 +- src/ipcpd/broadcast/main.c | 4 ++-- src/ipcpd/eth/eth.c | 2 +- src/ipcpd/local/main.c | 2 +- src/ipcpd/udp/main.c | 2 +- src/ipcpd/unicast/main.c | 4 ++-- src/irmd/configfile.c | 4 ++-- src/irmd/ipcp.c | 4 ++-- src/irmd/main.c | 8 ++++---- src/lib/pb/ipcp_config.proto | 4 ++-- src/lib/protobuf.c | 8 ++++---- src/tools/irm/irm_ipcp_bootstrap.c | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h index c4d596b2..4be9b48e 100644 --- a/include/ouroboros/ipcp.h +++ b/include/ouroboros/ipcp.h @@ -99,7 +99,7 @@ struct udp_config { /* Info reported back to the IRMd about the layer on enrollment */ struct layer_info { - char layer_name[LAYER_NAME_SIZE + 1]; + char name[LAYER_NAME_SIZE + 1]; int dir_hash_algo; }; diff --git a/src/ipcpd/broadcast/main.c b/src/ipcpd/broadcast/main.c index de1feeb2..e3e323a8 100644 --- a/src/ipcpd/broadcast/main.c +++ b/src/ipcpd/broadcast/main.c @@ -56,7 +56,7 @@ struct ipcp ipcpi; static int initialize_components(const struct ipcp_config * conf) { - strcpy(ipcpi.layer_name, conf->layer_info.layer_name); + strcpy(ipcpi.layer_name, conf->layer_info.name); ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo; assert(ipcp_dir_hash_len() != 0); @@ -147,7 +147,7 @@ static int broadcast_ipcp_enroll(const char * dst, log_info_id(id, "Enrolled with %s.", dst); info->dir_hash_algo = ipcpi.dir_hash_algo; - strcpy(info->layer_name, ipcpi.layer_name); + strcpy(info->name, ipcpi.layer_name); return 0; diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index 999c1ac8..09c7bde9 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -1248,7 +1248,7 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) assert(conf->type == THIS_TYPE); ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo; - strcpy(ipcpi.layer_name, conf->layer_info.layer_name); + strcpy(ipcpi.layer_name, conf->layer_info.name); if (strlen(conf->eth.dev) >= IFNAMSIZ) { log_err("Invalid device name: %s.", conf->eth.dev); diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index ef1c679b..58d9c866 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -145,7 +145,7 @@ static int local_ipcp_bootstrap(const struct ipcp_config * conf) assert(conf->type == THIS_TYPE); ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo; - strcpy(ipcpi.layer_name,conf->layer_info.layer_name); + strcpy(ipcpi.layer_name,conf->layer_info.name); if (pthread_create(&local_data.packet_loop, NULL, local_ipcp_packet_loop, NULL)) { diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c index ddcf1a5b..b189dce3 100644 --- a/src/ipcpd/udp/main.c +++ b/src/ipcpd/udp/main.c @@ -595,7 +595,7 @@ static int udp_ipcp_bootstrap(const struct ipcp_config * conf) ((struct ipcp_config *) conf)->layer_info.dir_hash_algo = HASH_MD5; ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo; - strcpy(ipcpi.layer_name, conf->layer_info.layer_name); + strcpy(ipcpi.layer_name, conf->layer_info.name); if (inet4_ntop(&conf->udp.ip_addr, ipstr) == NULL) { log_err("Failed to convert IP address."); diff --git a/src/ipcpd/unicast/main.c b/src/ipcpd/unicast/main.c index 83504168..06441ae0 100644 --- a/src/ipcpd/unicast/main.c +++ b/src/ipcpd/unicast/main.c @@ -59,7 +59,7 @@ struct ipcp ipcpi; static int initialize_components(const struct ipcp_config * conf) { - strcpy(ipcpi.layer_name, conf->layer_info.layer_name); + strcpy(ipcpi.layer_name, conf->layer_info.name); ipcpi.dir_hash_algo = conf->layer_info.dir_hash_algo; assert(ipcp_dir_hash_len() != 0); @@ -228,7 +228,7 @@ static int unicast_ipcp_enroll(const char * dst, log_info_id(id, "Enrolled with %s.", dst); info->dir_hash_algo = ipcpi.dir_hash_algo; - strcpy(info->layer_name, ipcpi.layer_name); + strcpy(info->name, ipcpi.layer_name); return 0; diff --git a/src/irmd/configfile.c b/src/irmd/configfile.c index 42a8a152..07f31ccf 100644 --- a/src/irmd/configfile.c +++ b/src/irmd/configfile.c @@ -516,13 +516,13 @@ static int toml_ipcp(toml_table_t * table, if (ret < 0) return -1; - strcpy(conf->layer_info.layer_name, bootstrap.u.s); + strcpy(conf->layer_info.name, bootstrap.u.s); free(bootstrap.u.s); if (bootstrap_ipcp(pid, conf) < 0) return -1; - if (toml_autobind(table, pid, name, conf->layer_info.layer_name) < 0) + if (toml_autobind(table, pid, name, conf->layer_info.name) < 0) return -1; if (toml_register(table, pid) < 0) { diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index eeda1fbc..b0d95b44 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -229,7 +229,7 @@ int ipcp_bootstrap(pid_t pid, } info->dir_hash_algo = recv_msg->layer_info->dir_hash_algo; - strcpy(info->layer_name, recv_msg->layer_info->layer_name); + strcpy(info->name, recv_msg->layer_info->name); ret = recv_msg->result; ipcp_msg__free_unpacked(recv_msg, NULL); @@ -272,7 +272,7 @@ int ipcp_enroll(pid_t pid, } info->dir_hash_algo = recv_msg->layer_info->dir_hash_algo; - strcpy(info->layer_name, recv_msg->layer_info->layer_name); + strcpy(info->name, recv_msg->layer_info->name); ipcp_msg__free_unpacked(recv_msg, NULL); diff --git a/src/irmd/main.c b/src/irmd/main.c index b97791a4..131bd468 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -640,7 +640,7 @@ int bootstrap_ipcp(pid_t pid, return -1; } - entry->layer = strdup(info.layer_name); + entry->layer = strdup(info.name); if (entry->layer == NULL) { pthread_rwlock_unlock(&irmd.reg_lock); log_warn("Failed to set name of layer."); @@ -652,7 +652,7 @@ int bootstrap_ipcp(pid_t pid, pthread_rwlock_unlock(&irmd.reg_lock); log_info("Bootstrapped IPCP %d in layer %s.", - pid, conf->layer_info.layer_name); + pid, conf->layer_info.name); return 0; } @@ -694,7 +694,7 @@ int enroll_ipcp(pid_t pid, return -1; } - ipcp->layer = strdup(info.layer_name); + ipcp->layer = strdup(info.name); if (ipcp->layer == NULL) { pthread_rwlock_unlock(&irmd.reg_lock); log_err("Failed to strdup layer_name."); @@ -706,7 +706,7 @@ int enroll_ipcp(pid_t pid, pthread_rwlock_unlock(&irmd.reg_lock); log_info("Enrolled IPCP %d in layer %s.", - pid, info.layer_name); + pid, info.name); return 0; } diff --git a/src/lib/pb/ipcp_config.proto b/src/lib/pb/ipcp_config.proto index 1ff304f1..9c24cabe 100644 --- a/src/lib/pb/ipcp_config.proto +++ b/src/lib/pb/ipcp_config.proto @@ -23,8 +23,8 @@ syntax = "proto2"; message layer_info_msg { - required string layer_name = 1; - required uint32 dir_hash_algo = 2; + required string name = 1; + required uint32 dir_hash_algo = 2; } message dt_config_msg { diff --git a/src/lib/protobuf.c b/src/lib/protobuf.c index 937e4efc..7fbcef8c 100644 --- a/src/lib/protobuf.c +++ b/src/lib/protobuf.c @@ -40,8 +40,8 @@ layer_info_msg_t * layer_info_s_to_msg(const struct layer_info * s) layer_info_msg__init(msg); - msg->layer_name = strdup(s->layer_name); - if (msg->layer_name == NULL) + msg->name = strdup(s->name); + if (msg->name == NULL) goto fail_msg; msg->dir_hash_algo = s->dir_hash_algo; @@ -59,10 +59,10 @@ struct layer_info layer_info_msg_to_s(const layer_info_msg_t * msg) struct layer_info s; assert(msg != NULL); - assert(strlen(msg->layer_name) <= LAYER_NAME_SIZE); + assert(strlen(msg->name) <= LAYER_NAME_SIZE); s.dir_hash_algo = msg->dir_hash_algo; - strcpy(s.layer_name, msg->layer_name); + strcpy(s.name, msg->name); return s; } diff --git a/src/tools/irm/irm_ipcp_bootstrap.c b/src/tools/irm/irm_ipcp_bootstrap.c index 87f8e09f..f1255113 100644 --- a/src/tools/irm/irm_ipcp_bootstrap.c +++ b/src/tools/irm/irm_ipcp_bootstrap.c @@ -307,7 +307,7 @@ int do_bootstrap_ipcp(int argc, goto fail_usage; } - strcpy(conf.layer_info.layer_name, layer); + strcpy(conf.layer_info.name, layer); conf.layer_info.dir_hash_algo = hash_algo; switch (conf.type) { -- cgit v1.2.3