Message ID | 1500296815-10243-13-git-send-email-bhupinder.thakur@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | SBSA UART emulation support in Xen | expand |
On Mon, Jul 17, 2017 at 06:36:42PM +0530, Bhupinder Thakur wrote: > 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> Acked-by: Wei Liu <wei.liu2@citrix.com>
On Mon, 17 Jul 2017, Bhupinder Thakur wrote: > 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> > --- > 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 | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c > index 9e92097..e4882e2 100644 > --- a/tools/console/daemon/io.c > +++ b/tools/console/daemon/io.c > @@ -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; > @@ -1121,9 +1131,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); > -- > 2.7.4 >
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 9e92097..e4882e2 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -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; @@ -1121,9 +1131,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);
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> --- 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)