revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / rom / filesys / afs / os_unix_support.h
blob8a415b13ac98510403cedf0955ca938043546bb8
1 #ifndef OS_UNIX_SUPPORT_H
2 #define OS_UNIX_SUPPORT_H
4 /*
5 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <stdio.h>
10 #include <stdint.h>
11 #ifdef _WIN32
13 /* We can't just #include <winsock2.h> because many definitions will conflict */
14 __declspec(dllimport) __stdcall unsigned long htonl(unsigned long);
15 __declspec(dllimport) __stdcall unsigned long ntohl(unsigned long);
17 #else
18 #include <arpa/inet.h>
19 #endif
21 /* exec/types.h */
22 typedef int8_t BYTE;
23 typedef uint8_t UBYTE;
24 typedef int16_t WORD;
25 typedef uint16_t UWORD;
26 typedef int32_t LONG;
27 typedef uint32_t ULONG;
28 typedef void* APTR;
29 typedef char* STRPTR;
30 typedef const char *CONST_STRPTR;
31 typedef unsigned char TEXT;
32 typedef uintptr_t IPTR;
33 typedef intptr_t SIPTR;
34 typedef uintptr_t BPTR;
35 typedef int16_t BOOL;
36 #define VOID void
37 #define FALSE 0L
38 #define TRUE 1L
40 struct AFSBase {};
41 struct Device {};
42 struct DeviceList {};
43 struct DosList {};
44 struct DriveGeometry {};
45 struct Interrupt {};
46 struct List {};
47 struct Node {};
49 /* libraries/iffparse.h */
50 #define MAKE_ID(a,b,c,d) (((ULONG) (a)<<24) | ((ULONG) (b)<<16) | \
51 ((ULONG) (c)<<8) | ((ULONG) (d)))
53 /* dos/asl.h */
54 #define ERROR_BUFFER_OVERFLOW 303
56 /* dos/bptr.h */
57 #define BADDR(x) ((void *)(x)) // Convert from BPTR to pointer.
58 #define MKBADDR(x) ((BPTR)(x)) // Convert from pointer to BPTR.
59 #define BNULL NULL
61 /* dos/dos.h */
62 #define DOSTRUE (-1)
63 #define DOSFALSE 0
64 #define ERROR_UNKNOWN 100
65 #define ERROR_NO_FREE_STORE 103
66 #define ERROR_BAD_NUMBER 115
67 #define ERROR_LINE_TOO_LONG 120
68 #define ERROR_OBJECT_IN_USE 202
69 #define ERROR_OBJECT_EXISTS 203
70 #define ERROR_OBJECT_NOT_FOUND 205
71 #define ERROR_INVALID_COMPONENT_NAME 210
72 #define ERROR_OBJECT_WRONG_TYPE 212
73 #define ERROR_DISK_WRITE_PROTECTED 214
74 #define ERROR_DIRECTORY_NOT_EMPTY 216
75 #define ERROR_SEEK_ERROR 219
76 #define ERROR_COMMENT_TOO_BIG 220
77 #define ERROR_DISK_FULL 221
78 #define ERROR_DELETE_PROTECTED 222
79 #define ERROR_NOT_A_DOS_DISK 225
80 #define ERROR_NO_DISK 226
81 #define ERROR_NO_MORE_ENTRIES 232
82 #define LOCK_DIFFERENT -1
83 #define LOCK_SAME 0
84 #define OFFSET_BEGINNING -1
85 #define OFFSET_CURRENT 0
86 #define OFFSET_END 1
87 #define FIBB_DELETE 0
88 #define FIBF_DELETE (1<<FIBB_DELETE)
89 #define MAXFILENAMELENGTH 108
90 #define MAXCOMMENTLENGTH 80
91 struct DateStamp {
92 LONG ds_Days;
93 LONG ds_Minute;
94 LONG ds_Tick;
96 struct FileInfoBlock {
97 LONG fib_DiskKey;
98 LONG fib_DirEntryType;
99 UBYTE fib_FileName[MAXFILENAMELENGTH];
100 LONG fib_Protection;
101 LONG fib_EntryType;
102 LONG fib_Size;
103 LONG fib_NumBlocks;
104 struct DateStamp fib_Date;
105 UBYTE fib_Comment[MAXCOMMENTLENGTH];
106 UWORD fib_OwnerUID;
107 UWORD fib_OwnerGID;
109 #define FIBB_DELETE 0
110 #define FIBB_WRITE 2
111 #define FIBB_READ 3
112 #define FIBF_DELETE (1<<FIBB_DELETE)
113 #define FIBF_WRITE (1<<FIBB_WRITE)
114 #define FIBF_READ (1<<FIBB_READ)
115 struct InfoData {
116 LONG id_NumSoftErrors;
117 LONG id_UnitNumber;
118 LONG id_DiskState;
119 LONG id_NumBlocks;
120 LONG id_NumBlocksUsed;
121 LONG id_BytesPerBlock;
122 LONG id_DiskType;
123 BPTR id_VolumeNode;
124 LONG id_InUse;
127 #define ID_WRITE_PROTECTED 80
128 #define ID_VALIDATING 81
129 #define ID_VALIDATED 82
130 #define ID_NO_DISK_PRESENT (-1L)
132 #define ID_UNREADABLE_DISK MAKE_ID('B','A','D',0)
133 #define ID_DOS_DISK MAKE_ID('D','O','S',0)
134 #define ID_FFS_DISK MAKE_ID('D','O','S',1)
135 #define ID_INTER_DOS_DISK MAKE_ID('D','O','S',2)
136 #define ID_INTER_FFS_DISK MAKE_ID('D','O','S',3)
137 #define ID_NOT_REALLY_DOS MAKE_ID('N','D','O','S')
139 /* dos/exall.h */
140 #define ED_NAME 1
141 #define ED_TYPE 2
142 #define ED_SIZE 3
143 #define ED_PROTECTION 4
144 #define ED_DATE 5
145 #define ED_COMMENT 6
146 #define ED_OWNER 7
147 struct ExAllData {
148 struct ExAllData *ed_Next;
149 UBYTE *ed_Name;
150 LONG ed_Type;
151 ULONG ed_Size;
152 ULONG ed_Prot;
153 ULONG ed_Days;
154 ULONG ed_Mins;
155 ULONG ed_Ticks;
156 UBYTE *ed_Comment;
157 UWORD ed_OwnerUID;
158 UWORD ed_OwnerGID;
160 struct ExAllControl {
161 ULONG eac_Entries;
162 ULONG eac_LastKey;
163 UBYTE *eac_MatchString;
164 struct Hook *eac_MatchFunc;
167 /* dos/dosextens.h */
168 #define ST_FILE -3
169 #define ST_ROOT 1
170 #define ST_USERDIR 2
171 #define ST_LINKDIR 4
173 /* dos/stdio.h */
174 #define ENDSTREAMCH -1
176 /* dos/filehandler.h */
177 struct DosEnvec {
178 IPTR de_TableSize;
179 IPTR de_SizeBlock;
180 IPTR de_SecOrg;
181 IPTR de_Surfaces;
182 IPTR de_SectorPerBlock;
183 IPTR de_BlocksPerTrack;
184 IPTR de_Reserved;
185 IPTR de_PerAlloc;
186 IPTR de_Interleave;
187 IPTR de_LowCyl;
188 IPTR de_HighCyl;
189 IPTR de_NumBuffers;
190 IPTR de_BufMemType;
191 IPTR de_MaxTransfer;
192 IPTR de_Mask;
193 IPTR de_BootPri;
194 IPTR de_DosType;
195 IPTR de_Baud;
196 IPTR de_Control;
197 IPTR de_BootBlocks;
200 /* dos/dos.h */
201 #define MODE_READWRITE 1004
202 #define MODE_OLDFILE 1005
203 #define MODE_NEWFILE 1006
205 /* aros/debug.h */
206 #if DEBUG
207 # define D(x) x
208 #else
209 # define D(x)
210 #endif
211 #define bug kprintf
212 #define kprintf printf
214 /* (aros/macros.h) */
215 #define OS_BE2LONG ntohl
216 #define OS_LONG2BE htonl
218 /* (aros/machine.h) */
219 #define OS_PTRALIGN (sizeof(APTR))
221 /* proto/exec.h */
222 APTR AllocMem(ULONG, ULONG);
223 APTR AllocVec(ULONG, ULONG);
224 void CopyMem(const void *, APTR, ULONG);
225 void FreeMem(APTR, ULONG);
226 void FreeVec(APTR);
227 /* exec/memory.h */
228 #define MEMF_PUBLIC (1L<<0)
229 #define MEMF_CLEAR (1L<<16)
231 /* proto/dos.h */
232 struct DateStamp *DateStamp(struct DateStamp *);
233 CONST_STRPTR PathPart(CONST_STRPTR);
235 /* io */
236 struct IOHandle {
237 STRPTR blockdevice;
238 ULONG unit;
239 ULONG flags;
240 FILE *fh;
241 void *mediachangedata;
242 ULONG ioflags;
245 #define IOHF_DISK_IN (1<<2)
247 void showText(struct AFSBase *, const char * const, ...);
248 LONG showError(struct AFSBase *, ULONG, ...);
249 LONG showRetriableError(struct AFSBase *, TEXT *, ...);
251 #endif