Show retry/cancel requesters when I/O errors occur.
[AROS.git] / rom / filesys / fat / support.c
blob80a7e49e9069595ee93b5f0c2d40e2cde7c10ce4
1 /*
2 * fat-handler - FAT12/16/32 filesystem handler
4 * Copyright © 2006 Marek Szyprowski
5 * Copyright © 2007-2015 The AROS Development Team
7 * This program is free software; you can redistribute it and/or modify it
8 * under the same terms as AROS itself.
10 * $Id$
13 #include <exec/types.h>
14 #include <exec/execbase.h>
15 #include <dos/dosextens.h>
16 #include <dos/filehandler.h>
17 #include <devices/input.h>
18 #include <devices/inputevent.h>
19 #include <intuition/intuition.h>
20 #include <intuition/intuitionbase.h>
22 #include <proto/intuition.h>
23 #include <proto/exec.h>
25 #include <stdarg.h>
26 #include <string.h>
28 #include "fat_fs.h"
30 void SendEvent(LONG event, struct Globals *glob)
32 struct IOStdReq *InputRequest;
33 struct MsgPort *InputPort;
34 struct InputEvent *ie;
36 if ((InputPort = (struct MsgPort *)CreateMsgPort()))
39 if ((InputRequest = (struct IOStdReq *)CreateIORequest(InputPort,
40 sizeof(struct IOStdReq))))
43 if (!OpenDevice("input.device", 0,
44 (struct IORequest *)InputRequest, 0))
47 if ((ie = AllocVec(sizeof(struct InputEvent),
48 MEMF_PUBLIC | MEMF_CLEAR)))
50 ie->ie_Class = event;
51 InputRequest->io_Command = IND_WRITEEVENT;
52 InputRequest->io_Data = ie;
53 InputRequest->io_Length = sizeof(struct InputEvent);
55 DoIO((struct IORequest *)InputRequest);
57 FreeVec(ie);
59 CloseDevice((struct IORequest *)InputRequest);
61 DeleteIORequest((struct IORequest *)InputRequest);
63 DeleteMsgPort(InputPort);
67 int ilog2(ULONG data)
69 int bitoffset = 31;
70 ULONG bitmask = 1 << bitoffset;
74 if ((data & bitmask) != 0)
75 return bitoffset;
77 bitoffset--;
78 bitmask >>= 1;
80 while (bitmask != 0);
82 return 0;
85 LONG ErrorMessageArgs(char *fmt, char *options, IPTR *ap,
86 struct Globals *glob)
88 struct IntuitionBase *IntuitionBase;
89 LONG answer = 0;
91 IntuitionBase =
92 (struct IntuitionBase *)OpenLibrary("intuition.library", 36);
93 if (IntuitionBase)
95 struct EasyStruct es =
97 sizeof(struct EasyStruct),
99 "FAT filesystem",
100 NULL,
101 options
104 es.es_TextFormat = fmt;
105 answer = EasyRequestArgs(NULL, &es, NULL, ap);
106 CloseLibrary((struct Library *)IntuitionBase);
109 return answer;