omfs_fs.h 2.5 KB

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