blob: 98a70c10de1637f7c6e0b45370de571eaafdd00d [file] [log] [blame]
#!/usr/bin/env bash
#
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -euo pipefail
readonly target_file="$FUCHSIA_DIR/src/connectivity/lib/ethernet/src/ethernet_sys.rs"
readonly source_file="$FUCHSIA_DIR/zircon/system/public/zircon/device/ethernet.h"
readonly copyright_line=$(grep -E "^// Copyright [0-9]+" "${source_file}" || \
echo "// Copyright $(date +%Y) The Fuchsia Authors. All rights reserved.")
readonly RAW_LINES="${copyright_line}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Generated by src/connectivity/lib/ethernet/scripts/bindgen.sh
"
bindgen \
--raw-line "${RAW_LINES}" \
--no-layout-tests \
--whitelist-type 'eth_fifo_entry' \
--whitelist-var 'ETH_FIFO_.+' \
"${source_file}" | \
grep -vF 'pub type __uint' > "${target_file}"