mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-29 00:37:15 +00:00
hv: Move uuid_is_equal to util.h
This patch moves uuid_is_equal from vm_config.c to util.h as inline API. Tracked-On: #6320 Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
This commit is contained in:
parent
32d6ead8de
commit
975ff33e01
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <asm/vm_config.h>
|
#include <asm/vm_config.h>
|
||||||
|
#include <util.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @pre vm_id < CONFIG_MAX_VM_NUM
|
* @pre vm_id < CONFIG_MAX_VM_NUM
|
||||||
@ -23,16 +24,6 @@ uint8_t get_vm_severity(uint16_t vm_id)
|
|||||||
return vm_configs[vm_id].severity;
|
return vm_configs[vm_id].severity;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2)
|
|
||||||
{
|
|
||||||
uint64_t uuid1_h = *(const uint64_t *)uuid1;
|
|
||||||
uint64_t uuid1_l = *(const uint64_t *)(uuid1 + 8);
|
|
||||||
uint64_t uuid2_h = *(const uint64_t *)uuid2;
|
|
||||||
uint64_t uuid2_l = *(const uint64_t *)(uuid2 + 8);
|
|
||||||
|
|
||||||
return ((uuid1_h == uuid2_h) && (uuid1_l == uuid2_l));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return true if the input uuid is configured in VM
|
* return true if the input uuid is configured in VM
|
||||||
*
|
*
|
||||||
|
@ -57,4 +57,17 @@ static inline uint8_t calculate_checksum8(const void *buf, uint32_t len)
|
|||||||
return (uint8_t)(0x100U - calculate_sum8(buf, len));
|
return (uint8_t)(0x100U - calculate_sum8(buf, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @pre (uuid1 != NULL) && (uuid2 != NULL)
|
||||||
|
*/
|
||||||
|
static inline bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2)
|
||||||
|
{
|
||||||
|
uint64_t uuid1_h = *(const uint64_t *)uuid1;
|
||||||
|
uint64_t uuid1_l = *(const uint64_t *)(uuid1 + 8);
|
||||||
|
uint64_t uuid2_h = *(const uint64_t *)uuid2;
|
||||||
|
uint64_t uuid2_l = *(const uint64_t *)(uuid2 + 8);
|
||||||
|
|
||||||
|
return ((uuid1_h == uuid2_h) && (uuid1_l == uuid2_l));
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* UTIL_H */
|
#endif /* UTIL_H */
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
#define size_t new_size_t
|
#define size_t new_size_t
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#undef size_t
|
#undef size_t
|
||||||
|
#include <util.h>
|
||||||
|
|
||||||
bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2);
|
|
||||||
bool sanitize_vm_config(void);
|
bool sanitize_vm_config(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user