mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
On Windows, we have to generate virtio_net_hdr_mrg_rxbuf ourselves since there is no actual TAP device. Since we have to serialize it onto a binary pipe, we need to get it as a binary slice, so here we implement DataInit on that struct. BUG=b:213151463 TEST=builds Change-Id: I25a3333c20a87d6bf576f0225aac3e1c816a46ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3609237 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Commit-Queue: Noah Gold <nkgold@google.com>
49 lines
1.5 KiB
Bash
Executable file
49 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Copyright 2022 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Regenerate virtio_sys bindgen bindings.
|
|
|
|
set -euo pipefail
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
source tools/impl/bindgen-common.sh
|
|
|
|
|
|
VIRTIO_NET_EXTRA="// Added by virtio_sys/bindgen.sh
|
|
use data_model::DataInit;
|
|
|
|
// Safe because virtio_net_hdr_mrg_rxbuf has no implicit padding.
|
|
unsafe impl DataInit for virtio_net_hdr_mrg_rxbuf {}"
|
|
|
|
bindgen_generate \
|
|
--allowlist-type='vhost_.*' \
|
|
--allowlist-var='VHOST_.*' \
|
|
--allowlist-var='VIRTIO_.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/vhost.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/vhost.rs
|
|
|
|
bindgen_generate \
|
|
--raw-line "${VIRTIO_NET_EXTRA}" \
|
|
--allowlist-var='VIRTIO_NET_.*' \
|
|
--allowlist-type='virtio_net_.*' \
|
|
--blocklist-type='virtio_net_ctrl_mac' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_net.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/virtio_net.rs
|
|
|
|
bindgen_generate \
|
|
--allowlist-var='VRING_.*' \
|
|
--allowlist-var='VIRTIO_RING_.*' \
|
|
--allowlist-type='vring.*' \
|
|
"${BINDGEN_LINUX_X86_HEADERS}/include/linux/virtio_ring.h" \
|
|
-- \
|
|
-isystem "${BINDGEN_LINUX_X86_HEADERS}/include" \
|
|
| replace_linux_int_types \
|
|
> virtio_sys/src/virtio_ring.rs
|