diff options
author | Thomas Haller <thaller@redhat.com> | 2022-08-05 21:59:30 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-08-09 08:02:38 +0200 |
commit | c74c783c2892ab0e73876751de71bf2ba9c28a72 (patch) | |
tree | fdd88e486f547932f41a95771393b17dbce77a8c | |
parent | 6e5dae732a8d14f0aab6d68b8a5a8aae87be81e7 (diff) | |
download | NetworkManager-c74c783c2892ab0e73876751de71bf2ba9c28a72.tar.gz |
platform/netlink: make callback parameters to nl_recvmsg() const
-rw-r--r-- | src/libnm-platform/nm-linux-platform.c | 2 | ||||
-rw-r--r-- | src/libnm-platform/nm-netlink.c | 6 | ||||
-rw-r--r-- | src/libnm-platform/nm-netlink.h | 8 | ||||
-rw-r--r-- | src/libnm-platform/wifi/nm-wifi-utils-nl80211.c | 18 | ||||
-rw-r--r-- | src/libnm-platform/wpan/nm-wpan-utils.c | 10 |
5 files changed, 23 insertions, 21 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 5f78d5da1a..27904d4570 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -2576,7 +2576,7 @@ typedef struct { } WireGuardParseData; static int -_wireguard_get_device_cb(struct nl_msg *msg, void *arg) +_wireguard_get_device_cb(const struct nl_msg *msg, void *arg) { static const struct nla_policy policy[] = { [WGDEVICE_A_IFINDEX] = {.type = NLA_U32}, diff --git a/src/libnm-platform/nm-netlink.c b/src/libnm-platform/nm-netlink.c index ecb700fc9b..3d89a4c1d6 100644 --- a/src/libnm-platform/nm-netlink.c +++ b/src/libnm-platform/nm-netlink.c @@ -255,7 +255,7 @@ flags_done: /*****************************************************************************/ struct nlmsghdr * -nlmsg_hdr(struct nl_msg *n) +nlmsg_hdr(const struct nl_msg *n) { return n->nm_nlh; } @@ -856,7 +856,7 @@ const struct nla_policy genl_ctrl_policy[CTRL_ATTR_MCAST_GROUPS + 1] = { }; static int -_genl_parse_getfamily(struct nl_msg *msg, void *arg) +_genl_parse_getfamily(const struct nl_msg *msg, void *arg) { struct nlattr *tb[G_N_ELEMENTS(genl_ctrl_policy)]; struct nlmsghdr *nlh = nlmsg_hdr(msg); @@ -1155,7 +1155,7 @@ _cb_init(struct nl_cb *dst, const struct nl_cb *src) } static int -ack_wait_handler(struct nl_msg *msg, void *arg) +ack_wait_handler(const struct nl_msg *msg, void *arg) { return NL_STOP; } diff --git a/src/libnm-platform/nm-netlink.h b/src/libnm-platform/nm-netlink.h index 07557b99c9..d21abb5002 100644 --- a/src/libnm-platform/nm-netlink.h +++ b/src/libnm-platform/nm-netlink.h @@ -454,7 +454,7 @@ nlmsg_tail(const struct nlmsghdr *nlh) return (unsigned char *) nlh + NLMSG_ALIGN(nlh->nlmsg_len); } -struct nlmsghdr *nlmsg_hdr(struct nl_msg *n); +struct nlmsghdr *nlmsg_hdr(const struct nl_msg *n); static inline int nlmsg_valid_hdr(const struct nlmsghdr *nlh, int hdrlen) @@ -585,9 +585,11 @@ enum nl_cb_action { NL_STOP, }; -typedef int (*nl_recvmsg_msg_cb_t)(struct nl_msg *msg, void *arg); +typedef int (*nl_recvmsg_msg_cb_t)(const struct nl_msg *msg, void *arg); -typedef int (*nl_recvmsg_err_cb_t)(struct sockaddr_nl *nla, struct nlmsgerr *nlerr, void *arg); +typedef int (*nl_recvmsg_err_cb_t)(const struct sockaddr_nl *nla, + const struct nlmsgerr *nlerr, + void *arg); struct nl_cb { nl_recvmsg_msg_cb_t valid_cb; diff --git a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c index 08eded3103..37edd928e3 100644 --- a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c +++ b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c @@ -58,7 +58,7 @@ typedef struct { G_DEFINE_TYPE(NMWifiUtilsNl80211, nm_wifi_utils_nl80211, NM_TYPE_WIFI_UTILS) static int -ack_handler(struct nl_msg *msg, void *arg) +ack_handler(const struct nl_msg *msg, void *arg) { int *done = arg; *done = 1; @@ -66,7 +66,7 @@ ack_handler(struct nl_msg *msg, void *arg) } static int -finish_handler(struct nl_msg *msg, void *arg) +finish_handler(const struct nl_msg *msg, void *arg) { int *done = arg; *done = 1; @@ -74,7 +74,7 @@ finish_handler(struct nl_msg *msg, void *arg) } static int -error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) +error_handler(const struct sockaddr_nl *nla, const struct nlmsgerr *err, void *arg) { int *done = arg; *done = err->error; @@ -106,7 +106,7 @@ nl80211_alloc_msg(NMWifiUtilsNl80211 *self, uint8_t cmd, uint16_t flags) static int nl80211_send_and_recv(NMWifiUtilsNl80211 *self, struct nl_msg *msg, - int (*valid_handler)(struct nl_msg *, void *), + int (*valid_handler)(const struct nl_msg *, void *), void *valid_data) { int err; @@ -167,7 +167,7 @@ struct nl80211_iface_info { }; static int -nl80211_iface_info_handler(struct nl_msg *msg, void *arg) +nl80211_iface_info_handler(const struct nl_msg *msg, void *arg) { struct nl80211_iface_info *info = arg; struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); @@ -269,7 +269,7 @@ nla_put_failure: } static int -nl80211_get_wake_on_wlan_handler(struct nl_msg *msg, void *arg) +nl80211_get_wake_on_wlan_handler(const struct nl_msg *msg, void *arg) { _NMSettingWirelessWakeOnWLan *wowl = arg; struct nlattr *attrs[NL80211_ATTR_MAX + 1]; @@ -422,7 +422,7 @@ struct nl80211_station_info { }; static int -nl80211_station_dump_handler(struct nl_msg *msg, void *arg) +nl80211_station_dump_handler(const struct nl_msg *msg, void *arg) { static const struct nla_policy stats_policy[] = { [NL80211_STA_INFO_INACTIVE_TIME] = {.type = NLA_U32}, @@ -576,7 +576,7 @@ struct nl80211_device_info { #define WLAN_CIPHER_SUITE_SMS4 0x00147201 static int -nl80211_wiphy_info_handler(struct nl_msg *msg, void *arg) +nl80211_wiphy_info_handler(const struct nl_msg *msg, void *arg) { static const struct nla_policy freq_policy[] = { [NL80211_FREQUENCY_ATTR_FREQ] = {.type = NLA_U32}, @@ -816,7 +816,7 @@ struct nl80211_csme_conn_info { }; static int -nl80211_csme_conn_event_handler(struct nl_msg *msg, void *arg) +nl80211_csme_conn_event_handler(const struct nl_msg *msg, void *arg) { struct nl80211_csme_conn_info *info = arg; NMPlatformCsmeConnInfo *out_conn_info = info->conn_info; diff --git a/src/libnm-platform/wpan/nm-wpan-utils.c b/src/libnm-platform/wpan/nm-wpan-utils.c index 9350a2a780..675efe5a59 100644 --- a/src/libnm-platform/wpan/nm-wpan-utils.c +++ b/src/libnm-platform/wpan/nm-wpan-utils.c @@ -51,7 +51,7 @@ G_DEFINE_TYPE(NMWpanUtils, nm_wpan_utils, G_TYPE_OBJECT) /*****************************************************************************/ static int -ack_handler(struct nl_msg *msg, void *arg) +ack_handler(const struct nl_msg *msg, void *arg) { int *done = arg; *done = 1; @@ -59,7 +59,7 @@ ack_handler(struct nl_msg *msg, void *arg) } static int -finish_handler(struct nl_msg *msg, void *arg) +finish_handler(const struct nl_msg *msg, void *arg) { int *done = arg; *done = 1; @@ -67,7 +67,7 @@ finish_handler(struct nl_msg *msg, void *arg) } static int -error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) +error_handler(const struct sockaddr_nl *nla, const struct nlmsgerr *err, void *arg) { int *done = arg; *done = err->error; @@ -98,7 +98,7 @@ nl802154_alloc_msg(NMWpanUtils *self, uint8_t cmd, uint16_t flags) static int nl802154_send_and_recv(NMWpanUtils *self, struct nl_msg *msg, - int (*valid_handler)(struct nl_msg *, void *), + int (*valid_handler)(const struct nl_msg *, void *), void *valid_data) { int err; @@ -144,7 +144,7 @@ struct nl802154_interface { }; static int -nl802154_get_interface_handler(struct nl_msg *msg, void *arg) +nl802154_get_interface_handler(const struct nl_msg *msg, void *arg) { static const struct nla_policy nl802154_policy[] = { [NL802154_ATTR_PAN_ID] = {.type = NLA_U16}, |