Revision 83ab7950
b/console.h | ||
---|---|---|
160 | 160 |
does not need to include console.h */ |
161 | 161 |
/* monitor.c */ |
162 | 162 |
void monitor_init(CharDriverState *hd, int show_banner); |
163 |
void monitor_start_input(void); |
|
164 | 163 |
void term_puts(const char *str); |
165 | 164 |
void term_vprintf(const char *fmt, va_list ap); |
166 | 165 |
void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); |
b/monitor.c | ||
---|---|---|
76 | 76 |
static uint8_t term_outbuf[1024]; |
77 | 77 |
static int term_outbuf_index; |
78 | 78 |
|
79 |
static void monitor_start_input(void); |
|
80 |
|
|
79 | 81 |
CPUState *mon_cpu = NULL; |
80 | 82 |
|
81 | 83 |
void term_flush(void) |
... | ... | |
2683 | 2685 |
readline_handle_byte(buf[i]); |
2684 | 2686 |
} |
2685 | 2687 |
|
2688 |
static void monitor_start_input(void); |
|
2689 |
|
|
2686 | 2690 |
static void monitor_handle_command1(void *opaque, const char *cmdline) |
2687 | 2691 |
{ |
2688 | 2692 |
monitor_handle_command(cmdline); |
2689 | 2693 |
monitor_start_input(); |
2690 | 2694 |
} |
2691 | 2695 |
|
2692 |
void monitor_start_input(void) |
|
2696 |
static void monitor_start_input(void)
|
|
2693 | 2697 |
{ |
2694 | 2698 |
readline_start("(qemu) ", 0, monitor_handle_command1, NULL); |
2695 | 2699 |
} |
... | ... | |
2730 | 2734 |
hide_banner = !show_banner; |
2731 | 2735 |
|
2732 | 2736 |
qemu_chr_add_handlers(hd, term_can_read, term_read, term_event, NULL); |
2737 |
|
|
2738 |
readline_start("", 0, monitor_handle_command1, NULL); |
|
2733 | 2739 |
} |
2734 | 2740 |
|
2735 | 2741 |
/* XXX: use threads ? */ |
b/vl.c | ||
---|---|---|
5721 | 5721 |
bdrv_flags |= BDRV_O_SNAPSHOT; |
5722 | 5722 |
if (!cache) |
5723 | 5723 |
bdrv_flags |= BDRV_O_DIRECT; |
5724 |
if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) { |
|
5724 |
if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) {
|
|
5725 | 5725 |
fprintf(stderr, "qemu: could not open disk image %s\n", |
5726 | 5726 |
file); |
5727 | 5727 |
return -1; |
... | ... | |
8009 | 8009 |
return -EPERM; |
8010 | 8010 |
} |
8011 | 8011 |
|
8012 |
static BlockDriverState *get_bdrv(int index) |
|
8013 |
{ |
|
8014 |
if (index > nb_drives) |
|
8015 |
return NULL; |
|
8016 |
return drives_table[index].bdrv; |
|
8017 |
} |
|
8018 |
|
|
8012 | 8019 |
static void read_passwords(void) |
8013 | 8020 |
{ |
8014 | 8021 |
BlockDriverState *bs; |
8015 | 8022 |
int i; |
8016 | 8023 |
|
8017 |
for(i = 0; i < nb_drives; i++) { |
|
8018 |
bs = drives_table[i].bdrv; |
|
8019 |
qemu_key_check(bs, bdrv_get_device_name(bs)); |
|
8024 |
for(i = 0; i < 6; i++) { |
|
8025 |
bs = get_bdrv(i); |
|
8026 |
if (bs) |
|
8027 |
qemu_key_check(bs, bdrv_get_device_name(bs)); |
|
8020 | 8028 |
} |
8021 | 8029 |
} |
8022 | 8030 |
|
... | ... | |
8185 | 8193 |
int optind; |
8186 | 8194 |
const char *r, *optarg; |
8187 | 8195 |
CharDriverState *monitor_hd; |
8188 |
int has_monitor; |
|
8189 | 8196 |
const char *monitor_device; |
8190 | 8197 |
const char *serial_devices[MAX_SERIAL_PORTS]; |
8191 | 8198 |
int serial_device_index; |
... | ... | |
9055 | 9062 |
} |
9056 | 9063 |
|
9057 | 9064 |
/* Maintain compatibility with multiple stdio monitors */ |
9058 |
|
|
9059 |
has_monitor = 0; |
|
9060 | 9065 |
if (!strcmp(monitor_device,"stdio")) { |
9061 | 9066 |
for (i = 0; i < MAX_SERIAL_PORTS; i++) { |
9062 | 9067 |
const char *devname = serial_devices[i]; |
... | ... | |
9069 | 9074 |
break; |
9070 | 9075 |
} |
9071 | 9076 |
} |
9072 |
has_monitor = 1; |
|
9073 | 9077 |
} |
9074 | 9078 |
if (monitor_device) { |
9075 | 9079 |
monitor_hd = qemu_chr_open(monitor_device); |
... | ... | |
9078 | 9082 |
exit(1); |
9079 | 9083 |
} |
9080 | 9084 |
monitor_init(monitor_hd, !nographic); |
9081 |
has_monitor = 1; |
|
9082 | 9085 |
} |
9083 | 9086 |
|
9084 | 9087 |
for(i = 0; i < MAX_SERIAL_PORTS; i++) { |
... | ... | |
9139 | 9142 |
} |
9140 | 9143 |
#endif |
9141 | 9144 |
|
9142 |
read_passwords(); |
|
9143 |
|
|
9144 |
if (has_monitor) |
|
9145 |
monitor_start_input(); |
|
9146 |
|
|
9147 | 9145 |
if (loadvm) |
9148 | 9146 |
do_loadvm(loadvm); |
9149 | 9147 |
|
9150 | 9148 |
{ |
9151 | 9149 |
/* XXX: simplify init */ |
9150 |
read_passwords(); |
|
9152 | 9151 |
if (autostart) { |
9153 | 9152 |
vm_start(); |
9154 | 9153 |
} |
Also available in: Unified diff