diff mbox

[17/25,v6] xen/arm: vpl011: Add a new handle_console_tty function in xenconsole

Message ID 1500296815-10243-18-git-send-email-bhupinder.thakur@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Bhupinder Thakur July 17, 2017, 1:06 p.m. UTC
This patch introduces a new handle_console_tty function. This function
performs read/write from/to console tty.

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
---
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>

Changes since v5:
- Split this change in a separate patch.

 tools/console/daemon/io.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

Comments

Wei Liu July 18, 2017, 1:13 p.m. UTC | #1
On Mon, Jul 17, 2017 at 06:36:47PM +0530, Bhupinder Thakur wrote:
> This patch introduces a new handle_console_tty function. This function
> performs read/write from/to console tty.
> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>

Acked-by: Wei Liu <wei.liu2@citrix.com>
Stefano Stabellini July 18, 2017, 7:51 p.m. UTC | #2
On Mon, 17 Jul 2017, Bhupinder Thakur wrote:
> This patch introduces a new handle_console_tty function. This function
> performs read/write from/to console tty.
> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> 
> Changes since v5:
> - Split this change in a separate patch.
> 
>  tools/console/daemon/io.c | 35 +++++++++++++++++++----------------
>  1 file changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
> index 775fb04..4097673 100644
> --- a/tools/console/daemon/io.c
> +++ b/tools/console/daemon/io.c
> @@ -1133,6 +1133,24 @@ static void add_console_tty_fd(struct console *con)
>  	}
>  }
>  
> +static void handle_console_tty(struct console *con)
> +{
> +	if (con->master_fd != -1 && con->master_pollfd_idx != -1) {
> +		if (fds[con->master_pollfd_idx].revents &
> +		    ~(POLLIN|POLLOUT|POLLPRI))
> +			console_handle_broken_tty(con, domain_is_valid(con->d->domid));
> +		else {
> +			if (fds[con->master_pollfd_idx].revents &
> +			    POLLIN)
> +				handle_tty_read(con);
> +			if (fds[con->master_pollfd_idx].revents &
> +			    POLLOUT)
> +				handle_tty_write(con);
> +		}
> +	}
> +	con->master_pollfd_idx = -1;
> +}
> +
>  void handle_io(void)
>  {
>  	int ret;
> @@ -1263,22 +1281,7 @@ void handle_io(void)
>  
>  			handle_console_ring(con);
>  
> -			if (con->master_fd != -1 && con->master_pollfd_idx != -1) {
> -				if (fds[con->master_pollfd_idx].revents &
> -				    ~(POLLIN|POLLOUT|POLLPRI))
> -					console_handle_broken_tty(con,
> -						   domain_is_valid(d->domid));
> -				else {
> -					if (fds[con->master_pollfd_idx].revents &
> -					    POLLIN)
> -						handle_tty_read(con);
> -					if (fds[con->master_pollfd_idx].revents &
> -					    POLLOUT)
> -						handle_tty_write(con);
> -				}
> -			}
> -
> -			con->master_pollfd_idx = -1;
> +			handle_console_tty(con);
>  
>  			if (d->last_seen != enum_pass)
>  				shutdown_domain(d);
> -- 
> 2.7.4
>
diff mbox

Patch

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 775fb04..4097673 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -1133,6 +1133,24 @@  static void add_console_tty_fd(struct console *con)
 	}
 }
 
+static void handle_console_tty(struct console *con)
+{
+	if (con->master_fd != -1 && con->master_pollfd_idx != -1) {
+		if (fds[con->master_pollfd_idx].revents &
+		    ~(POLLIN|POLLOUT|POLLPRI))
+			console_handle_broken_tty(con, domain_is_valid(con->d->domid));
+		else {
+			if (fds[con->master_pollfd_idx].revents &
+			    POLLIN)
+				handle_tty_read(con);
+			if (fds[con->master_pollfd_idx].revents &
+			    POLLOUT)
+				handle_tty_write(con);
+		}
+	}
+	con->master_pollfd_idx = -1;
+}
+
 void handle_io(void)
 {
 	int ret;
@@ -1263,22 +1281,7 @@  void handle_io(void)
 
 			handle_console_ring(con);
 
-			if (con->master_fd != -1 && con->master_pollfd_idx != -1) {
-				if (fds[con->master_pollfd_idx].revents &
-				    ~(POLLIN|POLLOUT|POLLPRI))
-					console_handle_broken_tty(con,
-						   domain_is_valid(d->domid));
-				else {
-					if (fds[con->master_pollfd_idx].revents &
-					    POLLIN)
-						handle_tty_read(con);
-					if (fds[con->master_pollfd_idx].revents &
-					    POLLOUT)
-						handle_tty_write(con);
-				}
-			}
-
-			con->master_pollfd_idx = -1;
+			handle_console_tty(con);
 
 			if (d->last_seen != enum_pass)
 				shutdown_domain(d);