-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jakub Kicinski <[email protected]>
- Loading branch information
Showing
43 changed files
with
43,891 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
CC=gcc | ||
CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow | ||
ifeq ("$(DEBUG)","1") | ||
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan | ||
endif | ||
|
||
include $(wildcard *.d) | ||
|
||
GEN_SRCS=$(wildcard generated/*.c) | ||
GENERATED=$(patsubst %.c,%.o,${GEN_SRCS}) | ||
|
||
all: ynl.a | ||
|
||
generated: | ||
$(MAKE) -C $@ | ||
|
||
ynl.a: ynl.o generated | ||
@echo -e "\tAR $@" | ||
@ar rcs $@ ynl.o $(GENERATED) | ||
|
||
clean: | ||
rm -f *.o *.d *~ | ||
$(MAKE) -C generated $@ | ||
|
||
distclean: clean | ||
rm -f *.a | ||
|
||
%.o: %.c | ||
@echo -e "\tCC $@" | ||
@$(COMPILE.c) -MMD -c -o $@ $< | ||
|
||
.PHONY: all clean generated | ||
.DEFAULT_GOAL=all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
# Try to include uAPI headers from the kernel uapi/ path. | ||
# Most code under tools/ requires the respective kernel uAPI headers | ||
# to be copied to tools/include. The duplication is annoying. | ||
# All the family headers should be self-contained. We avoid the copying | ||
# by selectively including just the uAPI header of the family directly | ||
# from the kernel sources. | ||
|
||
UAPI_PATH:=../uapi/ | ||
|
||
# scripts/headers_install.sh strips "_UAPI" from header guards so we | ||
# need the explicit -D matching what's in /usr, to avoid multiple definitions. | ||
|
||
get_hdr_inc=-D$(1) -include $(UAPI_PATH)/linux/$(2) | ||
|
||
CFLAGS_devlink:=$(call get_hdr_inc,_LINUX_DEVLINK_H_,devlink.h) | ||
CFLAGS_dpll:=$(call get_hdr_inc,_LINUX_DPLL_H,dpll.h) | ||
CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) | ||
CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h) | ||
CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H,mptcp_pm.h) | ||
CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h) | ||
CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h) | ||
CFLAGS_ovs_datapath:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) | ||
CFLAGS_ovs_flow:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) | ||
CFLAGS_ovs_vport:=$(call get_hdr_inc,__LINUX_OPENVSWITCH_H,openvswitch.h) | ||
CFLAGS_psp:=$(call get_hdr_inc,_LINUX_PSP_H,psp.h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# ynl-c | ||
Standalone copy of generated YNL C lib | ||
|
||
Standalone copy of generated YNL C lib. | ||
|
||
Development happens in the Linux kernel: | ||
|
||
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/tools/net/ynl/ | ||
|
||
This repo contains just the C parts, excluding all Python and | ||
scripts, even the code generator which generated the code. | ||
|
||
Basic intro: | ||
|
||
https://docs.kernel.org/next/userspace-api/netlink/intro-specs.html#ynl-lib | ||
|
||
Using the library | ||
================= | ||
|
||
Building the library generates an archive for static linking called ``ynl.a``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
CC=gcc | ||
CFLAGS=-std=gnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ | ||
-I../ -idirafter $(UAPI_PATH) | ||
ifeq ("$(DEBUG)","1") | ||
CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan | ||
endif | ||
|
||
include ../Makefile.deps | ||
|
||
SRCS=$(wildcard *.c) | ||
HDRS=$(wildcard *.h) | ||
OBJS=$(patsubst %-user.c,%-user.o,${SRCS}) | ||
|
||
all: $(OBJS) | ||
|
||
%-user.o: %-user.c %-user.h | ||
@echo -e "\tCC $@" | ||
@$(COMPILE.c) $(CFLAGS_$*) -o $@ $< | ||
|
||
clean: | ||
rm -f *.o | ||
|
||
.PHONY: all clean | ||
.DEFAULT_GOAL: all |
Oops, something went wrong.