grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / filesys / afs / os_aros_support.h
blobbd2fb282260240aa38afc8623ad1543c6e334f77
1 #ifndef OS_AROS_H
2 #define OS_AROS_H
4 /*
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <aros/macros.h>
10 #include <aros/preprocessor/variadic/cast2iptr.hpp>
11 #include <devices/trackdisk.h>
12 #include <dos/dos.h>
13 #include <dos/dosextens.h>
14 #include <dos/exall.h>
15 #include <dos/filehandler.h>
16 #include <dos/stdio.h>
17 #include <exec/interrupts.h>
18 #include <exec/types.h>
19 #include <aros/debug.h>
20 #include <proto/dos.h>
22 #include "error.h"
23 #include "afshandler.h"
25 #define OS_BE2LONG AROS_BE2LONG
26 #define OS_LONG2BE AROS_LONG2BE
28 #define OS_PTRALIGN AROS_PTRALIGN
30 struct IOHandle {
31 STRPTR blockdevice;
32 ULONG unit;
33 ULONG flags;
34 struct MsgPort *mp;
35 struct IOExtTD *ioreq;
36 struct IOExtTD *iochangeint;
37 struct Interrupt mc_int;
38 struct Interrupt vbl_int;
39 struct AFSBase *afsbase; /* for interrupt code */
40 ULONG sectorsize;
41 ULONG ioflags;
42 UWORD cmdread;
43 UWORD cmdwrite;
44 UWORD cmdseek;
45 UWORD cmdformat;
48 #define IOHF_MOTOR_OFF (1<<0)
49 #define IOHF_MEDIA_CHANGE (1<<1)
50 #define IOHF_DISK_IN (1<<2)
52 enum showReqType;
54 LONG showPtrArgsText(struct AFSBase *afsbase, const char *string, enum showReqType type, RAWARG args);
55 LONG showError(struct AFSBase *afsbase, ULONG error, ...);
57 static inline LONG showText(struct AFSBase *afsbase, const char *format, ...)
59 LONG ret;
61 AROS_SLOWSTACKFORMAT_PRE(format);
62 ret = showPtrArgsText(afsbase, format, Req_Cancel, AROS_SLOWSTACKFORMAT_ARG(format));
63 AROS_SLOWSTACKFORMAT_POST(format);
65 return ret;
68 static inline LONG showRetriableError(struct AFSBase *afsbase, const char *format, ...)
70 LONG ret;
72 AROS_SLOWSTACKFORMAT_PRE(format);
73 ret = showPtrArgsText(afsbase, format, Req_RetryCancel, AROS_SLOWSTACKFORMAT_ARG(format));
74 AROS_SLOWSTACKFORMAT_POST(format);
76 return ret;
79 void checkDeviceFlags(struct AFSBase *);
80 void motorOff(struct AFSBase *afsbase, struct IOHandle *ioh);
82 #endif