rust-vmm / vmm-sys-util

Helpers and utilities used by multiple rust-vmm components and VMMs
BSD 3-Clause "New" or "Revised" License
79 stars 64 forks source link

fix fam issues #118

Closed lauralt closed 3 years ago

lauralt commented 3 years ago

85, #99, #104

lauralt commented 3 years ago

@jiangliu was there any other concern regarding #104 besides the Clone and PartialEq implementations? I've noticed in vfio_ioctls the following structure:

struct vfio_region_info_with_cap {
    region_info: vfio_region_info,
    cap_info: __IncompleteArrayField<u8>,
}

which can be somehow seen as a fam struct even though the entries length is based on the region_info fields.

generate_fam_struct_impl indeed won't work for a structure that doesn't contain its own len field, but I don't think fixing this should be part of #104 since that macro is somehow of a helper (and I guess FamStruct can be implemented for the above structure as well). What do you think?

jiangliu commented 3 years ago

@jiangliu was there any other concern regarding #104 besides the Clone and PartialEq implementations? I've noticed in vfio_ioctls the following structure:

struct vfio_region_info_with_cap {
    region_info: vfio_region_info,
    cap_info: __IncompleteArrayField<u8>,
}

which can be somehow seen as a fam struct even though the entries length is based on the region_info fields.

generate_fam_struct_impl indeed won't work for a structure that doesn't contain its own len field, but I don't think fixing this should be part of #104 since that macro is somehow of a helper (and I guess FamStruct can be implemented for the above structure as well). What do you think?

When I was working on vfio-ioctls, I investigated the way to use generate_fam_struct_impl. But seems it's a little complex, so maybe it's ok to keep the hand-writing version for vfio-ioctls.