Commit be5bea1c authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Paolo Abeni

net: add basic C code generators for Netlink

Code generators to turn Netlink specs into C code.
I'm definitely not proud of it.

The main generator is in Python, there's a bash script
to regen all code-gen'ed files in tree after making
spec changes.
Acked-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent e616c07c
...@@ -14577,6 +14577,7 @@ F: include/uapi/linux/netdevice.h ...@@ -14577,6 +14577,7 @@ F: include/uapi/linux/netdevice.h
F: lib/net_utils.c F: lib/net_utils.c
F: lib/random32.c F: lib/random32.c
F: net/ F: net/
F: tools/net/
F: tools/testing/selftests/net/ F: tools/testing/selftests/net/
NETWORKING [IPSEC] NETWORKING [IPSEC]
......
This diff is collapsed.
#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause
TOOL=$(dirname $(realpath $0))/ynl-gen-c.py
force=
while [ ! -z "$1" ]; do
case "$1" in
-f ) force=yes; shift ;;
* ) echo "Unrecognized option '$1'"; exit 1 ;;
esac
done
KDIR=$(dirname $(dirname $(dirname $(dirname $(realpath $0)))))
files=$(git grep --files-with-matches '^/\* YNL-GEN \(kernel\|uapi\)')
for f in $files; do
# params: 0 1 2 3
# $YAML YNL-GEN kernel $mode
params=( $(git grep -B1 -h '/\* YNL-GEN' $f | sed 's@/\*\(.*\)\*/@\1@') )
if [ $f -nt ${params[0]} -a -z "$force" ]; then
echo -e "\tSKIP $f"
continue
fi
echo -e "\tGEN ${params[2]}\t$f"
$TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} -o $f
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment