get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/809316/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 809316,
    "url": "http://patchwork.ozlabs.org/api/patches/809316/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170903150031.18179-5-marek.behun@nic.cz/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170903150031.18179-5-marek.behun@nic.cz>",
    "list_archive_url": null,
    "date": "2017-09-03T15:00:26",
    "name": "[U-Boot,4/9] fs: btrfs: Add btrfs_tree.h and ctree.h from Linux (and modified)",
    "commit_ref": "d4a704af5d2d365c85801a7d3cd5560fa865d445",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "aa5afd8050f4202d369f63bd2aebf97bc6877f33",
    "submitter": {
        "id": 71605,
        "url": "http://patchwork.ozlabs.org/api/people/71605/?format=api",
        "name": "Marek Behún",
        "email": "marek.behun@nic.cz"
    },
    "delegate": {
        "id": 3651,
        "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api",
        "username": "trini",
        "first_name": "Tom",
        "last_name": "Rini",
        "email": "trini@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170903150031.18179-5-marek.behun@nic.cz/mbox/",
    "series": [
        {
            "id": 1246,
            "url": "http://patchwork.ozlabs.org/api/series/1246/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=1246",
            "date": "2017-09-03T15:00:25",
            "name": "Add single-device read-only BTRFS support",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1246/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/809316/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/809316/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tsecure) header.d=nic.cz header.i=@nic.cz header.b=\"gHVjB5Qn\"; \n\tdkim-atps=neutral"
        ],
        "Received": [
            "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlbv40bGvz9t2y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 01:07:43 +1000 (AEST)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid AAFF5C21E93; Sun,  3 Sep 2017 15:03:57 +0000 (UTC)",
            "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 40EE9C21F0B;\n\tSun,  3 Sep 2017 15:01:41 +0000 (UTC)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 50920C21D65; Sun,  3 Sep 2017 15:01:34 +0000 (UTC)",
            "from mail.nic.cz (mail.nic.cz [217.31.204.67])\n\tby lists.denx.de (Postfix) with ESMTPS id 6EB89C21D7D\n\tfor <u-boot@lists.denx.de>; Sun,  3 Sep 2017 15:01:33 +0000 (UTC)",
            "from dellmb.labs.office.nic.cz (unknown\n\t[IPv6:2001:1488:fffe:6:8982:ed8c:62b1:c0c8])\n\tby mail.nic.cz (Postfix) with ESMTP id 23AF06239F;\n\tSun,  3 Sep 2017 17:01:33 +0200 (CEST)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default;\n\tt=1504450893; bh=ttlBk9LvU7m8/B3rMdkCdJFXo2C6pb26UyGNxpjWsH0=;\n\th=From:To:Date;\n\tb=gHVjB5QntVP0oXzU6UPzRczyEDHDdl3PciJDtRLDV0ns+UMWns5iWRZVAyNJtxyV2\n\tKPg0GA858OdKg9EZpPsPegyQS/OQeNC6n/wHDmdB57Q0+kup6cONZSfvDGIrPEbNB8\n\twb0vkROFR20eM6Etj/HYmwY+C3Iv1f3mop6pmn5g=",
        "From": "=?utf-8?q?Marek_Beh=C3=BAn?= <marek.behun@nic.cz>",
        "To": "u-boot@lists.denx.de",
        "Date": "Sun,  3 Sep 2017 17:00:26 +0200",
        "Message-Id": "<20170903150031.18179-5-marek.behun@nic.cz>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": "<20170903150031.18179-1-marek.behun@nic.cz>",
        "References": "<20170903150031.18179-1-marek.behun@nic.cz>",
        "X-Virus-Scanned": "clamav-milter 0.99.2 at mail",
        "X-Virus-Status": "Clean",
        "Cc": "Tomas Hlavacek <tomas.hlavacek@nic.cz>, Stefan Roese <sr@denx.de>,\n\t=?utf-8?q?Andreas_F=C3=A4rber?= <afaerber@suse.de>",
        "Subject": "[U-Boot] [PATCH 4/9] fs: btrfs: Add btrfs_tree.h and ctree.h from\n\tLinux (and modified)",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.18",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>"
    },
    "content": "Add btrfs_tree.h and ctree.h from Linux which contains constants\nand structures for the BTRFS filesystem.\n\nSigned-off-by: Marek Behun <marek.behun@nic.cz>\n\n create mode 100644 fs/btrfs/btrfs_tree.h\n create mode 100644 fs/btrfs/ctree.h",
    "diff": "diff --git a/fs/btrfs/btrfs_tree.h b/fs/btrfs/btrfs_tree.h\nnew file mode 100644\nindex 0000000000..f171b24288\n--- /dev/null\n+++ b/fs/btrfs/btrfs_tree.h\n@@ -0,0 +1,766 @@\n+/*\n+ * From linux/include/uapi/linux/btrfs_tree.h\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#ifndef __BTRFS_BTRFS_TREE_H__\n+#define __BTRFS_BTRFS_TREE_H__\n+\n+#include <common.h>\n+\n+#define BTRFS_VOL_NAME_MAX 255\n+#define BTRFS_NAME_MAX 255\n+#define BTRFS_LABEL_SIZE 256\n+#define BTRFS_FSID_SIZE 16\n+#define BTRFS_UUID_SIZE 16\n+\n+/*\n+ * This header contains the structure definitions and constants used\n+ * by file system objects that can be retrieved using\n+ * the BTRFS_IOC_SEARCH_TREE ioctl.  That means basically anything that\n+ * is needed to describe a leaf node's key or item contents.\n+ */\n+\n+/* holds pointers to all of the tree roots */\n+#define BTRFS_ROOT_TREE_OBJECTID 1ULL\n+\n+/* stores information about which extents are in use, and reference counts */\n+#define BTRFS_EXTENT_TREE_OBJECTID 2ULL\n+\n+/*\n+ * chunk tree stores translations from logical -> physical block numbering\n+ * the super block points to the chunk tree\n+ */\n+#define BTRFS_CHUNK_TREE_OBJECTID 3ULL\n+\n+/*\n+ * stores information about which areas of a given device are in use.\n+ * one per device.  The tree of tree roots points to the device tree\n+ */\n+#define BTRFS_DEV_TREE_OBJECTID 4ULL\n+\n+/* one per subvolume, storing files and directories */\n+#define BTRFS_FS_TREE_OBJECTID 5ULL\n+\n+/* directory objectid inside the root tree */\n+#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL\n+\n+/* holds checksums of all the data extents */\n+#define BTRFS_CSUM_TREE_OBJECTID 7ULL\n+\n+/* holds quota configuration and tracking */\n+#define BTRFS_QUOTA_TREE_OBJECTID 8ULL\n+\n+/* for storing items that use the BTRFS_UUID_KEY* types */\n+#define BTRFS_UUID_TREE_OBJECTID 9ULL\n+\n+/* tracks free space in block groups. */\n+#define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL\n+\n+/* device stats in the device tree */\n+#define BTRFS_DEV_STATS_OBJECTID 0ULL\n+\n+/* for storing balance parameters in the root tree */\n+#define BTRFS_BALANCE_OBJECTID -4ULL\n+\n+/* orhpan objectid for tracking unlinked/truncated files */\n+#define BTRFS_ORPHAN_OBJECTID -5ULL\n+\n+/* does write ahead logging to speed up fsyncs */\n+#define BTRFS_TREE_LOG_OBJECTID -6ULL\n+#define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL\n+\n+/* for space balancing */\n+#define BTRFS_TREE_RELOC_OBJECTID -8ULL\n+#define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL\n+\n+/*\n+ * extent checksums all have this objectid\n+ * this allows them to share the logging tree\n+ * for fsyncs\n+ */\n+#define BTRFS_EXTENT_CSUM_OBJECTID -10ULL\n+\n+/* For storing free space cache */\n+#define BTRFS_FREE_SPACE_OBJECTID -11ULL\n+\n+/*\n+ * The inode number assigned to the special inode for storing\n+ * free ino cache\n+ */\n+#define BTRFS_FREE_INO_OBJECTID -12ULL\n+\n+/* dummy objectid represents multiple objectids */\n+#define BTRFS_MULTIPLE_OBJECTIDS -255ULL\n+\n+/*\n+ * All files have objectids in this range.\n+ */\n+#define BTRFS_FIRST_FREE_OBJECTID 256ULL\n+#define BTRFS_LAST_FREE_OBJECTID -256ULL\n+#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL\n+\n+\n+/*\n+ * the device items go into the chunk tree.  The key is in the form\n+ * [ 1 BTRFS_DEV_ITEM_KEY device_id ]\n+ */\n+#define BTRFS_DEV_ITEMS_OBJECTID 1ULL\n+\n+#define BTRFS_BTREE_INODE_OBJECTID 1\n+\n+#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2\n+\n+#define BTRFS_DEV_REPLACE_DEVID 0ULL\n+\n+/*\n+ * inode items have the data typically returned from stat and store other\n+ * info about object characteristics.  There is one for every file and dir in\n+ * the FS\n+ */\n+#define BTRFS_INODE_ITEM_KEY\t\t1\n+#define BTRFS_INODE_REF_KEY\t\t12\n+#define BTRFS_INODE_EXTREF_KEY\t\t13\n+#define BTRFS_XATTR_ITEM_KEY\t\t24\n+#define BTRFS_ORPHAN_ITEM_KEY\t\t48\n+/* reserve 2-15 close to the inode for later flexibility */\n+\n+/*\n+ * dir items are the name -> inode pointers in a directory.  There is one\n+ * for every name in a directory.\n+ */\n+#define BTRFS_DIR_LOG_ITEM_KEY  60\n+#define BTRFS_DIR_LOG_INDEX_KEY 72\n+#define BTRFS_DIR_ITEM_KEY\t84\n+#define BTRFS_DIR_INDEX_KEY\t96\n+/*\n+ * extent data is for file data\n+ */\n+#define BTRFS_EXTENT_DATA_KEY\t108\n+\n+/*\n+ * extent csums are stored in a separate tree and hold csums for\n+ * an entire extent on disk.\n+ */\n+#define BTRFS_EXTENT_CSUM_KEY\t128\n+\n+/*\n+ * root items point to tree roots.  They are typically in the root\n+ * tree used by the super block to find all the other trees\n+ */\n+#define BTRFS_ROOT_ITEM_KEY\t132\n+\n+/*\n+ * root backrefs tie subvols and snapshots to the directory entries that\n+ * reference them\n+ */\n+#define BTRFS_ROOT_BACKREF_KEY\t144\n+\n+/*\n+ * root refs make a fast index for listing all of the snapshots and\n+ * subvolumes referenced by a given root.  They point directly to the\n+ * directory item in the root that references the subvol\n+ */\n+#define BTRFS_ROOT_REF_KEY\t156\n+\n+/*\n+ * extent items are in the extent map tree.  These record which blocks\n+ * are used, and how many references there are to each block\n+ */\n+#define BTRFS_EXTENT_ITEM_KEY\t168\n+\n+/*\n+ * The same as the BTRFS_EXTENT_ITEM_KEY, except it's metadata we already know\n+ * the length, so we save the level in key->offset instead of the length.\n+ */\n+#define BTRFS_METADATA_ITEM_KEY\t169\n+\n+#define BTRFS_TREE_BLOCK_REF_KEY\t176\n+\n+#define BTRFS_EXTENT_DATA_REF_KEY\t178\n+\n+#define BTRFS_EXTENT_REF_V0_KEY\t\t180\n+\n+#define BTRFS_SHARED_BLOCK_REF_KEY\t182\n+\n+#define BTRFS_SHARED_DATA_REF_KEY\t184\n+\n+/*\n+ * block groups give us hints into the extent allocation trees.  Which\n+ * blocks are free etc etc\n+ */\n+#define BTRFS_BLOCK_GROUP_ITEM_KEY 192\n+\n+/*\n+ * Every block group is represented in the free space tree by a free space info\n+ * item, which stores some accounting information. It is keyed on\n+ * (block_group_start, FREE_SPACE_INFO, block_group_length).\n+ */\n+#define BTRFS_FREE_SPACE_INFO_KEY 198\n+\n+/*\n+ * A free space extent tracks an extent of space that is free in a block group.\n+ * It is keyed on (start, FREE_SPACE_EXTENT, length).\n+ */\n+#define BTRFS_FREE_SPACE_EXTENT_KEY 199\n+\n+/*\n+ * When a block group becomes very fragmented, we convert it to use bitmaps\n+ * instead of extents. A free space bitmap is keyed on\n+ * (start, FREE_SPACE_BITMAP, length); the corresponding item is a bitmap with\n+ * (length / sectorsize) bits.\n+ */\n+#define BTRFS_FREE_SPACE_BITMAP_KEY 200\n+\n+#define BTRFS_DEV_EXTENT_KEY\t204\n+#define BTRFS_DEV_ITEM_KEY\t216\n+#define BTRFS_CHUNK_ITEM_KEY\t228\n+\n+/*\n+ * Records the overall state of the qgroups.\n+ * There's only one instance of this key present,\n+ * (0, BTRFS_QGROUP_STATUS_KEY, 0)\n+ */\n+#define BTRFS_QGROUP_STATUS_KEY         240\n+/*\n+ * Records the currently used space of the qgroup.\n+ * One key per qgroup, (0, BTRFS_QGROUP_INFO_KEY, qgroupid).\n+ */\n+#define BTRFS_QGROUP_INFO_KEY           242\n+/*\n+ * Contains the user configured limits for the qgroup.\n+ * One key per qgroup, (0, BTRFS_QGROUP_LIMIT_KEY, qgroupid).\n+ */\n+#define BTRFS_QGROUP_LIMIT_KEY          244\n+/*\n+ * Records the child-parent relationship of qgroups. For\n+ * each relation, 2 keys are present:\n+ * (childid, BTRFS_QGROUP_RELATION_KEY, parentid)\n+ * (parentid, BTRFS_QGROUP_RELATION_KEY, childid)\n+ */\n+#define BTRFS_QGROUP_RELATION_KEY       246\n+\n+/*\n+ * Obsolete name, see BTRFS_TEMPORARY_ITEM_KEY.\n+ */\n+#define BTRFS_BALANCE_ITEM_KEY\t248\n+\n+/*\n+ * The key type for tree items that are stored persistently, but do not need to\n+ * exist for extended period of time. The items can exist in any tree.\n+ *\n+ * [subtype, BTRFS_TEMPORARY_ITEM_KEY, data]\n+ *\n+ * Existing items:\n+ *\n+ * - balance status item\n+ *   (BTRFS_BALANCE_OBJECTID, BTRFS_TEMPORARY_ITEM_KEY, 0)\n+ */\n+#define BTRFS_TEMPORARY_ITEM_KEY\t248\n+\n+/*\n+ * Obsolete name, see BTRFS_PERSISTENT_ITEM_KEY\n+ */\n+#define BTRFS_DEV_STATS_KEY\t\t249\n+\n+/*\n+ * The key type for tree items that are stored persistently and usually exist\n+ * for a long period, eg. filesystem lifetime. The item kinds can be status\n+ * information, stats or preference values. The item can exist in any tree.\n+ *\n+ * [subtype, BTRFS_PERSISTENT_ITEM_KEY, data]\n+ *\n+ * Existing items:\n+ *\n+ * - device statistics, store IO stats in the device tree, one key for all\n+ *   stats\n+ *   (BTRFS_DEV_STATS_OBJECTID, BTRFS_DEV_STATS_KEY, 0)\n+ */\n+#define BTRFS_PERSISTENT_ITEM_KEY\t249\n+\n+/*\n+ * Persistantly stores the device replace state in the device tree.\n+ * The key is built like this: (0, BTRFS_DEV_REPLACE_KEY, 0).\n+ */\n+#define BTRFS_DEV_REPLACE_KEY\t250\n+\n+/*\n+ * Stores items that allow to quickly map UUIDs to something else.\n+ * These items are part of the filesystem UUID tree.\n+ * The key is built like this:\n+ * (UUID_upper_64_bits, BTRFS_UUID_KEY*, UUID_lower_64_bits).\n+ */\n+#if BTRFS_UUID_SIZE != 16\n+#error \"UUID items require BTRFS_UUID_SIZE == 16!\"\n+#endif\n+#define BTRFS_UUID_KEY_SUBVOL\t251\t/* for UUIDs assigned to subvols */\n+#define BTRFS_UUID_KEY_RECEIVED_SUBVOL\t252\t/* for UUIDs assigned to\n+\t\t\t\t\t\t * received subvols */\n+\n+/*\n+ * string items are for debugging.  They just store a short string of\n+ * data in the FS\n+ */\n+#define BTRFS_STRING_ITEM_KEY\t253\n+\n+\n+\n+/* 32 bytes in various csum fields */\n+#define BTRFS_CSUM_SIZE 32\n+\n+/* csum types */\n+#define BTRFS_CSUM_TYPE_CRC32\t0\n+\n+/*\n+ * flags definitions for directory entry item type\n+ *\n+ * Used by:\n+ * struct btrfs_dir_item.type\n+ */\n+#define BTRFS_FT_UNKNOWN\t0\n+#define BTRFS_FT_REG_FILE\t1\n+#define BTRFS_FT_DIR\t\t2\n+#define BTRFS_FT_CHRDEV\t\t3\n+#define BTRFS_FT_BLKDEV\t\t4\n+#define BTRFS_FT_FIFO\t\t5\n+#define BTRFS_FT_SOCK\t\t6\n+#define BTRFS_FT_SYMLINK\t7\n+#define BTRFS_FT_XATTR\t\t8\n+#define BTRFS_FT_MAX\t\t9\n+\n+/*\n+ * The key defines the order in the tree, and so it also defines (optimal)\n+ * block layout.\n+ *\n+ * objectid corresponds to the inode number.\n+ *\n+ * type tells us things about the object, and is a kind of stream selector.\n+ * so for a given inode, keys with type of 1 might refer to the inode data,\n+ * type of 2 may point to file data in the btree and type == 3 may point to\n+ * extents.\n+ *\n+ * offset is the starting byte offset for this key in the stream.\n+ */\n+\n+struct btrfs_key {\n+\t__u64 objectid;\n+\t__u8 type;\n+\t__u64 offset;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_dev_item {\n+\t/* the internal btrfs device id */\n+\t__u64 devid;\n+\n+\t/* size of the device */\n+\t__u64 total_bytes;\n+\n+\t/* bytes used */\n+\t__u64 bytes_used;\n+\n+\t/* optimal io alignment for this device */\n+\t__u32 io_align;\n+\n+\t/* optimal io width for this device */\n+\t__u32 io_width;\n+\n+\t/* minimal io size for this device */\n+\t__u32 sector_size;\n+\n+\t/* type and info about this device */\n+\t__u64 type;\n+\n+\t/* expected generation for this device */\n+\t__u64 generation;\n+\n+\t/*\n+\t * starting byte of this partition on the device,\n+\t * to allow for stripe alignment in the future\n+\t */\n+\t__u64 start_offset;\n+\n+\t/* grouping information for allocation decisions */\n+\t__u32 dev_group;\n+\n+\t/* seek speed 0-100 where 100 is fastest */\n+\t__u8 seek_speed;\n+\n+\t/* bandwidth 0-100 where 100 is fastest */\n+\t__u8 bandwidth;\n+\n+\t/* btrfs generated uuid for this device */\n+\t__u8 uuid[BTRFS_UUID_SIZE];\n+\n+\t/* uuid of FS who owns this device */\n+\t__u8 fsid[BTRFS_UUID_SIZE];\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_stripe {\n+\t__u64 devid;\n+\t__u64 offset;\n+\t__u8 dev_uuid[BTRFS_UUID_SIZE];\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_chunk {\n+\t/* size of this chunk in bytes */\n+\t__u64 length;\n+\n+\t/* objectid of the root referencing this chunk */\n+\t__u64 owner;\n+\n+\t__u64 stripe_len;\n+\t__u64 type;\n+\n+\t/* optimal io alignment for this chunk */\n+\t__u32 io_align;\n+\n+\t/* optimal io width for this chunk */\n+\t__u32 io_width;\n+\n+\t/* minimal io size for this chunk */\n+\t__u32 sector_size;\n+\n+\t/* 2^16 stripes is quite a lot, a second limit is the size of a single\n+\t * item in the btree\n+\t */\n+\t__u16 num_stripes;\n+\n+\t/* sub stripes only matter for raid10 */\n+\t__u16 sub_stripes;\n+\tstruct btrfs_stripe stripe;\n+\t/* additional stripes go here */\n+} __attribute__ ((__packed__));\n+\n+#define BTRFS_FREE_SPACE_EXTENT\t1\n+#define BTRFS_FREE_SPACE_BITMAP\t2\n+\n+struct btrfs_free_space_entry {\n+\t__u64 offset;\n+\t__u64 bytes;\n+\t__u8 type;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_free_space_header {\n+\tstruct btrfs_key location;\n+\t__u64 generation;\n+\t__u64 num_entries;\n+\t__u64 num_bitmaps;\n+} __attribute__ ((__packed__));\n+\n+#define BTRFS_HEADER_FLAG_WRITTEN\t(1ULL << 0)\n+#define BTRFS_HEADER_FLAG_RELOC\t\t(1ULL << 1)\n+\n+/* Super block flags */\n+/* Errors detected */\n+#define BTRFS_SUPER_FLAG_ERROR\t\t(1ULL << 2)\n+\n+#define BTRFS_SUPER_FLAG_SEEDING\t(1ULL << 32)\n+#define BTRFS_SUPER_FLAG_METADUMP\t(1ULL << 33)\n+\n+\n+/*\n+ * items in the extent btree are used to record the objectid of the\n+ * owner of the block and the number of references\n+ */\n+\n+struct btrfs_extent_item {\n+\t__u64 refs;\n+\t__u64 generation;\n+\t__u64 flags;\n+} __attribute__ ((__packed__));\n+\n+\n+#define BTRFS_EXTENT_FLAG_DATA\t\t(1ULL << 0)\n+#define BTRFS_EXTENT_FLAG_TREE_BLOCK\t(1ULL << 1)\n+\n+/* following flags only apply to tree blocks */\n+\n+/* use full backrefs for extent pointers in the block */\n+#define BTRFS_BLOCK_FLAG_FULL_BACKREF\t(1ULL << 8)\n+\n+/*\n+ * this flag is only used internally by scrub and may be changed at any time\n+ * it is only declared here to avoid collisions\n+ */\n+#define BTRFS_EXTENT_FLAG_SUPER\t\t(1ULL << 48)\n+\n+struct btrfs_tree_block_info {\n+\tstruct btrfs_key key;\n+\t__u8 level;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_extent_data_ref {\n+\t__u64 root;\n+\t__u64 objectid;\n+\t__u64 offset;\n+\t__u32 count;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_shared_data_ref {\n+\t__u32 count;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_extent_inline_ref {\n+\t__u8 type;\n+\t__u64 offset;\n+} __attribute__ ((__packed__));\n+\n+/* dev extents record free space on individual devices.  The owner\n+ * field points back to the chunk allocation mapping tree that allocated\n+ * the extent.  The chunk tree uuid field is a way to double check the owner\n+ */\n+struct btrfs_dev_extent {\n+\t__u64 chunk_tree;\n+\t__u64 chunk_objectid;\n+\t__u64 chunk_offset;\n+\t__u64 length;\n+\t__u8 chunk_tree_uuid[BTRFS_UUID_SIZE];\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_inode_ref {\n+\t__u64 index;\n+\t__u16 name_len;\n+\t/* name goes here */\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_inode_extref {\n+\t__u64 parent_objectid;\n+\t__u64 index;\n+\t__u16 name_len;\n+\t__u8   name[0];\n+\t/* name goes here */\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_timespec {\n+\t__u64 sec;\n+\t__u32 nsec;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_inode_item {\n+\t/* nfs style generation number */\n+\t__u64 generation;\n+\t/* transid that last touched this inode */\n+\t__u64 transid;\n+\t__u64 size;\n+\t__u64 nbytes;\n+\t__u64 block_group;\n+\t__u32 nlink;\n+\t__u32 uid;\n+\t__u32 gid;\n+\t__u32 mode;\n+\t__u64 rdev;\n+\t__u64 flags;\n+\n+\t/* modification sequence number for NFS */\n+\t__u64 sequence;\n+\n+\t/*\n+\t * a little future expansion, for more than this we can\n+\t * just grow the inode item and version it\n+\t */\n+\t__u64 reserved[4];\n+\tstruct btrfs_timespec atime;\n+\tstruct btrfs_timespec ctime;\n+\tstruct btrfs_timespec mtime;\n+\tstruct btrfs_timespec otime;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_dir_log_item {\n+\t__u64 end;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_dir_item {\n+\tstruct btrfs_key location;\n+\t__u64 transid;\n+\t__u16 data_len;\n+\t__u16 name_len;\n+\t__u8 type;\n+} __attribute__ ((__packed__));\n+\n+#define BTRFS_ROOT_SUBVOL_RDONLY\t(1ULL << 0)\n+\n+/*\n+ * Internal in-memory flag that a subvolume has been marked for deletion but\n+ * still visible as a directory\n+ */\n+#define BTRFS_ROOT_SUBVOL_DEAD\t\t(1ULL << 48)\n+\n+struct btrfs_root_item {\n+\tstruct btrfs_inode_item inode;\n+\t__u64 generation;\n+\t__u64 root_dirid;\n+\t__u64 bytenr;\n+\t__u64 byte_limit;\n+\t__u64 bytes_used;\n+\t__u64 last_snapshot;\n+\t__u64 flags;\n+\t__u32 refs;\n+\tstruct btrfs_key drop_progress;\n+\t__u8 drop_level;\n+\t__u8 level;\n+\n+\t/*\n+\t * The following fields appear after subvol_uuids+subvol_times\n+\t * were introduced.\n+\t */\n+\n+\t/*\n+\t * This generation number is used to test if the new fields are valid\n+\t * and up to date while reading the root item. Every time the root item\n+\t * is written out, the \"generation\" field is copied into this field. If\n+\t * anyone ever mounted the fs with an older kernel, we will have\n+\t * mismatching generation values here and thus must invalidate the\n+\t * new fields. See btrfs_update_root and btrfs_find_last_root for\n+\t * details.\n+\t * the offset of generation_v2 is also used as the start for the memset\n+\t * when invalidating the fields.\n+\t */\n+\t__u64 generation_v2;\n+\t__u8 uuid[BTRFS_UUID_SIZE];\n+\t__u8 parent_uuid[BTRFS_UUID_SIZE];\n+\t__u8 received_uuid[BTRFS_UUID_SIZE];\n+\t__u64 ctransid; /* updated when an inode changes */\n+\t__u64 otransid; /* trans when created */\n+\t__u64 stransid; /* trans when sent. non-zero for received subvol */\n+\t__u64 rtransid; /* trans when received. non-zero for received subvol */\n+\tstruct btrfs_timespec ctime;\n+\tstruct btrfs_timespec otime;\n+\tstruct btrfs_timespec stime;\n+\tstruct btrfs_timespec rtime;\n+\t__u64 reserved[8]; /* for future */\n+} __attribute__ ((__packed__));\n+\n+/*\n+ * this is used for both forward and backward root refs\n+ */\n+struct btrfs_root_ref {\n+\t__u64 dirid;\n+\t__u64 sequence;\n+\t__u16 name_len;\n+} __attribute__ ((__packed__));\n+\n+#define BTRFS_FILE_EXTENT_INLINE 0\n+#define BTRFS_FILE_EXTENT_REG 1\n+#define BTRFS_FILE_EXTENT_PREALLOC 2\n+\n+enum btrfs_compression_type {\n+\tBTRFS_COMPRESS_NONE  = 0,\n+\tBTRFS_COMPRESS_ZLIB  = 1,\n+\tBTRFS_COMPRESS_LZO   = 2,\n+\tBTRFS_COMPRESS_TYPES = 2,\n+\tBTRFS_COMPRESS_LAST  = 3,\n+};\n+\n+struct btrfs_file_extent_item {\n+\t/*\n+\t * transaction id that created this extent\n+\t */\n+\t__u64 generation;\n+\t/*\n+\t * max number of bytes to hold this extent in ram\n+\t * when we split a compressed extent we can't know how big\n+\t * each of the resulting pieces will be.  So, this is\n+\t * an upper limit on the size of the extent in ram instead of\n+\t * an exact limit.\n+\t */\n+\t__u64 ram_bytes;\n+\n+\t/*\n+\t * 32 bits for the various ways we might encode the data,\n+\t * including compression and encryption.  If any of these\n+\t * are set to something a given disk format doesn't understand\n+\t * it is treated like an incompat flag for reading and writing,\n+\t * but not for stat.\n+\t */\n+\t__u8 compression;\n+\t__u8 encryption;\n+\t__u16 other_encoding; /* spare for later use */\n+\n+\t/* are we inline data or a real extent? */\n+\t__u8 type;\n+\n+\t/*\n+\t * disk space consumed by the extent, checksum blocks are included\n+\t * in these numbers\n+\t *\n+\t * At this offset in the structure, the inline extent data start.\n+\t */\n+\t__u64 disk_bytenr;\n+\t__u64 disk_num_bytes;\n+\t/*\n+\t * the logical offset in file blocks (no csums)\n+\t * this extent record is for.  This allows a file extent to point\n+\t * into the middle of an existing extent on disk, sharing it\n+\t * between two snapshots (useful if some bytes in the middle of the\n+\t * extent have changed\n+\t */\n+\t__u64 offset;\n+\t/*\n+\t * the logical number of file blocks (no csums included).  This\n+\t * always reflects the size uncompressed and without encoding.\n+\t */\n+\t__u64 num_bytes;\n+\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_csum_item {\n+\t__u8 csum;\n+} __attribute__ ((__packed__));\n+\n+/* different types of block groups (and chunks) */\n+#define BTRFS_BLOCK_GROUP_DATA\t\t(1ULL << 0)\n+#define BTRFS_BLOCK_GROUP_SYSTEM\t(1ULL << 1)\n+#define BTRFS_BLOCK_GROUP_METADATA\t(1ULL << 2)\n+#define BTRFS_BLOCK_GROUP_RAID0\t\t(1ULL << 3)\n+#define BTRFS_BLOCK_GROUP_RAID1\t\t(1ULL << 4)\n+#define BTRFS_BLOCK_GROUP_DUP\t\t(1ULL << 5)\n+#define BTRFS_BLOCK_GROUP_RAID10\t(1ULL << 6)\n+#define BTRFS_BLOCK_GROUP_RAID5         (1ULL << 7)\n+#define BTRFS_BLOCK_GROUP_RAID6         (1ULL << 8)\n+#define BTRFS_BLOCK_GROUP_RESERVED\t(BTRFS_AVAIL_ALLOC_BIT_SINGLE | \\\n+\t\t\t\t\t BTRFS_SPACE_INFO_GLOBAL_RSV)\n+\n+enum btrfs_raid_types {\n+\tBTRFS_RAID_RAID10,\n+\tBTRFS_RAID_RAID1,\n+\tBTRFS_RAID_DUP,\n+\tBTRFS_RAID_RAID0,\n+\tBTRFS_RAID_SINGLE,\n+\tBTRFS_RAID_RAID5,\n+\tBTRFS_RAID_RAID6,\n+\tBTRFS_NR_RAID_TYPES\n+};\n+\n+#define BTRFS_BLOCK_GROUP_TYPE_MASK\t(BTRFS_BLOCK_GROUP_DATA |    \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_SYSTEM |  \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_METADATA)\n+\n+#define BTRFS_BLOCK_GROUP_PROFILE_MASK\t(BTRFS_BLOCK_GROUP_RAID0 |   \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_RAID1 |   \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_RAID5 |   \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_RAID6 |   \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_DUP |     \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_RAID10)\n+#define BTRFS_BLOCK_GROUP_RAID56_MASK\t(BTRFS_BLOCK_GROUP_RAID5 |   \\\n+\t\t\t\t\t BTRFS_BLOCK_GROUP_RAID6)\n+\n+/*\n+ * We need a bit for restriper to be able to tell when chunks of type\n+ * SINGLE are available.  This \"extended\" profile format is used in\n+ * fs_info->avail_*_alloc_bits (in-memory) and balance item fields\n+ * (on-disk).  The corresponding on-disk bit in chunk.type is reserved\n+ * to avoid remappings between two formats in future.\n+ */\n+#define BTRFS_AVAIL_ALLOC_BIT_SINGLE\t(1ULL << 48)\n+\n+/*\n+ * A fake block group type that is used to communicate global block reserve\n+ * size to userspace via the SPACE_INFO ioctl.\n+ */\n+#define BTRFS_SPACE_INFO_GLOBAL_RSV\t(1ULL << 49)\n+\n+#define BTRFS_EXTENDED_PROFILE_MASK\t(BTRFS_BLOCK_GROUP_PROFILE_MASK | \\\n+\t\t\t\t\t BTRFS_AVAIL_ALLOC_BIT_SINGLE)\n+\n+#endif /* __BTRFS_BTRFS_TREE_H__ */\ndiff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h\nnew file mode 100644\nindex 0000000000..39f4473ae5\n--- /dev/null\n+++ b/fs/btrfs/ctree.h\n@@ -0,0 +1,334 @@\n+/*\n+ * From linux/fs/btrfs/ctree.h\n+ *   Copyright (C) 2007,2008 Oracle.  All rights reserved.\n+ *\n+ * Modified in 2017 by Marek Behun, CZ.NIC, marek.behun@nic.cz\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#ifndef __BTRFS_CTREE_H__\n+#define __BTRFS_CTREE_H__\n+\n+#include <common.h>\n+#include <compiler.h>\n+#include \"btrfs_tree.h\"\n+\n+#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */\n+\n+#define BTRFS_MAX_MIRRORS 3\n+\n+#define BTRFS_MAX_LEVEL 8\n+\n+#define BTRFS_COMPAT_EXTENT_TREE_V0\n+\n+/*\n+ * the max metadata block size.  This limit is somewhat artificial,\n+ * but the memmove costs go through the roof for larger blocks.\n+ */\n+#define BTRFS_MAX_METADATA_BLOCKSIZE 65536\n+\n+/*\n+ * we can actually store much bigger names, but lets not confuse the rest\n+ * of linux\n+ */\n+#define BTRFS_NAME_LEN 255\n+\n+/*\n+ * Theoretical limit is larger, but we keep this down to a sane\n+ * value. That should limit greatly the possibility of collisions on\n+ * inode ref items.\n+ */\n+#define BTRFS_LINK_MAX 65535U\n+\n+static const int btrfs_csum_sizes[] = { 4 };\n+\n+/* four bytes for CRC32 */\n+#define BTRFS_EMPTY_DIR_SIZE 0\n+\n+/* ioprio of readahead is set to idle */\n+#define BTRFS_IOPRIO_READA (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0))\n+\n+#define BTRFS_DIRTY_METADATA_THRESH\tSZ_32M\n+\n+#define BTRFS_MAX_EXTENT_SIZE SZ_128M\n+\n+/*\n+ * File system states\n+ */\n+#define BTRFS_FS_STATE_ERROR\t\t0\n+#define BTRFS_FS_STATE_REMOUNTING\t1\n+#define BTRFS_FS_STATE_TRANS_ABORTED\t2\n+#define BTRFS_FS_STATE_DEV_REPLACING\t3\n+#define BTRFS_FS_STATE_DUMMY_FS_INFO\t4\n+\n+#define BTRFS_BACKREF_REV_MAX\t\t256\n+#define BTRFS_BACKREF_REV_SHIFT\t\t56\n+#define BTRFS_BACKREF_REV_MASK\t\t(((u64)BTRFS_BACKREF_REV_MAX - 1) << \\\n+\t\t\t\t\t BTRFS_BACKREF_REV_SHIFT)\n+\n+#define BTRFS_OLD_BACKREF_REV\t\t0\n+#define BTRFS_MIXED_BACKREF_REV\t\t1\n+\n+/*\n+ * every tree block (leaf or node) starts with this header.\n+ */\n+struct btrfs_header {\n+\t/* these first four must match the super block */\n+\t__u8 csum[BTRFS_CSUM_SIZE];\n+\t__u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */\n+\t__u64 bytenr; /* which block this node is supposed to live in */\n+\t__u64 flags;\n+\n+\t/* allowed to be different from the super from here on down */\n+\t__u8 chunk_tree_uuid[BTRFS_UUID_SIZE];\n+\t__u64 generation;\n+\t__u64 owner;\n+\t__u32 nritems;\n+\t__u8 level;\n+} __attribute__ ((__packed__));\n+\n+/*\n+ * this is a very generous portion of the super block, giving us\n+ * room to translate 14 chunks with 3 stripes each.\n+ */\n+#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048\n+\n+/*\n+ * just in case we somehow lose the roots and are not able to mount,\n+ * we store an array of the roots from previous transactions\n+ * in the super.\n+ */\n+#define BTRFS_NUM_BACKUP_ROOTS 4\n+struct btrfs_root_backup {\n+\t__u64 tree_root;\n+\t__u64 tree_root_gen;\n+\n+\t__u64 chunk_root;\n+\t__u64 chunk_root_gen;\n+\n+\t__u64 extent_root;\n+\t__u64 extent_root_gen;\n+\n+\t__u64 fs_root;\n+\t__u64 fs_root_gen;\n+\n+\t__u64 dev_root;\n+\t__u64 dev_root_gen;\n+\n+\t__u64 csum_root;\n+\t__u64 csum_root_gen;\n+\n+\t__u64 total_bytes;\n+\t__u64 bytes_used;\n+\t__u64 num_devices;\n+\t/* future */\n+\t__u64 unused_64[4];\n+\n+\t__u8 tree_root_level;\n+\t__u8 chunk_root_level;\n+\t__u8 extent_root_level;\n+\t__u8 fs_root_level;\n+\t__u8 dev_root_level;\n+\t__u8 csum_root_level;\n+\t/* future and to align */\n+\t__u8 unused_8[10];\n+} __attribute__ ((__packed__));\n+\n+/*\n+ * the super block basically lists the main trees of the FS\n+ * it currently lacks any block count etc etc\n+ */\n+struct btrfs_super_block {\n+\t__u8 csum[BTRFS_CSUM_SIZE];\n+\t/* the first 4 fields must match struct btrfs_header */\n+\t__u8 fsid[BTRFS_FSID_SIZE];    /* FS specific uuid */\n+\t__u64 bytenr; /* this block number */\n+\t__u64 flags;\n+\n+\t/* allowed to be different from the btrfs_header from here own down */\n+\t__u64 magic;\n+\t__u64 generation;\n+\t__u64 root;\n+\t__u64 chunk_root;\n+\t__u64 log_root;\n+\n+\t/* this will help find the new super based on the log root */\n+\t__u64 log_root_transid;\n+\t__u64 total_bytes;\n+\t__u64 bytes_used;\n+\t__u64 root_dir_objectid;\n+\t__u64 num_devices;\n+\t__u32 sectorsize;\n+\t__u32 nodesize;\n+\t__u32 __unused_leafsize;\n+\t__u32 stripesize;\n+\t__u32 sys_chunk_array_size;\n+\t__u64 chunk_root_generation;\n+\t__u64 compat_flags;\n+\t__u64 compat_ro_flags;\n+\t__u64 incompat_flags;\n+\t__u16 csum_type;\n+\t__u8 root_level;\n+\t__u8 chunk_root_level;\n+\t__u8 log_root_level;\n+\tstruct btrfs_dev_item dev_item;\n+\n+\tchar label[BTRFS_LABEL_SIZE];\n+\n+\t__u64 cache_generation;\n+\t__u64 uuid_tree_generation;\n+\n+\t/* future expansion */\n+\t__u64 reserved[30];\n+\t__u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];\n+\tstruct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];\n+} __attribute__ ((__packed__));\n+\n+/*\n+ * Compat flags that we support.  If any incompat flags are set other than the\n+ * ones specified below then we will fail to mount\n+ */\n+#define BTRFS_FEATURE_COMPAT_SUPP\t\t0ULL\n+#define BTRFS_FEATURE_COMPAT_SAFE_SET\t\t0ULL\n+#define BTRFS_FEATURE_COMPAT_SAFE_CLEAR\t\t0ULL\n+\n+#define BTRFS_FEATURE_COMPAT_RO_SUPP\t\t\t\\\n+\t(BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |\t\\\n+\t BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID)\n+\n+#define BTRFS_FEATURE_COMPAT_RO_SAFE_SET\t0ULL\n+#define BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR\t0ULL\n+\n+#define BTRFS_FEATURE_INCOMPAT_SUPP\t\t\t\\\n+\t(BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF |\t\t\\\n+\t BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL |\t\\\n+\t BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS |\t\t\\\n+\t BTRFS_FEATURE_INCOMPAT_BIG_METADATA |\t\t\\\n+\t BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO |\t\t\\\n+\t BTRFS_FEATURE_INCOMPAT_RAID56 |\t\t\\\n+\t BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF |\t\t\\\n+\t BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA |\t\\\n+\t BTRFS_FEATURE_INCOMPAT_NO_HOLES)\n+\n+#define BTRFS_FEATURE_INCOMPAT_SAFE_SET\t\t\t\\\n+\t(BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)\n+#define BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR\t\t0ULL\n+\n+/*\n+ * A leaf is full of items. offset and size tell us where to find\n+ * the item in the leaf (relative to the start of the data area)\n+ */\n+struct btrfs_item {\n+\tstruct btrfs_key key;\n+\t__u32 offset;\n+\t__u32 size;\n+} __attribute__ ((__packed__));\n+\n+/*\n+ * leaves have an item area and a data area:\n+ * [item0, item1....itemN] [free space] [dataN...data1, data0]\n+ *\n+ * The data is separate from the items to get the keys closer together\n+ * during searches.\n+ */\n+struct btrfs_leaf {\n+\tstruct btrfs_header header;\n+\tstruct btrfs_item items[];\n+} __attribute__ ((__packed__));\n+\n+/*\n+ * all non-leaf blocks are nodes, they hold only keys and pointers to\n+ * other blocks\n+ */\n+struct btrfs_key_ptr {\n+\tstruct btrfs_key key;\n+\t__u64 blockptr;\n+\t__u64 generation;\n+} __attribute__ ((__packed__));\n+\n+struct btrfs_node {\n+\tstruct btrfs_header header;\n+\tstruct btrfs_key_ptr ptrs[];\n+} __attribute__ ((__packed__));\n+\n+union btrfs_tree_node {\n+\tstruct btrfs_header header;\n+\tstruct btrfs_leaf leaf;\n+\tstruct btrfs_node node;\n+};\n+\n+typedef __u8 u8;\n+typedef __u16 u16;\n+typedef __u32 u32;\n+typedef __u64 u64;\n+\n+struct btrfs_path {\n+\tunion btrfs_tree_node *nodes[BTRFS_MAX_LEVEL];\n+\tu32 slots[BTRFS_MAX_LEVEL];\n+};\n+\n+struct btrfs_root {\n+\tu64 objectid;\n+\tu64 bytenr;\n+\tu64 root_dirid;\n+};\n+\n+int btrfs_comp_keys(struct btrfs_key *, struct btrfs_key *);\n+int btrfs_comp_keys_type(struct btrfs_key *, struct btrfs_key *);\n+int btrfs_bin_search(union btrfs_tree_node *, struct btrfs_key *, int *);\n+void btrfs_free_path(struct btrfs_path *);\n+int btrfs_search_tree(const struct btrfs_root *, struct btrfs_key *,\n+\t\t      struct btrfs_path *);\n+int btrfs_prev_slot(struct btrfs_path *);\n+int btrfs_next_slot(struct btrfs_path *);\n+\n+static inline struct btrfs_key *btrfs_path_leaf_key(struct btrfs_path *p) {\n+\treturn &p->nodes[0]->leaf.items[p->slots[0]].key;\n+}\n+\n+static inline struct btrfs_key *\n+btrfs_search_tree_key_type(const struct btrfs_root *root, u64 objectid,\n+\t\t\t   u8 type, struct btrfs_path *path)\n+{\n+\tstruct btrfs_key key, *res;\n+\n+\tkey.objectid = objectid;\n+\tkey.type = type;\n+\tkey.offset = 0;\n+\n+\tif (btrfs_search_tree(root, &key, path))\n+\t\treturn NULL;\n+\n+\tres = btrfs_path_leaf_key(path);\n+\tif (btrfs_comp_keys_type(&key, res)) {\n+\t\tbtrfs_free_path(path);\n+\t\treturn NULL;\n+\t}\n+\n+\treturn res;\n+}\n+\n+static inline u32 btrfs_path_item_size(struct btrfs_path *p)\n+{\n+\treturn p->nodes[0]->leaf.items[p->slots[0]].size;\n+}\n+\n+static inline void *btrfs_leaf_data(struct btrfs_leaf *leaf, u32 slot)\n+{\n+\treturn ((u8 *) leaf) + sizeof(struct btrfs_header)\n+\t       + leaf->items[slot].offset;\n+}\n+\n+static inline void *btrfs_path_leaf_data(struct btrfs_path *p)\n+{\n+\treturn btrfs_leaf_data(&p->nodes[0]->leaf, p->slots[0]);\n+}\n+\n+#define btrfs_item_ptr(l,s,t)\t\t\t\\\n+\t((t *) btrfs_leaf_data((l),(s)))\n+\n+#define btrfs_path_item_ptr(p,t)\t\t\\\n+\t((t *) btrfs_path_leaf_data((p)))\n+\n+#endif /* __BTRFS_CTREE_H__ */\n",
    "prefixes": [
        "U-Boot",
        "4/9"
    ]
}