[PATCH 6/9] pagemap: give -1's a name

Dave Hansen
2007-08-22T23:18:13Z

-1 is a magic number in /proc/$pid/pagemap. It means that
there was no pte present for a particular page. We're
going to be refining that a bit shortly, so give this a
real name for now.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

lxc-dave/fs/proc/task_mmu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN fs/proc/task_mmu.c~give_-1s_a_name fs/proc/task_mmu.c
--- lxc/fs/proc/task_mmu.c~give_-1s_a_name 2007-08-22 16:16:53.000000000 -0700
+++ lxc-dave/fs/proc/task_mmu.c 2007-08-22 16:16:53.000000000 -0700
@@ -509,6 +509,7 @@ struct pagemapread {
};

#define PM_ENTRY_BYTES sizeof(unsigned long)
+#define PM_NOT_PRESENT ((unsigned long)-1)

static int add_to_pagemap(unsigned long addr, unsigned long pfn,
struct pagemapread *pm)
@@ -533,7 +534,7 @@ static int pagemap_pte_range(pmd_t *pmd,
if (addr < pm->next)
continue;
if (!pte_present(*pte))
- err = add_to_pagemap(addr, -1, pm);
+ err = add_to_pagemap(addr, PM_NOT_PRESENT, pm);
else
err = add_to_pagemap(addr, pte_pfn(*pte), pm);
if (err)