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