All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luciano A. Stertz" <luciano@tteng.com.br>
To: linux-mm@kvack.org
Subject: Pointers to contiguous pages
Date: Fri, 13 Aug 2004 13:13:46 -0300	[thread overview]
Message-ID: <411CE8BA.6060401@tteng.com.br> (raw)

alloc_pages with the desired order of pages. I'll fill these pages with 
data and need to add them to the page cache. So I need individual 
pointers to each page contained in the buffer. How do I get them?
     Is the following code correct?

     unsigned long pfn;
     struct page *page = alloc_pages(mask, order);
     if (!page)
         return;

     /* Fill the pages... */

     pfn = page_to_pfn(page)
     for (i=0; i<(1<<order); i++, pfn++)
     {
         struct page *p = pfn_to_page(pfn);
         ...
     }

     Is this correct? Is there a better way to do this?

     Thanks in advance,
         Luciano

	P.S.: I tryied kernelnewbies first, but I guess the question is too 
specific, nobody answered yet...


-- 
Luciano A. Stertz
luciano@tteng.com.br
T&T Engenheiros Associados Ltda
http://www.tteng.com.br
Fone/Fax (51) 3224 8425
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

             reply	other threads:[~2004-08-13 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-13 16:13 Luciano A. Stertz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-08-13 16:24 Pointers to contiguous pages Martin J. Bligh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=411CE8BA.6060401@tteng.com.br \
    --to=luciano@tteng.com.br \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.