romfs_fs.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __LINUX_ROMFS_FS_H
  2. #define __LINUX_ROMFS_FS_H
  3. #include <linux/types.h>
  4. #include <linux/fs.h>
  5. /* The basic structures of the romfs filesystem */
  6. #define ROMBSIZE BLOCK_SIZE
  7. #define ROMBSBITS BLOCK_SIZE_BITS
  8. #define ROMBMASK (ROMBSIZE-1)
  9. #define ROMFS_MAGIC 0x7275
  10. #define ROMFS_MAXFN 128
  11. #define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff))
  12. #define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff))
  13. #define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d)))
  14. #define ROMSB_WORD0 __mk4('-','r','o','m')
  15. #define ROMSB_WORD1 __mk4('1','f','s','-')
  16. /* On-disk "super block" */
  17. struct romfs_super_block {
  18. __be32 word0;
  19. __be32 word1;
  20. __be32 size;
  21. __be32 checksum;
  22. char name[0]; /* volume name */
  23. };
  24. /* On disk inode */
  25. struct romfs_inode {
  26. __be32 next; /* low 4 bits see ROMFH_ */
  27. __be32 spec;
  28. __be32 size;
  29. __be32 checksum;
  30. char name[0];
  31. };
  32. #define ROMFH_TYPE 7
  33. #define ROMFH_HRD 0
  34. #define ROMFH_DIR 1
  35. #define ROMFH_REG 2
  36. #define ROMFH_SYM 3
  37. #define ROMFH_BLK 4
  38. #define ROMFH_CHR 5
  39. #define ROMFH_SCK 6
  40. #define ROMFH_FIF 7
  41. #define ROMFH_EXEC 8
  42. /* Alignment */
  43. #define ROMFH_SIZE 16
  44. #define ROMFH_PAD (ROMFH_SIZE-1)
  45. #define ROMFH_MASK (~ROMFH_PAD)
  46. #endif