devices: virtio: gpu: regenerate udmabuf bindings

BUG=b:218388029
TEST=tools/presubmit --quick

Change-Id: If52944dc97bd61e62a0ee2e18df3bc976b95813d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3339806
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2021-12-07 15:01:50 -08:00 committed by Commit Bot
parent 90c1700c66
commit fde6c3bb39
3 changed files with 38 additions and 32 deletions

View file

@ -0,0 +1,18 @@
#!/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-gpu udmabuf bindgen bindings.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../../../.."
source tools/impl/bindgen-common.sh
bindgen_generate \
--allowlist-type='udmabuf_.*' \
--allowlist-var="UDMABUF_.*" \
"${BINDGEN_LINUX}/include/uapi/linux/udmabuf.h" \
| replace_linux_int_types | rustfmt \
> devices/src/virtio/gpu/udmabuf_bindings.rs

View file

@ -1,29 +1,25 @@
// Copyright 2021 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.
/* automatically generated by tools/bindgen-all-the-things */
/* automatically generated by rust-bindgen, though the exact command remains
* lost to history. Should be easy to duplicate, if needed.
*/
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
impl<T> __IncompleteArrayField<T> {
#[inline]
pub fn new() -> Self {
pub const fn new() -> Self {
__IncompleteArrayField(::std::marker::PhantomData, [])
}
#[inline]
pub unsafe fn as_ptr(&self) -> *const T {
::std::mem::transmute(self)
pub fn as_ptr(&self) -> *const T {
self as *const _ as *const T
}
#[inline]
pub unsafe fn as_mut_ptr(&mut self) -> *mut T {
::std::mem::transmute(self)
pub fn as_mut_ptr(&mut self) -> *mut T {
self as *mut _ as *mut T
}
#[inline]
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
@ -39,36 +35,27 @@ impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fmt.write_str("__IncompleteArrayField")
}
}
impl<T> ::std::clone::Clone for __IncompleteArrayField<T> {
#[inline]
fn clone(&self) -> Self {
Self::new()
}
}
pub const UDMABUF_FLAGS_CLOEXEC: u32 = 1;
pub type __u32 = ::std::os::raw::c_uint;
pub type __u64 = ::std::os::raw::c_ulonglong;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct udmabuf_create {
pub memfd: __u32,
pub flags: __u32,
pub offset: __u64,
pub size: __u64,
pub memfd: u32,
pub flags: u32,
pub offset: u64,
pub size: u64,
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct udmabuf_create_item {
pub memfd: __u32,
pub __pad: __u32,
pub offset: __u64,
pub size: __u64,
pub memfd: u32,
pub __pad: u32,
pub offset: u64,
pub size: u64,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default)]
pub struct udmabuf_create_list {
pub flags: __u32,
pub count: __u32,
pub flags: u32,
pub count: u32,
pub list: __IncompleteArrayField<udmabuf_create_item>,
}

View file

@ -20,6 +20,7 @@ die() {
dirs=(
common/io_uring
devices/src/virtio/gpu
)
for d in "${dirs[@]}"; do