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. #define OMFS_MAX_BLOCKS (1ul << 31)
  19. struct omfs_super_block {
  20. char s_fill1[256];
  21. __be64 s_root_block; /* block number of omfs_root_block */
  22. __be64 s_num_blocks; /* total number of FS blocks */
  23. __be32 s_magic; /* OMFS_MAGIC */
  24. __be32 s_blocksize; /* size of a block */
  25. __be32 s_mirrors; /* # of mirrors of system blocks */
  26. __be32 s_sys_blocksize; /* size of non-data blocks */
  27. };
  28. struct omfs_header {
  29. __be64 h_self; /* FS block where this is located */
  30. __be32 h_body_size; /* size of useful data after header */
  31. __be16 h_crc; /* crc-ccitt of body_size bytes */
  32. char h_fill1[2];
  33. u8 h_version; /* version, always 1 */
  34. char h_type; /* OMFS_INODE_X */
  35. u8 h_magic; /* OMFS_IMAGIC */
  36. u8 h_check_xor; /* XOR of header bytes before this */
  37. __be32 h_fill2;
  38. };
  39. struct omfs_root_block {
  40. struct omfs_header r_head; /* header */
  41. __be64 r_fill1;
  42. __be64 r_num_blocks; /* total number of FS blocks */
  43. __be64 r_root_dir; /* block # of root directory */
  44. __be64 r_bitmap; /* block # of free space bitmap */
  45. __be32 r_blocksize; /* size of a block */
  46. __be32 r_clustersize; /* size allocated for data blocks */
  47. __be64 r_mirrors; /* # of mirrors of system blocks */
  48. char r_name[OMFS_NAMELEN]; /* partition label */
  49. };
  50. struct omfs_inode {
  51. struct omfs_header i_head; /* header */
  52. __be64 i_parent; /* parent containing this inode */
  53. __be64 i_sibling; /* next inode in hash bucket */
  54. __be64 i_ctime; /* ctime, in milliseconds */
  55. char i_fill1[35];
  56. char i_type; /* OMFS_[DIR,FILE] */
  57. __be32 i_fill2;
  58. char i_fill3[64];
  59. char i_name[OMFS_NAMELEN]; /* filename */
  60. __be64 i_size; /* size of file, in bytes */
  61. };
  62. struct omfs_extent_entry {
  63. __be64 e_cluster; /* start location of a set of blocks */
  64. __be64 e_blocks; /* number of blocks after e_cluster */
  65. };
  66. struct omfs_extent {
  67. __be64 e_next; /* next extent table location */
  68. __be32 e_extent_count; /* total # extents in this table */
  69. __be32 e_fill;
  70. struct omfs_extent_entry e_entry; /* start of extent entries */
  71. };
  72. #endif