annotate docs/nitros9guide/chap3.chapter @ 1053:b5ff125a1d60

Since this book was only typeset in fixed width, single-font, they used capitalization and quotes (") to show what was commands, files and just text. With today's formatting, this is not necessary, so everywhere capitalization was used to show a command the <command> element is now used instead, and everywhere a file is mentioned the <filename> element is used.
author roug
date Thu, 20 Mar 2003 20:19:53 +0000
parents c9b63a3c0a17
children 4dae346c4969
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1 <chapter>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
2 <title>The OS-9 File System</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
3 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
4 <title>Introduction to the Unified Input/Output System</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
5 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
6 OS-9 has a unified input/output system in which data transfers to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
7 ALL I/O devices are performed in almost exactly the same manner,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
8 regardless of the particular hardware devices involved. It may seem
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
9 that the different operational characteristics of the I/O devices
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
10 might make this difficult. After all, line printers and disk drives
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
11 behave much differently. However, these differences can mostly be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
12 overcome by defining a set of standardized
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
13 <emphasis>logical functions</emphasis> for
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
14 all devices and by making all I/O devices conform to these
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
15 conventions, using software routines to eliminate hardware
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
16 dependencies wherever possible. This produces a much simpler and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
17 more versatile input/output system.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
18 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
19 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
20 OS-9's unified I/O system is based upon logical entities called
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
21 &quot;I/O paths&quot;. Paths are analogous to &quot;software I/O channels&quot; which
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
22 can be routed from a program to a mass-storage file, any other I/O
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
23 device, or even another program. Another way to say the same thing
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
24 is that paths are files, and all I/O devices behave as files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
25 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
26 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
27 Data transferred through paths may be processed by OS-9 to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
28 conform to the hardware requirements of the specific I/O device
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
29 involved. Data transfers can be either bidirectional (read/write)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
30 or unidirectional (read only or write only), depending on the device
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
31 and/or how the path was established.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
32 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
33 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
34 Data transferred through a path is considered to be a stream of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
35 8-bit binary bytes that have no specific type or value: what the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
36 data actually represents depends on how it is used by each program.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
37 This is important because it means that OS-9 does not require data
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
38 to have any special format or meaning.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
39 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
40 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
41 Some of the advantages of the unified I/O system are:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
42 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
43 <itemizedlist mark="square">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
44 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
45 Programs will operate correctly regardless of the particular I/O
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
46 devices selected and used when the program is actually executed.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
47 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
48 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
49 Programs are highly portable from one computer to another, even
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
50 when the computers have different kinds of I/O devices.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
51 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
52 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
53 I/O can be redirected to alternate files or devices when the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
54 program is run, without having to alter the program.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
55 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
56 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
57 New or special device driver routines can easily be created and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
58 installed by the user.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
59 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
60 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
61 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
62
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
63 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
64 <title>Pathlists: How Paths Are Named</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
65 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
66 Whenever a path is established (or &quot;opened&quot;), OS-9 must be given
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
67 a description of the &quot;routing&quot; of the path. This description is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
68 given in the form of a character string called a &quot;pathlist&quot;. It
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
69 specifies a particular mass-storage file, directory file, or any
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
70 other I/O device. OS-9 &quot;pathlists&quot; are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
71 similar to &quot;filenames&quot; used
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
72 by other operating systems.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
73 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
74 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
75 The name &quot;pathlist&quot; is used instead
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
76 of &quot;pathname&quot; or &quot;filename&quot;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
77 because in many cases it is a list consisting of more than one name
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
78 to specify a particular I/O device or file. In order to convey all
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
79 the information required, a pathlist may include a device name, one
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
80 or more directory file names and a data file name. Each name within
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
81 a pathlist is separated by slash &quot;/&quot; characters.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
82 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
83 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
84 Names are used to describe three kinds of things:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
85
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
86 <itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
87 <listitem><para>Names of Physical I/O Devices</para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
88 <listitem><para>Names of Regular Files</para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
89 <listitem><para>Names of Directory Files</para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
90 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
91
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
92
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
93 Names can have one to 29 characters, all of which are used for
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
94 matching. They must becin with an upper- or lower-case letter
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
95 followed by any combination of the following characters:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
96 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
97
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
98 <simplelist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
99 <member>uppercase letters: A - Z</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
100 <member>lowercase letters: a - z</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
101 <member>decimal digits: 0 - 9</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
102 <member>underscore: _</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
103 <member>period: .</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
104 </simplelist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
105
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
106 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
107 Here are examples of <emphasis>legal</emphasis> names:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
108 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
109 <tgroup cols="2">
644
41e412b40024 XMLified.
roug
parents: 149
diff changeset
110 <colspec colwidth="2.5in"/>
41e412b40024 XMLified.
roug
parents: 149
diff changeset
111 <colspec colwidth="2.5in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
112 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
113 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
114 <entry>raw.data.2</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
115 <entry>projectreview.backup</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
116 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
117 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
118 <entry>reconciliation.report</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
119 <entry>X042953</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
120 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
121 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
122 <entry>RJJones</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
123 <entry>search.bin</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
124 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
125 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
126 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
127 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
128
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
129 Here are examples of <emphasis>illegal</emphasis> names:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
130
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
131 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
132 <tgroup cols="2">
644
41e412b40024 XMLified.
roug
parents: 149
diff changeset
133 <colspec colwidth="3.1in"/>
41e412b40024 XMLified.
roug
parents: 149
diff changeset
134 <colspec colwidth="2.0in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
135 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
136 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
137 <entry>22November</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
138 <entry>(does not start with a letter)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
139 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
140 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
141 <entry>max*min</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
142 <entry>(* is not a legal character)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
143 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
144 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
145 <entry>.data</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
146 <entry>(does not start with a letter)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
147 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
148 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
149 <entry>open orders</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
150 <entry>(cannot contain a space)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
151 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
152 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
153 <entry>this.name.obviously.has.more.than.29.characters</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
154 <entry>(too long)</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
155 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
156 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
157 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
158 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
159 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
160 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
161
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
162 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
163 <title>I/O Device Names</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
164 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
165 Each physical input/output device supported by the system must
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
166 have a unique name. The actual names used are defined when the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
167 system is set up and cannot be changed while the system is running.
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
168 The device names used for the &make; are:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
169 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
170 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
171 <tgroup cols="2">
644
41e412b40024 XMLified.
roug
parents: 149
diff changeset
172 <colspec colwidth="0.7in"/>
41e412b40024 XMLified.
roug
parents: 149
diff changeset
173 <colspec colwidth="2in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
174 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
175 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
176 <entry>TERM</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
177 <entry>Video display/keyboard</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
178 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
179 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
180 <entry>P</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
181 <entry>Printer port</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
182 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
183 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
184 <entry>D0</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
185 <entry>Disk drive unit zero</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
186 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
187 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
188 <entry>D1</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
189 <entry>Disk drive unit one</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
190 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
191 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
192 <entry>PIPE</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
193 <entry>Pipes</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
194 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
195 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
196 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
197 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
198 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
199 Device names may only be used as the first name of a pathlist,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
200 and must be preceded by a slash &quot;/&quot; character to indicate that the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
201 name is that of an I/O device. If the device is not a disk or
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
202 similar device the device name is the only name allowed. This is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
203 true for devices such as terminals, printers, etc. Some examples of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
204 of pathlists that refer to I/O devices are:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
205 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
206
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
207 <simplelist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
208 <member>/TERM</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
209 <member>/P</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
210 <member>/D1</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
211 </simplelist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
212
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
213 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
214 I/O device names are actually the names of the &quot;device descriptor
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
215 modules&quot; kept by OS-9 in an internal data structure called the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
216 &quot;module directory&quot; (See the OS-9 System Programmer's manual for more
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
217 information about device driver and descriptor modules). This
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
218 directory is automatically set up during OS-9's system start up
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
219 sequence, and updated as modules are added or deleted while the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
220 system is running.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
221 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
222 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
223
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
224 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
225 <title>Multifile Devices And Directory Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
226 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
227 Multifile devices are mass storage devices (usually disk systems)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
228 that store data organized into separate logical entities called
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
229 &quot;files&quot;. Each file has a name which is entered in a directory file.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
230 Every multifile device has a master directory (called the &quot;root
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
231 directory&quot;) that includes the names of the files and sub-directories
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
232 stored on the device. The root directory is created automatically
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
233 when the disk is initialized by the <command>format</command> command.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
234 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
235 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
236 Pathlists that refer to multifile devices may have more than one
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
237 name. For example, to refer to the file &quot;mouse&quot; whose name appears
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
238 in the root directory of device &quot;D1&quot; (disk drive one) the following
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
239 pathlist is used:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
240 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
241 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
242
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
243 /d1/mouse
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
244
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
245 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
246 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
247 When OS-9 is asked to create a path, it uses the names in the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
248 pathlist sequentially from left to right to search various
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
249 directories to obtain the necessary routing information. These
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
250 directories are organized as a tree-structured hierarchy. The
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
251 highest-level directory is called the &quot;device directory&quot;, which
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
252 contains names and linkages to all the I/O devices on a given
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
253 system. If any of the devices are of a multifile type they each
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
254 have a root directory, which is the next-highest level.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
255 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
256 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
257 The diagram below is a simplified file system tree of a typical
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
258 OS-9 system disk. Note that device and directory names are capitalized
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
259 and ordinary file names are not. This is a customary (but
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
260 not mandatory) practice which allows you to easily identify directory
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
261 files using the short form of the <command>dir</command> command.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
262 </para>
644
41e412b40024 XMLified.
roug
parents: 149
diff changeset
263 <literallayout class="monospaced">
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
264 System Device Directory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
265 +---------------------------------+
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
266 ! ! ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
267 D0 TERM P D1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
268 ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
269 ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
270 ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
271 D0 Root Directory D1 Root Directory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
272 +----------------------+ +----------------------+
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
273 ! ! ! ! ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
274 DEFS startup CMDS file1 file2 file3
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
275 ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
276 ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
277 ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
278 --+-- +-----+----+-----+-----+
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
279 ! ! ! ! ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
280 OS9Defs copy list dir del backup
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
281 </literallayout>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
282 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
283 The device names in this example system are &quot;TERM&quot;,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
284 &quot;P&quot;, &quot;D0&quot; and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
285 &quot;D1&quot;. The root directory of device
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
286 &quot;D0&quot; includes two directory
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
287 files, <filename class="directory">DEFS</filename> and <filename class="directory">CMDS</filename>, and one ordinary file &quot;startup&quot;. Notice that
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
288 device &quot;D1&quot; has in its root directory three ordinary files. In
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
289 order to access the file &quot;file2&quot; on
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
290 device &quot;d1&quot;, a pathlist having
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
291 two names must be used:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
292 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
293 list /d1/file2
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
294 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
295 To construct a pathlist to access the file &quot;dir&quot; on device
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
296 &quot;d0&quot; it is necessary to include in the pathlist the name of the
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
297 intermediate directory file <filename class="directory">CMDS</filename>. For example, to copy this file
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
298 requires a pathlist having three names to describe the &quot;from&quot; file:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
299 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
300 copy /d0/cmds/dir temp
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
301 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
302 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
303 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
304
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
305 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
306 <title>Creating and Using Directories</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
307 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
308 It is possible to create a virtually unlimited number of levels
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
309 of directories on a mass storage device using the <command>makdir</command> command.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
310 Directories are a special type of file (see 3.8.1). They can be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
311 processed by the same I/O functions used to access regular files
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
312 which makes directory-related processing fairly simple.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
313 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
314 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
315 To demonstrate how directories work, assume that the disk in
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
316 drive one (&quot;d1&quot;) has been freshly formatted so that it has a root
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
317 directory only. The <command>build</command> command can be used to create a text file
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
318 on &quot;d1&quot;. The <command>build</command> command will print out &quot;?&quot; as a prompt to
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
319 indicate that it is waiting for a text line to be entered. It will
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
320 place each line into the text file until an empty line with only a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
321 carriage return is entered, as shown below:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
322 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
323 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
324 OS9: build /d1/file1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
325 ? This is the first file that
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
326 ? we created.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
327 ? [ENTER]
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
328 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
329
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
330 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
331 The <command>dir</command> command will now indicate the existence of the new file:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
332 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
333
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
334 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
335 OS9: dir /d1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
336
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
337 Directory of /d1 15:45:29
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
338 file1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
339 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
340
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
341 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
342 The <command>list</command> command can be used to display the text stored in the
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
343 file:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
344 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
345
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
346 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
347 OS9: list /d1/file1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
348
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
349 This is the first file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
350 that we created.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
351 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
352
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
353 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
354 The <command>build</command> command again is again used to create two more text
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
355 files:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
356 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
357
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
358 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
359 OS9: build /d1/file2
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
360 ? This is the second file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
361 ? that we created.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
362 ? [ENTER]
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
363
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
364 OS9: build /d1/file3
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
365 ? This is another file.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
366 ? [ENTER]
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
367 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
368
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
369 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
370 The <command>dir</command> command will now show three file names:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
371 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
372
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
373 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
374 OS9: dir /d1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
375 Directory of /D1 15:52:29
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
376 file1 file2 file3
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
377 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
378
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
379 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
380 To make a new directory in this directory, the <command>makdir</command> command is
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
381 used. The new directory will be called <filename class="directory">NEWDIR</filename>. Notice that
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
382 throughout this manual directory names are always capitalized. This
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
383 is <emphasis>not</emphasis> a requirement of OS-9 (see 3.1) . Rather, it is a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
384 practice popular with many OS-9 users because it allows easy identification
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
385 of directory files at all times (assuming all other file names use
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
386 lower-case letters).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
387 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
388
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
389 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
390 OS9: makdir /D1/NEWDIR
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
391 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
392
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
393 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
394 The directory file <filename class="directory">NEWDIR</filename> is now a file listed in D1's root
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
395 directory:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
396 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
397
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
398 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
399 OS9: dir /D1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
400
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
401 Directory of /D1 16:04:31
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
402 file1 file2 file3 NEWDIR
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
403 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
404
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
405 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
406 Now we will create a new file and put in the new directory, using
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
407 the <command>copy</command> command to duplicate <filename>file1</filename>:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
408 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
409 <screen>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
410 OS9: copy /d1/file1 /d1/newdir/file1.copy
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
411 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
412 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
413 Observe that the second pathlist now has three names: the name of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
414 the root directory (&quot;D1&quot;), the name of the next lower directory
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
415 (<filename class="directory">NEWDIR</filename>), then the actual file name (<filename class="directory">file1.copy</filename>). Here's what
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
416 the directories look like now:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
417 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
418 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
419 D1 Root Directory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
420 +---------+--------+--------+
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
421 ! ! ! !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
422 NEWDIR file1 file2 file3
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
423 !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
424 !
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
425 file1.copy
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
426 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
427 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
428 The <command>dir</command> command can now show the files in the new directory:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
429 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
430 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
431 OS9: dir /D1/NEWDIR
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
432
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
433 Directory of /D1/NEWDIR
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
434 file1.copy
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
435 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
436 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
437 It is possible to use <command>makdir</command> to create additional new directories
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
438 within <filename class="directory">NEWDIR</filename>, and so on, limited only by available disk
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
439 space.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
440 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
441 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
442
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
443 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
444 <title>Deleting Directory Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
445 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
446 The <command>del</command> command cannot be used to directly delete a directory
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
447 file. If a directory file that still contained file names were to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
448 be deleted, OS-9 would have no way to access the files or to return
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
449 their storage to the unallocated storage pool. Therefore, the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
450 following sequence must be performed to delete a directory file:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
451 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
452 <para>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
453 1. All file names in the directory must be deleted.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
454 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
455 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
456 2. The <command>attr</command> command is used to turn off the files directory
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
457 attrribute (-d option), making it an ordinary file (see 3.8).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
458 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
459 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
460 3. The file may now be deleted using the <command>del</command> command.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
461 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
462 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
463 A simpler alternative is to use the <command>deldir</command> command to automatically
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
464 perform all these steps for you.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
465 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
466 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
467
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
468 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
469 <title>Additional Information About Directories</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
470 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
471 The OS-9 directory system is very useful because it allows each
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
472 user to privately organize files as desired (by project, function,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
473 etc.), without affecting other files or other user's files. Another
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
474 advantage of the hierarchical directory system is that files with
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
475 identical names can be kept on the same device as long as the names
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
476 are in different directories. For example, you can have a set of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
477 test files to check out a program using the same file names as the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
478 program's actual working files. You can then run the program with
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
479 test data or actual data simply by switching directories.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
480 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
481 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
482 Here are some important characteristics relating to use of directory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
483 files:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
484 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
485 <itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
486 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
487 Directories have the same ownership and security attributes
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
488 and rules as regular files.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
489 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
490 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
491 The name of a given file appears in exactly one directory.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
492 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
493 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
494 Files can only be added to directories when they are created.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
495 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
496 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
497 A file and the directory in which its name is kept must reside on
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
498 the same device.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
499 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
500 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
501 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
502
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
503 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
504 <title>Using and Changing Working Directories</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
505 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
506 Each program (process) has two &quot;working directories&quot; associated
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
507 with it at all times: a &quot;data directory&quot; and an &quot;execution
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
508 directory&quot;. The working directory mechanism allows the name searching
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
509 involved in pathlist processing to start at any level (subtree)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
510 of the file system hierarchy. Any directory that the user has
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
511 permission to access (see 3.8) can be made a working directory.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
512 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
513 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
514 The rules used to determine whether pathlists refer to the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
515 current working directory or not are simple:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
516 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
517 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
518 ---&gt; When the first character of a pathlist IS a &quot;/&quot;,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
519 processing of the pathlist starts at the device directory,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
520 e.g., the first name MUST be a device name.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
521 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
522 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
523 ---&gt; When the first character of a pathlist IS NOT a &quot;/&quot;,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
524 processing of the pathlist starts at the current working
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
525 directory.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
526 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
527 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
528 Notice that pathlists starting with a &quot;/&quot;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
529 <emphasis>must</emphasis> be complete, in
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
530 other words, they must have all names required to trace the pathlist
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
531 from the device directory down through all intermediate directories
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
532 (if any). For example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
533 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
534 <informalexample>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
535 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
536 /d2/JOE/WORKINGFILES/testresults
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
537 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
538 </informalexample>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
539 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
540 On the other hand, use of the current working directory allows
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
541 all names in the file hierarchy tree to be implied instead of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
542 explicitly given. This not only makes pathlists shorter, but allows
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
543 OS-9 to locate files faster because (typically) fewer directories
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
544 need be searched. For example, if the current working directory is
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
545 <filename class="directory">/D1/PETE/GAMES</filename> and a pathlist is given such as:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
546 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
547 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
548 baseball
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
549 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
550 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
551 the actual pathlist <emphasis>implied</emphasis> is:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
552 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
553 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
554 /D1/PETE/GAMES/baseball
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
555 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
556 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
557 Pathlists using working directories can also specify additional
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
558 lower-level directories. Referring to the example above, the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
559 pathlist:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
560 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
561 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
562 ACTION/racing
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
563 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
564 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
565 implies the complete pathlist:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
566 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
567 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
568 /D1/PETE/GAMES/ACTION/racing
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
569 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
570
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
571 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
572 <title>Automatic Selection of Working Directories</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
573 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
574 Recall that two working directories are referred to as the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
575 &quot;current execution directory&quot; and the &quot;current data directory&quot;. The
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
576 reason two working directories are maintained is so that files
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
577 containing
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
578 <emphasis>programs</emphasis> can be organized in different directories than
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
579 files containing <emphasis>data</emphasis>.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
580 OS-9 automatically selects either working
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
581 directory, depending on the usage of the pathlist:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
582 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
583 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
584 ---&gt; OS-9 will search the execution directory when it attempts to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
585 load files into memory assumed to be executable programs. This
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
586 means that programs to be run as commands or loaded into
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
587 memory must be in the current execution directory.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
588 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
589 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
590 ---&gt; The data directory is used for all other file references (such
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
591 as text files, etc.)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
592 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
593 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
594 Immediately after startup, OS-9 will set the data directory to be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
595 (the root directory of) the system disk drive (usually &quot;D0&quot;), and
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
596 the working directory to be a directory called <filename class="directory">cmds</filename> on the same
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
597 drive (<filename class="directory">/D0/cmds</filename>). On timesharing systems, the <command>login</command> command
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
598 selects the initial execution and data directories to the file names
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
599 specified in each user's information record stored in the system
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
600 password file(ref. 5.4.2).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
601 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
602 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
603 Here is an example of a <command>shell</command> command statement using the default
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
604 working directory notation, and its equivalent expansion:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
605 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
606 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
607 copy file1 file2
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
608 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
609 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
610 If the current execution directory is <filename class="directory">/D0/CMDS</filename> and the current
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
611 data directory is <filename class="directory">/D0/JONES</filename>, the same command, fully expanded to
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
612 show complete pathlists implied is:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
613 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
614 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
615 OS9: /D0/CMDS/copy /D0/JONES/filel /D0/JONES/file2
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
616 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
617 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
618 Notice that the first pathlist <command>copy</command> expands to the current working
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
619 directory pathlist because it is assumed to be an executable program
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
620 but the two other file names expand using the data directory because
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
621 they are not assumed to be executable.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
622 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
623 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
624
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
625 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
626 <title>Changing Current Working Directories</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
627 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
628 The built-in shell commands <command>chd</command> and <command>chx</command> can be used to
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
629 independently change the current working data and execution
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
630 directories, respectively. These command names must be followed by
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
631 a pathlist that describes the new directory file. You must have
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
632 permission to access the directory according to normal file security
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
633 rules. Here are some examples:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
634 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
635 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
636 OS9: chd /D1/MY.DATAFILES
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
637
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
638 OS9: chx /D0/TESTPROGRAMS
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
639 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
640 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
641 When using the <command>chd</command> or <command>chx</command> commands, pathlists work the same as they
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
642 do for regular files, except for the last name in the pathlist must
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
643 be a directory name. If the pathlist begins with a &quot;/&quot; , OS-9 will
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
644 begin searching in the device directory for the new working
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
645 directory, otherwise searching will begin with the present directory.
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
646 For example, the following sequence of commands set the
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
647 working directory to the same file:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
648 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
649 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
650 OS9: CHD /D1/SARAH
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
651 OS9: CHD PROJECT1
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
652
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
653 OS9: CHD /D1/SARAH/PROJECT1 (same effect as above)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
654 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
655 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
656
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
657 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
658 <title>Anonymous Directory Names</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
659 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
660 Sometimes is useful to be able to refer to the current directory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
661 or the next higher-level directory, but its name (full pathlist) may
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
662 not be known. Because of this, special &quot;name substitutes&quot; are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
663 available. They are:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
664 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
665 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
666 <filename class="directory">.</filename> refers to the present working directory
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
667 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
668 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
669 <filename class="directory">..</filename> refers to the directory that contains the name of the present
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
670 directory (e.g., the next highest level directory)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
671 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
672 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
673 <filename class="directory">...</filename> refers to directory two levels up, and so on
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
674 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
675 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
676 These can be used in place of pathlists and/or the first name in a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
677 pathlist. Here are some examples:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
678 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
679 <informaltable frame="none">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
680 <tgroup cols="2">
644
41e412b40024 XMLified.
roug
parents: 149
diff changeset
681 <colspec colwidth="1.5in"/>
41e412b40024 XMLified.
roug
parents: 149
diff changeset
682 <colspec colwidth="3in"/>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
683 <tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
684 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
685 <entry>OS9: dir .</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
686 <entry>lists file names in the working data directory</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
687 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
688 <row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
689 <entry>OS9: dir ..</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
690 <entry>lists names in the working data directory's parent directory.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
691 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
692 <row>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
693 <entry>OS9: del ../temp</entry>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
694 <entry>deletes the file <filename>temp</filename> from the
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
695 working data directory's parent directory.</entry>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
696 </row>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
697 </tbody>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
698 </tgroup>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
699 </informaltable>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
700 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
701 The substitute names refer to either the execution or data
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
702 directories, depending on the context in which they are used.
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
703 For example, if <filename class="directory">..</filename> is used in a pathlist of a file which
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
704 will be loaded and/or executed, it will represent the parent
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
705 directory of the execution directory. Likewise, if <filename class="directory">.</filename> is used in a
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
706 pathlist describing a program's input file, it will represent the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
707 current data directory.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
708 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
709 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
710 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
711
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
712 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
713 <title>The File Security System</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
714 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
715 Every file (including directory files) has properties called
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
716 <emphasis>ownership</emphasis>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
717 and <emphasis>attributes</emphasis> which determine who may access the file and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
718 how it many be used.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
719 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
720 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
721 OS-9 automatically stores with each file the user number
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
722 associated with the process that created it. This user is considered
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
723 to be the &quot;owner&quot; of the file.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
724 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
725 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
726 Usage and security functions are based on &quot;attributes&quot;, which
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
727 define how and by whom the file can be accessed. There are a total
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
728 of seven attributes, each of which can be turned &quot;off&quot; or
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
729 &quot;on&quot;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
730 independently. The &quot;d&quot; attribute is used to indicate (when on) that
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
731 the file is a directory file. The other six attributes control
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
732 whether the file can be read, written to, or executed, by either the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
733 owner or by the &quot;public&quot; (all other users). Specifically, these six
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
734 attributes are:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
735 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
736 <para>
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
737 WRITE PERMISSION FOR OWNER: If on, the owner may write to the file
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
738 or delete it. This permission can be used to protect important
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
739 files from accidental deletion or modification.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
740 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
741 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
742 READ PERMISSION FOR OWNER: If on, the owner is allowed to read
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
743 from the file. This can be used to prevent &quot;binary&quot; files from
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
744 being used as &quot;text&quot; files
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
745 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
746 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
747 EXECUTE PERMISSION FOR OWNER: If on, the owner can load the file into memory
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
748 and execute it. Note that the file <emphasis>must</emphasis> contain one or
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
749 more valid OS-9 format memory modules in order to actually load
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
750 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
751 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
752 The following &quot;public permissions&quot; work the same way as
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
753 the &quot;owner permissions&quot; above but are applied to processes having
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
754 DIFFERENT user numbers than the file's owner.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
755 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
756 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
757 WRITE PERMISSION FOR PUBLIC - If on, any other user may write to or
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
758 delete the file.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
759 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
760 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
761 READ PERMISSION FOR PUBLIC - If on, any other user may read (and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
762 possibly copy) the file.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
763 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
764 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
765 EXECUTE PERMISSION FOR PUBLIC - If on, any other user may execute
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
766 the file.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
767 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
768 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
769 For example, if a particular file had all permissions on except
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
770 &quot;write permit to public&quot; and &quot;read permit to public&quot;, the owner
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
771 would have unrestricted access to the file, but other users could
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
772 execute it, but not read, copy, delete, or alter it.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
773 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
774
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
775 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
776 <title>Examining and Changing File Attributes</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
777 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
778 The <command>dir</command> command may be used to examine the security permissions
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
779 of the files in any particular directory when the &quot;e&quot; option is
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
780 used. An example using the <command>dir e</command> command to show the detailed
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
781 attributes of the files in the current working directory is:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
782 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
783 <screen>
1017
c9b63a3c0a17 More changes
boisy
parents: 1011
diff changeset
784 Directory of . 2003/03/04 10:20
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
785
1017
c9b63a3c0a17 More changes
boisy
parents: 1011
diff changeset
786 Owner Last Modified Attributes Sector Bytecount Name
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
787 ----- ----------------- ---------- ------ --------- ----
1017
c9b63a3c0a17 More changes
boisy
parents: 1011
diff changeset
788 1 2002/05/29 14:02 --e--e-r 47 42 file1
c9b63a3c0a17 More changes
boisy
parents: 1011
diff changeset
789 0 2002/10/12 02:15 ---wr-wr 48 43 file2
c9b63a3c0a17 More changes
boisy
parents: 1011
diff changeset
790 3 2002/04/29 23:35 -s----wr 51 22 file3
c9b63a3c0a17 More changes
boisy
parents: 1011
diff changeset
791 1 2003/01/06 16:19 d-ewrewr 6D 800 NEWDIR
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
792 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
793
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
794 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
795 This display is fairly self-explanatory. The &quot;attributes&quot; column
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
796 shows which attributes are currently on by the presence or absence
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
797 of associated characters in the following format:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
798 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
799 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
800 dsewrewr
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
801 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
802
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
803 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
804 The character positions correspond to from left to right: directory;
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
805 sharable; public execute; public write; public read; owner execute;
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
806 owner write; owner read. The <command>attr</command> command is used to examine or
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
807 change a file's attributes. Typing <command>attr</command> followed by a file name
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
808 will result in the present attributes to be displayed, for example:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
809 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
810
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
811 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
812 OS9: attr file2
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
813 -s-wr-ewr
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
814 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
815
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
816 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
817 If the command is used with a list of one or more attribute abbreviations,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
818 the file's attributes will be changed accordingly (if
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
819 legal). For example, the command:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
820 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
821 <screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
822 OS9: attr file2 pw pr -e -pe
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
823 </screen>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
824 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
825 enables public write and public read permissions and removes execute
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
826 permission for both the owner and the public.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
827 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
828 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
829 The &quot;directory&quot; attribute behaves somewhat differently than the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
830 read, write, and execute permissions. This is because it would be
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
831 quite dangerous to be able to change directory files to normal files,
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
832 and creation of a directory requires special initialization.
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
833 Therefore, the <command>attr</command> command
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
834 <emphasis>cannot</emphasis> be used to turn
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
835 the directory (d) attribute on (only <command>makdir</command> can), and can be used
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
836 to turn it off <emphasis>only</emphasis> if the directory is empty.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
837 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
838 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
839 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
840
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
841 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
842 <title>Reading and Writing From Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
843 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
844 A single file type and format is used for all mass storage files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
845 Files store an ordered sequence of 8-bit bytes. OS-9 is not usually
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
846 sensitive to the contents of files for most functions. A given file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
847 may store a machine language program, characters of text, or almost
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
848 anything else. Data is written to and read from files exactly as
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
849 given. The file can be any size from zero up to the maximum
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
850 capacity of the storage device, and can be expanded or shortened as
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
851 desired.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
852 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
853 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
854 When a file is created or opened a &quot;file pointer&quot; is established
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
855 for it. Bytes within the file are addressed like memory, and the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
856 file pointer holds the &quot;address&quot; of the next byte in the file to be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
857 written to or read from. The OS-9 &quot;read&quot; and &quot;write&quot; service
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
858 functions always update the pointer as data transfers are performed.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
859 Therefore, successive read or write operations will perform sequential data transfers.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
860 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
861 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
862 Any part of a file can also be read or written in non-sequential
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
863 order by using a function called &quot;seek&quot; to reposition the file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
864 pointer to any byte address in the file. This is used when random
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
865 access of the data is desired.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
866 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
867 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
868 To expand a file, you can simply write past the previous end of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
869 the file. Reading up to the last byte of a file will cause the next
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
870 &quot;read&quot; request to return an end-of-file status.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
871 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
872
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
873 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
874 <title>File Usage in OS-9</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
875 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
876 Even though there is physically only one type of file, the logical
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
877 usage of files in OS-9 covers a broad spectrum. Because all
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
878 OS-9 files have the same physical type, commands such as <command>copy</command>,
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
879 <command>del</command>, etc., can be used with any file regardless of its logical
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
880 usage. Similarly, a particular file can be treated as having a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
881 different logical usage at different times by different programs. The
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
882 main usage of files covered in this section are:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
883 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
884 <simplelist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
885 <member>TEXT</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
886 <member>RANDOM ACCESS DATA</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
887 <member>EXECUTABLE PROGRAM MODULES</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
888 <member>DIRECTORIES</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
889 <member>MISCELLANEOUS</member>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
890 </simplelist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
891 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
892
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
893 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
894 <title>Text Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
895 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
896 These files contain variable-length sequences (&quot;lines&quot;) of ASCII
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
897 characters. Each line is terminated by a carriage return character.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
898 Text files are used for program source code, procedure files,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
899 messages, documentation, etc. The Text Editor operates on this file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
900 format.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
901 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
902 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
903 Text files are usually read sequentially, and are supported by
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
904 almost all high-level languages (such as BASIC09 READ and WRITE
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
905 statements). Even though is is possible to randomly access data at
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
906 any location within a text file, it is rarely done in practice
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
907 because each line is variable length and it is hard to locate the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
908 beginning of each line without actually reading the data to locate
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
909 carriage return characters.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
910 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
911 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
912 The content of text files may be examined using the <command>list</command>
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
913 command.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
914 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
915 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
916
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
917 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
918 <title>Random Access Data Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
919 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
920 Random-access data files are created and used primarily from
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
921 within high-level languages such as Basic09, Pascal, C, and Cobol.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
922 In Basic09 and Pascal, &quot;GET&quot;, &quot;PUT&quot;, and &quot;SEEK&quot; functions operate on
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
923 random-access files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
924 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
925 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
926 The file is organized as an ordered sequence of &quot;records&quot;. Each
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
927 record has exactly the same length, so given a record's numerical
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
928 index, the record's beginning address within the file can be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
929 computed by multiplying the record number by the number of bytes
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
930 used for each record. Thus, records can be directly accessed in any
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
931 order.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
932 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
933 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
934 In most cases, the high-level language allows each record to be
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
935 subdivided into &quot;fields&quot;. Each field generally has a fixed length
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
936 and usage for all records within the file. For example, the first
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
937 field of a record may be defined as being 25 text characters, the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
938 next field may be two bytes long and used to hold 16-bit binary
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
939 numbers, etc.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
940 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
941 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
942 It is important to understand that OS-9 itself does not directly
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
943 process or deal with records other than providing the basic file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
944 functions required by all high-level languages to create and use
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
945 random-access files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
946 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
947 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
948
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
949 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
950 <title>Executable Program Module Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
951 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
952 These files are used to hold program modules generated by the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
953 assembler or <emphasis>compiled</emphasis> by high-level languages.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
954 Each file may
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
955 contain <emphasis>one or more</emphasis> program modules.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
956 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
957 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
958 OS-9 program modules resident in memory have a standard module
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
959 format that, besides the object code, includes a &quot;module header&quot; and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
960 a CRC check value. Program module(s) stored in files contain exact
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
961 binary copies of the programs as they will exist in memory, and not
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
962 one byte more. OS-9 does not require a &quot;load record&quot;
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
963 system commonly used by other operating systems because OS-9
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
964 programs are position-independent code and therefore do not have to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
965 be loaded into specific memory addresses.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
966 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
967 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
968 In order for OS-9 to load the program module(s) from a file, the
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
969 file itself must have execute permission and each module
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
970 must have a valid module header and CRC check value. If a program
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
971 module has been altered in any way, either as a file or in memory,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
972 its CRC check value will be incorrect And OS-9 will refuse to load
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
973 the module. The <command>verify</command> command can be used to check the correctness
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
974 of the check values, and update them to corrected values if
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
975 necessary.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
976 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
977 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
978 On Level One systems, if a file has two or more modules, they are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
979 treated as independent entities after loading and reside at different memory regions.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
980 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
981 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
982 Like other files that contain &quot;binary&quot; data, attempts to &quot;list&quot;
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
983 program files will result in the display of random characters on the
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
984 terminal giving strange effects. The <command>dump</command> command can be used to
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
985 safely examine the contents of this kind of file in hexadecimal and
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
986 controlled ASCII format.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
987 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
988 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
989
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
990 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
991 <title>Directory Files</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
992 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
993 Directory files play a key role in the OS-9 file system. They can only be created by the <command>makdir</command> command, and
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
994 can be identified by the &quot;d&quot; attribute being set (see 3.8.1). The
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
995 file is organized into 32-byte records. Each record can be a
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
996 directory entry. The first 29 bytes of the record is a string of
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
997 characters which is the file name. The last character of the name
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
998 has its sign bit (most significant bit) set. If the record is not
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
999 in use the first character position will have the value zero. The
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1000 last three bytes of the record is a 24-bit binary number which is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1001 the logical sector number where the file header record (see 3.10) is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1002 located.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1003 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1004 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
1005 The <command>makdir</command> command initializes all records in a new directory
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1006 to be unused entries except for the first two entries. These
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
1007 entries have the names <filename class="directory">.</filename> and <filename class="directory">..</filename> along with the logical sector
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1008 numbers of the directory and its parent directory, respectively (see 3.7.3).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1009 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1010 <para>
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
1011 Directories cannot be copied or listed - the <command>dir</command> command is
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1012 used instead. Directories also cannot be deleted directly (see 3.5).
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1013 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1014 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1015
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1016 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1017 <title>Miscellaneous File Usage</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1018 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1019 OS-9's basic file functions are so versatile it is possible to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1020 devise an almost unlimited number of special-purpose file formats
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1021 for particular applications, which do not fit into any of the three
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1022 previously discussed categories.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1023 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1024 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1025 Examples of this category are COBOL Indexed Sequential (ISAM)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1026 files and some special word processor file formats which allow
1011
cc153d1671f7 Updated for new manuals
boisy
parents: 644
diff changeset
1027 random access of text lines. As discussed in Sec.
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1028 3.9.1, most OS-9 utility commands work with any file format including
1053
b5ff125a1d60 Since this book was only typeset in fixed width, single-font, they used
roug
parents: 1017
diff changeset
1029 these special types. In general, the <command>dump</command> command is the preferred
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1030 method for examining the contents of unusually formatted files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1031 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1032 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1033 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1034
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1035 <section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1036 <title>Physical File Organization</title>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1037 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1038 OS-9's file system implements a universal logical organization
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1039 for all I/O devices that effectively eliminates most hardware-related
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1040 considerations for most applications. This section gives
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1041 basic information about the physical file structure used by OS-9.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1042 For more information, see the OS-9 System Programmer's Manual.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1043 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1044 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1045 Each OS-9 file is comprised of one or more sectors which are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1046 the physical storage units of the disk systems. Each sector holds
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1047 exactly 256 data bytes, and disk is numbered sequentially starting
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1048 with sector zero, track zero. This number is called a &quot;logical
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1049 sector number&quot;, or <emphasis>LSN</emphasis>.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1050 The mapping of logical sector numbers to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1051 physical track/sector numbers is done by the disk driver module.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1052 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1053 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1054 Sectors are the smallest allocatable physical unit on a disk
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1055 system, however, to increase efficiency on some larger-capacity disk.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1056 systems, OS-9 uses uniform-sized groups of sectors, called
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1057 <emphasis>clusters</emphasis>,
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1058 as the smallest allocatable unit. Cluster sizes are always an
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1059 integral power of two (2, 4, 8, etc.). One sector of each disk is
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1060 used as a <emphasis>bitmap</emphasis> (usually LSN 1),
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1061 in which each data bit corresponds
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1062 to one cluster on the disk. The bits are set and cleared to
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1063 indicate which clusters are in use (or defective), and which are
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1064 free for allocation to files.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1065 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1066 <para>
149
bb3e4d64103a Made the word "Dragon" an entity, thereby making it replacable with "Color"
roug
parents: 144
diff changeset
1067 The &make; Computer disk system uses the following format:
144
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1068 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1069 <itemizedlist mark="square">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1070 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1071 double density recording on one side
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1072 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1073 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1074 40 tracks per disk
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1075 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1076 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1077 18 sectors per track
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1078 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1079 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1080 one sector per cluster
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1081 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1082 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1083 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1084 Each file has a directory entry (see 3.9.5) which includes the
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1085 file name and the logical sector number of the file's &quot;file descriptor
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1086 sector&quot;, which contains a complete description of the file
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1087 including:
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1088 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1089 <itemizedlist mark="square">
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1090 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1091 attributes
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1092 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1093 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1094 owner
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1095 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1096 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1097 date and time created
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1098 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1099 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1100 size
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1101 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1102 <listitem><para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1103 segment list (description of data sector blocks)
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1104 </para></listitem>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1105 </itemizedlist>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1106 <para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1107 Unless the file size is zero, the file will have one or more
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1108 sectors/clusters used to store data. The data sectors are grouped
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1109 into one or more contiguous blocks called &quot;segments&quot;.
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1110 </para>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1111 </section>
f4e798ea65b9 More splitups.
roug
parents:
diff changeset
1112 </chapter>