| 1 | |
| 2 | |
| 3 |
|
| 4 | ATOMICDIR=$(dirname $0)
|
| 5 |
|
| 6 | . ${ATOMICDIR}/atomic-tbl.sh
|
| 7 |
|
| 8 | |
| 9 | gen_proto_order_variant()
|
| 10 | {
|
| 11 | local meta="$1"; shift
|
| 12 | local pfx="$1"; shift
|
| 13 | local name="$1"; shift
|
| 14 | local sfx="$1"; shift
|
| 15 | local order="$1"; shift
|
| 16 | local atomic="$1"; shift
|
| 17 | local int="$1"; shift
|
| 18 |
|
| 19 | local atomicname="${atomic}_${pfx}${name}${sfx}${order}"
|
| 20 |
|
| 21 | local ret="$(gen_ret_type "${meta}" "${int}")"
|
| 22 | local params="$(gen_params "${int}" "${atomic}" "$@")"
|
| 23 | local args="$(gen_args "$@")"
|
| 24 | local retstmt="$(gen_ret_stmt "${meta}")"
|
| 25 |
|
| 26 | cat <<EOF
|
| 27 | __rust_helper ${ret}
|
| 28 | rust_helper_${atomicname}(${params})
|
| 29 | {
|
| 30 | ${retstmt}${atomicname}(${args});
|
| 31 | }
|
| 32 |
|
| 33 | EOF
|
| 34 | }
|
| 35 |
|
| 36 | cat << EOF
|
| 37 | // SPDX-License-Identifier: GPL-2.0
|
| 38 |
|
| 39 | // Generated by $0
|
| 40 | // DO NOT MODIFY THIS FILE DIRECTLY
|
| 41 |
|
| 42 | /*
|
| 43 | * This file provides helpers for the various atomic functions for Rust.
|
| 44 | */
|
| 45 | #ifndef _RUST_ATOMIC_API_H
|
| 46 | #define _RUST_ATOMIC_API_H
|
| 47 |
|
| 48 | #include <linux/atomic.h>
|
| 49 |
|
| 50 | EOF
|
| 51 |
|
| 52 | grep '^[a-z]' "$1" | while read name meta args; do
|
| 53 | gen_proto "${meta}" "${name}" "atomic" "int" ${args}
|
| 54 | done
|
| 55 |
|
| 56 | grep '^[a-z]' "$1" | while read name meta args; do
|
| 57 | gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}
|
| 58 | done
|
| 59 |
|
| 60 | cat <<EOF
|
| 61 | #endif /* _RUST_ATOMIC_API_H */
|
| 62 | EOF
|