summaryrefslogtreecommitdiff
path: root/man/2/fsproto
blob: d67368efb961fb52ed56490701036a7355fac3f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.TH FSPROTO 2
.SH NAME
FSproto: readprotofile, readprotostring \- read file system prototype file
.SH SYNOPSIS
.EX
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));
.EE
.SH DESCRIPTION
.B FSproto
provides an interface to read a file system prototype file,
as defined by
.IR proto (6).
.PP
.B Init
must be called before any other function in the module.
.PP
.B Readprotofile
reads a file system prototype from the file
.IR proto .
It traverses the file system, starting at the given
.IR root ,
and each file or directory encountered that is mentioned
in the prototype causes
.B readprotofile
to send a
.B Direntry
tuple on the channel
.IR entries .
The tuple has the form
.BI ( old , new , dir\fP\f5)\fP
where
.I old
is the name of the current file or directory,
rooted at
.IR root ,
.I new
is the same file's name
.I relative
to
.IR root ,
and
.I dir
is a reference to the
.B Sys->Dir
directory information for
.IR old ,
as produced by
.IR sys-stat (2).
When all files in
.I root
have been examined,
.B readprotofile
sends a single tuple with all nil components on
.IR entries .
For each error that occurs during processing (eg, unable to open a directory)
.B readprotofile
sends a tuple
.BI ( old , diag )
on the channel
.IR warnings ,
naming the file and giving a diagnostic string,
but processing continues.
.PP
.B Readprotostring
reads a file system prototype from the string
.I proto
itself.
Otherwise, its operation is the same as
.BR readprotofile .
.SH SOURCE
.B /appl/lib/fsproto.b
.SH SEE ALSO
.IR fs (1),
.IR proto (6),
.IR mkfs (8)