home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / t / tornado / TNdemo2 / _TFS < prev    next >
Encoding:
Text File  |  1996-05-22  |  9.7 KB  |  253 lines

  1. TFS
  2. -=-
  3. Summary:
  4.  
  5.    TFS is a front-end filing system which interfaces between all users and
  6. any filing systems available under RISC-OS. Users do not have to concern
  7. themselves with how TFS manages this other than it creates a number of files
  8. in a RO directory in which the TFS directory tree is resident.
  9.  
  10. TFS bypasses the FileCore and FileSwitch restrictions placing all its files
  11. inside a single RISC-OS file, and managing the contents of the file by
  12. itself. It is capable of dynamically altering its size, reclaiming free space
  13. automatically, on-the-fly file compression and file encryption.
  14.  
  15. An optional extra which must be supported is the creation and utilisation of
  16. a seperate 'map' file which allows many operations to be sped up on slower
  17. filing systems with bad seek times especially (eg; CD-ROMs, floppies etc).
  18.  
  19. Features:
  20.  
  21.  * Files and directories are arranged in a hierarchical format
  22.  * Files may be up to 2^64 bytes long
  23.  * Filenames and directory names may be of any length and may contain any
  24. ASCII characters except those under 32
  25.  * File data can be compressed on the fly using a variety of compression
  26. methods
  27.  * Entire directories may be archived
  28.  * File and directory data can be encrypted in a number of secure methods
  29.  * A large amount of infomation can be attached to each file eg; who created
  30. the file, comments about the file, when it was created, what kind of data is
  31. in the file etc.
  32.  * Free data within the archive is automatically reclaimed during use and
  33. returned to the host disc and facilities exist for splitting of large files
  34. up into smaller sections.
  35.  
  36. TFS requires the tornado kernel to be present to work and is written entirely
  37. in assembler and uses fast block i/o for maximum speed. Typical speed losses
  38. should be around 5% for most media, although some may suffer more than this.
  39.  
  40. Techie
  41. -=-=-=
  42.    I have to admit I debated with myself for a while about implementing this.
  43. It's an awful diversion from what I really want to do, but as it's necessary
  44. for tornado to be even slightly functional at all, it had to be done.
  45.    I daddled with standard formats for a while (zip etc - thanks Karl), but
  46. found that the archive formats do not deal with frequently changing files
  47. well (they require the rebuilding of many CRCs). So I plumped for a very
  48. familiar format which will have dividends for virtual memory (similar code)
  49. later. You'll see it when you do.
  50.    TFS has a small problem in that it can have any alphanumeric character in
  51. its name, and so adfs:$.Niall.File is impossible. Therefore, TFS works from
  52. the command line as follows:
  53.  
  54. *. tfs:adfs:Niall's interesting directory<9>With loads of funny stuff in the
  55. name !@#$%^&*(). although it isn't a problem<9>Humm, this is a stupid file
  56. name........<9>You can even use *nix slashes:/\/\/\/\\/\/\/\ - what
  57. else?<9>Finally, the file!<0>
  58.  
  59. Of course, RO's command line limit is a problem here, but that's not my
  60. fault! (use *Set Sys$RCLimit to increase it). Anyway, the use of wildcards
  61. (as yet undefined, but will be control characters) can lessen the length (and
  62. typing time) considerably.
  63.  
  64. The TFS archive format:
  65.  
  66. Header:
  67.  +00:TFS + ASCII 0a
  68.  +04:Archive format - this is 0
  69.  +08,+12,+16,+20:16 bytes for the creator of the archive eg; "TFS (nd)"
  70.  +24:version of creator of the archive * 100
  71.  +28:minimum version of reader required * 100
  72.  +32,+36:2 words of date and time of creation
  73.  +40,+44:Date of last updation (written before anything is done)
  74.  +48,+52:Copy of the above written after alteration done
  75.  +56:The start of a tornado heap
  76.  
  77.  +56,+60:"TNHP", heap format (this is 0)
  78.  +64,+68:Total length of the heap
  79.  +72:Flags
  80.     bits 0,1:Heap type
  81.          %00:this heap is fully resident in ordinary memory
  82.          %01:Relocatable blocks in this memory-based heap may be stored
  83.              on disc temporarily
  84.          %10:this heap is resident on a media
  85.          %11:Blocks in this media-based heap may be cached in memory
  86.              temporarily
  87.     bit 2:this heap cannot be altered in any way.
  88.  
  89.     bit 8:this heap is auto-extending using Tornado_Extblk, ie; it is a heap
  90. within another heap block in another tornado heap
  91.     bit 9:this heap is auto-extending using OS_ChangeDynamicArea on a RPC or
  92. OS_Module in RMA on older machines
  93.     bits 10,11:reserved
  94.  +76:offset to path of the disc-based heap if bits 0,1 AND %10=%10
  95.  +80,+84:offset to heap base (ie; the start of the data)
  96.  +88,+92:offset to list of free blocks
  97.  +96,+100:offset to list of relocatable blocks
  98.  +104,+108:offset to list of non-relocatable blocks
  99.  +112:length of heap pointer chain below
  100.  +116:start of chain on heap pointers in which this heap resides
  101.       eg; if this heap were in a heap in a heap in the system heap:
  102.       +116:0 for the system heap as top heap
  103.       +120:-5 (say) for the block in the system heap containing the next heap
  104.       +124:-2 (say) as the block in the heap in the block above containing
  105.            the next heap
  106.       +128:-114 (say) as the block in the heap in the block above containing
  107.            the next heap
  108.       +132:-56326273 (say) as the block in the heap in the block above
  109.            containing our heap, ie; this heap.
  110.  +xx:The path of the disc-based heap as pointed to by +76
  111.  +xx:Free block list. The first word is the length of the list, with
  112.      subsequent quads of words offsets from the heap base of the free blocks
  113.      and the remaining two words the length of the free block in units of 4
  114.      bytes. If an offset is 0, then it means that this free space entry is
  115.      currently unused.
  116.         Also, the first word of the free block itself is the offset into the
  117.      free block list of that block's entry.
  118.  +xx:Relocatable block list. Same format as for the free block list
  119.  +xx:Non-relocatable block list. Same format as for the free block list
  120.  
  121. Relocatable and non-relocatable blocks:
  122.  -12:Flags
  123.     bit 0:non-relocatable block
  124.  -08,-04:precise length of the block in bytes. It is negative if there is no
  125.          data in memory at +00 but it is on the disc-based copy of this block
  126.  +00:the block's data
  127.  
  128. For files:
  129.  +00:"TNFL"
  130.  +12:offset to start of file data
  131.  +16:length of file
  132.  +20:length of file
  133.  +24,+28:filetype:
  134.     +24:%
  135.  +32:Flags
  136.     bits 0,1,2:CRC increment
  137.       %000:byte CRC
  138.       %001:word CRC
  139.       %010:64 byte CRC
  140.       %011:1024 byte CRC
  141.     bits 3,4,5:Encryption
  142.       %000:None
  143.       %001:Simple section word EOR with password
  144.       %010:Tornado encryption (Section word EOR with pseudo-random
  145.            progression based on derivative from password)
  146.     bits 6,7,8:Compression type
  147.       %000:No compression
  148.       %001:LZW quick compression
  149.  +36:CRC with increment as bits 0,1 in flags
  150.  +40,+44:Date of file creation
  151.  +48,+52:Date of last updation
  152.  +56,+60:Date of last viewing (for security)
  153.  +64:Length of filename
  154.  +68:Length of comment
  155.  +72:filename, terminated by null
  156.  +xx:comment, terminated by null (usually used for creator of file)
  157.  
  158. Directories:
  159.  +00:"TNDR"
  160.  +04:the number of files in this directory
  161.  +08:offset to first file block
  162.  +12:offset to the entry after the end of the directory
  163.  +16:offset to the entry after the end of the directory
  164.  +20,+24:filetype
  165.  +28:flags
  166.     bits 3,4,5:Encryption
  167.       %000:None
  168.       %001:Simple section word EOR with password
  169.       %010:Tornado encryption (Section word EOR with pseudo-random
  170.            progression based on derivative from password)
  171.     bits 6,7,8:Compression type
  172.       %000:No compression
  173.       %001:LZW quick compression
  174.     If encryption isn't %000, then all data within the directory is
  175.     encrypted and the offset to the file block is invalid without decryption
  176.     first.
  177.  +32,+36:Date of directory creation
  178.  +40,+44:Date of last updation
  179.  +48,+52:Date of last viewing
  180.  +56:Length of filename
  181.  +60:Length of comment
  182.  +64:filename, terminated by null
  183.  +xx:comment, terminated by null
  184.  
  185. Note that compression of directories is for archival purposes only, and thus
  186. is very slow (after compression of the directory the data is reinserted and
  187. any free space remaining is removed by shuffling all data after the directory
  188. down to fill the slot)
  189.  
  190.  
  191.  
  192.  
  193.  
  194. The map file is laid out as follows:
  195.  
  196.  +00:"TMAP"
  197.  +04,+08:Date of last updation (written after everything's done)
  198.  +12:Map format - this is 0
  199.  +16:Data - whatever
  200.  
  201. Files:
  202.  +00:"TNFL"
  203.  +04:offset of header into archive
  204.  +08:offset of header into archive
  205.  +12:offset to next entry
  206.  +16:length of file
  207.  +20:length of file
  208.  +24,+28:filetype
  209.  +32:Flags
  210.     bits 3,4,5:Encryption
  211.       %000:None
  212.       %001:Simple section word EOR with password
  213.       %010:Tornado encryption (Section word EOR with pseudo-random
  214.            progression based on derivative from password)
  215.     bits 6,7,8:Compression type
  216.       %000:No compression
  217.       %001:LZW quick compression
  218.  +36:reserved
  219.  +40,+44:Date of file creation
  220.  +48,+52:Date of last updation
  221.  +56,+60:Date of last viewing (for security)
  222.  +64:Length of filename
  223.  +68:Length of comment
  224.  +72:filename, terminated by null
  225.  +xx:comment, terminated by null (usually used for creator of file)
  226.  
  227. Directories:
  228.  +00:"TNDR"
  229.  +04:the number of files in this directory
  230.  +08:offset to first file block
  231.  +12:offset into archive of the directory header
  232.  +16:offset into archive of the directory header
  233.  +20,+24:filetype
  234.  +28:flags
  235.     bits 3,4,5:Encryption
  236.       %000:None
  237.       %001:Simple section word EOR with password
  238.       %010:Tornado encryption (Section word EOR with pseudo-random
  239.            progression based on derivative from password)
  240.     bits 6,7,8:Compression type
  241.       %000:No compression
  242.       %001:LZW quick compression
  243.     If encryption isn't %000, then all data within the directory is
  244.     encrypted and the offset to the file block is invalid without decryption
  245.     first.
  246.  +32,+36:Date of directory creation
  247.  +40,+44:Date of last updation
  248.  +48,+52:Date of last viewing
  249.  +56:Length of filename
  250.  +60:Length of comment
  251.  +64:filename, terminated by null
  252.  +xx:comment, terminated by null
  253.