Re: PAGE_MASK ?

Torsten Landschoff (t.landschoff@itzehoe.netsurf.de)
Wed, 30 Sep 1998 13:36:49 +0200 (CEST)


Hi Andrea,

On Tue, 29 Sep 1998, Andrea Arcangeli wrote:

> On Mon, 28 Sep 1998, Ravi Wijayaratne wrote:
> >
> >What does the PAGE_MASK macro do in the kernel ?
> >
> >The PAGE_MASK macro is defined as
> >
> >/* PAGE_SHIFT determines the page size */
> >#define PAGE_SHIFT 12
> >#define PAGE_SIZE (1UL << PAGE_SHIFT)
> >#define PAGE_MASK (~(PAGE_SIZE-1))
> >
> >in /linux/include/asm-i386/page.h
> >
> >and the macro usage is like
> >
> >pos=filp->f_pos;
> >ppos=pos&PAGE_MASK
>
> ppos will result something like the offset from the start of a page. It
> will mean how much pos is disaligned by the 4k boundaries.

I am sorry but this is not correct. The PAGE_MASK masks out the offset
from the start of the page. This way you will get the origin of the page.

cu
Torsten

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/