kernel newb -- read/write to a local file from in kernel

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Sep 4 23:46:13 PDT 2005


In message <431BE951.4070101 at c4solutions.net>, Jeb Campbell writes:
>I'm trying to learn about kernel programming and as a weekend project 
>I've started writing a Netgraph to file/dev module.
>
>The Netgraph stuff was pretty easy, but I'm at a loss on the file access 
>part as I've never done anything in-kernel.
>
>After much searching (most of it not knowing what I was looking for), I 
>think that I'm looking for something like "Vnode interface mechanics, 
>write to a local file" as taught in Mr. McKusick's "FreeBSD Kernel 
>Internals: An Intensive Code Walkthrough".
>
>I've looked at nullfs/null_vnops.c, but I think that is more of a 
>pass-through example.  Does anyone know of any online code that shows 
>the process of opening a file/device for read/write?

In the spirit of education I won't tell you "how to" but only "where
to look":  ktrace, coredumps and accounting all writes to files
from the kernel.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-fs mailing list