/filesystems/unixfs/ancientfs/ancientfs_oar.h

http://macfuse.googlecode.com/ · C Header · 76 lines · 57 code · 13 blank · 6 comment · 2 complexity · 568ec33f7ea0a4c7333110b670f14f3c MD5 · raw file

  1. /*
  2. * Ancient UNIX File Systems for MacFUSE
  3. * Amit Singh
  4. * http://osxbook.com
  5. */
  6. #ifndef _ANCIENTFS_OAR_H_
  7. #define _ANCIENTFS_OAR_H_
  8. #include "unixfs_internal.h"
  9. #include "ancientfs.h"
  10. typedef int16_t a_short; /* ancient short */
  11. typedef uint16_t a_ushort; /* ancient unsigned short */
  12. typedef int16_t a_int; /* ancient int */
  13. typedef uint16_t a_uint; /* ancient unsigned int */
  14. typedef int32_t a_long; /* ancient long */
  15. typedef uint32_t a_ulong; /* ancient unsigned long */
  16. typedef a_uint a_ino_t; /* ancient inode type (ancient unsigned int) */
  17. typedef a_long a_off_t; /* ancient offset type (ancient long) */
  18. typedef a_long a_time_t; /* ancient time type (ancient long) */
  19. typedef a_long a_daddr_t; /* ancient disk address type (ancient long) */
  20. typedef a_int a_dev_t; /* ancient device type (ancient int) */
  21. #define BSIZE 512
  22. #define BMASK 0777 /* BSIZE - 1 */
  23. #define ROOTINO 1
  24. #define DIRSIZ 14
  25. struct filsys
  26. {
  27. uint32_t s_fsize;
  28. uint32_t s_files;
  29. uint32_t s_directories;
  30. uint32_t s_lastino;
  31. struct inode* s_rootip;
  32. };
  33. #define ARMAG (uint16_t)0177545
  34. struct ar_hdr
  35. {
  36. char ar_name[DIRSIZ];
  37. a_long ar_date;
  38. char ar_uid;
  39. char ar_gid;
  40. a_int ar_mode;
  41. a_long ar_size;
  42. } __attribute__((packed));
  43. struct ar_node_info
  44. {
  45. struct inode* ar_self;
  46. uint8_t ar_name[DIRSIZ + 1];
  47. struct ar_node_info* ar_parent;
  48. struct ar_node_info* ar_children;
  49. struct ar_node_info* ar_next_sibling;
  50. };
  51. /* modes */
  52. #define IALLOC 0100000 /* file is used */
  53. #define IFMT 060000
  54. #define ILARG 010000 /* large addressing algorithm */
  55. static inline a_int
  56. ancientfs_ar_mode(mode_t mode)
  57. {
  58. a_int newmode = (a_int)mode & ~(IALLOC | ILARG);
  59. if ((newmode & IFMT) == 0) /* ancient regular file */
  60. newmode |= S_IFREG;
  61. return newmode;
  62. }
  63. #endif /* _ANCIENTFS_OAR_H_ */