qemu-char: Add fe_open tracking
Add tracking of the fe_open state to struct CharDriverState. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364292483-16564-4-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
fee204fd46
commit
c0c4bd2cfa
@ -75,6 +75,7 @@ struct CharDriverState {
|
|||||||
char *label;
|
char *label;
|
||||||
char *filename;
|
char *filename;
|
||||||
int be_open;
|
int be_open;
|
||||||
|
int fe_open;
|
||||||
int avail_connections;
|
int avail_connections;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
QTAILQ_ENTRY(CharDriverState) next;
|
QTAILQ_ENTRY(CharDriverState) next;
|
||||||
|
@ -3412,6 +3412,10 @@ void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo)
|
|||||||
|
|
||||||
void qemu_chr_fe_open(struct CharDriverState *chr)
|
void qemu_chr_fe_open(struct CharDriverState *chr)
|
||||||
{
|
{
|
||||||
|
if (chr->fe_open) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chr->fe_open = 1;
|
||||||
if (chr->chr_guest_open) {
|
if (chr->chr_guest_open) {
|
||||||
chr->chr_guest_open(chr);
|
chr->chr_guest_open(chr);
|
||||||
}
|
}
|
||||||
@ -3419,6 +3423,10 @@ void qemu_chr_fe_open(struct CharDriverState *chr)
|
|||||||
|
|
||||||
void qemu_chr_fe_close(struct CharDriverState *chr)
|
void qemu_chr_fe_close(struct CharDriverState *chr)
|
||||||
{
|
{
|
||||||
|
if (!chr->fe_open) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chr->fe_open = 0;
|
||||||
if (chr->chr_guest_close) {
|
if (chr->chr_guest_close) {
|
||||||
chr->chr_guest_close(chr);
|
chr->chr_guest_close(chr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user