ovn-northd: Remove info log in extract_lport_addresses().
[cascardo/ovs.git] / datapath / Makefile.am
index eac9582..458fa5b 100644 (file)
@@ -28,4 +28,31 @@ print-build-modules:
           echo "Could not find any kernel module."; \
           exit 1; \
        fi
-       @echo "$(build_modules)" | tr '_' '-';
\ No newline at end of file
+       @echo "$(build_modules)" | tr '_' '-';
+
+COMPAT_GET_FUNCTIONS := find $(top_srcdir)/datapath/linux/compat -name "*.h" \
+       -exec sed -n '/^[a-z][a-z]* \*\?[A-Za-z0-9_][A-Za-z0-9_]*([a-z]/p; /^struct [a-z0-9_][a-z0-9_]* \*\?[A-Za-z0-9_][A-Za-z0-9_]*([a-z]/p' {} \; | tr -d '*' | cut -d '(' -f1 | rev | cut -d ' ' -f1 | rev
+COMPAT_GET_EXPORTS := find $(top_srcdir)/datapath/linux/compat -name "*.c" \
+       -exec sed -n 's/^EXPORT_SYMBOL[A-Z_]*(\([a-z_][a-z_]*\));$$/\1/p' {} \;
+COMPAT_FUNCTIONS := $(shell $(COMPAT_GET_FUNCTIONS))
+COMPAT_EXPORTS := $(shell $(COMPAT_GET_EXPORTS))
+
+# Checks that all public functions are 'rpl_' or 'ovs_' prefixed.
+# Checks that all EXPORT_SYMBOL_GPL() export 'rpl_' or 'ovs_' prefixed functions.
+check-export-symbol:
+       @for fun_ in $(COMPAT_FUNCTIONS); do \
+          if ! grep -- $${fun_} $(top_srcdir)/datapath/linux/compat/build-aux/export-check-whitelist > /dev/null; then \
+             if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \
+                echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \
+                exit 1; \
+             fi; \
+          fi; \
+       done
+       @for fun_ in $(COMPAT_EXPORTS); do \
+          if ! echo $${fun_} | grep -q -E '^(rpl|ovs)_'; then \
+             echo "error: $${fun_}() needs to be prefixed with 'rpl_' or 'ovs_'."; \
+             exit 1; \
+          fi; \
+       done
+
+all-local: check-export-symbol