@@ -197,16 +197,15 @@ bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp)
if (CHARDEV_IS_MUX(s)) {
MuxChardev *d = MUX_CHARDEV(s);
- if (d->mux_cnt >= MAX_MUX) {
+ if (d->fe_cnt >= MAX_MUX) {
error_setg(errp,
"too many uses of multiplexed chardev '%s'"
" (maximum is " stringify(MAX_MUX) ")",
s->label);
return false;
}
-
- d->backends[d->mux_cnt] = b;
- tag = d->mux_cnt++;
+ d->backends[d->fe_cnt] = b;
+ tag = d->fe_cnt++;
} else if (s->be) {
error_setg(errp, "chardev '%s' is already in use", s->label);
return false;
@@ -168,9 +168,9 @@ static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
qemu_chr_be_event(chr, CHR_EVENT_BREAK);
break;
case 'c':
- assert(d->mux_cnt > 0); /* handler registered with first fe */
+ assert(d->fe_cnt > 0); /* handler registered with first fe */
/* Switch to the next registered device */
- mux_set_focus(chr, (d->focus + 1) % d->mux_cnt);
+ mux_set_focus(chr, (d->focus + 1) % d->fe_cnt);
break;
case 't':
d->timestamps = !d->timestamps;
@@ -248,8 +248,8 @@ void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event)
return;
}
- /* Send the event to all registered listeners */
- for (i = 0; i < d->mux_cnt; i++) {
+ /* Send the event to all registered frontend listeners */
+ for (i = 0; i < d->fe_cnt; i++) {
mux_chr_send_event(d, i, event);
}
}
@@ -277,7 +277,7 @@ static void char_mux_finalize(Object *obj)
MuxChardev *d = MUX_CHARDEV(obj);
int i;
- for (i = 0; i < d->mux_cnt; i++) {
+ for (i = 0; i < d->fe_cnt; i++) {
CharBackend *be = d->backends[i];
if (be) {
be->chr = NULL;
@@ -305,7 +305,7 @@ void mux_set_focus(Chardev *chr, int focus)
MuxChardev *d = MUX_CHARDEV(chr);
assert(focus >= 0);
- assert(focus < d->mux_cnt);
+ assert(focus < d->fe_cnt);
if (d->focus != -1) {
mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT);
@@ -333,7 +333,7 @@ static bool qemu_chr_is_busy(Chardev *s)
{
if (CHARDEV_IS_MUX(s)) {
MuxChardev *d = MUX_CHARDEV(s);
- return d->mux_cnt >= 0;
+ return d->fe_cnt >= 0;
} else {
return s->be != NULL;
}
@@ -38,7 +38,7 @@ struct MuxChardev {
CharBackend *backends[MAX_MUX];
CharBackend chr;
int focus;
- int mux_cnt;
+ int fe_cnt;
int term_got_escape;
int max_size;
/* Intermediate input buffer catches escape sequences even if the
In the following patches `MuxChardev` struct will suport backend multiplexing, the `mux_cnt` struct member has very common name and does not reflect the actual meaning: number of frontends attached to a mux. This patch renames the `mux_cnt` to `fe_cnt`. No other functional changes made. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com> Cc: qemu-devel@nongnu.org --- chardev/char-fe.c | 7 +++---- chardev/char-mux.c | 12 ++++++------ chardev/char.c | 2 +- chardev/chardev-internal.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-)