[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxc: osdep: Use XC_PAGE_{SHIFT, MASK}.
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1291369007 0 # Node ID fb0d782afc44541f5d6ec02c3daa626fd9df7346 # Parent 1f5e355c1f8889e0d3ab727f6536882d66196aee libxc: osdep: Use XC_PAGE_{SHIFT,MASK}. Avoid dependency on xc_private.h Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Signed-off-by: Ian Jackson <ian.jackson.citrix.com> --- tools/libxc/xc_linux.c | 24 ++++++++++++------------ tools/libxc/xc_minios.c | 4 ++-- tools/libxc/xc_netbsd.c | 8 ++++---- tools/libxc/xc_private.h | 4 ++-- tools/libxc/xc_solaris.c | 8 ++++---- 5 files changed, 24 insertions(+), 24 deletions(-) diff -r 1f5e355c1f88 -r fb0d782afc44 tools/libxc/xc_linux.c --- a/tools/libxc/xc_linux.c Fri Dec 03 09:36:47 2010 +0000 +++ b/tools/libxc/xc_linux.c Fri Dec 03 09:36:47 2010 +0000 @@ -110,7 +110,7 @@ static void *linux_privcmd_map_foreign_b void *addr; int rc; - addr = mmap(NULL, num << PAGE_SHIFT, prot, MAP_SHARED, fd, 0); + addr = mmap(NULL, num << XC_PAGE_SHIFT, prot, MAP_SHARED, fd, 0); if ( addr == MAP_FAILED ) { PERROR("xc_map_foreign_batch: mmap failed"); @@ -132,7 +132,7 @@ static void *linux_privcmd_map_foreign_b if ( (arr[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) == XEN_DOMCTL_PFINFO_PAGEDTAB ) { - unsigned long paged_addr = (unsigned long)addr + (i << PAGE_SHIFT); + unsigned long paged_addr = (unsigned long)addr + (i << XC_PAGE_SHIFT); rc = xc_map_foreign_batch_single(fd, dom, &arr[i], paged_addr); if ( rc < 0 ) @@ -146,7 +146,7 @@ static void *linux_privcmd_map_foreign_b { int saved_errno = errno; PERROR("xc_map_foreign_batch: ioctl failed"); - (void)munmap(addr, num << PAGE_SHIFT); + (void)munmap(addr, num << XC_PAGE_SHIFT); errno = saved_errno; return NULL; } @@ -164,7 +164,7 @@ static void *linux_privcmd_map_foreign_b unsigned int i; int rc; - addr = mmap(NULL, (unsigned long)num << PAGE_SHIFT, prot, MAP_SHARED, + addr = mmap(NULL, (unsigned long)num << XC_PAGE_SHIFT, prot, MAP_SHARED, fd, 0); if ( addr == MAP_FAILED ) { @@ -189,7 +189,7 @@ static void *linux_privcmd_map_foreign_b ioctlx.num = 1; ioctlx.dom = dom; - ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<PAGE_SHIFT); + ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT); ioctlx.arr = arr + i; ioctlx.err = err + i; do { @@ -239,7 +239,7 @@ static void *linux_privcmd_map_foreign_b continue; } rc = xc_map_foreign_batch_single(fd, dom, pfn + i, - (unsigned long)addr + ((unsigned long)i<<PAGE_SHIFT)); + (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT)); if ( rc < 0 ) { rc = -errno; @@ -273,7 +273,7 @@ static void *linux_privcmd_map_foreign_b int saved_errno = errno; PERROR("xc_map_foreign_bulk: ioctl failed"); - (void)munmap(addr, (unsigned long)num << PAGE_SHIFT); + (void)munmap(addr, (unsigned long)num << XC_PAGE_SHIFT); errno = saved_errno; return NULL; } @@ -290,7 +290,7 @@ static void *linux_privcmd_map_foreign_r int i; void *ret; - num = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; + num = (size + XC_PAGE_SIZE - 1) >> XC_PAGE_SHIFT; arr = calloc(num, sizeof(xen_pfn_t)); for ( i = 0; i < num; i++ ) @@ -313,7 +313,7 @@ static void *linux_privcmd_map_foreign_r int j; void *ret; - num_per_entry = chunksize >> PAGE_SHIFT; + num_per_entry = chunksize >> XC_PAGE_SHIFT; num = num_per_entry * nentries; arr = calloc(num, sizeof(xen_pfn_t)); @@ -474,7 +474,7 @@ void discard_file_cache(xc_interface *xc { if ( (cur = lseek(fd, 0, SEEK_CUR)) == (off_t)-1 ) cur = 0; - cur &= ~(PAGE_SIZE-1); + cur &= ~(XC_PAGE_SIZE-1); } /* Discard from the buffer cache. */ @@ -521,7 +521,7 @@ static void *linux_gnttab_map_grant_ref( } mmap_again: - addr = mmap(NULL, PAGE_SIZE, prot, MAP_SHARED, fd, map.index); + addr = mmap(NULL, XC_PAGE_SIZE, prot, MAP_SHARED, fd, map.index); if ( addr == MAP_FAILED ) { int saved_errno = errno; @@ -572,7 +572,7 @@ static void *do_gnttab_map_grant_refs(xc goto out; } - addr = mmap(NULL, PAGE_SIZE * count, prot, MAP_SHARED, fd, + addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd, map->index); if ( addr == MAP_FAILED ) { diff -r 1f5e355c1f88 -r fb0d782afc44 tools/libxc/xc_minios.c --- a/tools/libxc/xc_minios.c Fri Dec 03 09:36:47 2010 +0000 +++ b/tools/libxc/xc_minios.c Fri Dec 03 09:36:47 2010 +0000 @@ -169,11 +169,11 @@ static void *minios_privcmd_map_foreign_ pt_prot = L1_PROT; #endif - mfns = malloc((size / PAGE_SIZE) * sizeof(*mfns)); + mfns = malloc((size / XC_PAGE_SIZE) * sizeof(*mfns)); n = 0; for (i = 0; i < nentries; i++) - for (j = 0; j < chunksize / PAGE_SIZE; j++) + for (j = 0; j < chunksize / XC_PAGE_SIZE; j++) mfns[n++] = entries[i].mfn + j; ret = map_frames_ex(mfns, n, 1, 0, 1, dom, NULL, pt_prot); diff -r 1f5e355c1f88 -r fb0d782afc44 tools/libxc/xc_netbsd.c --- a/tools/libxc/xc_netbsd.c Fri Dec 03 09:36:47 2010 +0000 +++ b/tools/libxc/xc_netbsd.c Fri Dec 03 09:36:47 2010 +0000 @@ -84,7 +84,7 @@ static void *netbsd_privcmd_map_foreign_ int fd = (int)h; privcmd_mmapbatch_t ioctlx; void *addr; - addr = mmap(NULL, num*PAGE_SIZE, prot, MAP_ANON | MAP_SHARED, -1, 0); + addr = mmap(NULL, num*XC_PAGE_SIZE, prot, MAP_ANON | MAP_SHARED, -1, 0); if ( addr == MAP_FAILED ) { PERROR("xc_map_foreign_batch: mmap failed"); return NULL; @@ -98,7 +98,7 @@ static void *netbsd_privcmd_map_foreign_ { int saved_errno = errno; PERROR("xc_map_foreign_batch: ioctl failed"); - (void)munmap(addr, num*PAGE_SIZE); + (void)munmap(addr, num*XC_PAGE_SIZE); errno = saved_errno; return NULL; } @@ -126,7 +126,7 @@ static void *netbsd_privcmd_map_foreign_ ioctlx.entry=&entry; entry.va=(unsigned long) addr; entry.mfn=mfn; - entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT; + entry.npages=(size+XC_PAGE_SIZE-1)>>XC_PAGE_SHIFT; if ( ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 ) { int saved_errno = errno; @@ -154,7 +154,7 @@ static void *netbsd_privcmd_map_foreign_ for (i = 0; i < nentries; i++) { entries[i].va = (uintptr_t)addr + (i * chunksize); - entries[i].npages = chunksize >> PAGE_SHIFT; + entries[i].npages = chunksize >> XC_PAGE_SHIFT; } ioctlx.num = nentries; diff -r 1f5e355c1f88 -r fb0d782afc44 tools/libxc/xc_private.h --- a/tools/libxc/xc_private.h Fri Dec 03 09:36:47 2010 +0000 +++ b/tools/libxc/xc_private.h Fri Dec 03 09:36:47 2010 +0000 @@ -53,8 +53,8 @@ #undef PAGE_SIZE #undef PAGE_MASK #define PAGE_SHIFT XC_PAGE_SHIFT -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#define PAGE_SIZE XC_PAGE_SIZE +#define PAGE_MASK XC_PAGE_MASK /* Force a compilation error if condition is true */ #define XC_BUILD_BUG_ON(p) ((void)sizeof(struct { int:-!!(p); })) diff -r 1f5e355c1f88 -r fb0d782afc44 tools/libxc/xc_solaris.c --- a/tools/libxc/xc_solaris.c Fri Dec 03 09:36:47 2010 +0000 +++ b/tools/libxc/xc_solaris.c Fri Dec 03 09:36:47 2010 +0000 @@ -80,7 +80,7 @@ static void *solaris_privcmd_map_foreign int fd = (int)h; privcmd_mmapbatch_t ioctlx; void *addr; - addr = mmap(NULL, num*PAGE_SIZE, prot, MAP_SHARED, fd, 0); + addr = mmap(NULL, num*XC_PAGE_SIZE, prot, MAP_SHARED, fd, 0); if ( addr == MAP_FAILED ) return NULL; @@ -92,7 +92,7 @@ static void *solaris_privcmd_map_foreign { int saved_errno = errno; PERROR("XXXXXXXX"); - (void)munmap(addr, num*PAGE_SIZE); + (void)munmap(addr, num*XC_PAGE_SIZE); errno = saved_errno; return NULL; } @@ -118,7 +118,7 @@ static void *xc_map_foreign_range(xc_int ioctlx.entry=&entry; entry.va=(unsigned long) addr; entry.mfn=mfn; - entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT; + entry.npages=(size+XC_PAGE_SIZE-1)>>XC_PAGE_SHIFT; if ( ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 ) { int saved_errno = errno; @@ -145,7 +145,7 @@ static void *solaric_privcmd_map_foreign for (i = 0; i < nentries; i++) { entries[i].va = (uintptr_t)addr + (i * chunksize); - entries[i].npages = chunksize >> PAGE_SHIFT; + entries[i].npages = chunksize >> XC_PAGE_SHIFT; } ioctlx.num = nentries; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |