X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fiface-console.c;h=9eedbe595a9f700b5710b1f8564dde6d995a5d7e;hb=0429591d3bfd490a04e467e97b4490977fb54581;hp=d5b17674d563d0359adf85aa6bb94fb10fc3d0b4;hpb=de587d8ab2794607396b8ee9014e98e02d1c0a7e;p=palacios.git diff --git a/linux_module/iface-console.c b/linux_module/iface-console.c index d5b1767..9eedbe5 100644 --- a/linux_module/iface-console.c +++ b/linux_module/iface-console.c @@ -209,6 +209,7 @@ static int console_connect(struct v3_guest * guest, unsigned int cmd, struct palacios_console * cons = priv_data; int cons_fd = 0; unsigned long flags; + int acquired = 0; if (cons->open == 0) { printk("Attempted to connect to unopened console\n"); @@ -216,6 +217,16 @@ static int console_connect(struct v3_guest * guest, unsigned int cmd, } spin_lock_irqsave(&(cons->lock), flags); + if (cons->connected == 0) { + cons->connected = 1; + acquired = 1; + } + spin_unlock_irqrestore(&(cons->lock), flags); + + if (acquired == 0) { + printk("Console already connected\n"); + return -1; + } cons_fd = anon_inode_getfd("v3-cons", &cons_fops, cons, 0); @@ -224,10 +235,8 @@ static int console_connect(struct v3_guest * guest, unsigned int cmd, return cons_fd; } - cons->connected = 1; - v3_deliver_console_event(guest->v3_ctx, NULL); - spin_unlock_irqrestore(&(cons->lock), flags); + printk("Console connected\n");