]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xen/arm: vpl011: Add a new buffer_available function in xenconsole
authorBhupinder Thakur <bhupinder.thakur@linaro.org>
Wed, 27 Sep 2017 06:13:21 +0000 (11:43 +0530)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 3 Oct 2017 22:23:37 +0000 (15:23 -0700)
This patch introduces a new buffer_available function to check if
more data is allowed to be buffered.

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/console/daemon/io.c

index 1da08d76202924f6b945ed9556fe21464afcbc2e..0009bbef56ef95c09e45283816ac55f1fc59d751 100644 (file)
@@ -163,6 +163,16 @@ static int write_with_timestamp(int fd, const char *data, size_t sz,
        return 0;
 }
 
+static inline bool buffer_available(struct console *con)
+{
+       if (discard_overflowed_data ||
+           !con->buffer.max_capacity ||
+           con->buffer.size < con->buffer.max_capacity)
+               return true;
+       else
+               return false;
+}
+
 static void buffer_append(struct console *con)
 {
        struct buffer *buffer = &con->buffer;
@@ -1120,9 +1130,7 @@ void handle_io(void)
                                    con->next_period < next_timeout)
                                        next_timeout = con->next_period;
                        } else if (con->xce_handle != NULL) {
-                               if (discard_overflowed_data ||
-                                   !con->buffer.max_capacity ||
-                                   con->buffer.size < con->buffer.max_capacity) {
+                               if (buffer_available(con)) {
                                        int evtchn_fd = xenevtchn_fd(con->xce_handle);
                                        con->xce_pollfd_idx = set_fds(evtchn_fd,
                                                                    POLLIN|POLLPRI);