[lkml]   [2000]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: MAP_NR
In article <>,
Mike Galbraith <> wrote:
>On Thu, 19 Oct 2000 wrote:
>> can anyone tell the subsitute for MAP_NR in version 2.4?
>> or is MAP_NR still there?
>MAP_NR() became virt_to_page() as of test6-pre8.

Not quite.

The expression "(mem_map + MAP_NR(x))" has become "virt_to_page(x)".
There is nothing that is exactly the same as MAP_NR(), because the
concept doesn't really exist any more (there are now architectures out
there that have multiple page maps, so a single number is not sufficient
to describe the page).

Now, in 99% of all cases, this is how MAP_NR() was used, and most of the
time it's a simple 1:1 translation. In some cases there was one level of
indirection, something like

int i;

for (i = MAP_NR(x) ; i < MAP_NR(y); i++) {
... i + mem_map ...

and in those cases it needs to be slightly rewritten to use "struct
page" pointers instead, ie something like

struct page *page, *end;

page = virt_to_page(x);
end = virt_to_page(y);
do {
} while (++page < end);

rather than just a simple expression replacement.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:41    [W:0.049 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site