Introducing hf_vcpu_count_t for vCPU count.

Return 0 rather than -1 on error.

Change-Id: I95cdde0744ef13e9bd748ce8ed32439d3d7f2010
diff --git a/src/api.c b/src/api.c
index 5506a04..bb954a6 100644
--- a/src/api.c
+++ b/src/api.c
@@ -224,20 +224,22 @@
 }
 
 /**
- * Returns the number of vcpus configured in the given VM.
+ * Returns the number of vCPUs configured in the given VM, or 0 if there is no
+ * such VM or the caller is not the primary VM.
  */
-int64_t api_vcpu_get_count(spci_vm_id_t vm_id, const struct vcpu *current)
+spci_vcpu_count_t api_vcpu_get_count(spci_vm_id_t vm_id,
+				     const struct vcpu *current)
 {
 	struct vm *vm;
 
 	/* Only the primary VM needs to know about vcpus for scheduling. */
 	if (current->vm->id != HF_PRIMARY_VM_ID) {
-		return -1;
+		return 0;
 	}
 
 	vm = vm_find(vm_id);
 	if (vm == NULL) {
-		return -1;
+		return 0;
 	}
 
 	return vm->vcpu_count;
diff --git a/src/vm.c b/src/vm.c
index 0119fd8..f1b79e6 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -27,7 +27,8 @@
 static struct vm vms[MAX_VMS];
 static spci_vm_count_t vm_count;
 
-bool vm_init(uint32_t vcpu_count, struct mpool *ppool, struct vm **new_vm)
+bool vm_init(spci_vcpu_count_t vcpu_count, struct mpool *ppool,
+	     struct vm **new_vm)
 {
 	uint32_t i;
 	struct vm *vm;