From 6b5e971a282c0e7b18b47823103d695352b5a3c2 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 26 May 2015 18:34:26 +0200 Subject: batman-adv: Replace C99 int types with kernel type (s|u)(8|16|32|64) are the preferred types in the kernel. The use of the standard C99 types u?int(8|16|32|64)_t are objected by some people and even checkpatch now warns about using them. Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/main.c | 69 ++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'net/batman-adv/main.c') diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 8457097f1643..40750cbe4f4f 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -234,7 +234,7 @@ void batadv_mesh_free(struct net_device *soft_iface) * * Returns 'true' if the mac address was found, false otherwise. */ -bool batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr) +bool batadv_is_my_mac(struct batadv_priv *bat_priv, const u8 *addr) { const struct batadv_hard_iface *hard_iface; bool is_my_mac = false; @@ -387,7 +387,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, struct batadv_priv *bat_priv; struct batadv_ogm_packet *batadv_ogm_packet; struct batadv_hard_iface *hard_iface; - uint8_t idx; + u8 idx; int ret; hard_iface = container_of(ptype, struct batadv_hard_iface, @@ -496,7 +496,7 @@ static void batadv_recv_handler_init(void) } int -batadv_recv_handler_register(uint8_t packet_type, +batadv_recv_handler_register(u8 packet_type, int (*recv_handler)(struct sk_buff *, struct batadv_hard_iface *)) { @@ -512,7 +512,7 @@ batadv_recv_handler_register(uint8_t packet_type, return 0; } -void batadv_recv_handler_unregister(uint8_t packet_type) +void batadv_recv_handler_unregister(u8 packet_type) { batadv_rx_handler[packet_type] = batadv_recv_unhandled_packet; } @@ -642,8 +642,7 @@ batadv_tvlv_handler_free_ref(struct batadv_tvlv_handler *tvlv_handler) * Returns tvlv handler if found or NULL otherwise. */ static struct batadv_tvlv_handler -*batadv_tvlv_handler_get(struct batadv_priv *bat_priv, - uint8_t type, uint8_t version) +*batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version) { struct batadv_tvlv_handler *tvlv_handler_tmp, *tvlv_handler = NULL; @@ -691,8 +690,7 @@ static void batadv_tvlv_container_free_ref(struct batadv_tvlv_container *tvlv) * Returns tvlv container if found or NULL otherwise. */ static struct batadv_tvlv_container -*batadv_tvlv_container_get(struct batadv_priv *bat_priv, - uint8_t type, uint8_t version) +*batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version) { struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL; @@ -723,10 +721,10 @@ static struct batadv_tvlv_container * * Returns size of all currently registered tvlv containers in bytes. */ -static uint16_t batadv_tvlv_container_list_size(struct batadv_priv *bat_priv) +static u16 batadv_tvlv_container_list_size(struct batadv_priv *bat_priv) { struct batadv_tvlv_container *tvlv; - uint16_t tvlv_len = 0; + u16 tvlv_len = 0; hlist_for_each_entry(tvlv, &bat_priv->tvlv.container_list, list) { tvlv_len += sizeof(struct batadv_tvlv_hdr); @@ -764,7 +762,7 @@ static void batadv_tvlv_container_remove(struct batadv_tvlv_container *tvlv) * @version: tvlv container type to unregister */ void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv, - uint8_t type, uint8_t version) + u8 type, u8 version) { struct batadv_tvlv_container *tvlv; @@ -787,8 +785,8 @@ void batadv_tvlv_container_unregister(struct batadv_priv *bat_priv, * content is going to replace the old one. */ void batadv_tvlv_container_register(struct batadv_priv *bat_priv, - uint8_t type, uint8_t version, - void *tvlv_value, uint16_t tvlv_value_len) + u8 type, u8 version, + void *tvlv_value, u16 tvlv_value_len) { struct batadv_tvlv_container *tvlv_old, *tvlv_new; @@ -861,14 +859,13 @@ static bool batadv_tvlv_realloc_packet_buff(unsigned char **packet_buff, * * Returns size of all appended tvlv containers in bytes. */ -uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, - unsigned char **packet_buff, - int *packet_buff_len, - int packet_min_len) +u16 batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, + unsigned char **packet_buff, + int *packet_buff_len, int packet_min_len) { struct batadv_tvlv_container *tvlv; struct batadv_tvlv_hdr *tvlv_hdr; - uint16_t tvlv_value_len; + u16 tvlv_value_len; void *tvlv_value; bool ret; @@ -893,7 +890,7 @@ uint16_t batadv_tvlv_container_ogm_append(struct batadv_priv *bat_priv, tvlv_hdr->len = tvlv->tvlv_hdr.len; tvlv_value = tvlv_hdr + 1; memcpy(tvlv_value, tvlv + 1, ntohs(tvlv->tvlv_hdr.len)); - tvlv_value = (uint8_t *)tvlv_value + ntohs(tvlv->tvlv_hdr.len); + tvlv_value = (u8 *)tvlv_value + ntohs(tvlv->tvlv_hdr.len); } end: @@ -920,8 +917,8 @@ static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv, struct batadv_tvlv_handler *tvlv_handler, bool ogm_source, struct batadv_orig_node *orig_node, - uint8_t *src, uint8_t *dst, - void *tvlv_value, uint16_t tvlv_value_len) + u8 *src, u8 *dst, + void *tvlv_value, u16 tvlv_value_len) { if (!tvlv_handler) return NET_RX_SUCCESS; @@ -972,13 +969,13 @@ static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv, int batadv_tvlv_containers_process(struct batadv_priv *bat_priv, bool ogm_source, struct batadv_orig_node *orig_node, - uint8_t *src, uint8_t *dst, - void *tvlv_value, uint16_t tvlv_value_len) + u8 *src, u8 *dst, + void *tvlv_value, u16 tvlv_value_len) { struct batadv_tvlv_handler *tvlv_handler; struct batadv_tvlv_hdr *tvlv_hdr; - uint16_t tvlv_value_cont_len; - uint8_t cifnotfound = BATADV_TVLV_HANDLER_OGM_CIFNOTFND; + u16 tvlv_value_cont_len; + u8 cifnotfound = BATADV_TVLV_HANDLER_OGM_CIFNOTFND; int ret = NET_RX_SUCCESS; while (tvlv_value_len >= sizeof(*tvlv_hdr)) { @@ -1000,7 +997,7 @@ int batadv_tvlv_containers_process(struct batadv_priv *bat_priv, tvlv_value_cont_len); if (tvlv_handler) batadv_tvlv_handler_free_ref(tvlv_handler); - tvlv_value = (uint8_t *)tvlv_value + tvlv_value_cont_len; + tvlv_value = (u8 *)tvlv_value + tvlv_value_cont_len; tvlv_value_len -= tvlv_value_cont_len; } @@ -1034,7 +1031,7 @@ void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node) { void *tvlv_value; - uint16_t tvlv_value_len; + u16 tvlv_value_len; if (!batadv_ogm_packet) return; @@ -1066,14 +1063,14 @@ void batadv_tvlv_ogm_receive(struct batadv_priv *bat_priv, void batadv_tvlv_handler_register(struct batadv_priv *bat_priv, void (*optr)(struct batadv_priv *bat_priv, struct batadv_orig_node *orig, - uint8_t flags, + u8 flags, void *tvlv_value, - uint16_t tvlv_value_len), + u16 tvlv_value_len), int (*uptr)(struct batadv_priv *bat_priv, - uint8_t *src, uint8_t *dst, + u8 *src, u8 *dst, void *tvlv_value, - uint16_t tvlv_value_len), - uint8_t type, uint8_t version, uint8_t flags) + u16 tvlv_value_len), + u8 type, u8 version, u8 flags) { struct batadv_tvlv_handler *tvlv_handler; @@ -1108,7 +1105,7 @@ void batadv_tvlv_handler_register(struct batadv_priv *bat_priv, * @version: tvlv handler version to be unregistered */ void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv, - uint8_t type, uint8_t version) + u8 type, u8 version) { struct batadv_tvlv_handler *tvlv_handler; @@ -1134,9 +1131,9 @@ void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv, * @tvlv_value: tvlv content * @tvlv_value_len: tvlv content length */ -void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src, - uint8_t *dst, uint8_t type, uint8_t version, - void *tvlv_value, uint16_t tvlv_value_len) +void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src, + u8 *dst, u8 type, u8 version, + void *tvlv_value, u16 tvlv_value_len) { struct batadv_unicast_tvlv_packet *unicast_tvlv_packet; struct batadv_tvlv_hdr *tvlv_hdr; -- cgit v1.2.3