From 2324fd3a3931851618f2e523b14e7ee4efe0f72c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 Feb 2021 17:53:56 +0100 Subject: [PATCH 1/2] network: suffix types with _t in public headers Apparently, in our current public headers (i.e. those called sd-*.h) we suffixed typedefs that we use as values with _t, but we didn't do this for enum typedefs. Fix that while this stuff is not actually public yet. With this scheme "value typedefs" now end systematically in _t, and "object typedefs" (i.e. structures that are typically passed around via pointers and not values) do not. No code changes, just some renaming. --- src/libsystemd-network/lldp-internal.h | 4 ++-- src/libsystemd-network/ndisc-internal.h | 4 ++-- src/libsystemd-network/sd-dhcp-lease.c | 4 ++-- src/libsystemd-network/sd-dhcp-server.c | 6 +++--- src/libsystemd-network/sd-lldp.c | 8 ++++---- src/libsystemd-network/sd-ndisc.c | 4 ++-- src/libsystemd-network/test-lldp.c | 2 +- src/libsystemd-network/test-ndisc-rs.c | 2 +- src/libsystemd/sd-netlink/generic-netlink.c | 12 ++++++------ src/libsystemd/sd-netlink/generic-netlink.h | 2 +- src/libsystemd/sd-netlink/netlink-types.c | 2 +- src/network/networkd-dhcp-server.c | 4 ++-- src/network/networkd-link.c | 2 +- src/network/networkd-lldp-rx.c | 2 +- src/network/networkd-ndisc.c | 2 +- src/network/networkd-network.c | 2 +- src/network/networkd-util.c | 2 +- src/network/networkd-util.h | 4 ++-- src/network/test-network-tables.c | 8 ++++---- src/shared/wifi-util.c | 4 ++-- src/systemd/sd-dhcp-lease.h | 6 +++--- src/systemd/sd-dhcp-server.h | 2 +- src/systemd/sd-lldp.h | 6 +++--- src/systemd/sd-ndisc.h | 6 +++--- src/systemd/sd-netlink.h | 8 ++++---- 25 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/libsystemd-network/lldp-internal.h b/src/libsystemd-network/lldp-internal.h index f23695f974d..daedbb088fb 100644 --- a/src/libsystemd-network/lldp-internal.h +++ b/src/libsystemd-network/lldp-internal.h @@ -35,5 +35,5 @@ struct sd_lldp { #define log_lldp_errno(error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "LLDP: " fmt, ##__VA_ARGS__) #define log_lldp(fmt, ...) log_lldp_errno(0, fmt, ##__VA_ARGS__) -const char* lldp_event_to_string(sd_lldp_event e) _const_; -sd_lldp_event lldp_event_from_string(const char *s) _pure_; +const char* lldp_event_to_string(sd_lldp_event_t e) _const_; +sd_lldp_event_t lldp_event_from_string(const char *s) _pure_; diff --git a/src/libsystemd-network/ndisc-internal.h b/src/libsystemd-network/ndisc-internal.h index 65f9371b20c..70b254867bb 100644 --- a/src/libsystemd-network/ndisc-internal.h +++ b/src/libsystemd-network/ndisc-internal.h @@ -40,5 +40,5 @@ struct sd_ndisc { #define log_ndisc_errno(error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "NDISC: " fmt, ##__VA_ARGS__) #define log_ndisc(fmt, ...) log_ndisc_errno(0, fmt, ##__VA_ARGS__) -const char* ndisc_event_to_string(sd_ndisc_event e) _const_; -sd_ndisc_event ndisc_event_from_string(const char *s) _pure_; +const char* ndisc_event_to_string(sd_ndisc_event_t e) _const_; +sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_; diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 69ded6d1482..1c0b4311655 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -99,7 +99,7 @@ int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu) { int sd_dhcp_lease_get_servers( sd_dhcp_lease *lease, - sd_dhcp_lease_server_type what, + sd_dhcp_lease_server_type_t what, const struct in_addr **addr) { assert_return(lease, -EINVAL); @@ -281,7 +281,7 @@ static sd_dhcp_lease *dhcp_lease_free(sd_dhcp_lease *lease) { free(lease->hostname); free(lease->domainname); - for (sd_dhcp_lease_server_type i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++) + for (sd_dhcp_lease_server_type_t i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++) free(lease->servers[i].addr); free(lease->static_route); diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index bc50664dc79..d0e249b104b 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -149,7 +149,7 @@ static sd_dhcp_server *dhcp_server_free(sd_dhcp_server *server) { free(server->timezone); - for (sd_dhcp_lease_server_type i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++) + for (sd_dhcp_lease_server_type_t i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++) free(server->servers[i].addr); hashmap_free(server->leases_by_client_id); @@ -509,7 +509,7 @@ static int server_send_ack( return r; } - for (sd_dhcp_lease_server_type k = 0; k < _SD_DHCP_LEASE_SERVER_TYPE_MAX; k++) { + for (sd_dhcp_lease_server_type_t k = 0; k < _SD_DHCP_LEASE_SERVER_TYPE_MAX; k++) { if (server->servers[k].size <= 0) continue; @@ -1118,7 +1118,7 @@ int sd_dhcp_server_set_default_lease_time(sd_dhcp_server *server, uint32_t t) { int sd_dhcp_server_set_servers( sd_dhcp_server *server, - sd_dhcp_lease_server_type what, + sd_dhcp_lease_server_type_t what, const struct in_addr addresses[], size_t n_addresses) { diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c index 8b666522cb0..d3848ebf91c 100644 --- a/src/libsystemd-network/sd-lldp.c +++ b/src/libsystemd-network/sd-lldp.c @@ -21,13 +21,13 @@ #define LLDP_DEFAULT_NEIGHBORS_MAX 128U static const char * const lldp_event_table[_SD_LLDP_EVENT_MAX] = { - [SD_LLDP_EVENT_ADDED] = "added", - [SD_LLDP_EVENT_REMOVED] = "removed", + [SD_LLDP_EVENT_ADDED] = "added", + [SD_LLDP_EVENT_REMOVED] = "removed", [SD_LLDP_EVENT_UPDATED] = "updated", [SD_LLDP_EVENT_REFRESHED] = "refreshed", }; -DEFINE_STRING_TABLE_LOOKUP(lldp_event, sd_lldp_event); +DEFINE_STRING_TABLE_LOOKUP(lldp_event, sd_lldp_event_t); static void lldp_flush_neighbors(sd_lldp *lldp) { assert(lldp); @@ -35,7 +35,7 @@ static void lldp_flush_neighbors(sd_lldp *lldp) { hashmap_clear(lldp->neighbor_by_id); } -static void lldp_callback(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n) { +static void lldp_callback(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n) { assert(lldp); assert(event >= 0 && event < _SD_LLDP_EVENT_MAX); diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index f704445654e..8f04001755a 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -28,9 +28,9 @@ static const char * const ndisc_event_table[_SD_NDISC_EVENT_MAX] = { [SD_NDISC_EVENT_ROUTER] = "router", }; -DEFINE_STRING_TABLE_LOOKUP(ndisc_event, sd_ndisc_event); +DEFINE_STRING_TABLE_LOOKUP(ndisc_event, sd_ndisc_event_t); -static void ndisc_callback(sd_ndisc *ndisc, sd_ndisc_event event, sd_ndisc_router *rt) { +static void ndisc_callback(sd_ndisc *ndisc, sd_ndisc_event_t event, sd_ndisc_router *rt) { assert(ndisc); assert(event >= 0 && event < _SD_NDISC_EVENT_MAX); diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test-lldp.c index c52d422fce2..0331e387f03 100644 --- a/src/libsystemd-network/test-lldp.c +++ b/src/libsystemd-network/test-lldp.c @@ -30,7 +30,7 @@ int lldp_network_bind_raw_socket(int ifindex) { return test_fd[0]; } -static void lldp_handler(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata) { +static void lldp_handler(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n, void *userdata) { lldp_handler_calls++; } diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c index 1b2bba889d8..ce596bb96ab 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test-ndisc-rs.c @@ -232,7 +232,7 @@ int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) { return send_ra_function(0); } -static void test_callback(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata) { +static void test_callback(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata) { sd_event *e = userdata; static unsigned idx = 0; uint64_t flags_array[] = { diff --git a/src/libsystemd/sd-netlink/generic-netlink.c b/src/libsystemd/sd-netlink/generic-netlink.c index 38e80d8f460..d4ec268806e 100644 --- a/src/libsystemd/sd-netlink/generic-netlink.c +++ b/src/libsystemd/sd-netlink/generic-netlink.c @@ -25,9 +25,9 @@ static const genl_family genl_families[] = { int sd_genl_socket_open(sd_netlink **ret) { return netlink_open_family(ret, NETLINK_GENERIC); } -static int lookup_id(sd_netlink *nl, sd_genl_family family, uint16_t *id); +static int lookup_id(sd_netlink *nl, sd_genl_family_t family, uint16_t *id); -static int genl_message_new(sd_netlink *nl, sd_genl_family family, uint16_t nlmsg_type, uint8_t cmd, sd_netlink_message **ret) { +static int genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint16_t nlmsg_type, uint8_t cmd, sd_netlink_message **ret) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL; const NLType *genl_cmd_type, *nl_type; const NLTypeSystem *type_system; @@ -71,7 +71,7 @@ static int genl_message_new(sd_netlink *nl, sd_genl_family family, uint16_t nlms return 0; } -int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **ret) { +int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd_netlink_message **ret) { uint16_t id; int r; @@ -82,7 +82,7 @@ int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_n return genl_message_new(nl, family, id, cmd, ret); } -static int lookup_id(sd_netlink *nl, sd_genl_family family, uint16_t *id) { +static int lookup_id(sd_netlink *nl, sd_genl_family_t family, uint16_t *id) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL, *reply = NULL; uint16_t u; void *v; @@ -127,7 +127,7 @@ static int lookup_id(sd_netlink *nl, sd_genl_family family, uint16_t *id) { return 0; } -int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family *ret) { +int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family_t *ret) { void *p; assert_return(nl, -EINVAL); @@ -151,7 +151,7 @@ int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_famil return 0; } -int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family *family) { +int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family_t *family) { uint16_t type; int r; diff --git a/src/libsystemd/sd-netlink/generic-netlink.h b/src/libsystemd/sd-netlink/generic-netlink.h index 72001e88d21..fd0461426b8 100644 --- a/src/libsystemd/sd-netlink/generic-netlink.h +++ b/src/libsystemd/sd-netlink/generic-netlink.h @@ -3,4 +3,4 @@ #include "sd-netlink.h" -int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family *ret); +int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family_t *ret); diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c index 78a3e8f9739..4acf6a7ff8b 100644 --- a/src/libsystemd/sd-netlink/netlink-types.c +++ b/src/libsystemd/sd-netlink/netlink-types.c @@ -1636,7 +1636,7 @@ const NLTypeSystem *type_system_get_root(int protocol) { } int type_system_root_get_type(sd_netlink *nl, const NLType **ret, uint16_t type) { - sd_genl_family family; + sd_genl_family_t family; const NLType *nl_type; int r; diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c index 2c533c6f8dd..ad979fb2c4e 100644 --- a/src/network/networkd-dhcp-server.c +++ b/src/network/networkd-dhcp-server.c @@ -60,7 +60,7 @@ static Address* link_find_dhcp_server_address(Link *link) { static int link_push_uplink_to_dhcp_server( Link *link, - sd_dhcp_lease_server_type what, + sd_dhcp_lease_server_type_t what, sd_dhcp_server *s) { _cleanup_free_ struct in_addr *addresses = NULL; @@ -307,7 +307,7 @@ int dhcp4_server_configure(Link *link) { return log_link_error_errno(link, r, "Failed to set default lease time for DHCPv4 server instance: %m"); } - for (sd_dhcp_lease_server_type type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) { + for (sd_dhcp_lease_server_type_t type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) { if (!link->network->dhcp_server_emit[type].emit) continue; diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 8f97724ce6b..b2949051bd2 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2823,7 +2823,7 @@ static void serialize_addresses( char **addresses, sd_dhcp_lease *lease, bool conditional, - sd_dhcp_lease_server_type what, + sd_dhcp_lease_server_type_t what, sd_dhcp6_lease *lease6, bool conditional6, int (*lease6_get_addr)(sd_dhcp6_lease*, const struct in6_addr**), diff --git a/src/network/networkd-lldp-rx.c b/src/network/networkd-lldp-rx.c index c22852ff504..76ff3689e17 100644 --- a/src/network/networkd-lldp-rx.c +++ b/src/network/networkd-lldp-rx.c @@ -47,7 +47,7 @@ static bool link_lldp_rx_enabled(Link *link) { return link->network->lldp_mode != LLDP_MODE_NO; } -static void lldp_handler(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata) { +static void lldp_handler(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n, void *userdata) { Link *link = userdata; int r; diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 7af8e620a08..acc1de66d2a 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -1274,7 +1274,7 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) { return 0; } -static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata) { +static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata) { Link *link = userdata; int r; diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 352a57325a1..609170e1cae 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -664,7 +664,7 @@ static Network *network_free(Network *network) { free(network->dhcp_server_timezone); - for (sd_dhcp_lease_server_type t = 0; t < _SD_DHCP_LEASE_SERVER_TYPE_MAX; t++) + for (sd_dhcp_lease_server_type_t t = 0; t < _SD_DHCP_LEASE_SERVER_TYPE_MAX; t++) free(network->dhcp_server_emit[t].addresses); set_free_free(network->dnssec_negative_trust_anchors); diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c index e9fe87ea63a..72861e0f057 100644 --- a/src/network/networkd-util.c +++ b/src/network/networkd-util.c @@ -65,7 +65,7 @@ DEFINE_STRING_TABLE_LOOKUP(duplicate_address_detection_address_family, AddressFa DEFINE_CONFIG_PARSE_ENUM(config_parse_link_local_address_family, link_local_address_family, AddressFamily, "Failed to parse option"); DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_deprecated_address_family, AddressFamily); -DEFINE_STRING_TABLE_LOOKUP(dhcp_lease_server_type, sd_dhcp_lease_server_type); +DEFINE_STRING_TABLE_LOOKUP(dhcp_lease_server_type, sd_dhcp_lease_server_type_t); static AddressFamily address_family_compat_from_string(const char *s) { if (streq_ptr(s, "yes")) /* compat name */ diff --git a/src/network/networkd-util.h b/src/network/networkd-util.h index fa46c3a3ece..e70df0528e3 100644 --- a/src/network/networkd-util.h +++ b/src/network/networkd-util.h @@ -46,8 +46,8 @@ AddressFamily duplicate_address_detection_address_family_from_string(const char AddressFamily dhcp_deprecated_address_family_from_string(const char *s) _pure_; -const char *dhcp_lease_server_type_to_string(sd_dhcp_lease_server_type t) _const_; -sd_dhcp_lease_server_type dhcp_lease_server_type_from_string(const char *s) _pure_; +const char *dhcp_lease_server_type_to_string(sd_dhcp_lease_server_type_t t) _const_; +sd_dhcp_lease_server_type_t dhcp_lease_server_type_from_string(const char *s) _pure_; int kernel_route_expiration_supported(void); diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c index b1d934a3c40..ce34449554f 100644 --- a/src/network/test-network-tables.c +++ b/src/network/test-network-tables.c @@ -46,10 +46,10 @@ int main(int argc, char **argv) { test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE); test_table_sparse(address_family, ADDRESS_FAMILY); - assert_cc(sizeof(sd_lldp_event) == sizeof(int64_t)); - assert_cc(sizeof(sd_ndisc_event) == sizeof(int64_t)); - assert_cc(sizeof(sd_dhcp_lease_server_type) == sizeof(int64_t)); - assert_cc(sizeof(sd_genl_family) == sizeof(int64_t)); + assert_cc(sizeof(sd_lldp_event_t) == sizeof(int64_t)); + assert_cc(sizeof(sd_ndisc_event_t) == sizeof(int64_t)); + assert_cc(sizeof(sd_dhcp_lease_server_type_t) == sizeof(int64_t)); + assert_cc(sizeof(sd_genl_family_t) == sizeof(int64_t)); return EXIT_SUCCESS; } diff --git a/src/shared/wifi-util.c b/src/shared/wifi-util.c index 5caa95f3d2f..35940ad02ee 100644 --- a/src/shared/wifi-util.c +++ b/src/shared/wifi-util.c @@ -5,7 +5,7 @@ int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL; - sd_genl_family family; + sd_genl_family_t family; int r; assert(genl); @@ -75,7 +75,7 @@ nodata: int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid) { _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL; - sd_genl_family family; + sd_genl_family_t family; int r; assert(genl); diff --git a/src/systemd/sd-dhcp-lease.h b/src/systemd/sd-dhcp-lease.h index ca2da7920d6..5abf9a406c0 100644 --- a/src/systemd/sd-dhcp-lease.h +++ b/src/systemd/sd-dhcp-lease.h @@ -34,7 +34,7 @@ typedef struct sd_dhcp_route sd_dhcp_route; sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease); sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease); -typedef enum sd_dhcp_lease_server_type { +typedef enum sd_dhcp_lease_server_type_t { SD_DHCP_LEASE_DNS, SD_DHCP_LEASE_NTP, SD_DHCP_LEASE_SIP, @@ -44,7 +44,7 @@ typedef enum sd_dhcp_lease_server_type { _SD_DHCP_LEASE_SERVER_TYPE_MAX, _SD_DHCP_LEASE_SERVER_TYPE_INVALID = -EINVAL, _SD_ENUM_FORCE_S64(DHCP_LEASE_SERVER_TYPE), -} sd_dhcp_lease_server_type; +} sd_dhcp_lease_server_type_t; int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime); @@ -55,7 +55,7 @@ int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr); int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr); -int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_server_type what, const struct in_addr **addr); +int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_server_type_t what, const struct in_addr **addr); int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr); int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr); diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h index f42c3dbb8b7..aa49a7434c3 100644 --- a/src/systemd/sd-dhcp-server.h +++ b/src/systemd/sd-dhcp-server.h @@ -60,7 +60,7 @@ int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled); int sd_dhcp_server_set_servers( sd_dhcp_server *server, - sd_dhcp_lease_server_type what, + sd_dhcp_lease_server_type_t what, const struct in_addr addresses[], size_t n_addresses); diff --git a/src/systemd/sd-lldp.h b/src/systemd/sd-lldp.h index 88652bc2c67..d1d520afbd5 100644 --- a/src/systemd/sd-lldp.h +++ b/src/systemd/sd-lldp.h @@ -122,7 +122,7 @@ enum { typedef struct sd_lldp sd_lldp; typedef struct sd_lldp_neighbor sd_lldp_neighbor; -typedef enum sd_lldp_event { +typedef enum sd_lldp_event_t { SD_LLDP_EVENT_ADDED, SD_LLDP_EVENT_REMOVED, SD_LLDP_EVENT_UPDATED, @@ -130,9 +130,9 @@ typedef enum sd_lldp_event { _SD_LLDP_EVENT_MAX, _SD_LLDP_EVENT_INVALID = -EINVAL, _SD_ENUM_FORCE_S64(LLDP_EVENT), -} sd_lldp_event; +} sd_lldp_event_t; -typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata); +typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n, void *userdata); int sd_lldp_new(sd_lldp **ret); sd_lldp* sd_lldp_ref(sd_lldp *lldp); diff --git a/src/systemd/sd-ndisc.h b/src/systemd/sd-ndisc.h index 22e97d8ff7c..49b127c0181 100644 --- a/src/systemd/sd-ndisc.h +++ b/src/systemd/sd-ndisc.h @@ -55,15 +55,15 @@ enum { typedef struct sd_ndisc sd_ndisc; typedef struct sd_ndisc_router sd_ndisc_router; -typedef enum sd_ndisc_event { +typedef enum sd_ndisc_event_t { SD_NDISC_EVENT_TIMEOUT, SD_NDISC_EVENT_ROUTER, _SD_NDISC_EVENT_MAX, _SD_NDISC_EVENT_INVALID = -EINVAL, _SD_ENUM_FORCE_S64(NDISC_EVENT), -} sd_ndisc_event; +} sd_ndisc_event_t; -typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata); +typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata); int sd_ndisc_new(sd_ndisc **ret); sd_ndisc *sd_ndisc_ref(sd_ndisc *nd); diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h index fd51cf35016..8820c65e230 100644 --- a/src/systemd/sd-netlink.h +++ b/src/systemd/sd-netlink.h @@ -35,7 +35,7 @@ typedef struct sd_genl_socket sd_genl_socket; typedef struct sd_netlink_message sd_netlink_message; typedef struct sd_netlink_slot sd_netlink_slot; -typedef enum sd_genl_family { +typedef enum sd_genl_family_t { SD_GENL_ERROR, SD_GENL_DONE, SD_GENL_ID_CTRL, @@ -47,7 +47,7 @@ typedef enum sd_genl_family { _SD_GENL_FAMILY_MAX, _SD_GENL_FAMILY_INVALID = -EINVAL, _SD_ENUM_FORCE_S64(GENL_FAMILY) -} sd_genl_family; +} sd_genl_family_t; /* callback */ @@ -249,8 +249,8 @@ int sd_nfnl_nft_message_add_setelem_end(sd_netlink_message *m); /* genl */ int sd_genl_socket_open(sd_netlink **nl); -int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m); -int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family *family); +int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd_netlink_message **m); +int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family_t *family); /* slot */ sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl); From 135c4aad4c29bd843e8ee3cf696f010d30aaed19 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 Feb 2021 17:56:11 +0100 Subject: [PATCH 2/2] network: tighten table alignment a bit --- src/network/networkd-util.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c index 72861e0f057..52f4e9dbb56 100644 --- a/src/network/networkd-util.c +++ b/src/network/networkd-util.c @@ -9,35 +9,35 @@ #include "util.h" static const char* const address_family_table[_ADDRESS_FAMILY_MAX] = { - [ADDRESS_FAMILY_NO] = "no", - [ADDRESS_FAMILY_YES] = "yes", - [ADDRESS_FAMILY_IPV4] = "ipv4", - [ADDRESS_FAMILY_IPV6] = "ipv6", + [ADDRESS_FAMILY_NO] = "no", + [ADDRESS_FAMILY_YES] = "yes", + [ADDRESS_FAMILY_IPV4] = "ipv4", + [ADDRESS_FAMILY_IPV6] = "ipv6", }; static const char* const routing_policy_rule_address_family_table[_ADDRESS_FAMILY_MAX] = { - [ADDRESS_FAMILY_YES] = "both", - [ADDRESS_FAMILY_IPV4] = "ipv4", - [ADDRESS_FAMILY_IPV6] = "ipv6", + [ADDRESS_FAMILY_YES] = "both", + [ADDRESS_FAMILY_IPV4] = "ipv4", + [ADDRESS_FAMILY_IPV6] = "ipv6", }; static const char* const nexthop_address_family_table[_ADDRESS_FAMILY_MAX] = { - [ADDRESS_FAMILY_IPV4] = "ipv4", - [ADDRESS_FAMILY_IPV6] = "ipv6", + [ADDRESS_FAMILY_IPV4] = "ipv4", + [ADDRESS_FAMILY_IPV6] = "ipv6", }; static const char* const duplicate_address_detection_address_family_table[_ADDRESS_FAMILY_MAX] = { - [ADDRESS_FAMILY_NO] = "none", - [ADDRESS_FAMILY_YES] = "both", - [ADDRESS_FAMILY_IPV4] = "ipv4", - [ADDRESS_FAMILY_IPV6] = "ipv6", + [ADDRESS_FAMILY_NO] = "none", + [ADDRESS_FAMILY_YES] = "both", + [ADDRESS_FAMILY_IPV4] = "ipv4", + [ADDRESS_FAMILY_IPV6] = "ipv6", }; static const char* const dhcp_deprecated_address_family_table[_ADDRESS_FAMILY_MAX] = { - [ADDRESS_FAMILY_NO] = "none", - [ADDRESS_FAMILY_YES] = "both", - [ADDRESS_FAMILY_IPV4] = "v4", - [ADDRESS_FAMILY_IPV6] = "v6", + [ADDRESS_FAMILY_NO] = "none", + [ADDRESS_FAMILY_YES] = "both", + [ADDRESS_FAMILY_IPV4] = "v4", + [ADDRESS_FAMILY_IPV6] = "v6", }; static const char* const dhcp_lease_server_type_table[_SD_DHCP_LEASE_SERVER_TYPE_MAX] = {