mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
uuid: Make qemu_uuid_bswap() take and return a QemuUUID
Currently qemu_uuid_bswap() takes a pointer to the QemuUUID to be byte-swapped. This means it can't be used when the UUID to be swapped is in a packed member of a struct. It's also out of line with the general bswap*() functions we provide in bswap.h, which take the value to be swapped and return it. Make qemu_uuid_bswap() take a QemuUUID and return the swapped version. This fixes some clang warnings about taking the address of a packed struct member in block/vdi.c. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
ac928b8ee8
commit
1324f06384
5 changed files with 17 additions and 19 deletions
10
util/uuid.c
10
util/uuid.c
|
@ -110,10 +110,10 @@ int qemu_uuid_parse(const char *str, QemuUUID *uuid)
|
|||
|
||||
/* Swap from UUID format endian (BE) to the opposite or vice versa.
|
||||
*/
|
||||
void qemu_uuid_bswap(QemuUUID *uuid)
|
||||
QemuUUID qemu_uuid_bswap(QemuUUID uuid)
|
||||
{
|
||||
assert(QEMU_PTR_IS_ALIGNED(uuid, sizeof(uint32_t)));
|
||||
bswap32s(&uuid->fields.time_low);
|
||||
bswap16s(&uuid->fields.time_mid);
|
||||
bswap16s(&uuid->fields.time_high_and_version);
|
||||
bswap32s(&uuid.fields.time_low);
|
||||
bswap16s(&uuid.fields.time_mid);
|
||||
bswap16s(&uuid.fields.time_high_and_version);
|
||||
return uuid;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue