libbtrfs: use stub for list_head and drop list.h

The list_head is used in struct definitions but otherwise not at all as
it was copied from kernel code. For ctree.h add stub definition that
won't change the containing structure size.

Drop list.h from libbtrfs. This may break some builds if they used the
header, though this was never meant to be exported.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-08-06 14:39:07 +02:00
parent 2f297355c9
commit 674b50c719
3 changed files with 19 additions and 15 deletions

View File

@ -270,7 +270,7 @@ libbtrfs_objects = \
libbtrfs/crc32c.o
libbtrfs_headers = libbtrfs/send-stream.h libbtrfs/send-utils.h libbtrfs/send.h kernel-lib/rbtree.h \
kernel-lib/list.h kernel-lib/rbtree_types.h libbtrfs/kerncompat.h \
kernel-lib/rbtree_types.h libbtrfs/kerncompat.h \
libbtrfs/ioctl.h libbtrfs/ctree.h libbtrfs/version.h
libbtrfs_version = $(LIBBTRFS_MAJOR).$(LIBBTRFS_MINOR).$(LIBBTRFS_PATCHLEVEL)

View File

@ -23,16 +23,22 @@
#if BTRFS_FLAT_INCLUDES
#include "libbtrfs/kerncompat.h"
#include "kernel-lib/list.h"
#include "kernel-lib/rbtree.h"
#include "libbtrfs/ioctl.h"
#else
#include <btrfs/kerncompat.h>
#include <btrfs/list.h>
#include <btrfs/rbtree.h>
#include <btrfs/ioctl.h>
#endif /* BTRFS_FLAT_INCLUDES */
/*
* Stub definition used only for struct declarations, change the name so it
* does not clash with a real struct list_head if included.
*/
struct list_head_ {
struct list_head_ *next, *prev;
};
struct btrfs_root;
struct btrfs_trans_handle;
struct btrfs_free_space_ctl;
@ -224,7 +230,7 @@ struct cache_extent {
struct extent_io_tree {
struct cache_tree state;
struct cache_tree cache;
struct list_head lru;
struct list_head_ lru;
u64 cache_size;
u64 max_cache_size;
};
@ -241,8 +247,8 @@ struct extent_state {
struct extent_buffer {
struct cache_extent cache_node;
u64 start;
struct list_head lru;
struct list_head recow;
struct list_head_ lru;
struct list_head_ recow;
u32 len;
int refs;
u32 flags;
@ -1193,7 +1199,7 @@ struct btrfs_space_info {
*/
u64 bytes_reserved;
int full;
struct list_head list;
struct list_head_ list;
};
struct btrfs_block_group {
@ -1222,7 +1228,7 @@ struct btrfs_block_group {
struct rb_node cache_node;
/* For dirty block groups */
struct list_head dirty_list;
struct list_head_ dirty_list;
/*
* Allocation offset for the block group to implement sequential
@ -1280,11 +1286,11 @@ struct btrfs_fs_info {
u64 total_pinned;
u64 nr_global_roots;
struct list_head dirty_cowonly_roots;
struct list_head recow_ebs;
struct list_head_ dirty_cowonly_roots;
struct list_head_ recow_ebs;
struct btrfs_fs_devices *fs_devices;
struct list_head space_info;
struct list_head_ space_info;
unsigned int system_allocs:1;
unsigned int readonly:1;
@ -1354,10 +1360,10 @@ struct btrfs_root {
u32 type;
u64 last_inode_alloc;
struct list_head unaligned_extent_recs;
struct list_head_ unaligned_extent_recs;
/* the dirty list is only used by non-reference counted roots */
struct list_head dirty_list;
struct list_head_ dirty_list;
struct rb_node rb_node;
};

View File

@ -21,7 +21,6 @@
#include "libbtrfs/version.h"
#include "libbtrfs/ioctl.h"
#include "kernel-lib/rbtree.h"
#include "kernel-lib/list.h"
#include "kernel-shared/ctree.h"
#include "kernel-shared/send.h"
#include "common/send-stream.h"
@ -34,7 +33,6 @@
#include "btrfs/kerncompat.h"
#include "btrfs/version.h"
#include "btrfs/rbtree.h"
#include "btrfs/list.h"
#include "btrfs/ctree.h"
#include "btrfs/ioctl.h"
#include "btrfs/send.h"