/filesystems/unixfs/ancientfs/ancientfs_cpio_odc.h

http://macfuse.googlecode.com/ · C Header · 68 lines · 50 code · 10 blank · 8 comment · 0 complexity · a3053bb15e096b75559fef88aec58789 MD5 · raw file

  1. /*
  2. * Ancient UNIX File Systems for MacFUSE
  3. * Amit Singh
  4. * http://osxbook.com
  5. */
  6. #ifndef _ANCIENTFS_CPIO_ODC_H_
  7. #define _ANCIENTFS_CPIO_ODC_H_
  8. #include "unixfs_internal.h"
  9. #include "ancientfs.h"
  10. #define ROOTINO 1
  11. struct filsys
  12. {
  13. uint32_t s_fsize;
  14. uint32_t s_files;
  15. uint32_t s_directories;
  16. uint32_t s_lastino;
  17. uint32_t s_dataoffset;
  18. uint32_t s_needsswap;
  19. struct inode* s_rootip;
  20. };
  21. #define CPIO_ODC_BLOCK 512
  22. #define CPIO_ODC_MAGIC "070707"
  23. #define CPIO_ODC_MAGLEN 6
  24. #define CPIO_ODC_TRAILER "TRAILER!!!"
  25. #define CPIO_ODC_TRAILER_LEN (sizeof(CPIO_ODC_TRAILER)/sizeof(unsigned char))
  26. struct cpio_odc_header {
  27. char c_magic[6];
  28. char c_dev[6];
  29. char c_ino[6];
  30. char c_mode[6];
  31. char c_uid[6];
  32. char c_gid[6];
  33. char c_nlink[6];
  34. char c_rdev[6];
  35. char c_mtime[11];
  36. char c_namesize[6];
  37. char c_filesize[11];
  38. /* char c_name[c_namesize]; */
  39. /* char c_data[c_filesize]; */
  40. } __attribute__((packed));
  41. struct cpio_odc_node_info {
  42. struct inode* ci_self;
  43. struct cpio_odc_node_info* ci_parent;
  44. struct cpio_odc_node_info* ci_children;
  45. struct cpio_odc_node_info* ci_next_sibling;
  46. char* ci_name;
  47. char* ci_linktargetname;
  48. };
  49. /* modes */
  50. #define IALLOC 0100000 /* i-node is allocated */
  51. #define ILARG 010000 /* large file */
  52. #define IFMT 0170000 /* type of file */
  53. static inline mode_t
  54. ancientfs_cpio_odc_mode(mode_t mode, uint32_t flags)
  55. {
  56. return mode & (uint16_t)~(IALLOC & ILARG);
  57. }
  58. #endif /* _ANCIENTFS_CPIO_ODC_H_ */