FSPROTO(2)FSPROTO(2)NAME
FSproto: readprotofile, readprotostring - read file system prototype
file
SYNOPSIS
include "fsproto.m";
fsproto := load FSproto FSproto->PATH;
Direntry: type (string, string, ref Sys->Dir);
init: fn(): string;
readprotofile: fn(proto: string, root: string,
entries: chan of Direntry,
warnings: chan of (string, string)): string;
readprotostring: fn(proto: string, root: string,
entries: chan of Direntry,
warnings: chan of (string, string));
DESCRIPTION
FSproto provides an interface to read a file system prototype file, as
defined by proto(6).
Init must be called before any other function in the module.
Readprotofile reads a file system prototype from the file proto. It
traverses the file system, starting at the given root, and each file or
directory encountered that is mentioned in the prototype causes read‐
protofile to send a Direntry tuple on the channel entries. The tuple
has the form (old,new,dir) where old is the name of the current file or
directory, rooted at root, new is the same file's name relative to
root, and dir is a reference to the Sys->Dir directory information for
old, as produced by sys-stat(2). When all files in root have been
examined, readprotofile sends a single tuple with all nil components on
entries. For each error that occurs during processing (eg, unable to
open a directory) readprotofile sends a tuple (old,diag) on the channel
warnings, naming the file and giving a diagnostic string, but process‐
ing continues.
Readprotostring reads a file system prototype from the string proto
itself. Otherwise, its operation is the same as readprotofile.
SOURCE
/appl/lib/fsproto.b
SEE ALSOfs(1), proto(6), mkfs(8)FSPROTO(2)