aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/lguest
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/lguest')
-rw-r--r--Documentation/lguest/lguest.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 9f3240c45718..8704600c5e42 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -830,15 +830,14 @@ static bool handle_console_input(struct device *dev)
830static void handle_console_output(struct virtqueue *vq, bool timeout) 830static void handle_console_output(struct virtqueue *vq, bool timeout)
831{ 831{
832 unsigned int head, out, in; 832 unsigned int head, out, in;
833 int len;
834 struct iovec iov[vq->vring.num]; 833 struct iovec iov[vq->vring.num];
835 834
836 /* Keep getting output buffers from the Guest until we run out. */ 835 /* Keep getting output buffers from the Guest until we run out. */
837 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { 836 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
838 if (in) 837 if (in)
839 errx(1, "Input buffers in output queue?"); 838 errx(1, "Input buffers in output queue?");
840 len = writev(STDOUT_FILENO, iov, out); 839 writev(STDOUT_FILENO, iov, out);
841 add_used_and_trigger(vq, head, len); 840 add_used_and_trigger(vq, head, 0);
842 } 841 }
843} 842}
844 843
@@ -870,7 +869,6 @@ static void block_vq(struct virtqueue *vq)
870static void handle_net_output(struct virtqueue *vq, bool timeout) 869static void handle_net_output(struct virtqueue *vq, bool timeout)
871{ 870{
872 unsigned int head, out, in, num = 0; 871 unsigned int head, out, in, num = 0;
873 int len;
874 struct iovec iov[vq->vring.num]; 872 struct iovec iov[vq->vring.num];
875 static int last_timeout_num; 873 static int last_timeout_num;
876 874
@@ -878,10 +876,9 @@ static void handle_net_output(struct virtqueue *vq, bool timeout)
878 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { 876 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
879 if (in) 877 if (in)
880 errx(1, "Input buffers in output queue?"); 878 errx(1, "Input buffers in output queue?");
881 len = writev(vq->dev->fd, iov, out); 879 if (writev(vq->dev->fd, iov, out) < 0)
882 if (len < 0)
883 err(1, "Writing network packet to tun"); 880 err(1, "Writing network packet to tun");
884 add_used_and_trigger(vq, head, len); 881 add_used_and_trigger(vq, head, 0);
885 num++; 882 num++;
886 } 883 }
887 884