* [PATCH] don't use PAGE_SIZE in userspace
@ 2006-12-20 2:48 Alex Williamson
2006-12-20 3:26 ` Tony Breeds
0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2006-12-20 2:48 UTC (permalink / raw)
To: julian; +Cc: xen-devel
PAGE_SIZE is not a constant on all architectures, getpagesize()
should be used from userspace. Thanks,
Alex
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---
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 19:41:01 2006 -0700
@@ -1353,7 +1353,8 @@ int qcow_create(const char *filename, ui
free(ptr);
/*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());
if (qtruncate(fd, length, 0)!=0) {
DPRINTF("ERROR truncating file\n");
return -1;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] don't use PAGE_SIZE in userspace
2006-12-20 2:48 [PATCH] don't use PAGE_SIZE in userspace Alex Williamson
@ 2006-12-20 3:26 ` Tony Breeds
2006-12-20 3:36 ` Alex Williamson
0 siblings, 1 reply; 3+ messages in thread
From: Tony Breeds @ 2006-12-20 3:26 UTC (permalink / raw)
To: Alex Williamson; +Cc: xen-devel, julian
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,
>
> Alex
>
> Signed-off-by: Alex Williamson <alex.williamson@hp.com>
> ---
>
> 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 19:41:01 2006 -0700
> @@ -1353,7 +1353,8 @@ int qcow_create(const char *filename, ui
> free(ptr);
>
> /*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?
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2007.linux.org.au/
Jan 15-20 2007 The Australian Linux Technical Conference!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] don't use PAGE_SIZE in userspace
2006-12-20 3:26 ` Tony Breeds
@ 2006-12-20 3:36 ` Alex Williamson
0 siblings, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2006-12-20 3:36 UTC (permalink / raw)
To: Tony Breeds; +Cc: xen-devel, julian
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 <alex.williamson@hp.com>
---
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-20 3:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-20 2:48 [PATCH] don't use PAGE_SIZE in userspace Alex Williamson
2006-12-20 3:26 ` Tony Breeds
2006-12-20 3:36 ` Alex Williamson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.