···895895 }896896}897897898898+/* This is called when we no longer want to hear about Guest changes to a899899+ * virtqueue. This is more efficient in high-traffic cases, but it means we900900+ * have to set a timer to check if any more changes have occurred. */898901static void block_vq(struct virtqueue *vq)899902{900903 struct itimerval itm;···942939 if (!timeout && num)943940 block_vq(vq);944941942942+ /* We never quite know how long should we wait before we check the943943+ * queue again for more packets. We start at 500 microseconds, and if944944+ * we get fewer packets than last time, we assume we made the timeout945945+ * too small and increase it by 10 microseconds. Otherwise, we drop it946946+ * by one microsecond every time. It seems to work well enough. */945947 if (timeout) {946948 if (num < last_timeout_num)947949 timeout_usec += 10;
+8
drivers/lguest/lguest_device.c
···9898 return features;9999}100100101101+/* The virtio core takes the features the Host offers, and copies the102102+ * ones supported by the driver into the vdev->features array. Once103103+ * that's all sorted out, this routine is called so we can tell the104104+ * Host which features we understand and accept. */101105static void lg_finalize_features(struct virtio_device *vdev)102106{103107 unsigned int i, bits;···112108 /* Give virtio_ring a chance to accept features. */113109 vring_transport_features(vdev);114110111111+ /* The vdev->feature array is a Linux bitmask: this isn't the112112+ * same as a the simple array of bits used by lguest devices113113+ * for features. So we do this slow, manual conversion which is114114+ * completely general. */115115 memset(out_features, 0, desc->feature_len);116116 bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8;117117 for (i = 0; i < bits; i++) {