mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 01:37:44 +00:00
hv: treewide: fix 'inline function should be declared static'
MISRAC does not allow the use of an inline function with external linkage. What this patch does: - Add the static keyword for the function that is only used in the definition file. - Remove the inline keyword for the function that is used in multiple files. v1 -> v2: * Move some functions to headers as static inline function if it is possible Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
@@ -93,16 +93,11 @@ enum vm_paging_mode {
|
||||
/*
|
||||
* VM related APIs
|
||||
*/
|
||||
bool is_vm0(struct vm *vm);
|
||||
bool vm_lapic_disabled(struct vm *vm);
|
||||
uint64_t vcpumask2pcpumask(struct vm *vm, uint64_t vdmask);
|
||||
|
||||
int gva2gpa(struct vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_code);
|
||||
|
||||
struct vcpu *get_primary_vcpu(struct vm *vm);
|
||||
struct vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id);
|
||||
struct vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id);
|
||||
|
||||
enum vm_paging_mode get_vcpu_paging_mode(struct vcpu *vcpu);
|
||||
|
||||
void init_e820(void);
|
||||
|
@@ -193,6 +193,53 @@ struct vm_description {
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline bool is_vm0(struct vm *vm)
|
||||
{
|
||||
return (vm->vm_id) == 0U;
|
||||
}
|
||||
|
||||
static inline struct vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id)
|
||||
{
|
||||
uint16_t i;
|
||||
struct vcpu *vcpu;
|
||||
|
||||
foreach_vcpu(i, vm, vcpu) {
|
||||
if (vcpu->vcpu_id == vcpu_id) {
|
||||
return vcpu;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id)
|
||||
{
|
||||
uint16_t i;
|
||||
struct vcpu *vcpu;
|
||||
|
||||
foreach_vcpu(i, vm, vcpu) {
|
||||
if (vcpu->pcpu_id == pcpu_id) {
|
||||
return vcpu;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct vcpu *get_primary_vcpu(struct vm *vm)
|
||||
{
|
||||
uint16_t i;
|
||||
struct vcpu *vcpu;
|
||||
|
||||
foreach_vcpu(i, vm, vcpu) {
|
||||
if (is_vcpu_bsp(vcpu)) {
|
||||
return vcpu;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int shutdown_vm(struct vm *vm);
|
||||
void pause_vm(struct vm *vm);
|
||||
void resume_vm(struct vm *vm);
|
||||
|
Reference in New Issue
Block a user