WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [IA64] The blktap driver hardcodes PAGE_S

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] The blktap driver hardcodes PAGE_SIZE. Change it to use getpagesize(),
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jul 2006 17:40:35 +0000
Delivery-date: Fri, 14 Jul 2006 10:44:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 43bd4b01df9f77a3115273cc1529ec734709d685
# Parent  3352b5dc6a7c37e58a62f927520ab72642ef8b81
[IA64] The blktap driver hardcodes PAGE_SIZE. Change it to use getpagesize(),
thereby allowing it to build on ia64.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
---
 tools/blktap/drivers/tapdisk.c |   15 +++++++++------
 tools/blktap/lib/blktaplib.h   |    6 +++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff -r 3352b5dc6a7c -r 43bd4b01df9f tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c    Fri Jul 14 11:45:15 2006 +0100
+++ b/tools/blktap/drivers/tapdisk.c    Fri Jul 14 11:46:28 2006 +0100
@@ -83,8 +83,8 @@ static void unmap_disk(struct td_state *
 
        drv->td_close(s);
 
-       if (info != NULL && info->mem > 0) 
-               munmap(info->mem, PAGE_SIZE * BLKTAP_MMAP_REGION_SIZE);
+       if (info != NULL && info->mem > 0)
+               munmap(info->mem, getpagesize() * BLKTAP_MMAP_REGION_SIZE);
 
        ptr = s->fd_entry;
        prev = ptr->prev;
@@ -219,6 +219,7 @@ static int map_new_dev(struct td_state *
        tapdev_info_t *info = s->ring_info;
        char *devname;
        fd_list_entry_t *ptr;
+       int page_size;
 
        asprintf(&devname,"%s/%s%d", BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, minor);
        tap_fd = open(devname, O_RDWR);
@@ -230,7 +231,8 @@ static int map_new_dev(struct td_state *
        info->fd = tap_fd;
 
        /*Map the shared memory*/
-       info->mem = mmap(0, PAGE_SIZE * BLKTAP_MMAP_REGION_SIZE, 
+       page_size = getpagesize();
+       info->mem = mmap(0, page_size * BLKTAP_MMAP_REGION_SIZE, 
                          PROT_READ | PROT_WRITE, MAP_SHARED, info->fd, 0);
        if ((long int)info->mem == -1) 
        {
@@ -240,10 +242,10 @@ static int map_new_dev(struct td_state *
 
        /* assign the rings to the mapped memory */ 
        info->sring = (blkif_sring_t *)((unsigned long)info->mem);
-       BACK_RING_INIT(&info->fe_ring, info->sring, PAGE_SIZE);
+       BACK_RING_INIT(&info->fe_ring, info->sring, page_size);
        
        info->vstart = 
-               (unsigned long)info->mem + (BLKTAP_RING_PAGES << PAGE_SHIFT);
+               (unsigned long)info->mem + (BLKTAP_RING_PAGES * page_size);
 
        ioctl(info->fd, BLKTAP_IOCTL_SENDPID, process );
        ioctl(info->fd, BLKTAP_IOCTL_SETMODE, BLKTAP_MODE_INTERPOSE );
@@ -481,6 +483,7 @@ static void get_io_request(struct td_sta
        struct tap_disk *drv = s->drv;
        blkif_t *blkif = s->blkif;
        tapdev_info_t *info = s->ring_info;
+       int page_size = getpagesize();
 
        if (!run) return; /*We have received signal to close*/
 
@@ -508,7 +511,7 @@ static void get_io_request(struct td_sta
                        nsects = req->seg[i].last_sect - 
                                 req->seg[i].first_sect + 1;
        
-                       if ((req->seg[i].last_sect >= PAGE_SIZE >> 9) ||
+                       if ((req->seg[i].last_sect >= page_size >> 9) ||
                            (nsects <= 0))
                                continue;
 
diff -r 3352b5dc6a7c -r 43bd4b01df9f tools/blktap/lib/blktaplib.h
--- a/tools/blktap/lib/blktaplib.h      Fri Jul 14 11:45:15 2006 +0100
+++ b/tools/blktap/lib/blktaplib.h      Fri Jul 14 11:46:28 2006 +0100
@@ -41,7 +41,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
+#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, getpagesize())
 
 /* size of the extra VMA area to map in attached pages. */
 #define BLKTAP_VMA_PAGES BLK_RING_SIZE
@@ -206,8 +206,8 @@ int xs_fire_next_watch(struct xs_handle 
     (MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST)
 #define MMAP_VADDR(_vstart,_req,_seg)                                   \
     ((_vstart) +                                              \
-     ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) +    \
-     ((_seg) * PAGE_SIZE))
+     ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * getpagesize()) +    \
+     ((_seg) * getpagesize()))
 
 /* Defines that are only used by library clients */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] The blktap driver hardcodes PAGE_SIZE. Change it to use getpagesize(),, Xen patchbot-unstable <=