On Tue, 27 Aug 2013 20:38:12 +0800 Wenchao Xia <[email protected]> wrote:
> This series make auto completion and help functions works normal for sub > command, by using reentrant functions. In order to do that, global variables > are not directly used in those functions any more. With this series, cmd_table > is a member of structure Monitor so it is possible to create a monitor with > different command table now, auto completion will work in that monitor. In > short, "info" is not treated as a special case now, this series ensure help > and auto complete function works normal for any sub command added in the > future. > > Patch 5 replaced cur_mon with rs->mon, it is safe because: > monitor_init() calls readline_init() which initialize mon->rs, result is > mon->rs->mon == mon. Then qemu_chr_add_handlers() is called, which make > monitor_read() function take *mon as its opaque. Later, when user input, > monitor_read() is called, where cur_mon is set to *mon by "cur_mon = opaque". > If qemu's monitors run in one thread, then later in readline_handle_byte() > and readline_comletion(), cur_mon is actually equal to rs->mon, in another > word, it points to the monitor instance, so it is safe to replace *cur_mon > in those functions. > > Thanks for Luiz and Eric for reviewing. Applied to the qmp branch, thanks. Btw, I'm assuming that the patches that contain Eric's reviewed-by didn't change since he reviewed them. Personally, I don't think it's right to carry reviewed-bys when the patch changes, even if it's something small or obvious.
