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 <dsterba@suse.com>
master
David Sterba 2019-10-24 00:23:56 +02:00
parent de7856cee5
commit c618f46222
2 changed files with 62 additions and 4 deletions

View File

@ -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 $< $@

58
libbtrfs.sym 100644
View File

@ -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:
*;
};