Skip to content
This repository
Browse code

Merge pull request #55 from eXeC64/master

Moved sector joins out of sectors into a new structure
  • Loading branch information...
commit 71ca702ae16e5852a85157e296d60b18ed63a189 2 parents 6b03626 + 3d0337f
Melissa authored April 14, 2012
186  FS/Draft_Harrys_Allocation_Table.txt
@@ -2,7 +2,7 @@
2 2
 
3 3
 
4 4
 RFC (Draft-Fs)                                           H. Jeffery, Ed.
5  
-                                                          April 11, 2012
  5
+                                                          April 14, 2012
6 6
 
7 7
 
8 8
                         Harry's Allocation Table
@@ -24,25 +24,25 @@ Table of Contents
24 24
          3.1.1.1.  version . . . . . . . . . . . . . . . . . . . . . . 3
25 25
          3.1.1.2.  num_sectors . . . . . . . . . . . . . . . . . . . . 3
26 26
          3.1.1.3.  sector_map_start  . . . . . . . . . . . . . . . . . 4
27  
-         3.1.1.4.  sector_start  . . . . . . . . . . . . . . . . . . . 4
28  
-         3.1.1.5.  sector_size . . . . . . . . . . . . . . . . . . . . 4
29  
-         3.1.1.6.  sectors_used  . . . . . . . . . . . . . . . . . . . 4
  27
+         3.1.1.4.  sector_joins_start  . . . . . . . . . . . . . . . . 4
  28
+         3.1.1.5.  sector_start  . . . . . . . . . . . . . . . . . . . 4
  29
+         3.1.1.6.  sector_size . . . . . . . . . . . . . . . . . . . . 4
  30
+         3.1.1.7.  sectors_used  . . . . . . . . . . . . . . . . . . . 4
30 31
        3.1.2.  sector map  . . . . . . . . . . . . . . . . . . . . . . 4
31 32
          3.1.2.1.  bitmap  . . . . . . . . . . . . . . . . . . . . . . 4
32  
-       3.1.3.  sector  . . . . . . . . . . . . . . . . . . . . . . . . 4
33  
-         3.1.3.1.  next_sector_index . . . . . . . . . . . . . . . . . 5
34  
-         3.1.3.2.  sector_data . . . . . . . . . . . . . . . . . . . . 5
  33
+       3.1.3.  sector joins  . . . . . . . . . . . . . . . . . . . . . 5
  34
+       3.1.4.  sector  . . . . . . . . . . . . . . . . . . . . . . . . 5
35 35
      3.2.  Higher Layer  . . . . . . . . . . . . . . . . . . . . . . . 5
36 36
        3.2.1.  inode . . . . . . . . . . . . . . . . . . . . . . . . . 5
37 37
          3.2.1.1.  type  . . . . . . . . . . . . . . . . . . . . . . . 6
38 38
          3.2.1.2.  content_size  . . . . . . . . . . . . . . . . . . . 6
39 39
          3.2.1.3.  link_count  . . . . . . . . . . . . . . . . . . . . 6
40 40
        3.2.2.  link  . . . . . . . . . . . . . . . . . . . . . . . . . 6
41  
-         3.2.2.1.  strip_start_sector  . . . . . . . . . . . . . . . . 6
42  
-         3.2.2.2.  file_name . . . . . . . . . . . . . . . . . . . . . 6
  41
+         3.2.2.1.  strip_start_sector  . . . . . . . . . . . . . . . . 7
  42
+         3.2.2.2.  file_name . . . . . . . . . . . . . . . . . . . . . 7
43 43
    4.  Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
44 44
      4.1.  Constructing a HAT filesystem . . . . . . . . . . . . . . . 7
45  
-     4.2.  Finding a file's inode  . . . . . . . . . . . . . . . . . . 7
  45
+     4.2.  Finding a file's inode  . . . . . . . . . . . . . . . . . . 8
46 46
      4.3.  Allocating sectors  . . . . . . . . . . . . . . . . . . . . 8
47 47
    5.  Security Considerations . . . . . . . . . . . . . . . . . . . . 8
48 48
    Author's Address  . . . . . . . . . . . . . . . . . . . . . . . . . 8
@@ -115,16 +115,17 @@ Jeffery                                                         [Page 2]
115 115
 
116 116
 3.1.  Lower Layer
117 117
 
118  
-                              +------------+
119  
-                              |   Section  |
120  
-                              +------------+
121  
-                              |   header   |
122  
-                              | sector map |
123  
-                              |  sector 0  |
124  
-                              |  sector 1  |
125  
-                              |  sector 2  |
126  
-                              |     ...    |
127  
-                              +------------+
  118
+                             +--------------+
  119
+                             |    Section   |
  120
+                             +--------------+
  121
+                             |    header    |
  122
+                             |  sector map  |
  123
+                             | sector joins |
  124
+                             |   sector 0   |
  125
+                             |   sector 1   |
  126
+                             |   sector 2   |
  127
+                             |      ...     |
  128
+                             +--------------+
128 129
 
129 130
                        Table 1: Filesystem Structure
130 131
 
@@ -134,16 +135,17 @@ Jeffery                                                         [Page 2]
134 135
 
135 136
    The total size of the header is 16 words.
136 137
 
137  
-                        +------+------------------+
138  
-                        | Size |       Name       |
139  
-                        +------+------------------+
140  
-                        |   1  |      version     |
141  
-                        |   1  |    num_sectors   |
142  
-                        |   2  | sector_map_start |
143  
-                        |   2  |   sector_start   |
144  
-                        |   1  |    sector_size   |
145  
-                        |   1  |   sectors_used   |
146  
-                        +------+------------------+
  138
+                       +------+--------------------+
  139
+                       | Size |        Name        |
  140
+                       +------+--------------------+
  141
+                       |   1  |       version      |
  142
+                       |   1  |     num_sectors    |
  143
+                       |   2  |  sector_map_start  |
  144
+                       |   2  | sector_joins_start |
  145
+                       |   2  |    sector_start    |
  146
+                       |   1  |     sector_size    |
  147
+                       |   1  |    sectors_used    |
  148
+                       +------+--------------------+
147 149
 
148 150
                          Table 2: Header Structure
149 151
 
@@ -162,8 +164,6 @@ Jeffery                                                         [Page 2]
162 164
 
163 165
 
164 166
 
165  
-
166  
-
167 167
 Jeffery                                                         [Page 3]
168 168
 
169 169
                                    HAT                        April 2012
@@ -173,7 +173,12 @@ Jeffery                                                         [Page 3]
173 173
 
174 174
    This field contains the address of the start of the sector map.
175 175
 
176  
-3.1.1.4.  sector_start
  176
+3.1.1.4.  sector_joins_start
  177
+
  178
+   This field contains the address of the start of the array of sector
  179
+   joins.
  180
+
  181
+3.1.1.5.  sector_start
177 182
 
178 183
    This field contains the address of the first sector on disk.
179 184
 
@@ -181,13 +186,13 @@ Jeffery                                                         [Page 3]
181 186
    immediately after the header.  The first sector may be positioned to
182 187
    provide alignment with the underlying disk's blocks.
183 188
 
184  
-3.1.1.5.  sector_size
  189
+3.1.1.6.  sector_size
185 190
 
186 191
    This field contains the size of each sector in the filesystem.
187 192
 
188 193
    This must be a power of 2, such as 128, 256 or 512.
189 194
 
190  
-3.1.1.6.  sectors_used
  195
+3.1.1.7.  sectors_used
191 196
 
192 197
    This field contains the number of sectors that are currently in use.
193 198
 
@@ -213,11 +218,6 @@ Jeffery                                                         [Page 3]
213 218
 
214 219
    Any spare bits at the end of the bitmap must be set to 1.
215 220
 
216  
-3.1.3.  sector
217  
-
218  
-   The sector structure is used to store blocks of raw data.  Each
219  
-   sector may point to another sector.  The chain of sectors that forms
220  
-
221 221
 
222 222
 
223 223
 Jeffery                                                         [Page 4]
@@ -225,28 +225,41 @@ Jeffery                                                         [Page 4]
225 225
                                    HAT                        April 2012
226 226
 
227 227
 
228  
-   is then provided to the higher layer in the form of a strip that
229  
-   masks the non-contiguous nature of the sectors.
  228
+3.1.3.  sector joins
230 229
 
231  
-                  +-----------------+-------------------+
232  
-                  |       Size      |        Name       |
233  
-                  +-----------------+-------------------+
234  
-                  |        1        | next_sector_index |
235  
-                  | sector_size - 1 |    sector_data    |
236  
-                  +-----------------+-------------------+
  230
+   This section is an array of words, each word is used to join one
  231
+   sector to another.
237 232
 
238  
-                         Table 4: sector structure
  233
+                          +------+--------------+
  234
+                          | Size |     Name     |
  235
+                          +------+--------------+
  236
+                          |   1  | sector0_next |
  237
+                          |   1  | sector1_next |
  238
+                          |   1  | sector2_next |
  239
+                          |   1  | sector3_next |
  240
+                          |   1  |      ...     |
  241
+                          +------+--------------+
  242
+
  243
+                      Table 4: sector links structure
239 244
 
240  
-3.1.3.1.  next_sector_index
  245
+   Each entry joins the end of one sector to the start of another, if
  246
+   there is no next sector the entry is set to 0.
241 247
 
242  
-   This field contains the index of the sector that follows this one.
243  
-   When there is no such sector this field's value is set to 0x0000.
  248
+   For example, if there is a strip starting in sector 0, then
  249
+   continuing in sector 2, then sector 1, then finishing in sector 3,
  250
+   then the value of sector0_next will be 2, sector1_next will be 3,
  251
+   sector2_next will be 1, sector3_next will be 0.
244 252
 
245  
-3.1.3.2.  sector_data
  253
+   The total length of this section in words is the total number of
  254
+   sectors in the filesystem.
246 255
 
247  
-   This field simply contains raw data.
  256
+3.1.4.  sector
248 257
 
249  
-   The size of this field is determined by the sector_size field in the
  258
+   The sector structure is used to store blocks of raw data.  Sectors
  259
+   themselves are just raw blocks of data with no formatting or
  260
+   wrapping.
  261
+
  262
+   Each sector has the size equal to the sector_size, as defined by the
250 263
    header of the filesystem.
251 264
 
252 265
 3.2.  Higher Layer
@@ -255,19 +268,6 @@ Jeffery                                                         [Page 4]
255 268
 
256 269
    The inode structure is used to store metadata about files.
257 270
 
258  
-                          +------+--------------+
259  
-                          | Size |     Name     |
260  
-                          +------+--------------+
261  
-                          |   1  |     type     |
262  
-                          |   2  | content_size |
263  
-                          |   1  |  link_count  |
264  
-                          +------+--------------+
265  
-
266  
-                         Table 5: inode structure
267  
-
268  
-
269  
-
270  
-
271 271
 
272 272
 
273 273
 
@@ -281,6 +281,16 @@ Jeffery                                                         [Page 5]
281 281
                                    HAT                        April 2012
282 282
 
283 283
 
  284
+                          +------+--------------+
  285
+                          | Size |     Name     |
  286
+                          +------+--------------+
  287
+                          |   1  |     type     |
  288
+                          |   2  | content_size |
  289
+                          |   1  |  link_count  |
  290
+                          +------+--------------+
  291
+
  292
+                         Table 5: inode structure
  293
+
284 294
 3.2.1.1.  type
285 295
 
286 296
                      +-------+----------------------+
@@ -319,6 +329,14 @@ Jeffery                                                         [Page 5]
319 329
 
320 330
                           Table 7: link structure
321 331
 
  332
+
  333
+
  334
+
  335
+Jeffery                                                         [Page 6]
  336
+
  337
+                                   HAT                        April 2012
  338
+
  339
+
322 340
 3.2.2.1.  strip_start_sector
323 341
 
324 342
    This field contains the index of the start sector of the strip the
@@ -329,14 +347,6 @@ Jeffery                                                         [Page 5]
329 347
    This field contains the file name to be associated with the inode
330 348
    that is being linked.  Only alphanumeric characters, periods(.) and
331 349
    underscores(_) are allowed in the filename.  The maximum length of
332  
-
333  
-
334  
-
335  
-Jeffery                                                         [Page 6]
336  
-
337  
-                                   HAT                        April 2012
338  
-
339  
-
340 350
    the filename is 15 characters, any unused characters at the end of
341 351
    the filename must be set to 0x0000.
342 352
 
@@ -375,16 +385,6 @@ Jeffery                                                         [Page 6]
375 385
    on.  It is also highly advised to align the first sector to a block
376 386
    to maximise io performance.
377 387
 
378  
-4.2.  Finding a file's inode
379  
-
380  
-   To open a file is very simple.  HAT is simply passed an absolute path
381  
-   to the file.  The path is then broken up into a list of of
382  
-   directories.  The list is traversed, starting at the root inode until
383  
-   the file's inode is found.
384  
-
385  
-
386  
-
387  
-
388 388
 
389 389
 
390 390
 
@@ -393,6 +393,13 @@ Jeffery                                                         [Page 7]
393 393
                                    HAT                        April 2012
394 394
 
395 395
 
  396
+4.2.  Finding a file's inode
  397
+
  398
+   To open a file is very simple.  HAT is simply passed an absolute path
  399
+   to the file.  The path is then broken up into a list of of
  400
+   directories.  The list is traversed, starting at the root inode until
  401
+   the file's inode is found.
  402
+
396 403
 4.3.  Allocating sectors
397 404
 
398 405
    Unused sectors can be found very quickly using the sector map.  By
@@ -437,12 +444,5 @@ Author's Address
437 444
 
438 445
 
439 446
 
440  
-
441  
-
442  
-
443  
-
444  
-
445  
-
446  
-
447 447
 Jeffery                                                         [Page 8]
448 448
 
64  FS/Draft_Harrys_Allocation_Table.xml
@@ -67,6 +67,7 @@
67 67
           <ttcol align="center">Section</ttcol>
68 68
           <c>header</c>
69 69
           <c>sector map</c>
  70
+          <c>sector joins</c>
70 71
           <c>sector 0</c>
71 72
           <c>sector 1</c>
72 73
           <c>sector 2</c>
@@ -83,6 +84,7 @@
83 84
             <c>1</c><c>version</c>
84 85
             <c>1</c><c>num_sectors</c>
85 86
             <c>2</c><c>sector_map_start</c>
  87
+            <c>2</c><c>sector_joins_start</c>
86 88
             <c>2</c><c>sector_start</c>
87 89
             <c>1</c><c>sector_size</c>
88 90
             <c>1</c><c>sectors_used</c>
@@ -96,12 +98,18 @@
96 98
           </section>
97 99
     
98 100
           <section anchor="HeaderNumSectors" title="num_sectors">
99  
-            <t>This field contains the total number of sectors in the filesystem.
100  
-            </t>
  101
+            <t>This field contains the total number of sectors in the
  102
+            filesystem.</t>
101 103
           </section>
102 104
   
103 105
           <section anchor="HeaderSectorMapStart" title="sector_map_start">
104  
-            <t>This field contains the address of the start of the sector map.</t>
  106
+            <t>This field contains the address of the start of the sector map.
  107
+            </t>
  108
+          </section>
  109
+
  110
+          <section anchor="HeaderSectorLinksStart" title="sector_joins_start">
  111
+            <t>This field contains the address of the start of the array of
  112
+            sector joins.</t>
105 113
           </section>
106 114
   
107 115
           <section anchor="HeaderSectorStart" title="sector_start">
@@ -112,7 +120,8 @@
112 120
           </section>
113 121
   
114 122
           <section anchor="HeaderSectorSize" title="sector_size">
115  
-            <t>This field contains the size of each sector in the filesystem.</t>
  123
+            <t>This field contains the size of each sector in the filesystem.
  124
+            </t>
116 125
             <t>This must be a power of 2, such as 128, 256 or 512.</t>
117 126
           </section>
118 127
   
@@ -142,30 +151,35 @@
142 151
           </section>
143 152
         </section>
144 153
 
145  
-        <section anchor="Sector" title="sector">
146  
-          <t>The sector structure is used to store blocks of raw data. Each
147  
-          sector may point to another sector. The chain of sectors
148  
-          that forms is then provided to the higher layer in the form
149  
-          of a strip that masks the non-contiguous nature of the sectors.</t>
150  
-  
151  
-          <texttable anchor="SectorTable" title="sector structure">
  154
+        <section anchor="SectorJoins" title="sector joins">
  155
+          <t>This section is an array of words, each word is used to join
  156
+          one sector to another.</t>
  157
+
  158
+          <texttable anchor="SectorLinksTable" title="sector links structure">
152 159
             <ttcol align="center">Size</ttcol>
153 160
             <ttcol align="center">Name</ttcol>
154  
-            <c>1</c><c>next_sector_index</c>
155  
-            <c>sector_size - 1</c><c>sector_data</c>
  161
+            <c>1</c><c>sector0_next</c>
  162
+            <c>1</c><c>sector1_next</c>
  163
+            <c>1</c><c>sector2_next</c>
  164
+            <c>1</c><c>sector3_next</c>
  165
+            <c>1</c><c>...</c>
156 166
           </texttable>
157  
-  
158  
-          <section anchor="SectorNextSectorINdex" title="next_sector_index">
159  
-            <t>This field contains the index of the sector that follows this one.
160  
-            When there is no such sector this field's value is set to 0x0000.
161  
-            </t>
162  
-          </section>
163  
-  
164  
-          <section anchor="SectorSectorData" title="sector_data">
165  
-            <t>This field simply contains raw data.</t>
166  
-            <t>The size of this field is determined by the sector_size field in
167  
-            the header of the filesystem.</t>
168  
-          </section>
  167
+          <t>Each entry joins the end of one sector to the start of another,
  168
+          if there is no next sector the entry is set to 0.</t>
  169
+          <t>For example, if there is a strip starting in sector 0, then
  170
+          continuing in sector 2, then sector 1, then finishing in sector 3,
  171
+          then the value of sector0_next will be 2, sector1_next will be 3,
  172
+          sector2_next will be 1, sector3_next will be 0.</t>
  173
+          <t>The total length of this section in words is the total number
  174
+          of sectors in the filesystem.</t>
  175
+        </section>
  176
+
  177
+        <section anchor="Sector" title="sector">
  178
+          <t>The sector structure is used to store blocks of raw data. 
  179
+          Sectors themselves are just raw blocks of data with no formatting
  180
+          or wrapping.</t>
  181
+         <t>Each sector has the size equal to the sector_size, as defined by
  182
+          the header of the filesystem.</t>
169 183
         </section>
170 184
 
171 185
       </section>

0 notes on commit 71ca702

Please sign in to comment.
Something went wrong with that request. Please try again.