This commit adds check in Makefile to make sure that all public functions
in linux/compat/linux/ are all exported.

Signed-off-by: Alex Wang <[email protected]>
---
 datapath/Makefile.am |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/datapath/Makefile.am b/datapath/Makefile.am
index eac9582..4344e87 100644
--- a/datapath/Makefile.am
+++ b/datapath/Makefile.am
@@ -28,4 +28,18 @@ 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_CHECK_CMD := sed -n '/^[a-z][a-z]* \*\?[a-z0-9_][a-z0-9_]*([a-z]/p; 
/^struct [a-z0-9_][a-z0-9_]* \*\?[a-z0-9_][a-z0-9_]*([a-z]/p' 
$(top_srcdir)/datapath/linux/compat/include/linux/*.h | tr -d '*' | cut -d '(' 
-f1 | rev | cut -d ' ' -f1 | rev
+COMPAT_FUNCTIONS := $(shell $(COMPAT_CHECK_CMD))
+
+# Checks for exporting function symbols.
+check-export-symbols:
+       @for fun_ in $(COMPAT_FUNCTIONS); do \
+          if ! grep -- $${fun_} $(top_srcdir)/datapath/linux/compat/*.c | grep 
-- EXPORT_SYMBOL > /dev/null; then \
+             echo "Should export $${fun_}."; \
+             exit 1; \
+          fi \
+       done
+
+all-local: check-export-symbols
\ No newline at end of file
-- 
1.7.9.5

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to