Lots of the plan9 code is written in a style like this but with enums<p>A bit tricky to find the best example on my phone while on the bus but here's a flavour, the in-memory file system<p><a href="http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/ramfs.c" rel="nofollow">http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/ramfs.c</a><p>Edit : can anyone see how to add a comment to the article, I wanted to share the above info with him but comments don't seem open to me now I'm at my desk.<p>The plan9 way uses an interface style, the sort that is made explicit in Go :<p>from <a href="http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/nntpfs.c" rel="nofollow">http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/nntpfs....</a><p><pre><code> Srv nntpsrv = {
.destroyfid= fsdestroyfid,
.attach= fsattach,
.clone= fsclone,
.walk1= fswalk1,
.open= fsopen,
.read= fsread,
.write= fswrite,
.stat= fsstat,
};
</code></pre>
These file systems all run in user mode btw (as can all the disk based ones). Mycrotiv has even done a kernel with a built in rc shell that you attach your file systems after booting as yourself - a disk failure will not take down your system!