lkml.org 
[lkml]   [2000]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: MAP_NR
Date
In article <Pine.Linu.4.10.10010200555140.4063-100000@mikeg.weiden.de>,
Mike Galbraith <mikeg@wen-online.de> wrote:
>On Thu, 19 Oct 2000 mdaljeet@in.ibm.com wrote:
>
>> can anyone tell the subsitute for MAP_NR in version 2.4?
>> or is MAP_NR still there?
>
>Hi,
>
>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.

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

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