type.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef _TYPE_H
  2. #define _TYPE_H
  3. /* Macros */
  4. #define MAX(a,b) ((a) > (b) ? (a) : (b))
  5. #define MIN(a,b) ((a) < (b) ? (a) : (b))
  6. /* Type definitions */
  7. typedef unsigned short unshort; /* must be 16-bit unsigned */
  8. typedef unshort block_nr; /* block number */
  9. typedef unshort zone_nr; /* zone number */
  10. #define MAX_BLOCK_NR ((block_nr) 0177777) /* largest block number */
  11. #define HIGHEST_ZONE ((zone_nr) 0177777) /* largest zone number */
  12. #define MAX_INODE_NR ((ino_t 0177777) /* largest inode number */
  13. #define MAX_FILE_POS 017777777777L /* largest legal file offset */
  14. #define NO_BLOCK ((block_nr) 0) /* absence of a block number */
  15. #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
  16. #define NO_ZONE ((zone_nr) 0) /* absence of a zone number */
  17. #define NO_DEV ((dev_t) ~0) /* absence of a device numb */
  18. typedef unshort bit_nr; /* if ino_t & zone_nr both unshort,
  19. then also unshort, else long */
  20. typedef long zone_type; /* zone size */
  21. #if (CHIP == INTEL)
  22. typedef unsigned vir_bytes; /* virtual addresses and lengths in bytes */
  23. #endif
  24. #if (CHIP == M68000)
  25. typedef long vir_bytes; /* virtual addresses and lengths in bytes */
  26. #endif
  27. typedef unsigned vir_clicks; /* virtual addresses and lengths in clicks */
  28. typedef long phys_bytes; /* physical addresses and lengths in bytes */
  29. typedef unsigned phys_clicks; /* physical addresses and lengths in clicks */
  30. typedef int signed_clicks; /* same length as phys_clicks, but signed */
  31. /* Types relating to messages. */
  32. #define M1 1
  33. #define M3 3
  34. #define M4 4
  35. #define M3_STRING 14
  36. typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
  37. typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
  38. typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
  39. typedef struct {long m4l1, m4l2, m4l3, m4l4;} mess_4;
  40. typedef struct {char m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;} mess_5;
  41. #if _ANSI
  42. typedef struct {int m6i1, m6i2, m6i3; long m6l1; void (*m6f1)(int);} mess_6;
  43. #else
  44. typedef struct {int m6i1, m6i2, m6i3; long m6l1; void (*m6f1)();} mess_6;
  45. #endif
  46. typedef struct {
  47. int m_source; /* who sent the message */
  48. int m_type; /* what kind of message is it */
  49. union {
  50. mess_1 m_m1;
  51. mess_2 m_m2;
  52. mess_3 m_m3;
  53. mess_4 m_m4;
  54. mess_5 m_m5;
  55. mess_6 m_m6;
  56. } m_u;
  57. } message;
  58. #define MESS_SIZE (sizeof(message))
  59. #define NIL_MESS (message *) 0
  60. /* The following defines provide names for useful members. */
  61. #define m1_i1 m_u.m_m1.m1i1
  62. #define m1_i2 m_u.m_m1.m1i2
  63. #define m1_i3 m_u.m_m1.m1i3
  64. #define m1_p1 m_u.m_m1.m1p1
  65. #define m1_p2 m_u.m_m1.m1p2
  66. #define m1_p3 m_u.m_m1.m1p3
  67. #define m2_i1 m_u.m_m2.m2i1
  68. #define m2_i2 m_u.m_m2.m2i2
  69. #define m2_i3 m_u.m_m2.m2i3
  70. #define m2_l1 m_u.m_m2.m2l1
  71. #define m2_l2 m_u.m_m2.m2l2
  72. #define m2_p1 m_u.m_m2.m2p1
  73. #define m3_i1 m_u.m_m3.m3i1
  74. #define m3_i2 m_u.m_m3.m3i2
  75. #define m3_p1 m_u.m_m3.m3p1
  76. #define m3_ca1 m_u.m_m3.m3ca1
  77. #define m4_l1 m_u.m_m4.m4l1
  78. #define m4_l2 m_u.m_m4.m4l2
  79. #define m4_l3 m_u.m_m4.m4l3
  80. #define m4_l4 m_u.m_m4.m4l4
  81. #define m5_c1 m_u.m_m5.m5c1
  82. #define m5_c2 m_u.m_m5.m5c2
  83. #define m5_i1 m_u.m_m5.m5i1
  84. #define m5_i2 m_u.m_m5.m5i2
  85. #define m5_l1 m_u.m_m5.m5l1
  86. #define m5_l2 m_u.m_m5.m5l2
  87. #define m5_l3 m_u.m_m5.m5l3
  88. #define m6_i1 m_u.m_m6.m6i1
  89. #define m6_i2 m_u.m_m6.m6i2
  90. #define m6_i3 m_u.m_m6.m6i3
  91. #define m6_l1 m_u.m_m6.m6l1
  92. #define m6_f1 m_u.m_m6.m6f1
  93. struct mem_map {
  94. vir_clicks mem_vir; /* virtual address */
  95. phys_clicks mem_phys; /* physical address */
  96. vir_clicks mem_len; /* length */
  97. };
  98. struct copy_info { /* used by sys_copy(src, dst, bytes) */
  99. int cp_src_proc;
  100. int cp_src_space;
  101. vir_bytes cp_src_vir;
  102. int cp_dst_proc;
  103. int cp_dst_space;
  104. vir_bytes cp_dst_vir;
  105. vir_bytes cp_bytes;
  106. };
  107. struct iorequest_s {
  108. long io_position; /* position in device file (really off_t) */
  109. char *io_buf; /* buffer in user space */
  110. unsigned short io_nbytes; /* size of request */
  111. unsigned short io_request; /* read, write (optionally) */
  112. };
  113. #endif /* _TYPE_H */