On Mon, Jan 21, 2019 at 09:44:36AM +0100, Christoph Hellwig wrote: > On Fri, Jan 11, 2019 at 02:48:03PM +0100, David Sterba wrote: > > > if (is_fstree(objectid)) > > > - uuid_le_gen(&uuid); > > > - memcpy(root->root_item.uuid, uuid.b, BTRFS_UUID_SIZE); > > > + guid_gen((guid_t *)&root->root_item.uuid); > > > + else > > > + guid_copy((guid_t *)&root->root_item.uuid, &guid_null); > > > > I don't like the type casts, a simple wrapper would be better I think. > > It seems like we should use the guid_t type in the actual strutures > instead of doing this casting.
The uuid is part of several on-disk structures, so the definition with u8[BTRFS_UUID_SIZE] makes the size and alignment clear, also the constant is verified to be 16. I find it quite useful that all the on-disk definitions use only the basic types like u8 or u64. I'd rather not touch the definitions but rather add a glue for the guid_t API and the raw buffers.