wikifs, wikipost – wiki file system
method version uri
is a web server that facilitates easy editing of the pages it contains.
presents a wiki in two forms: as web pages to be served
and as text files to be viewed via the
presents a file system interface to the wiki data stored
mounts itself at
flag specifies a different mount point,
not to mount at all.
also announces 9P network services on the addresses
given as arguments to
option is given,
will post a service file descriptor in
flag causes a transcript of the 9P conversation
to be written to standard error.
The wiki holds both the current pages and also
all versions of all pages that have ever existed.
All pages have time stamps associated with them.
When a user wants to edit a page, he reads the
current page from the wiki, noting the time stamp
on the page.
When a user writes changes to a page, he includes the time stamp
of the page he started with. If the page has been updated
by someone else while he was editing, the write will fail.
This is called a “conflicting write.”
The submission is still saved in the history, so that
the user can compare the page he submitted with the changes
that were made while he was editing.
Each version of each page is described by a text file containing
one or more metadata lines followed by the page contents.
The metadata lines begin with a capital letter specifying the type of data.
Currently the metadata types are:
The date this page was written, in decimal seconds since the epoch.
The author of this version of the page. Typically the rest of the line
takes the form
This page’s contents were submitted but rejected due to a
After the metadata comes the actual page contents; each line of
page contents is prefixed with a
contains all the wiki data. Typically it is world-writable
can run as none.
Each page on the wiki has a unique sequence number
for each page, the
directory contains three files
holds the current version of the page: the first line of
is the page title, followed by page metadata and contents as described above.
The append-only file
holds the history of the page.
The first line of
is the title of the page.
The rest of the file is the metadata and contents of every
version of the page that has been submitted to the wiki.
is a lock file for the page: it must be
held while reading or writing
The lock files allow multiple instances of
to coexist peacefully.
file (with associated lock
provides a mapping from
to page titles.
Each map line is a decimal
a single space,
and then the title.
Since titles are presented as names by
they cannot contain slashes.
presents a three-level file system.
The top level contains per-page directories
named by the page titles with spaces turned
Each page also has a number associated with it
(see the discussion of the wiki data files below).
The number corresponding to a page may
also be used to access it, although directory
listings will always present the title.
file is used to add new or revised pages to the wiki:
writes to the file should be in the usual textual format:
a title line, metadata lines, and page contents.
Once all the contents have been written, a final zero-length
message should be written to mark the end of the page.
This last write will return an error if a conflicting
write has occurred.
After writing the file, the client may read from
to obtain the canonical title for the page, as presented
by the file system.
The page directories contain subdirectories representing
the history of the page, named
by the decimal time stamp corresponding to each version.
In addition to these history directories,
the page directories contain the following files:
The current raw data file for the page.
A web page listing the contents of every version of
the page that has ever appeared on the wiki.
The text is grey by default:
differences between versions appear in black.
A web form for editing the current version of the page.
A web page listing the time stamps of the historical versions of the page.
Each time stamp links to a page showing just
A textual formatting of the history. Each time stamp is prefixed with
the name of the directory corresponding to that version.
An HTML formatting of the current version of the page.
A textual formatting of the current version of the page.
An HTML error page to be returned by
on conflicting writes.
The HTML files are generated from the templates with the same names
are generated from the templates
The history directories
are similar to the page directories but only contain
are generated from the templates
is used to process editing requests posted
to the web server by users.
It expects the posted form to contain these
(usually hidden) fields:
the title of the page;
the time stamp of the page that is being edited;
the service name associated with this wiki
the base for wiki URLs in the response.
After mounting the wiki,
writes a page update request to
and then returns the contents of one HTML
If the write succeeds,
if the write fails due to a conflicting write,
The Plan 9 wiki at Bell Labs is started by running:
wikifs -p 666 -s wiki.plan9 -a tcp!*!wiki /sys/lib/wiki
The wiki is mounted for
by an entry in
mount -b #s/wiki.plan9 /usr/web/wiki/plan9
Notice that the wiki service was explicitly posted with
mode 666 so that
(running as none)
would be able to mount it.
In the Plan 9 distribution, the directory
contains sample files similar to those used
to start the current Plan 9 wiki.
The original wiki,