~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/atomic/gen-atomic-long.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/atomic/gen-atomic-long.sh (Architecture sparc) and /scripts/atomic/gen-atomic-long.sh (Architecture mips)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3                                                     3 
  4 ATOMICDIR=$(dirname $0)                             4 ATOMICDIR=$(dirname $0)
  5                                                     5 
  6 . ${ATOMICDIR}/atomic-tbl.sh                        6 . ${ATOMICDIR}/atomic-tbl.sh
  7                                                     7 
  8 #gen_cast(arg, int, atomic)                         8 #gen_cast(arg, int, atomic)
  9 gen_cast()                                          9 gen_cast()
 10 {                                                  10 {
 11         local arg="$1"; shift                      11         local arg="$1"; shift
 12         local int="$1"; shift                      12         local int="$1"; shift
 13         local atomic="$1"; shift                   13         local atomic="$1"; shift
 14                                                    14 
 15         [ "${arg%%:*}" = "p" ] || return           15         [ "${arg%%:*}" = "p" ] || return
 16                                                    16 
 17         printf "($(gen_param_type "${arg}" "${     17         printf "($(gen_param_type "${arg}" "${int}" "${atomic}"))"
 18 }                                                  18 }
 19                                                    19 
 20 #gen_args_cast(int, atomic, arg...)                20 #gen_args_cast(int, atomic, arg...)
 21 gen_args_cast()                                    21 gen_args_cast()
 22 {                                                  22 {
 23         local int="$1"; shift                      23         local int="$1"; shift
 24         local atomic="$1"; shift                   24         local atomic="$1"; shift
 25                                                    25 
 26         while [ "$#" -gt 0 ]; do                   26         while [ "$#" -gt 0 ]; do
 27                 local cast="$(gen_cast "$1" "$     27                 local cast="$(gen_cast "$1" "${int}" "${atomic}")"
 28                 local arg="$(gen_param_name "$     28                 local arg="$(gen_param_name "$1")"
 29                 printf "${cast}${arg}"             29                 printf "${cast}${arg}"
 30                 [ "$#" -gt 1 ] && printf ", "      30                 [ "$#" -gt 1 ] && printf ", "
 31                 shift;                             31                 shift;
 32         done                                       32         done
 33 }                                                  33 }
 34                                                    34 
 35 #gen_proto_order_variant(meta, pfx, name, sfx,     35 #gen_proto_order_variant(meta, pfx, name, sfx, order, arg...)
 36 gen_proto_order_variant()                          36 gen_proto_order_variant()
 37 {                                                  37 {
 38         local meta="$1"; shift                     38         local meta="$1"; shift
 39         local pfx="$1"; shift                      39         local pfx="$1"; shift
 40         local name="$1"; shift                     40         local name="$1"; shift
 41         local sfx="$1"; shift                      41         local sfx="$1"; shift
 42         local order="$1"; shift                    42         local order="$1"; shift
 43                                                    43 
 44         local atomicname="${pfx}${name}${sfx}$     44         local atomicname="${pfx}${name}${sfx}${order}"
 45                                                    45 
 46         local ret="$(gen_ret_type "${meta}" "l     46         local ret="$(gen_ret_type "${meta}" "long")"
 47         local params="$(gen_params "long" "ato     47         local params="$(gen_params "long" "atomic_long" "$@")"
 48         local argscast_32="$(gen_args_cast "in     48         local argscast_32="$(gen_args_cast "int" "atomic" "$@")"
 49         local argscast_64="$(gen_args_cast "s6     49         local argscast_64="$(gen_args_cast "s64" "atomic64" "$@")"
 50         local retstmt="$(gen_ret_stmt "${meta}     50         local retstmt="$(gen_ret_stmt "${meta}")"
 51                                                    51 
 52         gen_kerneldoc "raw_" "${meta}" "${pfx}     52         gen_kerneldoc "raw_" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "atomic_long" "long" "$@"
 53                                                    53 
 54 cat <<EOF                                          54 cat <<EOF
 55 static __always_inline ${ret}                      55 static __always_inline ${ret}
 56 raw_atomic_long_${atomicname}(${params})           56 raw_atomic_long_${atomicname}(${params})
 57 {                                                  57 {
 58 #ifdef CONFIG_64BIT                                58 #ifdef CONFIG_64BIT
 59         ${retstmt}raw_atomic64_${atomicname}($     59         ${retstmt}raw_atomic64_${atomicname}(${argscast_64});
 60 #else                                              60 #else
 61         ${retstmt}raw_atomic_${atomicname}(${a     61         ${retstmt}raw_atomic_${atomicname}(${argscast_32});
 62 #endif                                             62 #endif
 63 }                                                  63 }
 64                                                    64 
 65 EOF                                                65 EOF
 66 }                                                  66 }
 67                                                    67 
 68 cat << EOF                                         68 cat << EOF
 69 // SPDX-License-Identifier: GPL-2.0                69 // SPDX-License-Identifier: GPL-2.0
 70                                                    70 
 71 // Generated by $0                                 71 // Generated by $0
 72 // DO NOT MODIFY THIS FILE DIRECTLY                72 // DO NOT MODIFY THIS FILE DIRECTLY
 73                                                    73 
 74 #ifndef _LINUX_ATOMIC_LONG_H                       74 #ifndef _LINUX_ATOMIC_LONG_H
 75 #define _LINUX_ATOMIC_LONG_H                       75 #define _LINUX_ATOMIC_LONG_H
 76                                                    76 
 77 #include <linux/compiler.h>                        77 #include <linux/compiler.h>
 78 #include <asm/types.h>                             78 #include <asm/types.h>
 79                                                    79 
 80 #ifdef CONFIG_64BIT                                80 #ifdef CONFIG_64BIT
 81 typedef atomic64_t atomic_long_t;                  81 typedef atomic64_t atomic_long_t;
 82 #define ATOMIC_LONG_INIT(i)             ATOMIC     82 #define ATOMIC_LONG_INIT(i)             ATOMIC64_INIT(i)
 83 #define atomic_long_cond_read_acquire   atomic     83 #define atomic_long_cond_read_acquire   atomic64_cond_read_acquire
 84 #define atomic_long_cond_read_relaxed   atomic     84 #define atomic_long_cond_read_relaxed   atomic64_cond_read_relaxed
 85 #else                                              85 #else
 86 typedef atomic_t atomic_long_t;                    86 typedef atomic_t atomic_long_t;
 87 #define ATOMIC_LONG_INIT(i)             ATOMIC     87 #define ATOMIC_LONG_INIT(i)             ATOMIC_INIT(i)
 88 #define atomic_long_cond_read_acquire   atomic     88 #define atomic_long_cond_read_acquire   atomic_cond_read_acquire
 89 #define atomic_long_cond_read_relaxed   atomic     89 #define atomic_long_cond_read_relaxed   atomic_cond_read_relaxed
 90 #endif                                             90 #endif
 91                                                    91 
 92 EOF                                                92 EOF
 93                                                    93 
 94 grep '^[a-z]' "$1" | while read name meta args     94 grep '^[a-z]' "$1" | while read name meta args; do
 95         gen_proto "${meta}" "${name}" ${args}      95         gen_proto "${meta}" "${name}" ${args}
 96 done                                               96 done
 97                                                    97 
 98 cat <<EOF                                          98 cat <<EOF
 99 #endif /* _LINUX_ATOMIC_LONG_H */                  99 #endif /* _LINUX_ATOMIC_LONG_H */
100 EOF                                               100 EOF
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php