Skip to contentSkip to conversation

btrfs-progs: Use shared kernel btrfs_tree.h

PATCH Superseded Qu Wenruo 2 participants 2 messages Apr 7, 2020 – Apr 14, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 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.

---
 Makefile                   |   3 +-
 ctree.h                    | 699 +-------------------------
 kernel-shared/btrfs_tree.h | 991 +++++++++++++++++++++++++++++++++++++
 3 files changed, 1011 insertions(+), 682 deletions(-)
 create mode 100644 kernel-shared/btrfs_tree.h
Makefile +2 -1
index 02f3931bf229..a2470cc4a985 100644
@@ -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 -681

812 lines not on this page · raw message

kernel-shared/btrfs_tree.h new file +991 -0

991 lines not on this page · raw message

Signature · 1 line
2.26.0
#1 lore raw
Quoted 7 lines · Qu Wenruo

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

btrfs_tree.h

Quoted 1 line

only modification is to remove the existing headers.

As this is supposed to be copy of the kernel file, the progs patch should use the final version once it's done.

kernel-shared/btrfs_tree.h line 3

Quoted 12 lines

---

kernel-shared/btrfs_tree.h new file +3 -0
new file mode 100644
index 000000000000..c595d3c78a8e
@@ -0,0 +1,991 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _BTRFS_CTREE_H_
+#define _BTRFS_CTREE_H_

The define should roughly match the file name, _BTRFS_CTREE_H_ is too close to __BTRFS_CTREE_H__ that's in ctree.h

Quoted 6 lines
kernel-shared/btrfs_tree.h new file +6 -0
+
+/*
+ * Cross-ported from kernel/include/uapi/linux/btrfs_tree.h.
+ *
+ * With include files removed.
+ */