<div dir="ltr">Thanks for your idea.<br>Because I implement a kernel storage service based on a disk file through VFS layer. <br>To
simplify the implementation, I prefer to read/write the mapped
kernel space address instead of the file data access api(such as page
cache API / VFS API).<br>
<br>In FreeBSD, I can use <span>vm_map_find</span><span></span> to map a file into kernel space address( vnode pager)<br>But in linux, I don't know how to implement this(map disk file into kernel space)?<div>
<div><img src="https://mail.google.com/mail/u/0/images/cleardot.gif"></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 26, 2013 at 3:42 PM, Yu Bi <span dir="ltr"><<a href="mailto:lazysmartegg@gmail.com" target="_blank">lazysmartegg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi,</div><div> <span style="line-height:16.666667938232422px;font-size:13.333333969116211px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif">I try to mmap a file in a linux kernel module. I have tried to use the function do_mmap_pgoff</span><span style="line-height:16.666667938232422px;font-size:13.333333969116211px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif">. But the address returned is memory virtual address in current process' user space, i.e., below the kernel boundary. Instead, I want to map the file in the kernel space and get the kernel virtual address of the mapped region. Is there any kernel API in Linux support this operation? Or I have to reimplement a kernel mmap version ? </span></div>
<div> But reimplement a kernel version mmap() is not easy I guess. Do you have any idea? </div><div> </div><div><br></div><div> </div><div> </div><div> </div></div>
</blockquote></div><br></div></div>