From 0d60175bd684cf6a14f750579d82dbd1ba97fcbc Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 6 Mar 2013 01:11:59 -0800 Subject: contrib/qemu: Import qemu block source code This qemu block format source code and its minimal dependency files will be used in the next patch to implement a qemu-block format translator. Change-Id: Ic87638972f7ea9b3df84d7a0539512a250c11c1c BUG: 986775 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/5366 Tested-by: Gluster Build System Reviewed-by: Brian Foster --- contrib/qemu/include/monitor/readline.h | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 contrib/qemu/include/monitor/readline.h (limited to 'contrib/qemu/include/monitor/readline.h') diff --git a/contrib/qemu/include/monitor/readline.h b/contrib/qemu/include/monitor/readline.h new file mode 100644 index 000000000..fc9806ecf --- /dev/null +++ b/contrib/qemu/include/monitor/readline.h @@ -0,0 +1,55 @@ +#ifndef READLINE_H +#define READLINE_H + +#include "qemu-common.h" + +#define READLINE_CMD_BUF_SIZE 4095 +#define READLINE_MAX_CMDS 64 +#define READLINE_MAX_COMPLETIONS 256 + +typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque); +typedef void ReadLineCompletionFunc(const char *cmdline); + +typedef struct ReadLineState { + char cmd_buf[READLINE_CMD_BUF_SIZE + 1]; + int cmd_buf_index; + int cmd_buf_size; + + char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1]; + int last_cmd_buf_index; + int last_cmd_buf_size; + + int esc_state; + int esc_param; + + char *history[READLINE_MAX_CMDS]; + int hist_entry; + + ReadLineCompletionFunc *completion_finder; + char *completions[READLINE_MAX_COMPLETIONS]; + int nb_completions; + int completion_index; + + ReadLineFunc *readline_func; + void *readline_opaque; + int read_password; + char prompt[256]; + Monitor *mon; +} ReadLineState; + +void readline_add_completion(ReadLineState *rs, const char *str); +void readline_set_completion_index(ReadLineState *rs, int completion_index); + +const char *readline_get_history(ReadLineState *rs, unsigned int index); + +void readline_handle_byte(ReadLineState *rs, int ch); + +void readline_start(ReadLineState *rs, const char *prompt, int read_password, + ReadLineFunc *readline_func, void *opaque); +void readline_restart(ReadLineState *rs); +void readline_show_prompt(ReadLineState *rs); + +ReadLineState *readline_init(Monitor *mon, + ReadLineCompletionFunc *completion_finder); + +#endif /* !READLINE_H */ -- cgit