1 Basic Data Structures
Basic data structures that are used by the network level code as well
as the high level client and server side code.
1.1 File Information
(struct qid (type version path)) |
type : natural-number/c |
version : natural-number/c |
path : natural-number/c |
Information identifying a file in a filesystem uniquely. While
type determines whether the file is a directory and
contains other type flags, path and version
contain an arbitrary combination of numbers unique among all files
on the file system.
See stat(9P) for details about the contents of the structure.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
type : (or/c natural-number/c #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
dev : (or/c natural-number/c #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
qid : (or/c qid? #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode : (or/c natural-number/c #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
atime : (or/c natural-number/c #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
mtime : (or/c natural-number/c #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
length : (or/c natural-number/c #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
name : (or/c string? #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
uid : (or/c string? #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
gid : (or/c string? #f) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
muid : (or/c string? #f) |
A directory entry. When reading directories or asking files for their
stat information, the result normally doesn’t contain fields set
to #f. When setting the stat information for a file, any
field specified as #f is not changed. Many fields must
actually be specified as #f in that case, because they are
considered immutable.
See stat(9P) for details about the contents of the structure.
(type-flag id) | ||||||
|
Enumeration of file type flags as contained in the qid-type
field or the high bits of the stat-mode field. file
is the neutral value just indicating a normal file, dir
identifies directories, append files that can oly be
appended to, excl stands for exclusive access, mount
indicates mountpoints, auth authentication channels and
temp temporary files.
The transformer is defined using define-enum.
Expands to a numeric file type computed from a bitwise inclusive or
of flag values specified by identifiers as for type-flag.
(access-flag id) | ||||||
|
Enumeration of file permission flags as contained in the lower bits
of the stat-mode field. e is the neutral value
and just indicates file existence in permission checks, x
means execute acces, w write access and r read
access.
The transformer is defined using define-enum.
(file-mode (type id ...) (user id ...) (group id ...) (others id ...)) |
(file-mode (user id ...) (group id ...) (others id ...)) |
(file-mode type-bits perm-bits) |
Expands to a numeric file mode computed from a bitwise inclusive or
of bit shifted flag values for the type, specified by identifiers as
for type-flag, and for the access permissions, specified by
identifiers as for access-flag.
The type clause can be omitted or both type and permissions can be given directly as numbers, in which case the macro may still be useful because you don’t have to remember the correct bit shift counts to combine those values.
(file-mode-type m) → natural-number/c |
m : natural-number/c |
Extracts the bits defining the type of a file from a numeric
file mode.
(file-mode-user m) → natural-number/c |
m : natural-number/c |
Extracts the bits defining the access permissions for a file’s owner
from a numeric file mode.
(file-mode-group m) → natural-number/c |
m : natural-number/c |
Extracts the bits defining the access permissions for members of a
file’s owning group from a numeric file mode.
(file-mode-others m) → natural-number/c |
m : natural-number/c |
Extracts the bits defining the access permissions for other users
than the file’s owner or members of its owning group from a numeric file mode.
1.2 Operation Modes
(open-direction id) | ||||||
|
Enumeration of basic access types when opening a file. r
means read access, w write access, r/w both read
and write access and x means execute access.
Execute access behaves like read access except for the permission checks which use execute instead of read permissions.
The transformer is defined using define-enum.
(open-flag id) | ||||||
|
Enumeration of additional flags that can be used when opening a file.
trunc means the file, if opened for writing, should have its
size reset to zero, rclose means the file should be removed
once it is closed.
The transformer is defined using define-enum.
Expands to a numeric mode that can be passed to file open calls.
The mode is computed as a bitwise inclusive or of a direction
value and open flags that are specified by identifiers as for
open-direction and open-flag.
(open-mode-direction m) → natural-number/c |
m : natural-number/c |
Extracts the direction value from a numeric file open mode.
(open-mode-flags m) → natural-number/c |
m : natural-number/c |
Extracts the additional open flags from a numeric file open mode.
1.3 Packings
nstring/p : packing? |
Packing of a string prefixed with 16 bit size information.
nbytes/p : packing? |
Packing of a byte string prefixed with 16 bit size information
qid/p : packing? |
Packing of a qid file identifier structure.
stat/p : packing? |
Packing of a stat directory entry structure.