From c618f46222a20019d6f1e3c6ed785725c458d76f Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 24 Oct 2019 00:23:56 +0200 Subject: [PATCH] btrfs-progs: libbtrfs: add list of exported symbols The shared library exports many functions that are not supposed to be public, like rb-tree, crc32c or internal helpers but as this has been potentially in use we should at least make a list. There's only a subset being used by the snapper project. Export majority of current symbols visible in libbtrfs so any future additions to libbtrfs objects are automatically hidden and don't pollute the namespace further. Note that all projects should switch to libbtrfsutil rather than libbtrfs that exists for historical reasons and will be deprecated in the future. Signed-off-by: David Sterba --- Makefile | 8 ++++---- libbtrfs.sym | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 libbtrfs.sym diff --git a/Makefile b/Makefile index 21bf2717..44266821 100644 --- a/Makefile +++ b/Makefile @@ -445,16 +445,16 @@ kernel-lib/tables.c: @echo " [TABLE] $@" $(Q)./mktables > $@ || ($(RM) -f $@ && exit 1) -libbtrfs.so.0.1: $(libbtrfs_objects) +libbtrfs.so.0.1: $(libbtrfs_objects) libbtrfs.sym @echo " [LD] $@" - $(Q)$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBBTRFS_LIBS) \ - -shared -Wl,-soname,libbtrfs.so.0 -o $@ + $(Q)$(CC) $(CFLAGS) $(filter %.o,$^) $(LDFLAGS) $(LIBBTRFS_LIBS) \ + -shared -Wl,-soname,libbtrfs.so.0 -Wl,--version-script=libbtrfs.sym -o $@ libbtrfs.a: $(libbtrfs_objects) @echo " [AR] $@" $(Q)$(AR) cr $@ $^ -libbtrfs.so.0 libbtrfs.so: libbtrfs.so.0.1 +libbtrfs.so.0 libbtrfs.so: libbtrfs.so.0.1 libbtrfs.sym @echo " [LN] $@" $(Q)$(LN_S) -f $< $@ diff --git a/libbtrfs.sym b/libbtrfs.sym new file mode 100644 index 00000000..bbdb007c --- /dev/null +++ b/libbtrfs.sym @@ -0,0 +1,58 @@ +LIBBTRFS_0.1 { +global: + /* ctree.h */ + btrfs_get_subvol; + btrfs_list_get_path_rootid; + btrfs_lookup_uuid_received_subvol_item; + btrfs_lookup_uuid_subvol_item; + + /* btrfs-list.h */ + btrfs_subvolid_resolve; + + /* radix-tree.h */ + radix_tree_delete; + radix_tree_gang_lookup; + radix_tree_gang_lookup_tag; + radix_tree_init; + radix_tree_insert; + radix_tree_lookup; + radix_tree_lookup_slot; + radix_tree_preload; + radix_tree_tag_clear; + radix_tree_tagged; + radix_tree_tag_get; + radix_tree_tag_set; + + /* raid56.h */ + raid56_recov; + raid5_gen_result; + raid6_gen_syndrome; + raid6_recov_data2; + raid6_recov_datap; + + /* rbtree.h */ + rb_erase; + rb_first; + rb_first_postorder; + rb_insert_color; + rb_last; + rb_next; + rb_next_postorder; + rb_prev; + rb_replace_node; + + /* send-stream.h */ + btrfs_read_and_process_send_stream; + + /* send-utils.h */ + subvol_uuid_search; + subvol_uuid_search2; + subvol_uuid_search_add; + subvol_uuid_search_finit; + subvol_uuid_search_init; + btrfs_subvolid_resolve; + path_cat_out; + path_cat3_out; +local: + *; +};