From d00c599e39ae45ec7c8e12e6bac6b5e58f08f817 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 24 Aug 2012 15:13:34 -0400 Subject: [PATCH] Librarify filter in liblttng-ctl and hide symbols Create the libfilter.la inside the liblttng-ctl directory so we can statically link with lttng-ctl and the tests. Also hide the dynamic symbol of libfilter used in liblttng-ctl. Signed-off-by: David Goulet --- .gitignore | 10 +++---- configure.ac | 1 + src/lib/lttng-ctl/Makefile.am | 27 ++++--------------- src/lib/lttng-ctl/filter/Makefile.am | 24 +++++++++++++++++ src/lib/lttng-ctl/{ => filter}/align.h | 0 src/lib/lttng-ctl/{ => filter}/bug.h | 0 src/lib/lttng-ctl/{ => filter}/filter-ast.h | 0 .../lttng-ctl/{ => filter}/filter-bytecode.h | 3 ++- .../{ => filter}/filter-grammar-test.c | 0 src/lib/lttng-ctl/{ => filter}/filter-ir.h | 0 src/lib/lttng-ctl/{ => filter}/filter-lexer.l | 0 .../lttng-ctl/{ => filter}/filter-parser.y | 4 +++ .../filter-visitor-generate-bytecode.c | 2 ++ .../{ => filter}/filter-visitor-generate-ir.c | 3 ++- ...ilter-visitor-ir-check-binary-comparator.c | 0 ...ilter-visitor-ir-check-binary-op-nesting.c | 1 + .../{ => filter}/filter-visitor-set-parent.c | 1 + .../{ => filter}/filter-visitor-xml.c | 1 + src/lib/lttng-ctl/{ => filter}/memstream.h | 0 src/lib/lttng-ctl/{ => filter}/tests.txt | 0 src/lib/lttng-ctl/lttng-ctl.c | 12 ++++----- 21 files changed, 54 insertions(+), 35 deletions(-) create mode 100644 src/lib/lttng-ctl/filter/Makefile.am rename src/lib/lttng-ctl/{ => filter}/align.h (100%) rename src/lib/lttng-ctl/{ => filter}/bug.h (100%) rename src/lib/lttng-ctl/{ => filter}/filter-ast.h (100%) rename src/lib/lttng-ctl/{ => filter}/filter-bytecode.h (98%) rename src/lib/lttng-ctl/{ => filter}/filter-grammar-test.c (100%) rename src/lib/lttng-ctl/{ => filter}/filter-ir.h (100%) rename src/lib/lttng-ctl/{ => filter}/filter-lexer.l (100%) rename src/lib/lttng-ctl/{ => filter}/filter-parser.y (98%) rename src/lib/lttng-ctl/{ => filter}/filter-visitor-generate-bytecode.c (99%) rename src/lib/lttng-ctl/{ => filter}/filter-visitor-generate-ir.c (99%) rename src/lib/lttng-ctl/{ => filter}/filter-visitor-ir-check-binary-comparator.c (100%) rename src/lib/lttng-ctl/{ => filter}/filter-visitor-ir-check-binary-op-nesting.c (98%) rename src/lib/lttng-ctl/{ => filter}/filter-visitor-set-parent.c (99%) rename src/lib/lttng-ctl/{ => filter}/filter-visitor-xml.c (99%) rename src/lib/lttng-ctl/{ => filter}/memstream.h (100%) rename src/lib/lttng-ctl/{ => filter}/tests.txt (100%) diff --git a/.gitignore b/.gitignore index 6d04272c4..2c1df01ac 100644 --- a/.gitignore +++ b/.gitignore @@ -36,11 +36,11 @@ src/bin/lttng/lttng src/bin/lttng-consumerd/lttng-consumerd src/bin/lttng-relayd/lttng-relayd -src/lib/lttng-ctl/filter-grammar-test -src/lib/lttng-ctl/filter-lexer.c -src/lib/lttng-ctl/filter-parser.c -src/lib/lttng-ctl/filter-parser.h -src/lib/lttng-ctl/filter-parser.output +src/lib/lttng-ctl/filter/filter-grammar-test +src/lib/lttng-ctl/filter/filter-lexer.c +src/lib/lttng-ctl/filter/filter-parser.c +src/lib/lttng-ctl/filter/filter-parser.h +src/lib/lttng-ctl/filter/filter-parser.output # Tests test_sessions diff --git a/configure.ac b/configure.ac index 94f571be3..1603d569a 100644 --- a/configure.ac +++ b/configure.ac @@ -237,6 +237,7 @@ AC_CONFIG_FILES([ src/common/relayd/Makefile src/lib/Makefile src/lib/lttng-ctl/Makefile + src/lib/lttng-ctl/filter/Makefile src/bin/Makefile src/bin/lttng-consumerd/Makefile src/bin/lttng-sessiond/Makefile diff --git a/src/lib/lttng-ctl/Makefile.am b/src/lib/lttng-ctl/Makefile.am index e00a88026..f1b4b500c 100644 --- a/src/lib/lttng-ctl/Makefile.am +++ b/src/lib/lttng-ctl/Makefile.am @@ -1,28 +1,11 @@ -lib_LTLIBRARIES = liblttng-ctl.la -noinst_PROGRAMS = filter-grammar-test - -BUILT_SOURCES = filter-parser.h -AM_YFLAGS = -t -d -v +SUBDIRS = filter -noinst_HEADERS = filter-ast.h -liblttng_ctl_la_SOURCES = lttng-ctl.c \ - filter-lexer.l filter-parser.y \ - filter-visitor-set-parent.c \ - filter-visitor-xml.c \ - filter-visitor-generate-ir.c \ - filter-visitor-ir-check-binary-op-nesting.c \ - filter-visitor-generate-bytecode.c \ - align.h \ - bug.h \ - filter-ast.h \ - filter-bytecode.h \ - filter-ir.h \ - memstream.h +lib_LTLIBRARIES = liblttng-ctl.la -filter_grammar_test_SOURCES = filter-grammar-test.c -filter_grammar_test_LDADD = liblttng-ctl.la +liblttng_ctl_la_SOURCES = lttng-ctl.c liblttng_ctl_la_LIBADD = \ $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \ $(top_builddir)/src/common/libcommon.la \ - $(top_builddir)/src/common/hashtable/libhashtable.la + $(top_builddir)/src/common/hashtable/libhashtable.la \ + $(top_builddir)/src/lib/lttng-ctl/filter/libfilter.la diff --git a/src/lib/lttng-ctl/filter/Makefile.am b/src/lib/lttng-ctl/filter/Makefile.am new file mode 100644 index 000000000..45ed418eb --- /dev/null +++ b/src/lib/lttng-ctl/filter/Makefile.am @@ -0,0 +1,24 @@ +noinst_PROGRAMS = filter-grammar-test +noinst_LTLIBRARIES = libfilter.la +noinst_HEADERS = filter-ast.h + +BUILT_SOURCES = filter-parser.h +AM_YFLAGS = -t -d -v + +libfilter_la_SOURCES = filter-lexer.l filter-parser.y \ + filter-visitor-set-parent.c \ + filter-visitor-xml.c \ + filter-visitor-generate-ir.c \ + filter-visitor-ir-check-binary-op-nesting.c \ + filter-visitor-generate-bytecode.c \ + align.h \ + bug.h \ + filter-ast.h \ + filter-bytecode.h \ + filter-ir.h \ + memstream.h + +filter_grammar_test_SOURCES = filter-grammar-test.c +filter_grammar_test_LDADD = libfilter.la + +CLEANFILES = filter-lexer.c filter-parser.c filter-parser.h filter-parser.output diff --git a/src/lib/lttng-ctl/align.h b/src/lib/lttng-ctl/filter/align.h similarity index 100% rename from src/lib/lttng-ctl/align.h rename to src/lib/lttng-ctl/filter/align.h diff --git a/src/lib/lttng-ctl/bug.h b/src/lib/lttng-ctl/filter/bug.h similarity index 100% rename from src/lib/lttng-ctl/bug.h rename to src/lib/lttng-ctl/filter/bug.h diff --git a/src/lib/lttng-ctl/filter-ast.h b/src/lib/lttng-ctl/filter/filter-ast.h similarity index 100% rename from src/lib/lttng-ctl/filter-ast.h rename to src/lib/lttng-ctl/filter/filter-ast.h diff --git a/src/lib/lttng-ctl/filter-bytecode.h b/src/lib/lttng-ctl/filter/filter-bytecode.h similarity index 98% rename from src/lib/lttng-ctl/filter-bytecode.h rename to src/lib/lttng-ctl/filter/filter-bytecode.h index 7c76e3286..5d2559dd6 100644 --- a/src/lib/lttng-ctl/filter-bytecode.h +++ b/src/lib/lttng-ctl/filter/filter-bytecode.h @@ -22,8 +22,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "filter-ast.h" -#include "../../common/sessiond-comm/sessiond-comm.h" /* * offsets are absolute from start of bytecode. diff --git a/src/lib/lttng-ctl/filter-grammar-test.c b/src/lib/lttng-ctl/filter/filter-grammar-test.c similarity index 100% rename from src/lib/lttng-ctl/filter-grammar-test.c rename to src/lib/lttng-ctl/filter/filter-grammar-test.c diff --git a/src/lib/lttng-ctl/filter-ir.h b/src/lib/lttng-ctl/filter/filter-ir.h similarity index 100% rename from src/lib/lttng-ctl/filter-ir.h rename to src/lib/lttng-ctl/filter/filter-ir.h diff --git a/src/lib/lttng-ctl/filter-lexer.l b/src/lib/lttng-ctl/filter/filter-lexer.l similarity index 100% rename from src/lib/lttng-ctl/filter-lexer.l rename to src/lib/lttng-ctl/filter/filter-lexer.l diff --git a/src/lib/lttng-ctl/filter-parser.y b/src/lib/lttng-ctl/filter/filter-parser.y similarity index 98% rename from src/lib/lttng-ctl/filter-parser.y rename to src/lib/lttng-ctl/filter/filter-parser.y index d3be4be5b..3b77528a6 100644 --- a/src/lib/lttng-ctl/filter-parser.y +++ b/src/lib/lttng-ctl/filter/filter-parser.y @@ -34,6 +34,7 @@ __attribute__((visibility("hidden"))) int yydebug; +__attribute__((visibility("hidden"))) int filter_parser_debug = 0; __attribute__((visibility("hidden"))) @@ -231,11 +232,13 @@ static void filter_ast_free(struct filter_ast *ast) free(node); } +__attribute__((visibility("hidden"))) int filter_parser_ctx_append_ast(struct filter_parser_ctx *parser_ctx) { return yyparse(parser_ctx); } +__attribute__((visibility("hidden"))) struct filter_parser_ctx *filter_parser_ctx_alloc(FILE *input) { struct filter_parser_ctx *parser_ctx; @@ -277,6 +280,7 @@ cleanup_parser_ctx: return NULL; } +__attribute__((visibility("hidden"))) void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx) { int ret; diff --git a/src/lib/lttng-ctl/filter-visitor-generate-bytecode.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c similarity index 99% rename from src/lib/lttng-ctl/filter-visitor-generate-bytecode.c rename to src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c index 9877a86f9..36d35c558 100644 --- a/src/lib/lttng-ctl/filter-visitor-generate-bytecode.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c @@ -447,6 +447,7 @@ int recursive_visit_gen_bytecode(struct filter_parser_ctx *ctx, } } +__attribute__((visibility("hidden"))) void filter_bytecode_free(struct filter_parser_ctx *ctx) { free(ctx->bytecode); @@ -455,6 +456,7 @@ void filter_bytecode_free(struct filter_parser_ctx *ctx) ctx->bytecode_reloc = NULL; } +__attribute__((visibility("hidden"))) int filter_visitor_bytecode_generate(struct filter_parser_ctx *ctx) { int ret; diff --git a/src/lib/lttng-ctl/filter-visitor-generate-ir.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c similarity index 99% rename from src/lib/lttng-ctl/filter-visitor-generate-ir.c rename to src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c index d23372f4b..eec78fcae 100644 --- a/src/lib/lttng-ctl/filter-visitor-generate-ir.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c @@ -753,13 +753,14 @@ struct ir_op *generate_ir_recursive(struct filter_parser_ctx *ctx, return 0; } - +__attribute__((visibility("hidden"))) void filter_ir_free(struct filter_parser_ctx *ctx) { filter_free_ir_recursive(ctx->ir_root); ctx->ir_root = NULL; } +__attribute__((visibility("hidden"))) int filter_visitor_ir_generate(struct filter_parser_ctx *ctx) { struct ir_op *op; diff --git a/src/lib/lttng-ctl/filter-visitor-ir-check-binary-comparator.c b/src/lib/lttng-ctl/filter/filter-visitor-ir-check-binary-comparator.c similarity index 100% rename from src/lib/lttng-ctl/filter-visitor-ir-check-binary-comparator.c rename to src/lib/lttng-ctl/filter/filter-visitor-ir-check-binary-comparator.c diff --git a/src/lib/lttng-ctl/filter-visitor-ir-check-binary-op-nesting.c b/src/lib/lttng-ctl/filter/filter-visitor-ir-check-binary-op-nesting.c similarity index 98% rename from src/lib/lttng-ctl/filter-visitor-ir-check-binary-op-nesting.c rename to src/lib/lttng-ctl/filter/filter-visitor-ir-check-binary-op-nesting.c index 08488deff..bb9fd12e3 100644 --- a/src/lib/lttng-ctl/filter-visitor-ir-check-binary-op-nesting.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-ir-check-binary-op-nesting.c @@ -76,6 +76,7 @@ int check_bin_op_nesting_recursive(struct ir_op *node, int nesting) } } +__attribute__((visibility("hidden"))) int filter_visitor_ir_check_binary_op_nesting(struct filter_parser_ctx *ctx) { return check_bin_op_nesting_recursive(ctx->ir_root, 0); diff --git a/src/lib/lttng-ctl/filter-visitor-set-parent.c b/src/lib/lttng-ctl/filter/filter-visitor-set-parent.c similarity index 99% rename from src/lib/lttng-ctl/filter-visitor-set-parent.c rename to src/lib/lttng-ctl/filter/filter-visitor-set-parent.c index 2ad707f6d..fd895f6f1 100644 --- a/src/lib/lttng-ctl/filter-visitor-set-parent.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-set-parent.c @@ -133,6 +133,7 @@ int recursive_visit_set_parent(struct filter_node *node, return 0; } +__attribute__((visibility("hidden"))) int filter_visitor_set_parent(struct filter_parser_ctx *ctx) { return recursive_visit_set_parent(&ctx->ast->root, NULL); diff --git a/src/lib/lttng-ctl/filter-visitor-xml.c b/src/lib/lttng-ctl/filter/filter-visitor-xml.c similarity index 99% rename from src/lib/lttng-ctl/filter-visitor-xml.c rename to src/lib/lttng-ctl/filter/filter-visitor-xml.c index b3a1ac959..90a336dd9 100644 --- a/src/lib/lttng-ctl/filter-visitor-xml.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-xml.c @@ -246,6 +246,7 @@ int recursive_visit_print(struct filter_node *node, FILE *stream, int indent) return 0; } +__attribute__((visibility("hidden"))) int filter_visitor_print_xml(struct filter_parser_ctx *ctx, FILE *stream, int indent) { diff --git a/src/lib/lttng-ctl/memstream.h b/src/lib/lttng-ctl/filter/memstream.h similarity index 100% rename from src/lib/lttng-ctl/memstream.h rename to src/lib/lttng-ctl/filter/memstream.h diff --git a/src/lib/lttng-ctl/tests.txt b/src/lib/lttng-ctl/filter/tests.txt similarity index 100% rename from src/lib/lttng-ctl/tests.txt rename to src/lib/lttng-ctl/filter/tests.txt diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index ef288726a..27d69089f 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -34,17 +34,17 @@ #include #include -#include "filter-ast.h" -#include "filter-parser.h" -#include "filter-bytecode.h" -#include "memstream.h" +#include "filter/filter-ast.h" +#include "filter/filter-parser.h" +#include "filter/filter-bytecode.h" +#include "filter/memstream.h" #ifdef DEBUG -const int print_xml = 1; +static const int print_xml = 1; #define dbg_printf(fmt, args...) \ printf("[debug liblttng-ctl] " fmt, ## args) #else -const int print_xml = 0; +static const int print_xml = 0; #define dbg_printf(fmt, args...) \ do { \ /* do nothing but check printf format */ \ -- 2.34.1