Skip to content

Instantly share code, notes, and snippets.

@pcarrier
Created June 21, 2011 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcarrier/1039196 to your computer and use it in GitHub Desktop.
Save pcarrier/1039196 to your computer and use it in GitHub Desktop.
[1234] means 1234 represented on 32 bits
# indicates a comment
We escape:
- \ as \\
- character 0 as \0
- literal [, ] as \[, \]
- classical \ (\->\\, char 0 as \0, etc.)
- # as \#
lexicon:
S step
F file (contains errnos on operations)
D file data
S file stat
C command (contains errnos on execution)
O command stdout
E command stderr
? command return code
/ number of subitems (used for steps, files that are directories)
S\0/ -> [5]
S\0[0] -> Sgeneral\0
S\0[1] -> Skernel\0
S\0[2] -> F/etc/puppet/puppet.conf\0
S\0[3] -> ...
S\0[4] -> ...
Skernel\0/ -> [2]
Skernel\0[0] -> Skernel/mem\0
Skernel\0[1] -> Skernel/io\0
Sgeneral\0/ -> [1]
Sgeneral\0[0] -> Cdf\0
Skernel/io\0/ -> [1]
Skernel/io\0[0] -> F/etc/puppet/puppet.conf\0 # we read that earlier in execution
F/etc/puppet/puppet.conf\0 -> [0][0] # we didn't meet any errno when running stat or reading
S/etc/puppet/puppet.conf\0 -> [12][53][189]... # a struct stat serialized in a straightforward, platform independent way. shows it's a standard file, hence has contents in data
D/etc/puppet/puppet.conf\0 -> blahblahblah # file contents
F/etc/nfs\0 -> [0]
S/etc/nfs\0 -> ... # shows it's a symlink
D/etc/nfs\0 -> /etc2/nfs # readlink
S/etc2/nfs\0 -> ... # shows it's a directory
F/etc2/nfs\0 -> [0][0][0]...[0][4][6] # we met errnos 4 and 6 during readdir
F/etc2/nfs\0/ -> [9] # 9 dirents were readdir'ed
F/etc2/nfs/\0[0] -> ... # a dirent serialized in a straightforward, platform independant way :) includes the filename, eg "foo"
F/etc2/nfs/\0[8] -> ...
F/etc2/nfs/foo\0 -> [0]
S/etc2/nfs/foo\0 -> ... # shows it's a regular file
D/etc2/nfs/foo\0 -> <bar>\n</bar>
Cdf\0 -> [0] # no errnos when executing or reading the output
?df\0 -> [0] # return code for the command
Odf\0 -> Filesystem 512-blocks Used Available Capacity Mounted on\n/dev/disk0s2 117817264 116922808 382456 100% /
Edf\0 -> \0
@pcarrier
Copy link
Author

by "contents" I mean "children".
you will have guessed that we prefix every string by its length in keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment