btrfs-progs: Use shared kernel btrfs_tree.h
Subsystems (2)
PATCH v2 1/1 btrfs-progs: Use shared kernel btrfs_tree.h
Unlike kernel, btrfs-progs uses a monolithic ctree.h to define both on-disk data and runtime structures.
This is not good for future development, especially when we need a read-only code basis, for projects like U-boot.
This patch will cross-port the btree_header.h file to btrfs-progs. The only modification is to remove the existing headers.
Signed-off-by Qu Wenruo <[email protected]>
---
Changelog:
v2:
- Use the self-consistent version btrfs_tree.h
This leads to more code sync with kernel.
--- Makefile | 3 +- ctree.h | 940 +------------------------- ioctl.h | 25 +- kernel-shared/btrfs_tree.h | 1314 ++++++++++++++++++++++++++++++++++++ 4 files changed, 1340 insertions(+), 942 deletions(-) create mode 100644 kernel-shared/btrfs_tree.h
Makefile +2 -1
@@ -169,7 +169,8 @@ libbtrfs_objects = send-stream.o send-utils.o kernel-lib/rbtree.o btrfs-list.o \ libbtrfs_headers = send-stream.h send-utils.h send.h kernel-lib/rbtree.h btrfs-list.h \ crypto/crc32c.h kernel-lib/list.h kerncompat.h \ kernel-lib/radix-tree.h kernel-lib/sizes.h kernel-lib/raid56.h \ - extent-cache.h extent_io.h ioctl.h ctree.h btrfsck.h version.h + extent-cache.h extent_io.h ioctl.h ctree.h btrfsck.h version.h \ + kernel-shared/btrfs_tree.h libbtrfsutil_major := $(shell sed -rn 's/^\#define BTRFS_UTIL_VERSION_MAJOR ([0-9])+$$/\1/p' libbtrfsutil/btrfsutil.h) libbtrfsutil_minor := $(shell sed -rn 's/^\#define BTRFS_UTIL_VERSION_MINOR ([0-9])+$$/\1/p' libbtrfsutil/btrfsutil.h) libbtrfsutil_patch := $(shell sed -rn 's/^\#define BTRFS_UTIL_VERSION_PATCH ([0-9])+$$/\1/p' libbtrfsutil/btrfsutil.h)
ctree.h +18 -922
1,050 lines not on this page · raw message
ioctl.h +6 -19
@@ -27,6 +27,12 @@ extern "C" {#include <linux/ioctl.h> #include <stddef.h> +#if BTRFS_FLAT_INCLUDES +#include "kernel-shared/btrfs_tree.h" +#else +#include <btrfs/btrfs_tree.h> +#endif /* BTRFS_FLAT_INCLUDES */ +#ifndef __user#define __user#endif
@@ -522,25 +528,6 @@ struct btrfs_ioctl_logical_ino_args {*/ #define BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET (1ULL << 0) -enum btrfs_dev_stat_values { -/* disk I/O failure stats */ -BTRFS_DEV_STAT_WRITE_ERRS ,/* EIO or EREMOTEIO from lower layers */ -BTRFS_DEV_STAT_READ_ERRS ,/* EIO or EREMOTEIO from lower layers */ -BTRFS_DEV_STAT_FLUSH_ERRS ,/* EIO or EREMOTEIO from lower layers */ - -/* stats for indirect indications for I/O failures */ -BTRFS_DEV_STAT_CORRUPTION_ERRS ,/* checksum error, bytenr error or -* contents is illegal: this is an -* indication that the block was damaged -* during read or write, or written to -* wrong location or read from wrong -* location */ -BTRFS_DEV_STAT_GENERATION_ERRS ,/* an indication that blocks have not -* been written */ - -BTRFS_DEV_STAT_VALUES_MAX -}; -/* Reset statistics after reading; needs SYS_ADMIN capability */ #define BTRFS_DEV_STATS_RESET (1ULL << 0)
kernel-shared/btrfs_tree.h new file +1314 -0
1,314 lines not on this page · raw message
Signature · 1 line
2.26.0