omfs_fs.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef _OMFS_FS_H
  2. #define _OMFS_FS_H
  3. /* OMFS On-disk structures */
  4. #define OMFS_MAGIC 0xC2993D87
  5. #define OMFS_IMAGIC 0xD2
  6. #define OMFS_DIR 'D'
  7. #define OMFS_FILE 'F'
  8. #define OMFS_INODE_NORMAL 'e'
  9. #define OMFS_INODE_CONTINUATION 'c'
  10. #define OMFS_INODE_SYSTEM 's'
  11. #define OMFS_NAMELEN 256
  12. #define OMFS_DIR_START 0x1b8
  13. #define OMFS_EXTENT_START 0x1d0
  14. #define OMFS_EXTENT_CONT 0x40
  15. #define OMFS_XOR_COUNT 19
  16. #define OMFS_MAX_BLOCK_SIZE 8192
  17. #define OMFS_MAX_CLUSTER_SIZE 8
  18. struct omfs_super_block {
  19. char s_fill1[256];
  20. __be64 s_root_block; /* block number of omfs_root_block */
  21. __be64 s_num_blocks; /* total number of FS blocks */
  22. __be32 s_magic; /* OMFS_MAGIC */
  23. __be32 s_blocksize; /* size of a block */
  24. __be32 s_mirrors; /* # of mirrors of system blocks */
  25. __be32 s_sys_blocksize; /* size of non-data blocks */
  26. };
  27. struct omfs_header {
  28. __be64 h_self; /* FS block where this is located */
  29. __be32 h_body_size; /* size of useful data after header */
  30. __be16 h_crc; /* crc-ccitt of body_size bytes */
  31. char h_fill1[2];
  32. u8 h_version; /* version, always 1 */
  33. char h_type; /* OMFS_INODE_X */
  34. u8 h_magic; /* OMFS_IMAGIC */
  35. u8 h_check_xor; /* XOR of header bytes before this */
  36. __be32 h_fill2;
  37. };
  38. struct omfs_root_block {
  39. struct omfs_header r_head; /* header */
  40. __be64 r_fill1;
  41. __be64 r_num_blocks; /* total number of FS blocks */
  42. __be64 r_root_dir; /* block # of root directory */
  43. __be64 r_bitmap; /* block # of free space bitmap */
  44. __be32 r_blocksize; /* size of a block */
  45. __be32 r_clustersize; /* size allocated for data blocks */
  46. __be64 r_mirrors; /* # of mirrors of system blocks */
  47. char r_name[OMFS_NAMELEN]; /* partition label */
  48. };
  49. struct omfs_inode {
  50. struct omfs_header i_head; /* header */
  51. __be64 i_parent; /* parent containing this inode */
  52. __be64 i_sibling; /* next inode in hash bucket */
  53. __be64 i_ctime; /* ctime, in milliseconds */
  54. char i_fill1[35];
  55. char i_type; /* OMFS_[DIR,FILE] */
  56. __be32 i_fill2;
  57. char i_fill3[64];
  58. char i_name[OMFS_NAMELEN]; /* filename */
  59. __be64 i_size; /* size of file, in bytes */
  60. };
  61. struct omfs_extent_entry {
  62. __be64 e_cluster; /* start location of a set of blocks */
  63. __be64 e_blocks; /* number of blocks after e_cluster */
  64. };
  65. struct omfs_extent {
  66. __be64 e_next; /* next extent table location */
  67. __be32 e_extent_count; /* total # extents in this table */
  68. __be32 e_fill;
  69. struct omfs_extent_entry e_entry; /* start of extent entries */
  70. };
  71. #endif