lkml.org 
[lkml]   [2000]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectkiovec
Hello:

I looked at the implementation of kiovec (map_user_kiobuf() routine).
I understood how to get the 'struct page *' for the user buffer.

What I want to know is,

If I want to print the contents of the user buffer (in the kernel)
using this 'struct page *' how do I do it ('struct page *' points
to the physical page right)?

I want to use kiovec for my driver, but I do not want to use the same
interface, but something similar to it.

Thanks,
Pramodh



I have the relevant code here. Please comment on this.

This is what I have done in the code similar to map_user_kiobuf(). I have
cut n pasted the relevant code only.

my_user_buf_map_routine(unsigned long addr) /* user addr */
{
int offset;
unsigned long ptr;
struct vm_area_struct *vma;
struct page *map;
unsigned long buf;
char *page_buffer;

offset = addr & PAGE_MASK;
ptr = addr & PAGE_MASK;

vma = find_vma(current->mm, ptr);
handle_mm_fault(current, vma, ptr, (rw==READ));
map = follow_page(ptr);
buf = page_address(map);
page_buffer = (char *) (buf + offset);

/* If i try to print the page_buffer it seg_faults
but I get a valid pointer to the map (struct page *)
*/
}


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

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