// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: dbhistry - debugger HISTORY command * * Copyright (C) 2000 - 2018, Intel Corp. * *****************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acdebug.h" #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME("dbhistry") #define HI_NO_HISTORY 0 #define HI_RECORD_HISTORY 1 #define HISTORY_SIZE 40 typedef struct history_info { char *command; u32 cmd_num; } HISTORY_INFO; static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE]; static u16 acpi_gbl_lo_history = 0; static u16 acpi_gbl_num_history = 0; static u16 acpi_gbl_next_history_index = 0; u32 acpi_gbl_next_cmd_num = 1; /******************************************************************************* * * FUNCTION: acpi_db_add_to_history * * PARAMETERS: command_line - Command to add * * RETURN: None * * DESCRIPTION: Add a command line to the history buffer. * ******************************************************************************/
void acpi_db_add_to_history(char *command_line) { u16 cmd_len; u16 buffer_len; /* Put command into the next available slot */ cmd_len = (u16)strlen(command_line); if (!cmd_len) { return; } if (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command != NULL) { buffer_len = (u16) strlen(acpi_gbl_history_buffer[acpi_gbl_next_history_index]. command); if (cmd_len > buffer_len) { acpi_os_free(acpi_gbl_history_buffer [acpi_gbl_next_history_index].command); acpi_gbl_history_buffer[acpi_gbl_next_history_index]. command = acpi_os_allocate(cmd_len + 1); } } else { acpi_gbl_history_buffer[acpi_gbl_next_history_index].command = acpi_os_allocate(cmd_len + 1); } strcpy(acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line); acpi_gbl_history_buffer[acpi_gbl_next_history_index].cmd_num = acpi_gbl_next_cmd_num; /* Adjust indexes */ if ((acpi_gbl_num_history == HISTORY_SIZE) && (acpi_gbl_next_history_index == acpi_gbl_lo_history)) { acpi_gbl_lo_history++; if (acpi_gbl_lo_history >= HISTORY_SIZE) { acpi_gbl_lo_history = 0; } } acpi_gbl_next_history_index++; if (acpi_gbl_next_history_index >= HISTORY_SIZE) { acpi_gbl_next_history_index = 0; } acpi_gbl_next_cmd_num++; if (acpi_gbl_num_history < HISTORY_SIZE) { acpi_gbl_num_history++; } }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lv Zheng | 193 | 100.00% | 1 | 100.00% |
Total | 193 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Lv Zheng | 78 | 100.00% | 1 | 100.00% |
Total | 78 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Lv Zheng | 49 | 100.00% | 1 | 100.00% |
Total | 49 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Lv Zheng | 87 | 100.00% | 1 | 100.00% |
Total | 87 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Lv Zheng | 484 | 99.59% | 1 | 50.00% |
Erik Schmauss | 2 | 0.41% | 1 | 50.00% |
Total | 486 | 100.00% | 2 | 100.00% |