From 791267a5613be52dada7ca4b634e980e3dab6b2e Mon Sep 17 00:00:00 2001 From: Shelley Chen Date: Fri, 27 Jan 2017 15:34:57 -0800 Subject: poppy: Converting all // comments to /* */ Also, ensuring comments start with capital letter. BUG=chrome-os-partner:61275 BRANCH=None TEST=None. No functionality change. Change-Id: I961236e2b6d95cf0281cd4e3313f465bf12ead9f Signed-off-by: Shelley Chen Reviewed-on: https://chromium-review.googlesource.com/434250 Reviewed-by: Randall Spangler --- firmware/lib/vboot_ui_menu.c | 134 ++++++++++++++++++++++--------------------- 1 file changed, 70 insertions(+), 64 deletions(-) diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c index 414ea117..18c8fe0a 100644 --- a/firmware/lib/vboot_ui_menu.c +++ b/firmware/lib/vboot_ui_menu.c @@ -61,7 +61,7 @@ static void VbTryLegacyMenu(int allowed) else if (0 != RollbackKernelLock(0)) VB2_DEBUG("Error locking kernel versions on legacy boot.\n"); else - VbExLegacy(); /* will not return if successful */ + VbExLegacy(); /* Will not return if successful */ /* If legacy boot fails, beep and return to calling UI loop. */ VbExBeep(120, 400); @@ -218,7 +218,7 @@ typedef enum _VB_TO_DEV_MENU { VB_TO_DEV_COUNT, } VB_TO_DEV_MENU; -// currently we're only supporting +// TODO: currently we're only supporting // english. Will need to somehow find mapping // from language to localization index. typedef enum _VB_LANGUAGES_MENU { @@ -340,7 +340,6 @@ VbError_t vb2_get_current_menu_size(VB_MENU menu, char ***menu_array, int *size) // printouts. VbError_t vb2_print_current_menu() { - // create menu string char m_str[1024]; const char *selected = "==> "; const char *deselected = " "; @@ -353,9 +352,9 @@ VbError_t vb2_print_current_menu() vb2_get_current_menu_size(current_menu, &m, &size); VB2_DEBUG("vb2_print_current_menu:\n"); + /* Create menu string */ for (i = 0; i < size; i++) { if (current_menu_idx == i) { - // add selection to indicate current selection strncat(m_str, selected, strlen(selected)); } else { strncat(m_str, deselected, strlen(deselected)); @@ -412,24 +411,24 @@ VbError_t vb2_update_menu() } /* - * 1. select dev menu - * 2. default to dev boot device + * 1. Select dev menu + * 2. Default to dev boot device */ vb2_set_menu_items(VB_MENU_DEV, next_menu_idx); break; case VB_WARN_DBG_INFO: - /* show debug info */ + /* Show debug info */ break; case VB_WARN_ENABLE_VER: /* - * 1. enable boot verification - * 2. default to the power off option + * 1. Enable boot verification + * 2. Default to the power off option */ vb2_set_menu_items(VB_MENU_TO_NORM, VB_TO_NORM_POWER_OFF); break; case VB_WARN_POWER_OFF: - /* power off machine */ + /* Power off machine */ ret = VBERROR_SHUTDOWN_REQUESTED; break; case VB_WARN_LANGUAGE: @@ -439,34 +438,34 @@ VbError_t vb2_update_menu() VB_LANGUAGES_EN_US); break; default: - /* invalid menu item. Don't update anything. */ + /* Invalid menu item. Don't update anything. */ break; } break; case VB_MENU_DEV: switch(current_menu_idx) { case VB_DEV_NETWORK: - /* boot network image */ + /* Boot network image */ break; case VB_DEV_LEGACY: - /* boot legacy BIOS */ + /* Boot legacy BIOS */ break; case VB_DEV_USB: - /* boot USB image */ + /* Boot USB image */ break; case VB_DEV_DISK: - /* boot developer image */ + /* Boot developer image */ break; case VB_DEV_CANCEL: /* - * 1. cancel (go back to developer warning menu) - * 2. default to power off option. + * 1. Cancel (go back to developer warning menu) + * 2. Default to power off option. */ vb2_set_menu_items(VB_MENU_DEV_WARNING, VB_WARN_POWER_OFF); break; case VB_DEV_POWER_OFF: - /* power off */ + /* Power off */ ret = VBERROR_SHUTDOWN_REQUESTED; break; case VB_DEV_LANGUAGE: @@ -475,25 +474,25 @@ VbError_t vb2_update_menu() VB_LANGUAGES_EN_US); break; default: - /* invalid menu item. don't update anything. */ + /* Invalid menu item. Don't update anything. */ break; } break; case VB_MENU_TO_NORM: switch(current_menu_idx) { case VB_TO_NORM_CONFIRM: - /* confirm enabling verified boot */ + /* Confirm enabling verified boot */ break; case VB_TO_NORM_CANCEL: /* - * 1. cancel (go back to developer warning menu) - * 2. default to power off + * 1. Cancel (go back to developer warning menu) + * 2. Default to power off */ vb2_set_menu_items(VB_MENU_DEV_WARNING, VB_WARN_POWER_OFF); break; case VB_TO_NORM_POWER_OFF: - /* power off */ + /* Power off */ ret = VBERROR_SHUTDOWN_REQUESTED; break; case VB_TO_NORM_LANGUAGE: @@ -502,7 +501,7 @@ VbError_t vb2_update_menu() VB_LANGUAGES_EN_US); break; default: - /* invalid menu item. don't update anything */ + /* Invalid menu item. Don't update anything */ break; } break; @@ -510,8 +509,8 @@ VbError_t vb2_update_menu() switch(current_menu_idx) { case VB_RECOVERY_TO_DEV: /* - * 1. switch to TO_DEV menu - * 2. default to power off option + * 1. Switch to TO_DEV menu + * 2. Default to power off option */ vb2_set_menu_items(VB_MENU_TO_DEV, VB_TO_DEV_POWER_OFF); @@ -526,14 +525,14 @@ VbError_t vb2_update_menu() VB_LANGUAGES_EN_US); break; default: - /* invalid menu item. don't update anything */ + /* Invalid menu item. Don't update anything */ break; } break; case VB_MENU_TO_DEV: switch(current_menu_idx) { case VB_TO_DEV_CONFIRM: - /* confirm enabling dev mode */ + /* Confirm enabling dev mode */ break; case VB_TO_DEV_CANCEL: vb2_set_menu_items(VB_MENU_RECOVERY, @@ -547,7 +546,7 @@ VbError_t vb2_update_menu() VB_LANGUAGES_EN_US); break; default: - /* invalid menu item. don't update anything. */ + /* Invalid menu item. Don't update anything. */ break; } break; @@ -555,10 +554,9 @@ VbError_t vb2_update_menu() switch(current_menu_idx) { default: /* - * Assume that we selected a language. - * Go to previous menu. - * Purposely bypassing vb2_set_menu_items() - * here because need to do in different order. + * Assume that we selected a language. Go to previous + * menu. Purposely bypassing vb2_set_menu_items() here + * because need to do in different order. */ current_menu = prev_menu; current_menu_idx = 0; @@ -661,7 +659,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) } /* Show the dev mode warning screen */ - /* TODO: change this to blank screen? */ + //TODO: change this to blank screen? VbDisplayScreen(ctx, cparams, VB_SCREEN_DEVELOPER_WARNING, 0); vb2_print_current_menu(); @@ -682,7 +680,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) key = VbExKeyboardRead(); switch (key) { case 0: - /* nothing pressed */ + /* Nothing pressed */ break; case '\r': /* Only disable virtual dev switch if allowed by GBB */ @@ -692,7 +690,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) case VB_KEY_UP: vb2_get_current_menu_size(current_menu, NULL, &menu_size); - // do not wrap selection index + /* Do not wrap selection index */ if (current_menu_idx > 0) current_menu_idx--; vb2_print_current_menu(); @@ -701,43 +699,44 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) case VB_KEY_DOWN: vb2_get_current_menu_size(current_menu, NULL, &menu_size); - // do no wrap selection index + /* Do no wrap selection index */ if (current_menu_idx < menu_size-1) current_menu_idx++; vb2_print_current_menu(); break; case VB_BUTTON_POWER: case VB_KEY_RIGHT: - // temporarily using this as a stand in for power button - // until get power button bypassed selected = 1; ret = vb2_update_menu(); - // unfortunately, we need the blanking to get rid of - // artifacts from previous menu printing. + /* + * Unfortunately, we need the blanking to get rid of + * artifacts from previous menu printing. + */ VbDisplayScreen(ctx, cparams, VB_SCREEN_BLANK, 0); VbDisplayScreen(ctx, cparams, VB_SCREEN_DEVELOPER_WARNING, 0); vb2_print_current_menu(); - // probably shutting down + /* Probably shutting down */ if (ret != VBERROR_SUCCESS) { VB2_DEBUG("VbBootDeveloperMenu() - shutting down!\n"); return ret; } - // nothing selected, skip everything else. + /* Nothing selected, skip everything else */ if (selected == 0) break; - // below is all the selection actions - // Display debug information = tab on most chromebooks + /* All the actions associated with selection */ + + /* Display debug information */ if (current_menu == VB_MENU_DEV_WARNING && current_menu_idx == VB_WARN_DBG_INFO) { VbDisplayDebugInfo(ctx, cparams); } - // Ctrl+L = legacy mode + /* Boot Legacy mode */ if (current_menu == VB_MENU_DEV && current_menu_idx == VB_DEV_LEGACY) { VB2_DEBUG("VbBootDeveloperMenu() - " @@ -746,7 +745,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) VbTryLegacyMenu(allow_legacy); } - // Ctrl+U = try USB boot, or beep if failure + /* USB boot, or beep if failure */ if (current_menu == VB_MENU_DEV && current_menu_idx == VB_DEV_USB) { VB2_DEBUG("VbBootDeveloperMenu() - " @@ -763,8 +762,10 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) VbExSleepMs(120); VbExBeep(120, 400); } else { - // Clear the screen to show we get the - // Ctrl+U key press. + /* + * Clear the screen to show we get the + * Ctrl+U key press. + */ VbDisplayScreen(ctx, cparams, VB_SCREEN_BLANK, 0); if (VBERROR_SUCCESS == @@ -772,8 +773,10 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) VbAudioClose(audio); return VBERROR_SUCCESS; } else { - // Show dev mode warning screen - // again + /* + * Show dev mode warning screen + * again + */ VbDisplayScreen(ctx, cparams, VB_SCREEN_DEVELOPER_WARNING, @@ -782,7 +785,7 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) } } - /* Ctrl+D = dismiss warning; advance to timeout */ + /* Boot developer mode: advance to timeout */ if (current_menu == VB_MENU_DEV && current_menu_idx == VB_DEV_DISK) { VB2_DEBUG("VbBootDeveloperMenu() - " @@ -791,14 +794,16 @@ VbError_t vb2_developer_menu(struct vb2_context *ctx, VbCommonParams *cparams) goto fallout; } - /* enabling verified boot */ + /* Enabling verified boot */ if (current_menu == VB_MENU_TO_NORM && current_menu_idx == VB_TO_NORM_CONFIRM) { - // See if we should disable virtual dev-mode - // switch. + /* + * See if we should disable virtual dev-mode + * switch. + */ VB2_DEBUG("%s shared->flags=0x%x\n", __func__, shared->flags); - // Ignore space in VbUserConfirmsMenu()... + /* Ignore space in VbUserConfirmsMenu()... */ VB2_DEBUG("%s() - leaving dev-mode.\n", __func__); vb2_nv_set(ctx, VB2_NV_DISABLE_DEV_REQUEST, @@ -909,7 +914,8 @@ VbError_t vb2_recovery_menu(struct vb2_context *ctx, VbCommonParams *cparams) /* Loop and wait for a recovery image */ VB2_DEBUG("VbBootRecoveryMenu() waiting for a recovery image\n"); - // initialize menu to recovery menu. + + /* Initialize menu to recovery menu. */ current_menu = VB_MENU_RECOVERY; prev_menu = VB_MENU_RECOVERY; current_menu_idx = VB_RECOVERY_POWER_OFF; @@ -967,17 +973,17 @@ VbError_t vb2_recovery_menu(struct vb2_context *ctx, VbCommonParams *cparams) break; case VB_BUTTON_POWER: case VB_KEY_RIGHT: - // temporarily using this as a stand in for - // power button until get power button bypassed VB2_DEBUG("VbBootRecoveryMenu() - pressed key VB_KEY_RIGHT (SELECT)\n"); selected = 1; ret = vb2_update_menu(); if (current_menu != VB_MENU_RECOVERY || current_menu_idx != VB_RECOVERY_DBG_INFO) { - // unfortunately we need this screen - // blanking to clear previous menus - // printed. + /* + * Unfortunately we need this screen + * blanking to clear previous menus + * printed. + */ VbDisplayScreen(ctx, cparams, VB_SCREEN_BLANK, 0); VbDisplayScreen(ctx, cparams, VBERROR_NO_DISK_FOUND == retval ? VB_SCREEN_RECOVERY_INSERT : @@ -986,13 +992,13 @@ VbError_t vb2_recovery_menu(struct vb2_context *ctx, VbCommonParams *cparams) vb2_print_current_menu(); } - // probably shutting down + /* Probably shutting down */ if (ret != VBERROR_SUCCESS) { VB2_DEBUG("VbBootRecoveryMenu() - update_menu - shutting down!\n"); return ret; } - // nothing selected, skip everything else. + /* Nothing selected, skip everything else. */ if (selected == 0) break; -- cgit v1.2.1