shithub: fsgen

ref: 3c203e383e93d0ae44263e9f824d66f8e1f7878d
dir: /test/test.fs/

View raw version
# This is a demo description file for the fsgen filesystem generator.
# - Lines starting with # are comments
# - all functions need to be assigned to a file path
# - file paths have to start with / (root of the mountpoint)
# - lines enclosed with %{ and %} enclose code that is copied verbatim
# - path parts can be enclosed in {} to make a variable
# - variables can be accessed by name. Prevent collisions with other symbols.
# - handler functions start with the short name of the handler (see below), followed by {}.
#
# There are a few handler functions that are available:
# - read: r{ and r}
# - write: w{ and w}
# - stat: s{ and s}
# - directory listings (not implemented yet)
#
# Read through this example to get a better idea.
#



%{
#include "fns.h"
%}

# lines starting with a # are comments.

# you can access /mnt/fsgen/test/bla
/test/{fname}
r{
	char buf[512];
	snprint(buf, sizeof buf, "read: %s\n", fname);
	readstr(r, buf);
	respond(r, nil);
r}
w{
	respond(r, "write");
w}