bindgen: switch to allowlist/blocklist options

Rust bindgen now supports --allowlist and --blocklist option names as of
https://github.com/rust-lang/rust-bindgen/pull/1990 - use them in the
various bindgen invocations in scripts and comments.

BUG=b:178821708
TEST=../dev/contrib/search_blocked_words.sh unblocked_terms.txt

Change-Id: I9797f049999a01ab2c41617823463236b4d03cbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3243012
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2021-10-25 13:51:09 -07:00 committed by Commit Bot
parent 9abac407ac
commit 0c2f9c749f
10 changed files with 93 additions and 93 deletions

View file

@ -6,8 +6,8 @@
//!
//! ```shell
//! $ bindgen virtio_video.h \
//! --whitelist-type "virtio_video.*" \
//! --whitelist-var "VIRTIO_VIDEO_.*" \
//! --allowlist-type "virtio_video.*" \
//! --allowlist-var "VIRTIO_VIDEO_.*" \
//! --with-derive-default \
//! --no-layout-tests \
//! --no-prepend-enum-name > protocol.rs

View file

@ -21,70 +21,70 @@ extern "C" {}
EOF
bindgen --no-layout-tests --no-derive-debug \
--whitelist-function XAllocSizeHints \
--whitelist-function XBlackPixelOfScreen \
--whitelist-function XClearWindow \
--whitelist-function XCloseDisplay \
--whitelist-function XConnectionNumber \
--whitelist-function XCreateGC \
--whitelist-function XCreateSimpleWindow \
--whitelist-function XDefaultDepthOfScreen \
--whitelist-function XDefaultScreenOfDisplay \
--whitelist-function XDefaultVisualOfScreen \
--whitelist-function XDestroyImage \
--whitelist-function XDestroyWindow \
--whitelist-function XFlush \
--whitelist-function XFree \
--whitelist-function XFreeGC \
--whitelist-function XGetVisualInfo \
--whitelist-function XInternAtom \
--whitelist-function XKeycodeToKeysym \
--whitelist-function XMapRaised \
--whitelist-function XNextEvent \
--whitelist-function XOpenDisplay \
--whitelist-function XPending \
--whitelist-function XRootWindowOfScreen \
--whitelist-function XScreenNumberOfScreen \
--whitelist-function XSelectInput \
--whitelist-function XSetWMNormalHints \
--whitelist-function XSetWMProtocols \
--whitelist-function XShmAttach \
--whitelist-function XShmCreateImage \
--whitelist-function XShmDetach \
--whitelist-function XShmGetEventBase \
--whitelist-function XShmPutImage \
--whitelist-function XShmQueryExtension \
--whitelist-var 'XK_.*' \
--whitelist-var ButtonPress \
--whitelist-var ButtonPressMask \
--whitelist-var Button1 \
--whitelist-var Button1Mask \
--whitelist-var ButtonRelease \
--whitelist-var ButtonReleaseMask \
--whitelist-var ClientMessage \
--whitelist-var Expose \
--whitelist-var ExposureMask \
--whitelist-var KeyPress \
--whitelist-var KeyPressMask \
--whitelist-var KeyRelease \
--whitelist-var KeyReleaseMask \
--whitelist-var MotionNotify \
--whitelist-var PMaxSize \
--whitelist-var PMinSize \
--whitelist-var PointerMotionMask \
--whitelist-var ShmCompletion \
--whitelist-var VisualBlueMaskMask \
--whitelist-var VisualDepthMask \
--whitelist-var VisualGreenMaskMask \
--whitelist-var VisualRedMaskMask \
--whitelist-var VisualScreenMask \
--whitelist-var ZPixmap \
--whitelist-type Display \
--whitelist-type GC \
--whitelist-type Screen \
--whitelist-type XShmCompletionEvent \
--whitelist-type ShmSeg \
--whitelist-type Visual \
--whitelist-type Window \
--whitelist-type XVisualInfo \
--allowlist-function XAllocSizeHints \
--allowlist-function XBlackPixelOfScreen \
--allowlist-function XClearWindow \
--allowlist-function XCloseDisplay \
--allowlist-function XConnectionNumber \
--allowlist-function XCreateGC \
--allowlist-function XCreateSimpleWindow \
--allowlist-function XDefaultDepthOfScreen \
--allowlist-function XDefaultScreenOfDisplay \
--allowlist-function XDefaultVisualOfScreen \
--allowlist-function XDestroyImage \
--allowlist-function XDestroyWindow \
--allowlist-function XFlush \
--allowlist-function XFree \
--allowlist-function XFreeGC \
--allowlist-function XGetVisualInfo \
--allowlist-function XInternAtom \
--allowlist-function XKeycodeToKeysym \
--allowlist-function XMapRaised \
--allowlist-function XNextEvent \
--allowlist-function XOpenDisplay \
--allowlist-function XPending \
--allowlist-function XRootWindowOfScreen \
--allowlist-function XScreenNumberOfScreen \
--allowlist-function XSelectInput \
--allowlist-function XSetWMNormalHints \
--allowlist-function XSetWMProtocols \
--allowlist-function XShmAttach \
--allowlist-function XShmCreateImage \
--allowlist-function XShmDetach \
--allowlist-function XShmGetEventBase \
--allowlist-function XShmPutImage \
--allowlist-function XShmQueryExtension \
--allowlist-var 'XK_.*' \
--allowlist-var ButtonPress \
--allowlist-var ButtonPressMask \
--allowlist-var Button1 \
--allowlist-var Button1Mask \
--allowlist-var ButtonRelease \
--allowlist-var ButtonReleaseMask \
--allowlist-var ClientMessage \
--allowlist-var Expose \
--allowlist-var ExposureMask \
--allowlist-var KeyPress \
--allowlist-var KeyPressMask \
--allowlist-var KeyRelease \
--allowlist-var KeyReleaseMask \
--allowlist-var MotionNotify \
--allowlist-var PMaxSize \
--allowlist-var PMinSize \
--allowlist-var PointerMotionMask \
--allowlist-var ShmCompletion \
--allowlist-var VisualBlueMaskMask \
--allowlist-var VisualDepthMask \
--allowlist-var VisualGreenMaskMask \
--allowlist-var VisualRedMaskMask \
--allowlist-var VisualScreenMask \
--allowlist-var ZPixmap \
--allowlist-type Display \
--allowlist-type GC \
--allowlist-type Screen \
--allowlist-type XShmCompletionEvent \
--allowlist-type ShmSeg \
--allowlist-type Visual \
--allowlist-type Window \
--allowlist-type XVisualInfo \
xlib_wrapper.h >>xlib.rs

View file

@ -7,7 +7,7 @@
* From chromeos-linux v4.19 include/uapi/linux/elf.h
* $ bindgen \
* --no-layout-tests --with-derive-default \
* --whitelist-type Elf64_Ehdr --whitelist-type Elf64_Phdr --whitelist-var .+ \
* --allowlist-type Elf64_Ehdr --allowlist-type Elf64_Phdr --allowlist-var .+ \
* include/uapi/linux/elf.h
*/

View file

@ -16,7 +16,7 @@ generated with the command:
cd ${CHROMEOS_DIR}/src/platform2 && \
bindgen arc/vm/libvda/libvda_common.h \
-o ../platform/crosvm/libvda/src/common/bindings.rs \
--whitelist-type "video_.*"
--allowlist-type "video_.*"
*/
pub type __int32_t = ::std::os::raw::c_int;

View file

@ -17,14 +17,14 @@ cd ${CHROMEOS_DIR}/src/platform2/ && \
bindgen arc/vm/libvda/libvda_decode.h \
-o ../platform/crosvm/libvda/src/decode/bindings.rs \
--raw-line 'pub use crate::bindings::*;' \
--whitelist-function "initialize" \
--whitelist-function "deinitialize" \
--whitelist-function "get_vda_capabilities" \
--whitelist-function "init_decode_session" \
--whitelist-function "close_decode_session" \
--whitelist-function "vda_.*" \
--whitelist-type "vda_.*" \
--blacklist-type "video_.*" \
--allowlist-function "initialize" \
--allowlist-function "deinitialize" \
--allowlist-function "get_vda_capabilities" \
--allowlist-function "init_decode_session" \
--allowlist-function "close_decode_session" \
--allowlist-function "vda_.*" \
--allowlist-type "vda_.*" \
--blocklist-type "video_.*" \
-- \
-I .
*/

View file

@ -10,14 +10,14 @@ cd ${CHROMEOS_DIR}/src/platform2/ && \
bindgen arc/vm/libvda/libvda_encode.h \
-o ../platform/crosvm/libvda/src/encode/bindings.rs \
--raw-line 'pub use crate::bindings::*;' \
--whitelist-function "initialize_encode" \
--whitelist-function "deinitialize_encode" \
--whitelist-function "get_vea_capabilities" \
--whitelist-function "init_encode_session" \
--whitelist-function "close_encode_session" \
--whitelist-function "vea_.*" \
--whitelist-type "vea_.*" \
--blacklist-type "video_.*" \
--allowlist-function "initialize_encode" \
--allowlist-function "deinitialize_encode" \
--allowlist-function "get_vea_capabilities" \
--allowlist-function "init_encode_session" \
--allowlist-function "close_encode_session" \
--allowlist-function "vea_.*" \
--allowlist-type "vea_.*" \
--blocklist-type "video_.*" \
-- \
-I .
*/

View file

@ -26,14 +26,14 @@ END_COLOR = '\033[0m'
verbose = False
def generate_module(module_name, whitelist, header, clang_args, lib_name,
def generate_module(module_name, allowlist, header, clang_args, lib_name,
derive_default):
args = [
'bindgen',
'--no-layout-tests',
'--whitelist-function', whitelist,
'--whitelist-var', whitelist,
'--whitelist-type', whitelist,
'--allowlist-function', allowlist,
'--allowlist-var', allowlist,
'--allowlist-type', allowlist,
'--no-prepend-enum-name',
'--no-rustfmt-bindings',
'-o', module_name + '_bindings.rs',

View file

@ -28,7 +28,7 @@ pub struct VirglBox {
* automatically generated by rust-bindgen
* $ bindgen /usr/include/stdio.h \
* --no-layout-tests \
* --whitelist-function vsnprintf \
* --allowlist-function vsnprintf \
* -o vsnprintf.rs
*/

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generated with bindgen --whitelist-function='gbm_.*' --whitelist-type='gbm_.*' minigbm/gbm.h
// Generated with bindgen --allowlist-function='gbm_.*' --allowlist-type='gbm_.*' minigbm/gbm.h
// Then modified manually
#![cfg(feature = "minigbm")]

View file

@ -7,7 +7,7 @@
* From chromeos-linux v4.19
* $ bindgen \
* --no-layout-tests --with-derive-default --no-doc-comments \
* --whitelist-type boot_params --whitelist-type setup_data \
* --allowlist-type boot_params --allowlist-type setup_data \
* arch/x86/include/uapi/asm/bootparam.h
*/