On Mon, 27 Aug 2007 17:37:37 -0400
Josef Bacik <jbacik@redhat.com> wrote:
> Hello,
>
> Ok I've just about got this xattr stuff working, the name is getting
> saved properly, but the data isn't. This is what I'm doing to
write
> the data in the dir item
>
> btrfs_set_dir_data_len(dir_item, data_len);
> name_ptr = (char *)(dir_item + 1);
> data_ptr = (char *)(name_ptr + name_len + 1);
>
> btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name,
> name_len); btrfs_memcpy(root, path->nodes[0]->b_data, data_ptr, data,
> data_len); btrfs_mark_buffer_dirty(path->nodes[0]);
>
> this keeps resulting in garbage when i try to read it off the disk.
> What am I missing? Thank you,
It works best to hack knowledge of your stuff into
btrfsprogs/print-tree.c, so that debug-tree will show you what is going
on. But, the length of the item in the item header needs to include
the length of the data, so my guess is that's the problem. If you post
the code I can take a look.
-chris