1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00

Make some unwise casts. On i386 these casts wind up being safe. Rather

than disturb the API, go with these casts to shut gcc up.
This commit is contained in:
Warner Losh 2014-04-05 22:42:00 +00:00
parent 086036aad3
commit 3e5a6bd16d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264177
4 changed files with 24 additions and 21 deletions

View File

@ -182,7 +182,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device)
/* Send the gpadl notification request */
ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
sizeof(nvsp_msg), (uint64_t)init_pkt,
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@ -280,7 +280,7 @@ hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device)
/* Send the gpadl notification request */
ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
sizeof(nvsp_msg), (uint64_t)init_pkt,
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@ -334,7 +334,7 @@ hv_nv_destroy_rx_buffer(netvsc_dev *net_dev)
ret = hv_vmbus_channel_send_packet(net_dev->dev->channel,
revoke_pkt, sizeof(nvsp_msg),
(uint64_t)revoke_pkt,
(uint64_t)(uintptr_t)revoke_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
/*
@ -402,7 +402,7 @@ hv_nv_destroy_send_buffer(netvsc_dev *net_dev)
ret = hv_vmbus_channel_send_packet(net_dev->dev->channel,
revoke_pkt, sizeof(nvsp_msg),
(uint64_t)revoke_pkt,
(uint64_t)(uintptr_t)revoke_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
/*
* If we failed here, we might as well return and have a leak
@ -464,7 +464,7 @@ hv_nv_negotiate_nvsp_protocol(struct hv_device *device, netvsc_dev *net_dev,
/* Send the init request */
ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
sizeof(nvsp_msg), (uint64_t)init_pkt,
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
@ -508,7 +508,7 @@ hv_nv_send_ndis_config(struct hv_device *device, uint32_t mtu)
/* Send the configuration packet */
ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
sizeof(nvsp_msg), (uint64_t)init_pkt,
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
if (ret != 0)
return (-EINVAL);
@ -580,7 +580,7 @@ hv_nv_connect_to_vsp(struct hv_device *device)
/* Send the init request */
ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
sizeof(nvsp_msg), (uint64_t)init_pkt,
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, 0);
if (ret != 0) {
goto cleanup;
@ -830,10 +830,10 @@ hv_nv_on_send(struct hv_device *device, netvsc_packet *pkt)
if (pkt->page_buf_count) {
ret = hv_vmbus_channel_send_packet_pagebuffer(device->channel,
pkt->page_buffers, pkt->page_buf_count,
&send_msg, sizeof(nvsp_msg), (uint64_t)pkt);
&send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt);
} else {
ret = hv_vmbus_channel_send_packet(device->channel,
&send_msg, sizeof(nvsp_msg), (uint64_t)pkt,
&send_msg, sizeof(nvsp_msg), (uint64_t)(uintptr_t)pkt,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}

View File

@ -344,7 +344,7 @@ netvsc_xmit_completion(void *context)
struct mbuf *mb;
uint8_t *buf;
mb = (struct mbuf *)packet->compl.send.send_completion_tid;
mb = (struct mbuf *)(uintptr_t)packet->compl.send.send_completion_tid;
buf = ((uint8_t *)packet) - HV_NV_PACKET_OFFSET_IN_BUF;
free(buf, M_DEVBUF);
@ -494,7 +494,7 @@ hn_start_locked(struct ifnet *ifp)
/* Set the completion routine */
packet->compl.send.on_send_completion = netvsc_xmit_completion;
packet->compl.send.send_completion_context = packet;
packet->compl.send.send_completion_tid = (uint64_t)m_head;
packet->compl.send.send_completion_tid = (uint64_t)(uintptr_t)m_head;
/* Removed critical_enter(), does not appear necessary */
ret = hv_rf_on_send(device_ctx, packet);
@ -682,7 +682,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet)
*/
for (i=0; i < packet->page_buf_count; i++) {
/* Shift virtual page number to form virtual page address */
uint8_t *vaddr = (uint8_t *)
uint8_t *vaddr = (uint8_t *)(uintptr_t)
(packet->page_buffers[i].pfn << PAGE_SHIFT);
hv_m_append(m_new, packet->page_buffers[i].length,

View File

@ -26,6 +26,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
@ -334,7 +337,7 @@ hv_rf_on_receive(struct hv_device *device, netvsc_packet *pkt)
return (EINVAL);
/* Shift virtual page number to form virtual page address */
rndis_hdr = (rndis_msg *)(pkt->page_buffers[0].pfn << PAGE_SHIFT);
rndis_hdr = (rndis_msg *)(uintptr_t)(pkt->page_buffers[0].pfn << PAGE_SHIFT);
rndis_hdr = (void *)((unsigned long)rndis_hdr
+ pkt->page_buffers[0].offset);

View File

@ -296,7 +296,7 @@ hv_storvsc_channel_init(struct hv_device *dev)
dev->channel,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)request,
(uint64_t)(uintptr_t)request,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@ -330,7 +330,7 @@ hv_storvsc_channel_init(struct hv_device *dev)
dev->channel,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)request,
(uint64_t)(uintptr_t)request,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@ -361,7 +361,7 @@ hv_storvsc_channel_init(struct hv_device *dev)
dev->channel,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)request,
(uint64_t)(uintptr_t)request,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@ -389,7 +389,7 @@ hv_storvsc_channel_init(struct hv_device *dev)
dev->channel,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)request,
(uint64_t)(uintptr_t)request,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@ -482,7 +482,7 @@ hv_storvsc_host_reset(struct hv_device *dev)
ret = hv_vmbus_channel_send_packet(dev->channel,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)&sc->hs_reset_req,
(uint64_t)(uintptr_t)&sc->hs_reset_req,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@ -547,14 +547,14 @@ hv_storvsc_io_request(struct hv_device *device,
&request->data_buf,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)request);
(uint64_t)(uintptr_t)request);
} else {
ret = hv_vmbus_channel_send_packet(
device->channel,
vstor_packet,
sizeof(struct vstor_packet),
(uint64_t)request,
(uint64_t)(uintptr_t)request,
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}
@ -634,7 +634,7 @@ hv_storvsc_on_channel_callback(void *context)
&request_id);
while ((ret == 0) && (bytes_recvd > 0)) {
request = (struct hv_storvsc_request *)request_id;
request = (struct hv_storvsc_request *)(uintptr_t)request_id;
KASSERT(request, ("request"));
if ((request == &sc->hs_init_req) ||