From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH] don't use PAGE_SIZE in userspace Date: Tue, 19 Dec 2006 20:36:29 -0700 Message-ID: <1166585789.5054.8.camel@bling> References: <1166582883.5054.6.camel@bling> <20061220032645.GB27551@bakeyournoodle.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20061220032645.GB27551@bakeyournoodle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Tony Breeds Cc: xen-devel , julian@xensource.com List-Id: xen-devel@lists.xenproject.org On Wed, 2006-12-20 at 14:26 +1100, Tony Breeds wrote: > On Tue, Dec 19, 2006 at 07:48:03PM -0700, Alex Williamson wrote: > > > > PAGE_SIZE is not a constant on all architectures, getpagesize() > > should be used from userspace. Thanks, > > > > /*adjust file length to 4 KByte boundary*/ > > - length = ROUNDUP(header_size + (l1_size * sizeof(uint64_t)),PAGE_SIZE); > > + length = ROUNDUP(header_size + (l1_size * sizeof(uint64_t)), > > + getpagesize()); > > How about updateing the comment above, aswell? Oops, fixed. Thanks, Alex Signed-off-by: Alex Williamson --- diff -r 381f119b15a0 tools/blktap/drivers/block-qcow.c --- a/tools/blktap/drivers/block-qcow.c Tue Dec 19 21:33:12 2006 +0000 +++ b/tools/blktap/drivers/block-qcow.c Tue Dec 19 20:34:11 2006 -0700 @@ -1352,8 +1352,9 @@ int qcow_create(const char *filename, ui printf("Created cksum: %d\n",exthdr.cksum); free(ptr); - /*adjust file length to 4 KByte boundary*/ - length = ROUNDUP(header_size + (l1_size * sizeof(uint64_t)),PAGE_SIZE); + /*adjust file length to system page size boundary*/ + length = ROUNDUP(header_size + (l1_size * sizeof(uint64_t)), + getpagesize()); if (qtruncate(fd, length, 0)!=0) { DPRINTF("ERROR truncating file\n"); return -1;