Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@0xabad1dea 0xabad1dea authored
View
186 FS/Draft_Harrys_Allocation_Table.txt
@@ -2,7 +2,7 @@
RFC (Draft-Fs) H. Jeffery, Ed.
- April 11, 2012
+ April 14, 2012
Harry's Allocation Table
@@ -24,25 +24,25 @@ Table of Contents
3.1.1.1. version . . . . . . . . . . . . . . . . . . . . . . 3
3.1.1.2. num_sectors . . . . . . . . . . . . . . . . . . . . 3
3.1.1.3. sector_map_start . . . . . . . . . . . . . . . . . 4
- 3.1.1.4. sector_start . . . . . . . . . . . . . . . . . . . 4
- 3.1.1.5. sector_size . . . . . . . . . . . . . . . . . . . . 4
- 3.1.1.6. sectors_used . . . . . . . . . . . . . . . . . . . 4
+ 3.1.1.4. sector_joins_start . . . . . . . . . . . . . . . . 4
+ 3.1.1.5. sector_start . . . . . . . . . . . . . . . . . . . 4
+ 3.1.1.6. sector_size . . . . . . . . . . . . . . . . . . . . 4
+ 3.1.1.7. sectors_used . . . . . . . . . . . . . . . . . . . 4
3.1.2. sector map . . . . . . . . . . . . . . . . . . . . . . 4
3.1.2.1. bitmap . . . . . . . . . . . . . . . . . . . . . . 4
- 3.1.3. sector . . . . . . . . . . . . . . . . . . . . . . . . 4
- 3.1.3.1. next_sector_index . . . . . . . . . . . . . . . . . 5
- 3.1.3.2. sector_data . . . . . . . . . . . . . . . . . . . . 5
+ 3.1.3. sector joins . . . . . . . . . . . . . . . . . . . . . 5
+ 3.1.4. sector . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2. Higher Layer . . . . . . . . . . . . . . . . . . . . . . . 5
3.2.1. inode . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2.1.1. type . . . . . . . . . . . . . . . . . . . . . . . 6
3.2.1.2. content_size . . . . . . . . . . . . . . . . . . . 6
3.2.1.3. link_count . . . . . . . . . . . . . . . . . . . . 6
3.2.2. link . . . . . . . . . . . . . . . . . . . . . . . . . 6
- 3.2.2.1. strip_start_sector . . . . . . . . . . . . . . . . 6
- 3.2.2.2. file_name . . . . . . . . . . . . . . . . . . . . . 6
+ 3.2.2.1. strip_start_sector . . . . . . . . . . . . . . . . 7
+ 3.2.2.2. file_name . . . . . . . . . . . . . . . . . . . . . 7
4. Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.1. Constructing a HAT filesystem . . . . . . . . . . . . . . . 7
- 4.2. Finding a file's inode . . . . . . . . . . . . . . . . . . 7
+ 4.2. Finding a file's inode . . . . . . . . . . . . . . . . . . 8
4.3. Allocating sectors . . . . . . . . . . . . . . . . . . . . 8
5. Security Considerations . . . . . . . . . . . . . . . . . . . . 8
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 8
@@ -115,16 +115,17 @@ Jeffery [Page 2]
3.1. Lower Layer
- +------------+
- | Section |
- +------------+
- | header |
- | sector map |
- | sector 0 |
- | sector 1 |
- | sector 2 |
- | ... |
- +------------+
+ +--------------+
+ | Section |
+ +--------------+
+ | header |
+ | sector map |
+ | sector joins |
+ | sector 0 |
+ | sector 1 |
+ | sector 2 |
+ | ... |
+ +--------------+
Table 1: Filesystem Structure
@@ -134,16 +135,17 @@ Jeffery [Page 2]
The total size of the header is 16 words.
- +------+------------------+
- | Size | Name |
- +------+------------------+
- | 1 | version |
- | 1 | num_sectors |
- | 2 | sector_map_start |
- | 2 | sector_start |
- | 1 | sector_size |
- | 1 | sectors_used |
- +------+------------------+
+ +------+--------------------+
+ | Size | Name |
+ +------+--------------------+
+ | 1 | version |
+ | 1 | num_sectors |
+ | 2 | sector_map_start |
+ | 2 | sector_joins_start |
+ | 2 | sector_start |
+ | 1 | sector_size |
+ | 1 | sectors_used |
+ +------+--------------------+
Table 2: Header Structure
@@ -162,8 +164,6 @@ Jeffery [Page 2]
-
-
Jeffery [Page 3]
HAT April 2012
@@ -173,7 +173,12 @@ Jeffery [Page 3]
This field contains the address of the start of the sector map.
-3.1.1.4. sector_start
+3.1.1.4. sector_joins_start
+
+ This field contains the address of the start of the array of sector
+ joins.
+
+3.1.1.5. sector_start
This field contains the address of the first sector on disk.
@@ -181,13 +186,13 @@ Jeffery [Page 3]
immediately after the header. The first sector may be positioned to
provide alignment with the underlying disk's blocks.
-3.1.1.5. sector_size
+3.1.1.6. sector_size
This field contains the size of each sector in the filesystem.
This must be a power of 2, such as 128, 256 or 512.
-3.1.1.6. sectors_used
+3.1.1.7. sectors_used
This field contains the number of sectors that are currently in use.
@@ -213,11 +218,6 @@ Jeffery [Page 3]
Any spare bits at the end of the bitmap must be set to 1.
-3.1.3. sector
-
- The sector structure is used to store blocks of raw data. Each
- sector may point to another sector. The chain of sectors that forms
-
Jeffery [Page 4]
@@ -225,28 +225,41 @@ Jeffery [Page 4]
HAT April 2012
- is then provided to the higher layer in the form of a strip that
- masks the non-contiguous nature of the sectors.
+3.1.3. sector joins
- +-----------------+-------------------+
- | Size | Name |
- +-----------------+-------------------+
- | 1 | next_sector_index |
- | sector_size - 1 | sector_data |
- +-----------------+-------------------+
+ This section is an array of words, each word is used to join one
+ sector to another.
- Table 4: sector structure
+ +------+--------------+
+ | Size | Name |
+ +------+--------------+
+ | 1 | sector0_next |
+ | 1 | sector1_next |
+ | 1 | sector2_next |
+ | 1 | sector3_next |
+ | 1 | ... |
+ +------+--------------+
+
+ Table 4: sector links structure
-3.1.3.1. next_sector_index
+ Each entry joins the end of one sector to the start of another, if
+ there is no next sector the entry is set to 0.
- This field contains the index of the sector that follows this one.
- When there is no such sector this field's value is set to 0x0000.
+ For example, if there is a strip starting in sector 0, then
+ continuing in sector 2, then sector 1, then finishing in sector 3,
+ then the value of sector0_next will be 2, sector1_next will be 3,
+ sector2_next will be 1, sector3_next will be 0.
-3.1.3.2. sector_data
+ The total length of this section in words is the total number of
+ sectors in the filesystem.
- This field simply contains raw data.
+3.1.4. sector
- The size of this field is determined by the sector_size field in the
+ The sector structure is used to store blocks of raw data. Sectors
+ themselves are just raw blocks of data with no formatting or
+ wrapping.
+
+ Each sector has the size equal to the sector_size, as defined by the
header of the filesystem.
3.2. Higher Layer
@@ -255,19 +268,6 @@ Jeffery [Page 4]
The inode structure is used to store metadata about files.
- +------+--------------+
- | Size | Name |
- +------+--------------+
- | 1 | type |
- | 2 | content_size |
- | 1 | link_count |
- +------+--------------+
-
- Table 5: inode structure
-
-
-
-
@@ -281,6 +281,16 @@ Jeffery [Page 5]
HAT April 2012
+ +------+--------------+
+ | Size | Name |
+ +------+--------------+
+ | 1 | type |
+ | 2 | content_size |
+ | 1 | link_count |
+ +------+--------------+
+
+ Table 5: inode structure
+
3.2.1.1. type
+-------+----------------------+
@@ -319,6 +329,14 @@ Jeffery [Page 5]
Table 7: link structure
+
+
+
+Jeffery [Page 6]
+
+ HAT April 2012
+
+
3.2.2.1. strip_start_sector
This field contains the index of the start sector of the strip the
@@ -329,14 +347,6 @@ Jeffery [Page 5]
This field contains the file name to be associated with the inode
that is being linked. Only alphanumeric characters, periods(.) and
underscores(_) are allowed in the filename. The maximum length of
-
-
-
-Jeffery [Page 6]
-
- HAT April 2012
-
-
the filename is 15 characters, any unused characters at the end of
the filename must be set to 0x0000.
@@ -375,16 +385,6 @@ Jeffery [Page 6]
on. It is also highly advised to align the first sector to a block
to maximise io performance.
-4.2. Finding a file's inode
-
- To open a file is very simple. HAT is simply passed an absolute path
- to the file. The path is then broken up into a list of of
- directories. The list is traversed, starting at the root inode until
- the file's inode is found.
-
-
-
-
@@ -393,6 +393,13 @@ Jeffery [Page 7]
HAT April 2012
+4.2. Finding a file's inode
+
+ To open a file is very simple. HAT is simply passed an absolute path
+ to the file. The path is then broken up into a list of of
+ directories. The list is traversed, starting at the root inode until
+ the file's inode is found.
+
4.3. Allocating sectors
Unused sectors can be found very quickly using the sector map. By
@@ -437,12 +444,5 @@ Author's Address
-
-
-
-
-
-
-
Jeffery [Page 8]
View
64 FS/Draft_Harrys_Allocation_Table.xml
@@ -67,6 +67,7 @@
<ttcol align="center">Section</ttcol>
<c>header</c>
<c>sector map</c>
+ <c>sector joins</c>
<c>sector 0</c>
<c>sector 1</c>
<c>sector 2</c>
@@ -83,6 +84,7 @@
<c>1</c><c>version</c>
<c>1</c><c>num_sectors</c>
<c>2</c><c>sector_map_start</c>
+ <c>2</c><c>sector_joins_start</c>
<c>2</c><c>sector_start</c>
<c>1</c><c>sector_size</c>
<c>1</c><c>sectors_used</c>
@@ -96,12 +98,18 @@
</section>
<section anchor="HeaderNumSectors" title="num_sectors">
- <t>This field contains the total number of sectors in the filesystem.
- </t>
+ <t>This field contains the total number of sectors in the
+ filesystem.</t>
</section>
<section anchor="HeaderSectorMapStart" title="sector_map_start">
- <t>This field contains the address of the start of the sector map.</t>
+ <t>This field contains the address of the start of the sector map.
+ </t>
+ </section>
+
+ <section anchor="HeaderSectorLinksStart" title="sector_joins_start">
+ <t>This field contains the address of the start of the array of
+ sector joins.</t>
</section>
<section anchor="HeaderSectorStart" title="sector_start">
@@ -112,7 +120,8 @@
</section>
<section anchor="HeaderSectorSize" title="sector_size">
- <t>This field contains the size of each sector in the filesystem.</t>
+ <t>This field contains the size of each sector in the filesystem.
+ </t>
<t>This must be a power of 2, such as 128, 256 or 512.</t>
</section>
@@ -142,30 +151,35 @@
</section>
</section>
- <section anchor="Sector" title="sector">
- <t>The sector structure is used to store blocks of raw data. Each
- sector may point to another sector. The chain of sectors
- that forms is then provided to the higher layer in the form
- of a strip that masks the non-contiguous nature of the sectors.</t>
-
- <texttable anchor="SectorTable" title="sector structure">
+ <section anchor="SectorJoins" title="sector joins">
+ <t>This section is an array of words, each word is used to join
+ one sector to another.</t>
+
+ <texttable anchor="SectorLinksTable" title="sector links structure">
<ttcol align="center">Size</ttcol>
<ttcol align="center">Name</ttcol>
- <c>1</c><c>next_sector_index</c>
- <c>sector_size - 1</c><c>sector_data</c>
+ <c>1</c><c>sector0_next</c>
+ <c>1</c><c>sector1_next</c>
+ <c>1</c><c>sector2_next</c>
+ <c>1</c><c>sector3_next</c>
+ <c>1</c><c>...</c>
</texttable>
-
- <section anchor="SectorNextSectorINdex" title="next_sector_index">
- <t>This field contains the index of the sector that follows this one.
- When there is no such sector this field's value is set to 0x0000.
- </t>
- </section>
-
- <section anchor="SectorSectorData" title="sector_data">
- <t>This field simply contains raw data.</t>
- <t>The size of this field is determined by the sector_size field in
- the header of the filesystem.</t>
- </section>
+ <t>Each entry joins the end of one sector to the start of another,
+ if there is no next sector the entry is set to 0.</t>
+ <t>For example, if there is a strip starting in sector 0, then
+ continuing in sector 2, then sector 1, then finishing in sector 3,
+ then the value of sector0_next will be 2, sector1_next will be 3,
+ sector2_next will be 1, sector3_next will be 0.</t>
+ <t>The total length of this section in words is the total number
+ of sectors in the filesystem.</t>
+ </section>
+
+ <section anchor="Sector" title="sector">
+ <t>The sector structure is used to store blocks of raw data.
+ Sectors themselves are just raw blocks of data with no formatting
+ or wrapping.</t>
+ <t>Each sector has the size equal to the sector_size, as defined by
+ the header of the filesystem.</t>
</section>
</section>
Please sign in to comment.
Something went wrong with that request. Please try again.