Convert enum fields to upper snakecase.

Change-Id: I0fb65ecf523b3e5303344737c54bbe82c5e93ee0
diff --git a/src/api.c b/src/api.c
index a726404..c9246c6 100644
--- a/src/api.c
+++ b/src/api.c
@@ -108,7 +108,7 @@
 		.code = HF_VCPU_RUN_PREEMPTED,
 	};
 
-	return api_switch_to_primary(current, ret, vcpu_state_ready);
+	return api_switch_to_primary(current, ret, VCPU_STATE_READY);
 }
 
 /**
@@ -122,7 +122,7 @@
 	};
 
 	return api_switch_to_primary(current, ret,
-				     vcpu_state_blocked_interrupt);
+				     VCPU_STATE_BLOCKED_INTERRUPT);
 }
 
 /**
@@ -141,7 +141,7 @@
 		return NULL;
 	}
 
-	return api_switch_to_primary(current, ret, vcpu_state_ready);
+	return api_switch_to_primary(current, ret, VCPU_STATE_READY);
 }
 
 /**
@@ -167,7 +167,7 @@
 
 	/* TODO: free resources once all vCPUs abort. */
 
-	return api_switch_to_primary(current, ret, vcpu_state_aborted);
+	return api_switch_to_primary(current, ret, VCPU_STATE_ABORTED);
 }
 
 /**
@@ -227,7 +227,7 @@
 	struct wait_entry *entry;
 	struct vm *vm = locked_vm.vm;
 
-	if (vm->mailbox.state != mailbox_state_empty ||
+	if (vm->mailbox.state != MAILBOX_STATE_EMPTY ||
 	    vm->mailbox.recv == NULL || list_empty(&vm->mailbox.waiter_list)) {
 		/* The mailbox is not writable or there are no waiters. */
 		return NULL;
@@ -303,7 +303,7 @@
 			.wake_up.vm_id = target_vm->id,
 			.wake_up.vcpu = target_vcpu - target_vm->vcpus,
 		};
-		*next = api_switch_to_primary(current, ret, vcpu_state_ready);
+		*next = api_switch_to_primary(current, ret, VCPU_STATE_READY);
 	}
 
 out:
@@ -340,7 +340,7 @@
 		sl_lock(&vcpu->lock);
 
 		/* The VM needs to be locked to deliver mailbox messages. */
-		need_vm_lock = vcpu->state == vcpu_state_blocked_mailbox;
+		need_vm_lock = vcpu->state == VCPU_STATE_BLOCKED_MAILBOX;
 		if (need_vm_lock) {
 			sl_unlock(&vcpu->lock);
 			sl_lock(&vcpu->vm->lock);
@@ -351,7 +351,7 @@
 			break;
 		}
 
-		if (vcpu->state == vcpu_state_running) {
+		if (vcpu->state == VCPU_STATE_RUNNING) {
 			/*
 			 * vCPU is running on another pCPU.
 			 *
@@ -372,34 +372,34 @@
 	}
 
 	if (atomic_load_explicit(&vcpu->vm->aborting, memory_order_relaxed)) {
-		if (vcpu->state != vcpu_state_aborted) {
+		if (vcpu->state != VCPU_STATE_ABORTED) {
 			dlog("Aborting VM %u vCPU %u\n", vcpu->vm->id,
 			     vcpu_index(vcpu));
-			vcpu->state = vcpu_state_aborted;
+			vcpu->state = VCPU_STATE_ABORTED;
 		}
 		ret = false;
 		goto out;
 	}
 
 	switch (vcpu->state) {
-	case vcpu_state_running:
-	case vcpu_state_off:
-	case vcpu_state_aborted:
+	case VCPU_STATE_RUNNING:
+	case VCPU_STATE_OFF:
+	case VCPU_STATE_ABORTED:
 		ret = false;
 		goto out;
 
-	case vcpu_state_blocked_mailbox:
+	case VCPU_STATE_BLOCKED_MAILBOX:
 		/*
 		 * A pending message allows the vCPU to run so the message can
 		 * be delivered directly.
 		 */
-		if (vcpu->vm->mailbox.state == mailbox_state_received) {
+		if (vcpu->vm->mailbox.state == MAILBOX_STATE_RECEIVED) {
 			arch_regs_set_retval(&vcpu->regs, SPCI_SUCCESS);
-			vcpu->vm->mailbox.state = mailbox_state_read;
+			vcpu->vm->mailbox.state = MAILBOX_STATE_READ;
 			break;
 		}
 		/* Fall through. */
-	case vcpu_state_blocked_interrupt:
+	case VCPU_STATE_BLOCKED_INTERRUPT:
 		/* Allow virtual interrupts to be delivered. */
 		if (vcpu->interrupts.enabled_and_pending_count > 0) {
 			break;
@@ -416,7 +416,7 @@
 		 */
 		if (arch_timer_enabled(&vcpu->regs)) {
 			run_ret->code =
-				vcpu->state == vcpu_state_blocked_mailbox
+				vcpu->state == VCPU_STATE_BLOCKED_MAILBOX
 					? HF_VCPU_RUN_WAIT_FOR_MESSAGE
 					: HF_VCPU_RUN_WAIT_FOR_INTERRUPT;
 			run_ret->sleep.ns =
@@ -426,13 +426,13 @@
 		ret = false;
 		goto out;
 
-	case vcpu_state_ready:
+	case VCPU_STATE_READY:
 		break;
 	}
 
 	/* It has been decided that the vCPU should be run. */
 	vcpu->cpu = current->cpu;
-	vcpu->state = vcpu_state_running;
+	vcpu->state = VCPU_STATE_RUNNING;
 
 	/*
 	 * Mark the registers as unavailable now that we're about to reflect
@@ -563,7 +563,7 @@
 	 * Switch back to the primary VM, informing it that there are waiters
 	 * that need to be notified.
 	 */
-	*next = api_switch_to_primary(current, ret, vcpu_state_ready);
+	*next = api_switch_to_primary(current, ret, VCPU_STATE_READY);
 
 	return 0;
 }
@@ -784,7 +784,7 @@
 
 	sl_lock(&to->lock);
 
-	if (to->mailbox.state != mailbox_state_empty ||
+	if (to->mailbox.state != MAILBOX_STATE_EMPTY ||
 	    to->mailbox.recv == NULL) {
 		/*
 		 * Fail if the target isn't currently ready to receive data,
@@ -816,18 +816,18 @@
 
 	/* Messages for the primary VM are delivered directly. */
 	if (to->id == HF_PRIMARY_VM_ID) {
-		to->mailbox.state = mailbox_state_read;
+		to->mailbox.state = MAILBOX_STATE_READ;
 		*next = api_switch_to_primary(current, primary_ret,
-					      vcpu_state_ready);
+					      VCPU_STATE_READY);
 		goto out;
 	}
 
-	to->mailbox.state = mailbox_state_received;
+	to->mailbox.state = MAILBOX_STATE_RECEIVED;
 
 	/* Return to the primary VM directly or with a switch. */
 	if (from->id != HF_PRIMARY_VM_ID) {
 		*next = api_switch_to_primary(current, primary_ret,
-					      vcpu_state_ready);
+					      VCPU_STATE_READY);
 	}
 
 out:
@@ -861,8 +861,8 @@
 	sl_lock(&vm->lock);
 
 	/* Return pending messages without blocking. */
-	if (vm->mailbox.state == mailbox_state_received) {
-		vm->mailbox.state = mailbox_state_read;
+	if (vm->mailbox.state == MAILBOX_STATE_RECEIVED) {
+		vm->mailbox.state = MAILBOX_STATE_READ;
 		return_code = SPCI_SUCCESS;
 		goto out;
 	}
@@ -895,7 +895,7 @@
 		};
 
 		*next = api_switch_to_primary(current, run_return,
-					      vcpu_state_blocked_mailbox);
+					      VCPU_STATE_BLOCKED_MAILBOX);
 	}
 out:
 	sl_unlock(&vm->lock);
@@ -1002,17 +1002,17 @@
 
 	vm_lock(vm, &locked);
 	switch (vm->mailbox.state) {
-	case mailbox_state_empty:
+	case MAILBOX_STATE_EMPTY:
 		ret = 0;
 		break;
 
-	case mailbox_state_received:
+	case MAILBOX_STATE_RECEIVED:
 		ret = -1;
 		break;
 
-	case mailbox_state_read:
+	case MAILBOX_STATE_READ:
 		ret = api_waiter_result(locked, current, next);
-		vm->mailbox.state = mailbox_state_empty;
+		vm->mailbox.state = MAILBOX_STATE_EMPTY;
 		break;
 	}
 	vm_unlock(&locked);