(Against lguest:use-tun-ringfd.patch)

Signed-off-by: Mark McLoughlin <[EMAIL PROTECTED]>
---
 Documentation/lguest/lguest.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 630e159..d37fa2d 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -1373,22 +1373,16 @@ static bool recvfd_used(int fd, struct device *dev)
 static int map_vring(struct vring *vr)
 {
        int fd = open_or_die("/dev/vring", O_RDWR);
+       struct vring_ioctl_info info;
 
-       /* Map the rings over where they belong in Guest. */
-       if (mmap(vr->desc, page_align(vring_size(vr->num, getpagesize())),
-                PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, fd,
-                vr->num * getpagesize()) != vr->desc)
-               err(1, "mmaping /dev/vring");
-
-       /* This is subtle and nasty.  If we lazily map this, Waker may
-        * see different pages when we touch it, and hence it will get
-        * a different result for poll(). */
-       memset(vr->desc, 0, vring_size(vr->num, getpagesize()));
-
-       /* Set offset & limit. */
-       if (ioctl(fd, VRINGSETBASE, guest_base) != 0
-           || ioctl(fd, VRINGSETLIMIT, guest_limit) != 0)
-               err(1, "Setting vring offset and limit");
+       info.num_descs = vr->num;
+       info.descs = (unsigned long)vr->desc;
+       info.base = (unsigned long)guest_base;
+       info.limit = guest_limit;
+
+       /* Tell /dev/vring where the ring is */
+       if (ioctl(fd, VRINGSETINFO, &info) != 0)
+               err(1, "Setting up /dev/vring fd");
 
        return fd;
 }
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to