1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 /* Symfiles are a generalization of Unix symlinks.
5 A symfile when read behaves as though you took its contents and
6 substituted them into the reiser4 naming system as the right hand side
7 of an assignment, and then read that which you had assigned to it.
9 A key issue for symfiles is how to implement writes through to
10 subfiles. In general, one must have some method of determining what
11 of that which is written to the symfile is written to what subfile.
12 This can be done by use of custom plugin methods written by users, or
13 by using a few general methods we provide for those willing to endure
14 the insertion of delimiters into what is read.
16 Writing to symfiles without delimiters to denote what is written to
17 what subfile is not supported by any plugins we provide in this
18 release. Our most sophisticated support for writes is that embodied
19 by the invert plugin (see invert.c).
21 A read only version of the /etc/passwd file might be
22 constructed as a symfile whose contents are as follows:
24 /etc/passwd/userlines/*
28 /etc/passwd/userlines/demidov+/etc/passwd/userlines/edward+/etc/passwd/userlines/reiser+/etc/passwd/userlines/root
32 /etc/passwd/userlines/(demidov+edward+reiser+root)
34 A symfile with contents
36 /filenameA+"(some text stored in the uninvertable symfile)+/filenameB
40 The contents of filenameAsome text stored in the uninvertable symfileThe contents of filenameB
42 and write of what has been read will not be possible to implement as
43 an identity operation because there are no delimiters denoting the
44 boundaries of what is to be written to what subfile.
46 Note that one could make this a read/write symfile if one specified
47 delimiters, and the write method understood those delimiters delimited
48 what was written to subfiles.
50 So, specifying the symfile in a manner that allows writes:
52 /etc/passwd/userlines/demidov+"(
53 )+/etc/passwd/userlines/edward+"(
54 )+/etc/passwd/userlines/reiser+"(
55 )+/etc/passwd/userlines/root+"(
60 /etc/passwd/userlines/(demidov+"(
66 and the file demidov might be specified as:
68 /etc/passwd/userlines/demidov/username+"(:)+/etc/passwd/userlines/demidov/password+"(:)+/etc/passwd/userlines/demidov/userid+"(:)+/etc/passwd/userlines/demidov/groupid+"(:)+/etc/passwd/userlines/demidov/gecos+"(:)+/etc/passwd/userlines/demidov/home+"(:)+/etc/passwd/userlines/demidov/shell
72 /etc/passwd/userlines/demidov/(username+"(:)+password+"(:)+userid+"(:)+groupid+"(:)+gecos+"(:)+home+"(:)+shell)
74 Notice that if the file demidov has a carriage return in it, the
75 parsing fails, but then if you put carriage returns in the wrong place
76 in a normal /etc/passwd file it breaks things also.
78 Note that it is forbidden to have no text between two interpolations
79 if one wants to be able to define what parts of a write go to what
80 subfiles referenced in an interpolation.
82 If one wants to be able to add new lines by writing to the file, one
83 must either write a custom plugin for /etc/passwd that knows how to
84 name an added line, or one must use an invert, or one must use a more
85 sophisticated symfile syntax that we are not planning to write for