mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-30 23:16:40 +00:00
hv:Change shell_init to void type
Remove shell_construct Change shell_init to void type Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
a1923dd6e0
commit
311787032a
@ -1159,17 +1159,3 @@ void shell_special_serial(struct shell *p_shell, uint8_t ch)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int shell_construct(struct shell **p_shell)
|
||||
{
|
||||
int status = 0;
|
||||
/* Allocate memory for shell session */
|
||||
*p_shell = (struct shell *) calloc(1, sizeof(**p_shell));
|
||||
|
||||
if ((*p_shell) == NULL) {
|
||||
pr_err("Error: out of memory");
|
||||
status = -ENOMEM;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -139,7 +139,6 @@ struct shell_cmd {
|
||||
|
||||
/* Global function prototypes */
|
||||
int shell_show_req_info(struct shell *p_shell, int argc, char **argv);
|
||||
int shell_construct(struct shell **p_shell);
|
||||
int shell_cmd_help(struct shell *p_shell, int argc, char **argv);
|
||||
int shell_list_vm(struct shell *p_shell, int argc, char **argv);
|
||||
int shell_list_vcpu(struct shell *p_shell, int argc, char **argv);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "shell_internal.h"
|
||||
|
||||
/* Shell that uses serial I/O */
|
||||
static struct shell *serial_session;
|
||||
static struct shell serial_session;
|
||||
|
||||
static struct shell_cmd acrn_cmd[] = {
|
||||
{
|
||||
@ -133,31 +133,22 @@ static struct shell_cmd acrn_cmd[] = {
|
||||
},
|
||||
};
|
||||
|
||||
int shell_init(void)
|
||||
void shell_init(void)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = shell_construct(&serial_session);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Set the function pointers for the shell i/p and o/p functions */
|
||||
serial_session->session_io.io_init = shell_init_serial;
|
||||
serial_session->session_io.io_deinit = shell_terminate_serial;
|
||||
serial_session->session_io.io_puts = shell_puts_serial;
|
||||
serial_session->session_io.io_getc = shell_getc_serial;
|
||||
serial_session->session_io.io_special = shell_special_serial;
|
||||
serial_session->session_io.io_echo_on = (bool)true;
|
||||
serial_session.session_io.io_init = shell_init_serial;
|
||||
serial_session.session_io.io_deinit = shell_terminate_serial;
|
||||
serial_session.session_io.io_puts = shell_puts_serial;
|
||||
serial_session.session_io.io_getc = shell_getc_serial;
|
||||
serial_session.session_io.io_special = shell_special_serial;
|
||||
serial_session.session_io.io_echo_on = (bool)true;
|
||||
|
||||
serial_session->shell_cmd = acrn_cmd;
|
||||
serial_session->cmd_count = ARRAY_SIZE(acrn_cmd);
|
||||
serial_session.shell_cmd = acrn_cmd;
|
||||
serial_session.cmd_count = ARRAY_SIZE(acrn_cmd);
|
||||
/* Initialize the handler for the serial port that will be used
|
||||
* for shell i/p and o/p
|
||||
*/
|
||||
status = serial_session->session_io.io_init(serial_session);
|
||||
|
||||
return status;
|
||||
serial_session.session_io.io_init(&serial_session);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,7 +185,7 @@ int shell_set_name(struct shell *p_shell, const char *name)
|
||||
void shell_kick_session(void)
|
||||
{
|
||||
/* Kick the shell */
|
||||
kick_shell(serial_session);
|
||||
kick_shell(&serial_session);
|
||||
}
|
||||
|
||||
int shell_switch_console(void)
|
||||
@ -208,7 +199,7 @@ int shell_switch_console(void)
|
||||
|
||||
vuart->active = false;
|
||||
/* Output that switching to ACRN shell */
|
||||
shell_puts(serial_session,
|
||||
shell_puts(&serial_session,
|
||||
"\r\n\r\n----- Entering ACRN Shell -----\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,11 +11,11 @@
|
||||
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 0 /* CTRL + SPACE */
|
||||
|
||||
#ifdef HV_DEBUG
|
||||
int shell_init(void);
|
||||
void shell_init(void);
|
||||
void shell_kick_session(void);
|
||||
int shell_switch_console(void);
|
||||
#else
|
||||
static inline int shell_init(void) { return 0; }
|
||||
static inline void shell_init(void) {}
|
||||
static inline void shell_kick_session(void) {}
|
||||
static inline int shell_switch_console(void) { return 0; }
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user