X Tutup
Skip to content

Commit 386059e

Browse files
committed
network: make use of SD_ENUM_FORCE_S64() for all public enums
1 parent 9823703 commit 386059e

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

src/network/test-network-tables.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,16 @@ int main(int argc, char **argv) {
4040
test_table(wol, WOL);
4141
test_table(lldp_event, SD_LLDP_EVENT);
4242
test_table(ndisc_event, SD_NDISC_EVENT);
43+
test_table(dhcp_lease_server_type, SD_DHCP_LEASE_SERVER_TYPE);
4344

4445
test_table_sparse(ipvlan_mode, NETDEV_IPVLAN_MODE);
4546
test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE);
4647
test_table_sparse(address_family, ADDRESS_FAMILY);
4748

49+
assert_cc(sizeof(sd_lldp_event) == sizeof(int64_t));
50+
assert_cc(sizeof(sd_ndisc_event) == sizeof(int64_t));
51+
assert_cc(sizeof(sd_dhcp_lease_server_type) == sizeof(int64_t));
52+
assert_cc(sizeof(sd_genl_family) == sizeof(int64_t));
53+
4854
return EXIT_SUCCESS;
4955
}

src/shared/wifi-util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftyp
4242
if (r < 0)
4343
return log_debug_errno(r, "Failed to determine genl family: %m");
4444
if (family != SD_GENL_NL80211) {
45-
log_debug("Received message of unexpected genl family %u, ignoring.", family);
45+
log_debug("Received message of unexpected genl family %" PRIi64 ", ignoring.", family);
4646
goto nodata;
4747
}
4848

@@ -110,7 +110,7 @@ int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid) {
110110
if (r < 0)
111111
return log_debug_errno(r, "Failed to determine genl family: %m");
112112
if (family != SD_GENL_NL80211) {
113-
log_debug("Received message of unexpected genl family %u, ignoring.", family);
113+
log_debug("Received message of unexpected genl family %" PRIi64 ", ignoring.", family);
114114
goto nodata;
115115
}
116116

src/systemd/sd-dhcp-lease.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ typedef enum sd_dhcp_lease_server_type {
4343
SD_DHCP_LEASE_LPR,
4444
_SD_DHCP_LEASE_SERVER_TYPE_MAX,
4545
_SD_DHCP_LEASE_SERVER_TYPE_INVALID = -EINVAL,
46+
_SD_ENUM_FORCE_S64(DHCP_LEASE_SERVER_TYPE),
4647
} sd_dhcp_lease_server_type;
4748

4849
int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr);

src/systemd/sd-lldp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ typedef enum sd_lldp_event {
129129
SD_LLDP_EVENT_REFRESHED,
130130
_SD_LLDP_EVENT_MAX,
131131
_SD_LLDP_EVENT_INVALID = -EINVAL,
132+
_SD_ENUM_FORCE_S64(LLDP_EVENT),
132133
} sd_lldp_event;
133134

134135
typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata);

src/systemd/sd-ndisc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ typedef enum sd_ndisc_event {
6060
SD_NDISC_EVENT_ROUTER,
6161
_SD_NDISC_EVENT_MAX,
6262
_SD_NDISC_EVENT_INVALID = -EINVAL,
63+
_SD_ENUM_FORCE_S64(NDISC_EVENT),
6364
} sd_ndisc_event;
6465

6566
typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata);

src/systemd/sd-netlink.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
along with systemd; If not, see <http://www.gnu.org/licenses/>.
1818
***/
1919

20+
#include <errno.h>
2021
#include <inttypes.h>
2122
#include <net/ethernet.h>
2223
#include <netinet/in.h>
@@ -34,7 +35,7 @@ typedef struct sd_genl_socket sd_genl_socket;
3435
typedef struct sd_netlink_message sd_netlink_message;
3536
typedef struct sd_netlink_slot sd_netlink_slot;
3637

37-
typedef enum sd_gen_family {
38+
typedef enum sd_genl_family {
3839
SD_GENL_ERROR,
3940
SD_GENL_DONE,
4041
SD_GENL_ID_CTRL,
@@ -43,6 +44,9 @@ typedef enum sd_gen_family {
4344
SD_GENL_L2TP,
4445
SD_GENL_MACSEC,
4546
SD_GENL_NL80211,
47+
_SD_GENL_FAMILY_MAX,
48+
_SD_GENL_FAMILY_INVALID = -EINVAL,
49+
_SD_ENUM_FORCE_S64(GENL_FAMILY)
4650
} sd_genl_family;
4751

4852
/* callback */

0 commit comments

Comments
 (0)
X Tutup