zephyr: replace zephyr integer types with C99 types

git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-05-27 11:26:57 -05:00 committed by Kumar Gala
commit a1b77fd589
2364 changed files with 32505 additions and 32505 deletions

View file

@ -156,10 +156,10 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt)
/* Timestamp of the current network packet sent if enabled */
struct net_ptp_time start_timestamp;
u32_t curr_time = 0;
uint32_t curr_time = 0;
/* We collect send statistics for each socket priority if enabled */
u8_t pkt_priority;
uint8_t pkt_priority;
if (!pkt) {
return false;
@ -276,8 +276,8 @@ static void process_tx_packet(struct k_work *work)
void net_if_queue_tx(struct net_if *iface, struct net_pkt *pkt)
{
u8_t prio = net_pkt_priority(pkt);
u8_t tc = net_tx_priority2tc(prio);
uint8_t prio = net_pkt_priority(pkt);
uint8_t tc = net_tx_priority2tc(prio);
k_work_init(net_pkt_work(pkt), process_tx_packet);
@ -513,10 +513,10 @@ static enum net_l2_flags l2_flags_get(struct net_if *iface)
#if defined(CONFIG_NET_NATIVE_IPV4) || defined(CONFIG_NET_NATIVE_IPV6)
/* Return how many bits are shared between two IP addresses */
static u8_t get_ipaddr_diff(const u8_t *src, const u8_t *dst, int addr_len)
static uint8_t get_ipaddr_diff(const uint8_t *src, const uint8_t *dst, int addr_len)
{
u8_t j, k, xor;
u8_t len = 0U;
uint8_t j, k, xor;
uint8_t len = 0U;
for (j = 0U; j < addr_len; j++) {
if (src[j] == dst[j]) {
@ -539,7 +539,7 @@ static u8_t get_ipaddr_diff(const u8_t *src, const u8_t *dst, int addr_len)
}
static struct net_if_router *iface_router_lookup(struct net_if *iface,
u8_t family, void *addr)
uint8_t family, void *addr)
{
int i;
@ -592,10 +592,10 @@ static void iface_router_notify_deletion(struct net_if_router *router,
}
static void iface_router_run_timer(u32_t current_time)
static void iface_router_run_timer(uint32_t current_time)
{
struct net_if_router *router, *next;
u32_t new_timer = UINT_MAX;
uint32_t new_timer = UINT_MAX;
if (k_delayed_work_remaining_get(&router_timer)) {
k_delayed_work_cancel(&router_timer);
@ -603,7 +603,7 @@ static void iface_router_run_timer(u32_t current_time)
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&active_router_timers,
router, next, node) {
u32_t current_timer = router->life_start +
uint32_t current_timer = router->life_start +
(MSEC_PER_SEC * router->lifetime) - current_time;
new_timer = MIN(current_timer, new_timer);
@ -616,7 +616,7 @@ static void iface_router_run_timer(u32_t current_time)
static void iface_router_expired(struct k_work *work)
{
u32_t current_time = k_uptime_get_32();
uint32_t current_time = k_uptime_get_32();
struct net_if_router *router, *next;
sys_snode_t *prev_node = NULL;
@ -625,7 +625,7 @@ static void iface_router_expired(struct k_work *work)
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&active_router_timers,
router, next, node) {
if ((s32_t)(router->life_start +
if ((int32_t)(router->life_start +
(MSEC_PER_SEC * router->lifetime) -
current_time) > 0) {
/* We have to loop on all active routers as their
@ -645,9 +645,9 @@ static void iface_router_expired(struct k_work *work)
}
static struct net_if_router *iface_router_add(struct net_if *iface,
u8_t family, void *addr,
uint8_t family, void *addr,
bool is_default,
u16_t lifetime)
uint16_t lifetime)
{
int i;
@ -731,7 +731,7 @@ static bool iface_router_rm(struct net_if_router *router)
}
static struct net_if_router *iface_router_find_default(struct net_if *iface,
u8_t family, void *addr)
uint8_t family, void *addr)
{
int i;
@ -892,7 +892,7 @@ static void join_mcast_nodes(struct net_if *iface, struct in6_addr *addr)
static void dad_timeout(struct k_work *work)
{
u32_t current_time = k_uptime_get_32();
uint32_t current_time = k_uptime_get_32();
struct net_if_addr *ifaddr, *next;
ARG_UNUSED(work);
@ -902,7 +902,7 @@ static void dad_timeout(struct k_work *work)
struct net_if_addr *tmp;
struct net_if *iface;
if ((s32_t)(ifaddr->dad_start +
if ((int32_t)(ifaddr->dad_start +
DAD_TIMEOUT - current_time) > 0) {
break;
}
@ -1059,7 +1059,7 @@ static inline void net_if_ipv6_start_dad(struct net_if *iface,
static void rs_timeout(struct k_work *work)
{
u32_t current_time = k_uptime_get_32();
uint32_t current_time = k_uptime_get_32();
struct net_if_ipv6 *ipv6, *next;
ARG_UNUSED(work);
@ -1068,7 +1068,7 @@ static void rs_timeout(struct k_work *work)
ipv6, next, rs_node) {
struct net_if *iface;
if ((s32_t)(ipv6->rs_start + RS_TIMEOUT - current_time) > 0) {
if ((int32_t)(ipv6->rs_start + RS_TIMEOUT - current_time) > 0) {
break;
}
@ -1238,14 +1238,14 @@ static inline int z_vrfy_net_if_ipv6_addr_lookup_by_index(
#include <syscalls/net_if_ipv6_addr_lookup_by_index_mrsh.c>
#endif
static bool check_timeout(u32_t start, s32_t timeout, u32_t counter,
u32_t current_time)
static bool check_timeout(uint32_t start, int32_t timeout, uint32_t counter,
uint32_t current_time)
{
if (counter > 0) {
return false;
}
if ((s32_t)((start + (u32_t)timeout) - current_time) > 0) {
if ((int32_t)((start + (uint32_t)timeout) - current_time) > 0) {
return false;
}
@ -1266,7 +1266,7 @@ static void address_expired(struct net_if_addr *ifaddr)
}
static bool address_manage_timeout(struct net_if_addr *ifaddr,
u32_t current_time, u32_t *next_wakeup)
uint32_t current_time, uint32_t *next_wakeup)
{
if (check_timeout(ifaddr->lifetime.timer_start,
ifaddr->lifetime.timer_timeout,
@ -1292,8 +1292,8 @@ static bool address_manage_timeout(struct net_if_addr *ifaddr,
static void address_lifetime_timeout(struct k_work *work)
{
u64_t timeout_update = UINT64_MAX;
u32_t current_time = k_uptime_get_32();
uint64_t timeout_update = UINT64_MAX;
uint32_t current_time = k_uptime_get_32();
bool found = false;
struct net_if_addr *current, *next;
@ -1301,7 +1301,7 @@ static void address_lifetime_timeout(struct k_work *work)
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&active_address_lifetime_timers,
current, next, lifetime.node) {
u32_t next_timeout;
uint32_t next_timeout;
bool is_timeout;
is_timeout = address_manage_timeout(current, current_time,
@ -1319,14 +1319,14 @@ static void address_lifetime_timeout(struct k_work *work)
}
if (found) {
/* If we are near upper limit of s32_t timeout, then lower it
/* If we are near upper limit of int32_t timeout, then lower it
* a bit so that kernel timeout variable will not overflow.
*/
if (timeout_update >= NET_TIMEOUT_MAX_VALUE) {
timeout_update = NET_TIMEOUT_MAX_VALUE;
}
NET_DBG("Waiting for %d ms", (s32_t)timeout_update);
NET_DBG("Waiting for %d ms", (int32_t)timeout_update);
k_delayed_work_submit(&address_lifetime_timer,
K_MSEC(timeout_update));
@ -1342,7 +1342,7 @@ void net_address_lifetime_timeout(void)
static void address_submit_work(struct net_if_addr *ifaddr)
{
s32_t remaining;
int32_t remaining;
remaining = k_delayed_work_remaining_get(&address_lifetime_timer);
if (!remaining || (ifaddr->lifetime.wrap_counter == 0 &&
@ -1362,25 +1362,25 @@ static void address_submit_work(struct net_if_addr *ifaddr)
}
}
static void address_start_timer(struct net_if_addr *ifaddr, u32_t vlifetime)
static void address_start_timer(struct net_if_addr *ifaddr, uint32_t vlifetime)
{
u64_t expire_timeout = (u64_t)MSEC_PER_SEC * (u64_t)vlifetime;
uint64_t expire_timeout = (uint64_t)MSEC_PER_SEC * (uint64_t)vlifetime;
sys_slist_append(&active_address_lifetime_timers,
&ifaddr->lifetime.node);
ifaddr->lifetime.timer_start = k_uptime_get_32();
ifaddr->lifetime.wrap_counter = expire_timeout /
(u64_t)NET_TIMEOUT_MAX_VALUE;
(uint64_t)NET_TIMEOUT_MAX_VALUE;
ifaddr->lifetime.timer_timeout = expire_timeout -
(u64_t)NET_TIMEOUT_MAX_VALUE *
(u64_t)ifaddr->lifetime.wrap_counter;
(uint64_t)NET_TIMEOUT_MAX_VALUE *
(uint64_t)ifaddr->lifetime.wrap_counter;
address_submit_work(ifaddr);
}
void net_if_ipv6_addr_update_lifetime(struct net_if_addr *ifaddr,
u32_t vlifetime)
uint32_t vlifetime)
{
NET_DBG("Updating expire time of %s by %u secs",
log_strdup(net_sprint_ipv6_addr(&ifaddr->address.in6_addr)),
@ -1415,7 +1415,7 @@ static struct net_if_addr *ipv6_addr_find(struct net_if *iface,
static inline void net_if_addr_init(struct net_if_addr *ifaddr,
struct in6_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
ifaddr->is_used = true;
ifaddr->address.family = AF_INET6;
@ -1440,7 +1440,7 @@ static inline void net_if_addr_init(struct net_if_addr *ifaddr,
struct net_if_addr *net_if_ipv6_addr_add(struct net_if *iface,
struct in6_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
struct net_if_addr *ifaddr;
struct net_if_ipv6 *ipv6;
@ -1558,7 +1558,7 @@ bool net_if_ipv6_addr_rm(struct net_if *iface, const struct in6_addr *addr)
bool z_impl_net_if_ipv6_addr_add_by_index(int index,
struct in6_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
struct net_if *iface;
@ -1575,7 +1575,7 @@ bool z_impl_net_if_ipv6_addr_add_by_index(int index,
bool z_vrfy_net_if_ipv6_addr_add_by_index(int index,
struct in6_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
#if defined(CONFIG_NET_IF_USERSPACE_ACCESS)
struct in6_addr addr_v6;
@ -1769,7 +1769,7 @@ void net_if_mcast_monitor(struct net_if *iface,
static void remove_prefix_addresses(struct net_if *iface,
struct net_if_ipv6 *ipv6,
struct in6_addr *addr,
u8_t len)
uint8_t len)
{
int i;
@ -1828,7 +1828,7 @@ static void prefix_timer_remove(struct net_if_ipv6_prefix *ifprefix)
}
static bool prefix_manage_timeout(struct net_if_ipv6_prefix *ifprefix,
u32_t current_time, u32_t *next_wakeup)
uint32_t current_time, uint32_t *next_wakeup)
{
if (check_timeout(ifprefix->lifetime.timer_start,
ifprefix->lifetime.timer_timeout,
@ -1853,8 +1853,8 @@ static bool prefix_manage_timeout(struct net_if_ipv6_prefix *ifprefix,
static void prefix_lifetime_timeout(struct k_work *work)
{
u64_t timeout_update = UINT64_MAX;
u32_t current_time = k_uptime_get_32();
uint64_t timeout_update = UINT64_MAX;
uint32_t current_time = k_uptime_get_32();
bool found = false;
struct net_if_ipv6_prefix *current, *next;
@ -1862,7 +1862,7 @@ static void prefix_lifetime_timeout(struct k_work *work)
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&active_prefix_lifetime_timers,
current, next, lifetime.node) {
u32_t next_timeout;
uint32_t next_timeout;
bool is_timeout;
is_timeout = prefix_manage_timeout(current, current_time,
@ -1880,14 +1880,14 @@ static void prefix_lifetime_timeout(struct k_work *work)
}
if (found) {
/* If we are near upper limit of s32_t timeout, then lower it
/* If we are near upper limit of int32_t timeout, then lower it
* a bit so that kernel timeout will not overflow.
*/
if (timeout_update >= NET_TIMEOUT_MAX_VALUE) {
timeout_update = NET_TIMEOUT_MAX_VALUE;
}
NET_DBG("Waiting for %d ms", (u32_t)timeout_update);
NET_DBG("Waiting for %d ms", (uint32_t)timeout_update);
k_delayed_work_submit(&prefix_lifetime_timer,
K_MSEC(timeout_update));
@ -1896,7 +1896,7 @@ static void prefix_lifetime_timeout(struct k_work *work)
static void prefix_submit_work(struct net_if_ipv6_prefix *ifprefix)
{
s32_t remaining;
int32_t remaining;
remaining = k_delayed_work_remaining_get(&prefix_lifetime_timer);
if (!remaining || (ifprefix->lifetime.wrap_counter == 0 &&
@ -1917,9 +1917,9 @@ static void prefix_submit_work(struct net_if_ipv6_prefix *ifprefix)
}
static void prefix_start_timer(struct net_if_ipv6_prefix *ifprefix,
u32_t lifetime)
uint32_t lifetime)
{
u64_t expire_timeout = (u64_t)MSEC_PER_SEC * (u64_t)lifetime;
uint64_t expire_timeout = (uint64_t)MSEC_PER_SEC * (uint64_t)lifetime;
(void)sys_slist_find_and_remove(&active_prefix_lifetime_timers,
&ifprefix->lifetime.node);
@ -1928,17 +1928,17 @@ static void prefix_start_timer(struct net_if_ipv6_prefix *ifprefix,
ifprefix->lifetime.timer_start = k_uptime_get_32();
ifprefix->lifetime.wrap_counter = expire_timeout /
(u64_t)NET_TIMEOUT_MAX_VALUE;
(uint64_t)NET_TIMEOUT_MAX_VALUE;
ifprefix->lifetime.timer_timeout = expire_timeout -
(u64_t)NET_TIMEOUT_MAX_VALUE *
(u64_t)ifprefix->lifetime.wrap_counter;
(uint64_t)NET_TIMEOUT_MAX_VALUE *
(uint64_t)ifprefix->lifetime.wrap_counter;
prefix_submit_work(ifprefix);
}
static struct net_if_ipv6_prefix *ipv6_prefix_find(struct net_if *iface,
struct in6_addr *prefix,
u8_t prefix_len)
uint8_t prefix_len)
{
struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6;
int i;
@ -1963,8 +1963,8 @@ static struct net_if_ipv6_prefix *ipv6_prefix_find(struct net_if *iface,
static void net_if_ipv6_prefix_init(struct net_if *iface,
struct net_if_ipv6_prefix *ifprefix,
struct in6_addr *addr, u8_t len,
u32_t lifetime)
struct in6_addr *addr, uint8_t len,
uint32_t lifetime)
{
ifprefix->is_used = true;
ifprefix->len = len;
@ -1980,8 +1980,8 @@ static void net_if_ipv6_prefix_init(struct net_if *iface,
struct net_if_ipv6_prefix *net_if_ipv6_prefix_add(struct net_if *iface,
struct in6_addr *prefix,
u8_t len,
u32_t lifetime)
uint8_t len,
uint32_t lifetime)
{
struct net_if_ipv6_prefix *ifprefix;
struct net_if_ipv6 *ipv6;
@ -2022,7 +2022,7 @@ struct net_if_ipv6_prefix *net_if_ipv6_prefix_add(struct net_if *iface,
}
bool net_if_ipv6_prefix_rm(struct net_if *iface, struct in6_addr *addr,
u8_t len)
uint8_t len)
{
struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6;
int i;
@ -2095,7 +2095,7 @@ struct net_if_ipv6_prefix *net_if_ipv6_prefix_get(struct net_if *iface,
struct net_if_ipv6_prefix *net_if_ipv6_prefix_lookup(struct net_if *iface,
struct in6_addr *addr,
u8_t len)
uint8_t len)
{
struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6;
int i;
@ -2152,7 +2152,7 @@ bool net_if_ipv6_addr_onlink(struct net_if **iface, struct in6_addr *addr)
}
void net_if_ipv6_prefix_set_timer(struct net_if_ipv6_prefix *prefix,
u32_t lifetime)
uint32_t lifetime)
{
/* No need to set a timer for infinite timeout */
if (lifetime == 0xffffffff) {
@ -2186,7 +2186,7 @@ struct net_if_router *net_if_ipv6_router_find_default(struct net_if *iface,
}
void net_if_ipv6_router_update_lifetime(struct net_if_router *router,
u16_t lifetime)
uint16_t lifetime)
{
NET_DBG("Updating expire time of %s by %u secs",
log_strdup(net_sprint_ipv6_addr(&router->address.in6_addr)),
@ -2200,7 +2200,7 @@ void net_if_ipv6_router_update_lifetime(struct net_if_router *router,
struct net_if_router *net_if_ipv6_router_add(struct net_if *iface,
struct in6_addr *addr,
u16_t lifetime)
uint16_t lifetime)
{
return iface_router_add(iface, AF_INET6, addr, false, lifetime);
}
@ -2307,10 +2307,10 @@ struct in6_addr *net_if_ipv6_get_global_addr(enum net_addr_state state,
return NULL;
}
static u8_t get_diff_ipv6(const struct in6_addr *src,
static uint8_t get_diff_ipv6(const struct in6_addr *src,
const struct in6_addr *dst)
{
return get_ipaddr_diff((const u8_t *)src, (const u8_t *)dst, 16);
return get_ipaddr_diff((const uint8_t *)src, (const uint8_t *)dst, 16);
}
static inline bool is_proper_ipv6_address(struct net_if_addr *addr)
@ -2326,11 +2326,11 @@ static inline bool is_proper_ipv6_address(struct net_if_addr *addr)
static struct in6_addr *net_if_ipv6_get_best_match(struct net_if *iface,
const struct in6_addr *dst,
u8_t *best_so_far)
uint8_t *best_so_far)
{
struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6;
struct in6_addr *src = NULL;
u8_t len;
uint8_t len;
int i;
if (!ipv6) {
@ -2363,7 +2363,7 @@ const struct in6_addr *net_if_ipv6_select_src_addr(struct net_if *dst_iface,
const struct in6_addr *dst)
{
struct in6_addr *src = NULL;
u8_t best_match = 0U;
uint8_t best_match = 0U;
struct net_if *iface;
if (!net_ipv6_is_ll_addr(dst) && !net_ipv6_is_addr_mcast(dst)) {
@ -2428,9 +2428,9 @@ struct net_if *net_if_ipv6_select_src_iface(const struct in6_addr *dst)
return iface;
}
u32_t net_if_ipv6_calc_reachable_time(struct net_if_ipv6 *ipv6)
uint32_t net_if_ipv6_calc_reachable_time(struct net_if_ipv6 *ipv6)
{
u32_t min_reachable, max_reachable;
uint32_t min_reachable, max_reachable;
min_reachable = (MIN_RANDOM_NUMER * ipv6->base_reachable_time)
/ MIN_RANDOM_DENOM;
@ -2588,7 +2588,7 @@ struct net_if_router *net_if_ipv4_router_find_default(struct net_if *iface,
struct net_if_router *net_if_ipv4_router_add(struct net_if *iface,
struct in_addr *addr,
bool is_default,
u16_t lifetime)
uint16_t lifetime)
{
return iface_router_add(iface, AF_INET, addr, is_default, lifetime);
}
@ -2602,7 +2602,7 @@ bool net_if_ipv4_addr_mask_cmp(struct net_if *iface,
const struct in_addr *addr)
{
struct net_if_ipv4 *ipv4 = iface->config.ip.ipv4;
u32_t subnet;
uint32_t subnet;
int i;
if (!ipv4) {
@ -2682,10 +2682,10 @@ struct net_if *net_if_ipv4_select_src_iface(const struct in_addr *dst)
return net_if_get_default();
}
static u8_t get_diff_ipv4(const struct in_addr *src,
static uint8_t get_diff_ipv4(const struct in_addr *src,
const struct in_addr *dst)
{
return get_ipaddr_diff((const u8_t *)src, (const u8_t *)dst, 4);
return get_ipaddr_diff((const uint8_t *)src, (const uint8_t *)dst, 4);
}
static inline bool is_proper_ipv4_address(struct net_if_addr *addr)
@ -2701,11 +2701,11 @@ static inline bool is_proper_ipv4_address(struct net_if_addr *addr)
static struct in_addr *net_if_ipv4_get_best_match(struct net_if *iface,
const struct in_addr *dst,
u8_t *best_so_far)
uint8_t *best_so_far)
{
struct net_if_ipv4 *ipv4 = iface->config.ip.ipv4;
struct in_addr *src = NULL;
u8_t len;
uint8_t len;
int i;
if (!ipv4) {
@ -2782,7 +2782,7 @@ const struct in_addr *net_if_ipv4_select_src_addr(struct net_if *dst_iface,
const struct in_addr *dst)
{
struct in_addr *src = NULL;
u8_t best_match = 0U;
uint8_t best_match = 0U;
struct net_if *iface;
if (!net_ipv4_is_ll_addr(dst) && !net_ipv4_is_addr_mcast(dst)) {
@ -3011,7 +3011,7 @@ static struct net_if_addr *ipv4_addr_find(struct net_if *iface,
struct net_if_addr *net_if_ipv4_addr_add(struct net_if *iface,
struct in_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
struct net_if_addr *ifaddr;
struct net_if_ipv4 *ipv4;
@ -3114,7 +3114,7 @@ bool net_if_ipv4_addr_rm(struct net_if *iface, const struct in_addr *addr)
bool z_impl_net_if_ipv4_addr_add_by_index(int index,
struct in_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
struct net_if *iface;
struct net_if_addr *if_addr;
@ -3132,7 +3132,7 @@ bool z_impl_net_if_ipv4_addr_add_by_index(int index,
bool z_vrfy_net_if_ipv4_addr_add_by_index(int index,
struct in_addr *addr,
enum net_addr_type addr_type,
u32_t vlifetime)
uint32_t vlifetime)
{
#if defined(CONFIG_NET_IF_USERSPACE_ACCESS)
struct in_addr addr_v4;