__le64 offset;
} __attribute__ ((__packed__));
+struct btrfs_inode_ref {
+ __le16 name_len;
+ /* name goes here */
+} __attribute__ ((__packed__));
+
struct btrfs_inode_timespec {
__le64 sec;
__le32 nsec;
* the FS
*/
#define BTRFS_INODE_ITEM_KEY 1
-#define BTRFS_XATTR_ITEM_KEY 2
+#define BTRFS_INODE_REF_KEY 2
+#define BTRFS_XATTR_ITEM_KEY 8
/* reserve 3-15 close to the inode for later flexibility */
BTRFS_SETGET_STACK_FUNCS(extent_refs, struct btrfs_extent_item, refs, 32);
+BTRFS_SETGET_STACK_FUNCS(inode_ref_name_len, struct btrfs_inode_ref,
+ name_len, 16);
+
+
BTRFS_SETGET_STACK_FUNCS(ref_root, struct btrfs_extent_ref, root, 64);
BTRFS_SETGET_STACK_FUNCS(ref_generation, struct btrfs_extent_ref,
generation, 64);
}
return 0;
}
+
+static int print_inode_ref_item(struct btrfs_item *item,
+ struct btrfs_inode_ref *ref)
+{
+ u32 total;
+ u32 cur = 0;
+ u32 len;
+ total = btrfs_item_size(item);
+ while(cur < total) {
+ len = btrfs_inode_ref_name_len(ref);
+ printf("\t\tinode ref name: %.*s\n", len, (char *)(ref + 1));
+ len += sizeof(*ref);
+ ref = (struct btrfs_inode_ref *)((char *)ref + len);
+ cur += len;
+ }
+ return 0;
+}
+
void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l)
{
int i;
struct btrfs_csum_item *ci;
struct btrfs_block_group_item *bi;
struct btrfs_extent_ref *ref;
+ struct btrfs_inode_ref *iref;
u32 type;
printf("leaf %llu ptrs %d free space %d generation %llu owner %llu\n",
btrfs_inode_mode(ii),
btrfs_inode_nlink(ii));
break;
+ case BTRFS_INODE_REF_KEY:
+ iref = btrfs_item_ptr(l, i, struct btrfs_inode_ref);
+ print_inode_ref_item(l->items + i, iref);
+ break;
case BTRFS_DIR_ITEM_KEY:
di = btrfs_item_ptr(l, i, struct btrfs_dir_item);
print_dir_item(l->items + i, di);