1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

all: remove pointer casts for msg.content.ptr

This commit is contained in:
Kaspar Schleiser 2016-06-02 20:40:15 +02:00
parent f0b44d5175
commit 7718f114cb
42 changed files with 108 additions and 109 deletions

View File

@ -404,7 +404,7 @@ void msg_queue_print(void)
msg_t *m = &msg_array[i];
printf(" * %u: sender: %" PRIkernel_pid ", type: 0x%04" PRIu16
", content: %" PRIu32 " (%p)\n", i, m->sender_pid, m->type,
m->content.value, (void *)m->content.ptr);
m->content.value, m->content.ptr);
}
irq_restore(state);

View File

@ -1019,7 +1019,7 @@ void nrf24l01p_rx_cb(void *arg)
if (dev->listener != KERNEL_PID_UNDEF) {
msg_t m;
m.type = RCV_PKT_NRF24L01P;
m.content.ptr = (char *)dev;
m.content.ptr = dev;
/* transmit more things here ? */
msg_send_int(&m, dev->listener);
}

View File

@ -77,7 +77,7 @@ int pir_register_thread(pir_t *dev)
static void pir_send_msg(pir_t *dev, pir_event_t event)
{
DEBUG("pir_send_msg\n");
msg_t m = { .type = event, .content.ptr = (char*) dev, };
msg_t m = { .type = event, .content.ptr = dev, };
int ret = msg_send_int(&m, dev->msg_thread_pid);
DEBUG("pir_send_msg: msg_send_int: %i\n", ret);

View File

@ -93,7 +93,7 @@ void conn_udp_close(conn_udp_t *conn)
if (conn->waiting_thread != KERNEL_PID_UNDEF) {
msg_t msg;
msg.type = _MSG_TYPE_CLOSE;
msg.content.ptr = (char *)conn;
msg.content.ptr = conn;
mutex_unlock(&conn->mutex);
msg_send(&msg, conn->waiting_thread);
mutex_lock(&conn->mutex);
@ -139,7 +139,7 @@ int conn_udp_recvfrom(conn_udp_t *conn, void *data, size_t max_len, void *addr,
}
else if (msg.type == _MSG_TYPE_RCV) {
mutex_lock(&conn->mutex);
if (msg.content.ptr == (char *)conn) {
if (msg.content.ptr == conn) {
if (max_len < conn->recv_info.datalen) {
conn->waiting_thread = KERNEL_PID_UNDEF;
mutex_unlock(&conn->mutex);
@ -219,7 +219,7 @@ static void _input_callback(struct udp_socket *c, void *ptr,
conn->recv_info.data = data;
conn->recv_info.datalen = datalen - sizeof(ipv6_hdr_t);
msg.type = _MSG_TYPE_RCV;
msg.content.ptr = (char *)conn;
msg.content.ptr = conn;
mutex_unlock(&conn->mutex);
msg_send(&msg, conn->waiting_thread);
}

View File

@ -216,7 +216,7 @@ static void _event_cb(netdev2_t *dev, netdev2_event_t event)
msg_t msg;
msg.type = LWIP_NETDEV2_MSG_TYPE_EVENT;
msg.content.ptr = (char *)dev;
msg.content.ptr = dev;
if (msg_send(&msg, _pid) <= 0) {
DEBUG("lwip_netdev2: possibly lost interrupt.\n");
@ -251,7 +251,7 @@ static void *_event_loop(void *arg)
msg_t msg;
msg_receive(&msg);
if (msg.type == LWIP_NETDEV2_MSG_TYPE_EVENT) {
netdev2_t *dev = (netdev2_t *)msg.content.ptr;
netdev2_t *dev = msg.content.ptr;
dev->driver->isr(dev);
}
}

View File

@ -121,11 +121,11 @@
* msg_receive(&msg);
* switch (msg.type) {
* case GNRC_NETAPI_MSG_TYPE_RCV:
* pkt = (gnrc_pktsnip_t *) msg.content.ptr;
* pkt = msg.content.ptr;
* _handle_incoming_pkt(pkt);
* break;
* case GNRC_NETAPI_MSG_TYPE_SND:
* pkt = (gnrc_pktsnip_t *) msg.content.ptr;
* pkt = msg.content.ptr;
* _handle_outgoing_pkt(pkt);
* break;
* case GNRC_NETAPI_MSG_TYPE_SET:

View File

@ -485,7 +485,7 @@ int _tftp_server(tftp_context_t *ctxt)
/* release packet if we received one */
if (msg.type == GNRC_NETAPI_MSG_TYPE_RCV) {
gnrc_pktbuf_release((gnrc_pktsnip_t *) msg.content.ptr);
gnrc_pktbuf_release(msg.content.ptr);
}
}
@ -544,7 +544,7 @@ int _tftp_do_client_transfer(tftp_context_t *ctxt)
/* release packet if we received one */
if (msg.type == GNRC_NETAPI_MSG_TYPE_RCV) {
gnrc_pktbuf_release((gnrc_pktsnip_t *) msg.content.ptr);
gnrc_pktbuf_release(msg.content.ptr);
}
}
@ -595,7 +595,7 @@ tftp_state _tftp_state_processes(tftp_context_t *ctxt, msg_t *m)
return TS_BUSY;
}
gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)(m->content.ptr);
gnrc_pktsnip_t *pkt = m->content.ptr;
gnrc_pktsnip_t *tmp;
tmp = gnrc_pktsnip_search_type(pkt, GNRC_NETTYPE_UDP);

View File

@ -573,7 +573,7 @@ void *_event_loop(void *args)
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
DEBUG("zep: GNRC_NETAPI_MSG_TYPE_RCV\n");
ringbuffer_add(&_rx_buf, (char *)(&msg.content.ptr),
ringbuffer_add(&_rx_buf, (void*)&msg.content.ptr,
sizeof(gnrc_pktsnip_t *));
ack.type = GNRC_NETDEV_MSG_TYPE_EVENT;
ack.content.value = _EVENT_RX_STARTED;
@ -582,12 +582,12 @@ void *_event_loop(void *args)
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("zep: GNRC_NETAPI_MSG_TYPE_SND\n");
_send(dev, (gnrc_pktsnip_t *)msg.content.ptr);
_send(dev, msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_GET:
DEBUG("zep: GNRC_NETAPI_MSG_TYPE_GET\n");
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
ack.type = GNRC_NETAPI_MSG_TYPE_ACK;
ack.content.value = _get(dev, opt->opt, opt->data, opt->data_len);
msg_reply(&msg, &ack);
@ -595,7 +595,7 @@ void *_event_loop(void *args)
case GNRC_NETAPI_MSG_TYPE_SET:
DEBUG("zep: GNRC_NETAPI_MSG_TYPE_SET\n");
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
ack.type = GNRC_NETAPI_MSG_TYPE_ACK;
ack.content.value = _set(dev, opt->opt, opt->data, opt->data_len);
msg_reply(&msg, &ack);

View File

@ -32,7 +32,7 @@ int gnrc_conn_recvfrom(conn_t *conn, void *data, size_t max_len, void *addr, siz
msg_receive(&msg);
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
pkt = (gnrc_pktsnip_t *)msg.content.ptr;
pkt = msg.content.ptr;
if (pkt->size > max_len) {
return -ENOMEM;
}

View File

@ -54,7 +54,7 @@ static void _event_cb(netdev2_t *dev, netdev2_event_t event)
msg_t msg;
msg.type = NETDEV2_MSG_TYPE_EVENT;
msg.content.ptr = (void*) gnrc_netdev2;
msg.content.ptr = gnrc_netdev2;
if (msg_send(&msg, gnrc_netdev2->pid) <= 0) {
puts("gnrc_netdev2: possibly lost interrupt.");
@ -142,12 +142,12 @@ static void *_gnrc_netdev2_thread(void *args)
break;
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("gnrc_netdev2: GNRC_NETAPI_MSG_TYPE_SND received\n");
gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)msg.content.ptr;
gnrc_pktsnip_t *pkt = msg.content.ptr;
gnrc_netdev2->send(gnrc_netdev2, pkt);
break;
case GNRC_NETAPI_MSG_TYPE_SET:
/* read incoming options */
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
DEBUG("gnrc_netdev2: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n",
netopt2str(opt->opt));
/* set option for device driver */
@ -160,7 +160,7 @@ static void *_gnrc_netdev2_thread(void *args)
break;
case GNRC_NETAPI_MSG_TYPE_GET:
/* read incoming options */
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
DEBUG("gnrc_netdev2: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n",
netopt2str(opt->opt));
/* get option from device driver */

View File

@ -88,14 +88,14 @@ static void *_nomac_thread(void *args)
break;
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("nomac: GNRC_NETAPI_MSG_TYPE_SND received\n");
dev->driver->send_data(dev, (gnrc_pktsnip_t *)msg.content.ptr);
dev->driver->send_data(dev, msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SET:
/* TODO: filter out MAC layer options -> for now forward
everything to the device driver */
DEBUG("nomac: GNRC_NETAPI_MSG_TYPE_SET received\n");
/* read incoming options */
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
/* set option for device driver */
res = dev->driver->set(dev, opt->opt, opt->data, opt->data_len);
DEBUG("nomac: response of netdev->set: %i\n", res);
@ -109,7 +109,7 @@ static void *_nomac_thread(void *args)
everything to the device driver */
DEBUG("nomac: GNRC_NETAPI_MSG_TYPE_GET received\n");
/* read incoming options */
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
/* get option from device driver */
res = dev->driver->get(dev, opt->opt, opt->data, opt->data_len);
DEBUG("nomac: response of netdev->get: %i\n", res);

View File

@ -218,13 +218,13 @@ static void *_slip(void *args)
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("slip: GNRC_NETAPI_MSG_TYPE_SND received\n");
_slip_send(dev, (gnrc_pktsnip_t *)msg.content.ptr);
_slip_send(dev, msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_GET:
DEBUG("slip: GNRC_NETAPI_MSG_TYPE_GET received\n");
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
reply.content.value = (uint32_t)_slip_get((gnrc_netapi_opt_t *)msg.content.ptr);
reply.content.value = (uint32_t)_slip_get(msg.content.ptr);
msg_reply(&msg, &reply);
break;

View File

@ -57,7 +57,7 @@ static gnrc_nettest_res_t _pkt_test(uint16_t cmd_type, kernel_pid_t pid,
gnrc_nettest_res_t res = GNRC_NETTEST_SUCCESS;
msg.type = cmd_type;
msg.content.ptr = (char *)in;
msg.content.ptr = in;
msg_send(&msg, pid);
@ -81,7 +81,7 @@ static gnrc_nettest_res_t _pkt_test(uint16_t cmd_type, kernel_pid_t pid,
return GNRC_NETTEST_WRONG_SENDER;
}
out = (gnrc_pktsnip_t *)msg.content.ptr;
out = msg.content.ptr;
if (out == NULL) {
return GNRC_NETTEST_FAIL;
@ -99,7 +99,7 @@ static gnrc_nettest_res_t _pkt_test(uint16_t cmd_type, kernel_pid_t pid,
exp = exp->next;
}
gnrc_pktbuf_release((gnrc_pktsnip_t *)msg.content.ptr);
gnrc_pktbuf_release(msg.content.ptr);
}
return res;
@ -234,14 +234,14 @@ static void *_event_loop(void *arg)
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_GET:
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
reply.content.value = _get_set_opt(_opt_cbs[opt->opt].get,
opt->context, opt->data,
opt->data_len);
break;
case GNRC_NETAPI_MSG_TYPE_SET:
opt = (gnrc_netapi_opt_t *)msg.content.ptr;
opt = msg.content.ptr;
reply.content.value = _get_set_opt(_opt_cbs[opt->opt].set,
opt->context, opt->data,
opt->data_len);

View File

@ -263,12 +263,12 @@ static void *_event_loop(void *args)
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
DEBUG("ipv6: GNRC_NETAPI_MSG_TYPE_RCV received\n");
_receive((gnrc_pktsnip_t *)msg.content.ptr);
_receive(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("ipv6: GNRC_NETAPI_MSG_TYPE_SND received\n");
_send((gnrc_pktsnip_t *)msg.content.ptr, true);
_send(msg.content.ptr, true);
break;
case GNRC_NETAPI_MSG_TYPE_GET:
@ -289,43 +289,43 @@ static void *_event_loop(void *args)
/* case GNRC_NDP_MSG_ADDR_TIMEOUT: */
/* DEBUG("ipv6: Router advertisement timer event received\n"); */
/* gnrc_ipv6_netif_remove_addr(KERNEL_PID_UNDEF, */
/* (ipv6_addr_t *)msg.content.ptr); */
/* msg.content.ptr); */
/* break; */
case GNRC_NDP_MSG_NBR_SOL_RETRANS:
DEBUG("ipv6: Neigbor solicitation retransmission timer event received\n");
gnrc_ndp_retrans_nbr_sol((gnrc_ipv6_nc_t *)msg.content.ptr);
gnrc_ndp_retrans_nbr_sol(msg.content.ptr);
break;
case GNRC_NDP_MSG_NC_STATE_TIMEOUT:
DEBUG("ipv6: Neigbor cache state timeout received\n");
gnrc_ndp_state_timeout((gnrc_ipv6_nc_t *)msg.content.ptr);
gnrc_ndp_state_timeout(msg.content.ptr);
break;
#endif
#ifdef MODULE_GNRC_NDP_ROUTER
case GNRC_NDP_MSG_RTR_ADV_RETRANS:
DEBUG("ipv6: Router advertisement retransmission event received\n");
gnrc_ndp_router_retrans_rtr_adv((gnrc_ipv6_netif_t *)msg.content.ptr);
gnrc_ndp_router_retrans_rtr_adv(msg.content.ptr);
break;
case GNRC_NDP_MSG_RTR_ADV_DELAY:
DEBUG("ipv6: Delayed router advertisement event received\n");
gnrc_ndp_router_send_rtr_adv((gnrc_ipv6_nc_t *)msg.content.ptr);
gnrc_ndp_router_send_rtr_adv(msg.content.ptr);
break;
#endif
#ifdef MODULE_GNRC_NDP_HOST
case GNRC_NDP_MSG_RTR_SOL_RETRANS:
DEBUG("ipv6: Router solicitation retransmission event received\n");
gnrc_ndp_host_retrans_rtr_sol((gnrc_ipv6_netif_t *)msg.content.ptr);
gnrc_ndp_host_retrans_rtr_sol(msg.content.ptr);
break;
#endif
#ifdef MODULE_GNRC_SIXLOWPAN_ND
case GNRC_SIXLOWPAN_ND_MSG_MC_RTR_SOL:
DEBUG("ipv6: Multicast router solicitation event received\n");
gnrc_sixlowpan_nd_mc_rtr_sol((gnrc_ipv6_netif_t *)msg.content.ptr);
gnrc_sixlowpan_nd_mc_rtr_sol(msg.content.ptr);
break;
case GNRC_SIXLOWPAN_ND_MSG_UC_RTR_SOL:
DEBUG("ipv6: Unicast router solicitation event received\n");
gnrc_sixlowpan_nd_uc_rtr_sol((gnrc_ipv6_nc_t *)msg.content.ptr);
gnrc_sixlowpan_nd_uc_rtr_sol(msg.content.ptr);
break;
# ifdef MODULE_GNRC_SIXLOWPAN_CTX
case GNRC_SIXLOWPAN_ND_MSG_DELETE_CTX:
@ -338,18 +338,17 @@ static void *_event_loop(void *args)
#ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER
case GNRC_SIXLOWPAN_ND_MSG_ABR_TIMEOUT:
DEBUG("ipv6: border router timeout event received\n");
gnrc_sixlowpan_nd_router_abr_remove(
(gnrc_sixlowpan_nd_router_abr_t *)msg.content.ptr);
gnrc_sixlowpan_nd_router_abr_remove(msg.content.ptr);
break;
/* XXX reactivate when https://github.com/RIOT-OS/RIOT/issues/5122 is
* solved properly */
/* case GNRC_SIXLOWPAN_ND_MSG_AR_TIMEOUT: */
/* DEBUG("ipv6: address registration timeout received\n"); */
/* gnrc_sixlowpan_nd_router_gc_nc((gnrc_ipv6_nc_t *)msg.content.ptr); */
/* gnrc_sixlowpan_nd_router_gc_nc(msg.content.ptr); */
/* break; */
case GNRC_NDP_MSG_RTR_ADV_SIXLOWPAN_DELAY:
DEBUG("ipv6: Delayed router advertisement event received\n");
gnrc_ipv6_nc_t *nc_entry = (gnrc_ipv6_nc_t *)msg.content.ptr;
gnrc_ipv6_nc_t *nc_entry = msg.content.ptr;
gnrc_ndp_internal_send_rtr_adv(nc_entry->iface, NULL,
&(nc_entry->ipv6_addr), false);
break;

View File

@ -60,7 +60,7 @@ static void _nc_remove(kernel_pid_t iface, gnrc_ipv6_nc_t *entry)
gnrc_ipv6_netif_t *if_entry = gnrc_ipv6_netif_get(iface);
if ((if_entry != NULL) && (if_entry->rtr_adv_msg.content.ptr == (char *) entry)) {
if ((if_entry != NULL) && (if_entry->rtr_adv_msg.content.ptr == entry)) {
/* cancel timer set by gnrc_ndp_rtr_sol_handle */
xtimer_remove(&if_entry->rtr_adv_timer);
}
@ -175,18 +175,18 @@ gnrc_ipv6_nc_t *gnrc_ipv6_nc_add(kernel_pid_t iface, const ipv6_addr_t *ipv6_add
#ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER
free_entry->type_timeout_msg.type = GNRC_SIXLOWPAN_ND_MSG_AR_TIMEOUT;
free_entry->type_timeout_msg.content.ptr = (char *) free_entry;
free_entry->type_timeout_msg.content.ptr = free_entry;
#endif
free_entry->rtr_timeout_msg.type = GNRC_NDP_MSG_RTR_TIMEOUT;
free_entry->rtr_timeout_msg.content.ptr = (char *) free_entry;
free_entry->rtr_timeout_msg.content.ptr = free_entry;
#if defined(MODULE_GNRC_NDP_ROUTER) || defined(MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER)
free_entry->rtr_adv_msg.type = GNRC_NDP_MSG_RTR_ADV_DELAY;
free_entry->rtr_adv_msg.content.ptr = (char *) free_entry;
free_entry->rtr_adv_msg.content.ptr = free_entry;
#endif
free_entry->nbr_sol_msg.content.ptr = (char *) free_entry;
free_entry->nbr_sol_msg.content.ptr = free_entry;
return free_entry;
}

View File

@ -156,7 +156,7 @@ static ipv6_addr_t *_add_addr_to_entry(gnrc_ipv6_netif_t *entry, const ipv6_addr
}
tmp_addr->valid_timeout_msg.type = GNRC_NDP_MSG_ADDR_TIMEOUT;
tmp_addr->valid_timeout_msg.content.ptr = (char *) &tmp_addr->addr;
tmp_addr->valid_timeout_msg.content.ptr = &tmp_addr->addr;
return &(tmp_addr->addr);
}

View File

@ -442,7 +442,7 @@ void gnrc_ndp_rtr_sol_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
gnrc_ipv6_nc_t *nc_entry = gnrc_ipv6_nc_get(iface, &ipv6->src);
if (nc_entry != NULL) {
if_entry->rtr_adv_msg.type = GNRC_NDP_MSG_RTR_ADV_SIXLOWPAN_DELAY;
if_entry->rtr_adv_msg.content.ptr = (char *) nc_entry;
if_entry->rtr_adv_msg.content.ptr = nc_entry;
xtimer_set_msg(&if_entry->rtr_adv_timer, delay, &if_entry->rtr_adv_msg,
gnrc_ipv6_pid);
}
@ -451,7 +451,7 @@ void gnrc_ndp_rtr_sol_handle(kernel_pid_t iface, gnrc_pktsnip_t *pkt,
if (ipv6_addr_is_unspecified(&ipv6->src)) {
/* either multicast, if source unspecified */
if_entry->rtr_adv_msg.type = GNRC_NDP_MSG_RTR_ADV_RETRANS;
if_entry->rtr_adv_msg.content.ptr = (char *) if_entry;
if_entry->rtr_adv_msg.content.ptr = if_entry;
xtimer_set_msg(&if_entry->rtr_adv_timer, delay, &if_entry->rtr_adv_msg,
gnrc_ipv6_pid);
}

View File

@ -28,7 +28,7 @@ static inline void _reschedule_rtr_sol(gnrc_ipv6_netif_t *iface, uint32_t delay)
{
xtimer_remove(&iface->rtr_sol_timer);
iface->rtr_sol_msg.type = GNRC_NDP_MSG_RTR_SOL_RETRANS;
iface->rtr_sol_msg.content.ptr = (char *) iface;
iface->rtr_sol_msg.content.ptr = iface;
xtimer_set_msg(&iface->rtr_sol_timer, delay, &iface->rtr_sol_msg, gnrc_ipv6_pid);
}

View File

@ -51,7 +51,7 @@ static inline void _send_delayed(xtimer_t *t, msg_t *msg, uint32_t interval, gnr
{
xtimer_remove(t);
msg->type = GNRC_NETAPI_MSG_TYPE_SND;
msg->content.ptr = (char *) pkt;
msg->content.ptr = pkt;
xtimer_set_msg(t, interval, msg, gnrc_ipv6_pid);
}

View File

@ -106,7 +106,7 @@ static void _send_rtr_adv(gnrc_ipv6_netif_t *iface, ipv6_addr_t *dst)
/* reset timer for next router advertisement */
xtimer_remove(&iface->rtr_adv_timer);
iface->rtr_adv_msg.type = GNRC_NDP_MSG_RTR_ADV_RETRANS;
iface->rtr_adv_msg.content.ptr = (char *) iface;
iface->rtr_adv_msg.content.ptr = iface;
xtimer_set_msg(&iface->rtr_adv_timer, interval * SEC_IN_USEC, &iface->rtr_adv_msg,
gnrc_ipv6_pid);
}

View File

@ -290,7 +290,7 @@ static void _send(gnrc_pktsnip_t *pkt)
/* set the outgoing message's fields */
msg.type = GNRC_SIXLOWPAN_MSG_FRAG_SND;
msg.content.ptr = (void *)&fragment_msg;
msg.content.ptr = &fragment_msg;
/* send message to self */
msg_send_to_self(&msg);
}
@ -332,12 +332,12 @@ static void *_event_loop(void *args)
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
DEBUG("6lo: GNRC_NETDEV_MSG_TYPE_RCV received\n");
_receive((gnrc_pktsnip_t *)msg.content.ptr);
_receive(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("6lo: GNRC_NETDEV_MSG_TYPE_SND received\n");
_send((gnrc_pktsnip_t *)msg.content.ptr);
_send(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_GET:
@ -349,7 +349,7 @@ static void *_event_loop(void *args)
#ifdef MODULE_GNRC_SIXLOWPAN_FRAG
case GNRC_SIXLOWPAN_MSG_FRAG_SND:
DEBUG("6lo: send fragmented event received\n");
gnrc_sixlowpan_frag_send((gnrc_sixlowpan_msg_frag_t *)msg.content.ptr);
gnrc_sixlowpan_frag_send(msg.content.ptr);
break;
#endif

View File

@ -30,7 +30,7 @@ static inline void _rtr_sol_reschedule(gnrc_ipv6_netif_t *iface, uint32_t sec_de
{
xtimer_remove(&iface->rtr_sol_timer);
iface->rtr_sol_msg.type = GNRC_SIXLOWPAN_ND_MSG_MC_RTR_SOL;
iface->rtr_sol_msg.content.ptr = (char *) iface;
iface->rtr_sol_msg.content.ptr = iface;
xtimer_set_msg(&iface->rtr_sol_timer, sec_delay * SEC_IN_USEC, &iface->rtr_sol_msg,
gnrc_ipv6_pid);
}
@ -228,7 +228,7 @@ void gnrc_sixlowpan_nd_rtr_sol_reschedule(gnrc_ipv6_nc_t *nce, uint32_t sec_dela
gnrc_ipv6_netif_t *iface = gnrc_ipv6_netif_get(nce->iface);
xtimer_remove(&iface->rtr_sol_timer);
iface->rtr_sol_msg.type = GNRC_SIXLOWPAN_ND_MSG_MC_RTR_SOL;
iface->rtr_sol_msg.content.ptr = (char *) iface;
iface->rtr_sol_msg.content.ptr = iface;
xtimer_set_msg(&iface->rtr_sol_timer, sec_delay * SEC_IN_USEC, &iface->rtr_sol_msg,
gnrc_ipv6_pid);
}

View File

@ -243,7 +243,7 @@ void gnrc_sixlowpan_nd_opt_abr_handle(kernel_pid_t iface, ndp_rtr_adv_t *rtr_adv
xtimer_remove(&abr->ltimer);
abr->ltimer_msg.type = GNRC_SIXLOWPAN_ND_MSG_ABR_TIMEOUT;
abr->ltimer_msg.content.ptr = (char *) abr;
abr->ltimer_msg.content.ptr = abr;
xtimer_set_msg(&abr->ltimer, t, &abr->ltimer_msg, gnrc_ipv6_pid);
}

View File

@ -134,11 +134,11 @@ static void *_eventloop(void *arg)
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
puts("PKTDUMP: data received:");
_dump((gnrc_pktsnip_t *)msg.content.ptr);
_dump(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SND:
puts("PKTDUMP: data to send:");
_dump((gnrc_pktsnip_t *)msg.content.ptr);
_dump(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_GET:
case GNRC_NETAPI_MSG_TYPE_SET:

View File

@ -210,21 +210,21 @@ static void *_event_loop(void *args)
break;
case GNRC_RPL_MSG_TYPE_TRICKLE_INTERVAL:
DEBUG("RPL: GNRC_RPL_MSG_TYPE_TRICKLE_INTERVAL received\n");
trickle = (trickle_t *) msg.content.ptr;
trickle = msg.content.ptr;
if (trickle && (trickle->callback.func != NULL)) {
trickle_interval(trickle);
}
break;
case GNRC_RPL_MSG_TYPE_TRICKLE_CALLBACK:
DEBUG("RPL: GNRC_RPL_MSG_TYPE_TRICKLE_CALLBACK received\n");
trickle = (trickle_t *) msg.content.ptr;
trickle = msg.content.ptr;
if (trickle && (trickle->callback.func != NULL)) {
trickle_callback(trickle);
}
break;
case GNRC_NETAPI_MSG_TYPE_RCV:
DEBUG("RPL: GNRC_NETAPI_MSG_TYPE_RCV received\n");
_receive((gnrc_pktsnip_t *)msg.content.ptr);
_receive(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SND:
break;

View File

@ -232,11 +232,11 @@ static void *_event_loop(void *arg)
switch (msg.type) {
case GNRC_NETAPI_MSG_TYPE_RCV:
DEBUG("udp: GNRC_NETAPI_MSG_TYPE_RCV\n");
_receive((gnrc_pktsnip_t *)msg.content.ptr);
_receive(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SND:
DEBUG("udp: GNRC_NETAPI_MSG_TYPE_SND\n");
_send((gnrc_pktsnip_t *)msg.content.ptr);
_send(msg.content.ptr);
break;
case GNRC_NETAPI_MSG_TYPE_SET:
case GNRC_NETAPI_MSG_TYPE_GET:

View File

@ -345,7 +345,7 @@ static int fib_signal_rp(fib_table_t *table, uint16_t type, uint8_t *dat,
for (size_t i = 0; i < FIB_MAX_REGISTERED_RP; ++i) {
if (table->notify_rp[i] != KERNEL_PID_UNDEF) {
DEBUG("[fib_signal_rp] send msg@: %p to pid[%d]: %d\n", \
(void *)msg.content.ptr, (int)i, (int)(table->notify_rp[i]));
msg.content.ptr, (int)i, (int)(table->notify_rp[i]));
/* do only signal a RP if its registered prefix matches */
if (type != FIB_MSG_RP_SIGNAL_SOURCE_ROUTE_CREATED) {

View File

@ -203,7 +203,7 @@ int nhdp_register_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8
/* Start sending periodic HELLO */
signal_msg.type = HELLO_TIMER;
signal_msg.content.ptr = (char *) if_entry;
signal_msg.content.ptr = if_entry;
/* TODO: msg_send or msg_try_send? */
msg_try_send(&signal_msg, nhdp_pid);
@ -255,7 +255,7 @@ static void *_nhdp_runner(void *arg)
switch (msg_rcvd.type) {
case HELLO_TIMER:
mutex_lock(&send_rcv_mutex);
if_entry = (nhdp_if_entry_t *) msg_rcvd.content.ptr;
if_entry = msg_rcvd.content.ptr;
nhdp_writer_send_hello(if_entry);

View File

@ -108,7 +108,7 @@ static void *pthread_reaper(void *arg)
while (1) {
msg_t m;
msg_receive(&m);
DEBUG("pthread_reaper(): free(%p)\n", (void *)m.content.ptr);
DEBUG("pthread_reaper(): free(%p)\n", m.content.ptr);
free(m.content.ptr);
}

View File

@ -57,7 +57,7 @@ int sema_destroy(sema_t *sema)
msg_t msg;
kernel_pid_t pid = (kernel_pid_t)next->data;
msg.type = MSG_DESTROYED;
msg.content.ptr = (void *) sema;
msg.content.ptr = sema;
msg_send_int(&msg, pid);
}
irq_restore(old_state);
@ -77,7 +77,7 @@ int sema_wait_timed_msg(sema_t *sema, uint64_t timeout, msg_t *msg)
old_state = irq_disable();
timeout_timer.target = 0, timeout_timer.long_target = 0;
timeout_msg.type = MSG_TIMEOUT;
timeout_msg.content.ptr = (char *)sema;
timeout_msg.content.ptr = sema;
/* we will stay in the same stack context so we can use timeout_msg */
xtimer_set_msg64(&timeout_timer, timeout, &timeout_msg, sched_active_pid);
irq_restore(old_state);
@ -111,7 +111,7 @@ int sema_wait_timed_msg(sema_t *sema, uint64_t timeout, msg_t *msg)
}
priority_queue_remove(&sema->queue, &n);
irq_restore(old_state);
if (msg->content.ptr != (void *)sema) {
if (msg->content.ptr != sema) {
return -EAGAIN;
}
@ -164,7 +164,7 @@ int sema_post(sema_t *sema)
DEBUG("sema_post: %" PRIkernel_pid ": waking up %" PRIkernel_pid "\n",
sched_active_thread->pid, next_process->pid);
msg.type = MSG_SIGNAL;
msg.content.ptr = (void *) sema;
msg.content.ptr = sema;
msg_send_int(&msg, pid);
irq_restore(old_state);
sched_switch(prio);

View File

@ -289,7 +289,7 @@ int _icmpv6_ping(int argc, char **argv)
case GNRC_NETAPI_MSG_TYPE_RCV:
stop = xtimer_now() - start;
gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)msg.content.ptr;
gnrc_pktsnip_t *pkt = msg.content.ptr;
success += _handle_reply(pkt, stop);
gnrc_pktbuf_release(pkt);
@ -318,7 +318,7 @@ int _icmpv6_ping(int argc, char **argv)
while (msg_try_receive(&msg) > 0) {
if (msg.type == GNRC_NETAPI_MSG_TYPE_RCV) {
printf("dropping additional response packet (probably caused by duplicates)\n");
gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)msg.content.ptr;
gnrc_pktsnip_t *pkt = msg.content.ptr;
gnrc_pktbuf_release(pkt);
}
}
@ -342,7 +342,7 @@ int _icmpv6_ping(int argc, char **argv)
while (msg_try_receive(&msg) > 0) {
if (msg.type == GNRC_NETAPI_MSG_TYPE_RCV) {
printf("dropping additional response packet (probably caused by duplicates)\n");
gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)msg.content.ptr;
gnrc_pktsnip_t *pkt = msg.content.ptr;
gnrc_pktbuf_release(pkt);
}
}

View File

@ -75,9 +75,9 @@ void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t interval_msg_t
trickle->Imax = Imax;
trickle->I = trickle->Imin + random_uint32_range(0, 4 * trickle->Imin);
trickle->pid = pid;
trickle->msg_interval.content.ptr = (char *)trickle;
trickle->msg_interval.content.ptr = trickle;
trickle->msg_interval.type = interval_msg_type;
trickle->msg_callback.content.ptr = (char *)trickle;
trickle->msg_callback.content.ptr = trickle;
trickle->msg_callback.type = callback_msg_type;
trickle_interval(trickle);

View File

@ -166,7 +166,7 @@ void xtimer_now_timex(timex_t *out)
static void _setup_timer_msg(msg_t *m, xtimer_t *t)
{
m->type = MSG_XTIMER;
m->content.ptr = (char *) m;
m->content.ptr = m;
t->target = t->long_target = 0;
}
@ -175,7 +175,7 @@ static void _setup_timer_msg(msg_t *m, xtimer_t *t)
static int _msg_wait(msg_t *m, msg_t *tmsg, xtimer_t *t)
{
msg_receive(m);
if (m->type == MSG_XTIMER && m->content.ptr == (char *) tmsg) {
if (m->type == MSG_XTIMER && m->content.ptr == tmsg) {
/* we hit the timeout */
return -1;
}

View File

@ -48,7 +48,7 @@ static void _event_cb(netdev2_t *dev, netdev2_event_t event)
msg_t msg;
msg.type = MSG_TYPE_ISR;
msg.content.ptr = (void *) dev;
msg.content.ptr = dev;
if (msg_send(&msg, _recv_pid) <= 0) {
puts("gnrc_netdev2: possibly lost interrupt.");
@ -75,7 +75,7 @@ void *_recv_thread(void *arg)
msg_t msg;
msg_receive(&msg);
if (msg.type == MSG_TYPE_ISR) {
netdev2_t *dev = (netdev2_t *)msg.content.ptr;
netdev2_t *dev = msg.content.ptr;
dev->driver->isr(dev);
}
else {

View File

@ -139,16 +139,16 @@ void *nrf24l01p_rx_handler(void *arg)
puts("Received packet.");
/* CE low */
nrf24l01p_stop((nrf24l01p_t *)m.content.ptr);
nrf24l01p_stop(m.content.ptr);
/* read payload */
nrf24l01p_read_payload((nrf24l01p_t *)m.content.ptr, rx_buf, NRF24L01P_MAX_DATA_LENGTH);
nrf24l01p_read_payload(m.content.ptr, rx_buf, NRF24L01P_MAX_DATA_LENGTH);
/* flush rx fifo */
nrf24l01p_flush_rx_fifo((nrf24l01p_t *)m.content.ptr);
nrf24l01p_flush_rx_fifo(m.content.ptr);
/* CE high */
nrf24l01p_start((nrf24l01p_t *)m.content.ptr);
nrf24l01p_start(m.content.ptr);
/* print rx buffer */
for (int i = 0; i < NRF24L01P_MAX_DATA_LENGTH; i++) {

View File

@ -45,7 +45,7 @@ static void *thread1(void *args)
int counter = 0, success = 1;
msg_resp.content.ptr = NULL;
msg_req.content.ptr = (void *) &counter;
msg_req.content.ptr = &counter;
for (int i = 0; i < TEST_EXECUTION_NUM; i++) {
msg_send_receive(&msg_req, &msg_resp, thread2_pid);
@ -76,7 +76,7 @@ static void *thread2(void *args)
msg_t msg_req, msg_resp;
int counter = 0;
msg_resp.content.ptr = (void *) &counter;
msg_resp.content.ptr = &counter;
for (int i = 0; i < TEST_EXECUTION_NUM; i++) {
msg_receive(&msg_req);

View File

@ -165,7 +165,7 @@ static int test_receive(void)
puts("Expected netapi receive message");
return 0;
}
pkt = (gnrc_pktsnip_t *)msg.content.ptr;
pkt = msg.content.ptr;
/* check payload */
if (pkt->size != _tmp_len - sizeof(ethernet_hdr_t)) {
puts("Payload of unexpected size");

View File

@ -44,7 +44,7 @@ void *thread1(void *arg)
/* step 2: send message, turning its status into STATUS_REPLY_BLOCKED */
msg_send_receive(&msg, &reply, p_main);
printf("received: %" PRIkernel_pid ", %u \n", reply.sender_pid, reply.type);
printf("pointer: %s\n", reply.content.ptr);
printf("pointer: %s\n", (char *)reply.content.ptr);
printf("THREAD %" PRIkernel_pid " SHOULD BE BLOCKING :(\n", p1);

View File

@ -44,7 +44,7 @@ void *thread1(void *arg)
/* step 2: send message, turning its status into STATUS_REPLY_BLOCKED */
msg_send_receive(&msg, &reply, p_main);
printf("received: %" PRIkernel_pid ", %u \n", reply.sender_pid, reply.type);
printf("pointer: %s\n", reply.content.ptr);
printf("pointer: %s\n", (char *)reply.content.ptr);
printf("THREAD %" PRIkernel_pid " SHOULD BE BLOCKING :(\n", p1);

View File

@ -39,7 +39,7 @@ void *sub_thread(void *arg)
msg_t msg;
msg.content.ptr = (char*) arg;
msg.content.ptr = arg;
msg_send(&msg, p_main);
@ -68,7 +68,7 @@ int main(void)
puts("THREADS CREATED\n");
for(int i = 0; i < 3; i++) {
msg_receive(&msg);
printf("Got msg from pid %" PRIkernel_pid ": \"%s\"\n", msg.sender_pid, msg.content.ptr);
printf("Got msg from pid %" PRIkernel_pid ": \"%s\"\n", msg.sender_pid, (char *)msg.content.ptr);
}
return 0;

View File

@ -73,12 +73,12 @@ void *slacker_thread(void *arg)
while (1) {
msg_t m;
msg_receive(&m);
struct timer_msg *tmsg = (struct timer_msg *) m.content.ptr;
struct timer_msg *tmsg = m.content.ptr;
xtimer_now_timex(&now);
xtimer_usleep(TEST_MSG_RX_USLEEP);
tmsg->msg.type = 12345;
tmsg->msg.content.ptr = (void*)tmsg;
tmsg->msg.content.ptr = tmsg;
xtimer_set_msg(&tmsg->timer, tmsg->interval, &tmsg->msg, thread_getpid());
}
}
@ -157,11 +157,11 @@ int main(void)
"slacker1");
puts("sending 1st msg");
m.content.ptr = (char *) &msg_a;
m.content.ptr = &msg_a;
msg_try_send(&m, pid1);
puts("sending 2nd msg");
m.content.ptr = (char *) &msg_b;
m.content.ptr = &msg_b;
msg_try_send(&m, pid1);
kernel_pid_t pid2 = thread_create(
@ -174,11 +174,11 @@ int main(void)
"slacker2");
puts("sending 3rd msg");
m.content.ptr = (char *) &msg_c;
m.content.ptr = &msg_c;
msg_try_send(&m, pid2);
puts("sending 4th msg");
m.content.ptr = (char *) &msg_d;
m.content.ptr = &msg_d;
msg_try_send(&m, pid2);
kernel_pid_t pid3 = thread_create(

View File

@ -57,7 +57,7 @@ void *timer_thread(void *arg)
while (1) {
msg_t m;
msg_receive(&m);
struct timer_msg *tmsg = (struct timer_msg *) m.content.ptr;
struct timer_msg *tmsg = m.content.ptr;
xtimer_now_timex(&now);
printf("now=%" PRIu32 ":%" PRIu32 " -> every %" PRIu32 ".%" PRIu32 "s: %s\n",
now.seconds,
@ -67,7 +67,7 @@ void *timer_thread(void *arg)
tmsg->text);
tmsg->msg.type = 12345;
tmsg->msg.content.ptr = (void*)tmsg;
tmsg->msg.content.ptr = tmsg;
xtimer_set_msg(&tmsg->timer, tmsg->interval, &tmsg->msg, thread_getpid());
}
}
@ -104,11 +104,11 @@ int main(void)
"timer");
puts("sending 1st msg");
m.content.ptr = (char *) &msg_a;
m.content.ptr = &msg_a;
msg_try_send(&m, pid);
puts("sending 2nd msg");
m.content.ptr = (char *) &msg_b;
m.content.ptr = &msg_b;
msg_try_send(&m, pid);
kernel_pid_t pid2 = thread_create(