On Tue, May 27, 2003 at 12:33:29PM +0100, Christoph Hellwig wrote: > On Tue, May 27, 2003 at 01:22:37PM +0200, Ralf Baechle wrote: > > [...] > > portably refer to any piece of memory. If you have a cpu pointer > > (which may be validly DMA'd too) you may easily obtain the page > > and offset using something like this: > > > > struct page *page = virt_to_page(ptr); > > unsigned long offset = ((unsigned long)ptr & ~PAGE_MASK); > > [...] > > > > While it's officially documented I still don't like it. > > Hmm, I remembered that some ports used vmalloc-like allocators for > this and virt_to_page doesn't work for those.. There's at least one MIPS system which we don't support anymore but which would have to be supported by something like this. Whatever - virt_to_page should then be considered a a legacy API which we have to try to support as well as possible in the hope it's going to fade away ... Ralf