[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V5 1/7] monitor: avoid direct use of global *cur
From: |
Wenchao Xia |
Subject: |
Re: [Qemu-devel] [PATCH V5 1/7] monitor: avoid direct use of global *cur_mon in completion functions |
Date: |
Wed, 10 Jul 2013 14:06:58 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
δΊ 2013-7-9 22:14, Luiz Capitulino ει:
On Tue, 09 Jul 2013 22:03:42 +0800
Wenchao Xia <address@hidden> wrote:
You could pass cur_mon to readline_completion() in readline_handle_byte()
to avoid all this, but it would be preferable to clarify the matter.
This is also another benefit of having readline_completion() in a
different patch, you can (and should!) clarify this point in the commit
log along with testing results.
OK, I'll test multiple monitors case.
Do you have an example about how invoke qemu with multiple monitor?
Do you have recommendation about the way to connect to qemu's moniotr?
I tried pty with minicom but it seems not good, so wonder your method.
You can open telnet sessions:
-monitor tcp:0:4444,server,nowait,telnet \
-monitor tcp:0:4445,server,nowait,telnet
But note that, besides testing, I'd like to see an explanation on
the commitlog as to why dropping cur_mon doesn't brake the current
code.
Thanks for the info, it works now.
After re-check the code in readline_completion(), I think current
code with cur_mon, is redundant:
mon = cur_mon;
...
} else {
monitor_printf(mon, "\n");
...
...
for(i = 0; i < rs->nb_completions; i++) {
monitor_printf(rs->mon, "%-*s", max_width, rs->completions[i]);
if (++j == nb_cols || i == (rs->nb_completions - 1)) {
monitor_printf(rs->mon, "\n");
j = 0;
}
}
readline_show_prompt(rs);
}
You can see later, it uses rs->mon to printf the auto completion
result, so the first 'monitor_printf(mon, "\n");', is used to start
a new line for the completion result, so mon should always be equal
to rs->mon, I can't think out a case that one monitor instance does
not print tips in new line while another monitor instance does. I'll
add a few line for it in commit message.
About pass cur_mon to readline_completion(), I think parameter *rs
already have member rs->mon, allowing specify *mon would specify
the encapsulation a bit.
--
Best Regards
Wenchao Xia