From: Haiyue Wang Date: Sat, 25 Apr 2020 10:56:15 +0000 (+0800) Subject: eal: add internal ABI tag definition X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fba5af82adc8;p=dpdk.git eal: add internal ABI tag definition Introduce the __rte_internal tag to mark internal ABI function which is used only by the drivers or other libraries. Like for __rte_experimental, this tag must be on a separate line before function proprotypes. Signed-off-by: Haiyue Wang --- diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index c30ce64cc1..42b833e0d7 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -111,6 +111,37 @@ check_experimental_tags() { # return $res } +check_internal_tags() { # + res=0 + + cat "$1" |awk ' + BEGIN { + current_file = ""; + ret = 0; + } + /^+++ b\// { + current_file = $2; + } + /^+.*__rte_internal/ { + if (current_file ~ ".c$" ) { + print "Please only put __rte_internal tags in " \ + "headers ("current_file")"; + ret = 1; + } + if ($1 != "+__rte_internal" || $2 != "") { + print "__rte_internal must appear alone on the line" \ + " immediately preceding the return type of" \ + " a function." + ret = 1; + } + } + END { + exit ret; + }' || res=1 + + return $res +} + number=0 range='origin/master..' quiet=false @@ -194,6 +225,14 @@ check () { # ret=1 fi + ! $verbose || printf '\nChecking __rte_internal tags:\n' + report=$(check_internal_tags "$tmpinput") + if [ $? -ne 0 ] ; then + $headline_printed || print_headline "$3" + printf '%s\n' "$report" + ret=1 + fi + if [ "$tmpinput" != "$1" ]; then rm -f "$tmpinput" trap - INT diff --git a/lib/librte_eal/include/rte_compat.h b/lib/librte_eal/include/rte_compat.h index 3eb33784b3..4cd8f68d68 100644 --- a/lib/librte_eal/include/rte_compat.h +++ b/lib/librte_eal/include/rte_compat.h @@ -19,4 +19,17 @@ __attribute__((section(".text.experimental"))) #endif +#ifndef ALLOW_INTERNAL_API + +#define __rte_internal \ +__attribute__((error("Symbol is not public ABI"), \ +section(".text.internal"))) + +#else + +#define __rte_internal \ +__attribute__((section(".text.internal"))) + +#endif + #endif /* _RTE_COMPAT_H_ */