File:  [NetBSD Developer Wiki] / wikisrc / projects / project / kernfs-rewrite.mdwn
Revision 1.1: download - view: text, annotated - select for diffs
Sun Nov 6 19:58:46 2011 UTC (8 years, 11 months ago) by jmmv
Branches: MAIN
CVS tags: HEAD
Add the projects from the website (htdocs/contrib/projects.xml).

At this point, all this is is a "blind conversion" from the xml file to
individual mdwn files.  I did this by using a custom xslt file and some
manual cleanups on the files.

Most of these projects are still misclassified as they do not list the
correct difficulty or the category they list is not yet defined in the
wiki.  Some other projects need to be pruned out due to the lack of
details (or moved to the ideas page).  But this is a "good enough" start
that should allow me to nuke these same projects from htdocs.

[[!template id=project

title="Rewrite kernfs and procfs"


[Julio Merino](

duration="2-3 months"

kernfs is a virtual file system that provides the user several information about
the current system and, in some cases, allows him to configure some aspects of
the kernel through those virtual files.  procfs is another virtual file system
that provides information about the currently running processes.

These two file systems are written in a non-extensible way.  For example, kernfs
is built on a hardcoded table that always exposes the same set of files; there
is no way for other system areas to add or remove entries from the kernfs
contents.  procfs has similar issues as someone might think of a subsystem that
could benefit from attaching information of its own to each running process.
The current code is not modular, not well-designed and, as time has shown, there
probably remain serious security bugs in them.

Linux exposes some APIs that abstract procfs' contents and allow external code
to manage its entries by adding or removing files and/ or directories.  This is
a very interesting feature when writing loadable kernel modules as they can use
this virtual file system to provide a way of interaction with the end user.

NetBSD could benefit of similar APIs for both kernfs and procfs.  This project
would consist on adding these APIs, which most likely requires (or suggests) a
full rewrite of these file systems.  The developer should keep in mind the
distinction between the two to avoid having a procfs similar to the one in
Linux, which mixes system configuration and process management.

In order to keep the new implementations simple, the developer should
investigate the possibility of using tmpfs as a backend for kernfs and procfs.
With some changes, one could create a kernel "library" that allowed the creation
of virtual file systems with few code.  For example, it's unlikely that the
directory management routines will change among the three file systems, so the
code from tmpfs should be reused.  Similarly other features should be reusable,
making procfs's and kernfs's code a lot simpler than currently is.

Alternatively, investigate FreeBSD's pseudofs and see if this could be a useful
for this project and base for all the file systems mentioned above.

When working in this project, it is very important to write a complete
regression test suite for procfs and kernfs beforehand to ensure that the
rewrites do not add incompatibilities.

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb