1.1 --- a/docs/wiki/Components Sat Oct 16 00:22:38 2021 +0200
1.2 +++ b/docs/wiki/Components Sat Oct 16 22:09:18 2021 +0200
1.3 @@ -15,8 +15,8 @@
1.4
1.5 == Overview ==
1.6
1.7 -An overview of the component interactions involved in opening a file is
1.8 -provided by the diagram below.
1.9 +An overview of the component interactions involved in opening a file or
1.10 +directory is provided by the diagram below.
1.11
1.12 ######## A graph showing the interactions between components
1.13
1.14 @@ -29,7 +29,7 @@
1.15 rankdir=LR;
1.16
1.17 subgraph {
1.18 - node [label="Client",style=solid,color="#000000",fontcolor="#000000"];
1.19 + node [label="Client"];
1.20 rank=min;
1.21
1.22 Client1; Client2; Client3; Client4; Client5; Client6; Client7;
1.23 @@ -37,11 +37,13 @@
1.24
1.25 subgraph {
1.26 rank=same;
1.27 +
1.28 Memory [label="filename",shape=note];
1.29 }
1.30
1.31 subgraph {
1.32 - rank=same;
1.33 + rank=max;
1.34 +
1.35 Filesystem;
1.36
1.37 subgraph {
1.38 @@ -54,7 +56,7 @@
1.39 OpenerContext1; OpenerContext2; OpenerContext3;
1.40 }
1.41
1.42 - MappedFile;
1.43 + Object [label="MappedFile\nor\nDirectory"];
1.44 }
1.45
1.46 Client1 -> Client2 -> Client3 -> Client4 -> Client5 -> Client6 -> Client7 [arrowhead=none,style=dotted];
1.47 @@ -72,8 +74,8 @@
1.48 Client5 -> Memory -> OpenerContext2;
1.49
1.50 Client6 -> OpenerContext3 [label="open(flags, ...)"];
1.51 - OpenerContext3 -> MappedFile;
1.52 - MappedFile -> Client7;
1.53 + OpenerContext3 -> Object;
1.54 + Object -> Client7;
1.55 }
1.56 }}}
1.57
1.58 @@ -89,6 +91,67 @@
1.59 file = context.open(flags, ...)
1.60 }}}
1.61
1.62 +Reading from an opened directory is achieved as shown in the following
1.63 +diagram.
1.64 +
1.65 +######## A graph showing the interactions between components
1.66 +
1.67 +{{{#!graphviz
1.68 +#format svg
1.69 +#transform notugly
1.70 +digraph components {
1.71 + node [fontsize="12.0",fontname="sans-serif",shape=box];
1.72 + edge [fontsize="12.0",fontname="sans-serif"];
1.73 + rankdir=LR;
1.74 +
1.75 + subgraph {
1.76 + node [label="Client"];
1.77 + rank=min;
1.78 +
1.79 + Client1; Client2; Client3; Client4;
1.80 + }
1.81 +
1.82 + subgraph {
1.83 + rank=same;
1.84 +
1.85 + Memory [label="entries",shape=note];
1.86 + }
1.87 +
1.88 + subgraph {
1.89 + rank=max;
1.90 +
1.91 + Directory;
1.92 +
1.93 + subgraph {
1.94 + node [label="Reader"];
1.95 +
1.96 + Reader1; Reader2; Reader3;
1.97 + }
1.98 + }
1.99 +
1.100 + Client1 -> Client2 -> Client3 -> Client4 [arrowhead=none,style=dotted];
1.101 + Reader1 -> Reader2 -> Reader3 [arrowhead=none,style=dotted];
1.102 +
1.103 + Client1 -> Directory [label="opendir()"];
1.104 + Directory -> Reader1;
1.105 + Reader1 -> Client2;
1.106 +
1.107 + Client3 -> Reader2 [label="current_region()"];
1.108 + Reader3 -> Memory -> Client4;
1.109 +}
1.110 +}}}
1.111 +
1.112 +########
1.113 +
1.114 +In pseudocode, the operations as conducted by the client program are as
1.115 +follows:
1.116 +
1.117 +{{{
1.118 +reader = directory.opendir()
1.119 +reader.current_region()
1.120 +entries = reader.read() # this being a memory access operation
1.121 +}}}
1.122 +
1.123 == Filesystems ==
1.124
1.125 Filesystems implement the `Filesystem` interface which provides the
1.126 @@ -165,7 +228,17 @@
1.127
1.128 == Directories ==
1.129
1.130 -Directories are also meant to be accessed like files, meaning that it should
1.131 +Directories are obtained, like files, using the `open` operation. They
1.132 +implement the `Directory` interface.
1.133 +
1.134 +To read directory listings, the `opendir` operation is used to obtain a
1.135 +directory reader:
1.136 +
1.137 +{{{
1.138 +opendir(out offset_t size, out cap file, out object_flags_t object_flags)
1.139 +}}}
1.140 +
1.141 +Directory readers are meant to be accessed like files, meaning that it should
1.142 be possible to attach them to a task using a region manager and access the
1.143 provided content, this being a listing of directory entries, via the mapped
1.144 region.
1.145 @@ -175,9 +248,6 @@
1.146 supporting precisely the same navigation mechanisms as those supported by
1.147 files.
1.148
1.149 -'''Note''' that directories may well be redefined to support multiple
1.150 -operations, one of which supporting the file-like access described above.
1.151 -
1.152 == Pipe Openers ==
1.153
1.154 Distinct from filesystems but potentially used by them, pipe openers provide a