Re: PAGE_MASK ?

Andrea Arcangeli (andrea@e-mind.com)
Tue, 29 Sep 1998 12:35:01 +0200 (CEST)


On Mon, 28 Sep 1998, Ravi Wijayaratne wrote:

>Hi,
>
>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.

Andrea[s] Arcangeli

-
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/