Check if volumes are bootable by checking whether C/Shell is compatible with
[cake.git] / rom / exec / waitio.c
blobf9af31ada815bb91b1cff1aff433cfdec23f3095
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Wait until IO request completes.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <exec/io.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH1(BYTE, WaitIO,
19 /* SYNOPSIS */
20 AROS_LHA(struct IORequest *, iORequest, A1),
22 /* LOCATION */
23 struct ExecBase *, SysBase, 79, Exec)
25 /* FUNCTION
26 Waits until the I/O request is completed and removes it from the
27 reply port. If the message is already done when calling this function
28 it doesn't wait but just remove the message.
30 INPUTS
31 iORequest - Pointer to iorequest structure.
33 RESULT
34 Error state of I/O request.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 OpenDevice(), CloseDevice(), DoIO(), SendIO(), AbortIO(), CheckIO()
45 INTERNALS
47 ******************************************************************************/
49 AROS_LIBFUNC_INIT
52 The I/O request is still in use if it wasn't done quick
53 and isn't yet replied (ln_Type==NT_MESSAGE).
54 If it is still in use wait until it is complete.
55 Note the the port may be used for other things as well - so
56 don't just wait but repeat the check.
58 while(!(iORequest->io_Flags&IOF_QUICK)&&
59 iORequest->io_Message.mn_Node.ln_Type==NT_MESSAGE)
61 Wait at the reply port. Don't use WaitPort() - there may
62 already be other messages waiting at it.
64 Wait(1<<iORequest->io_Message.mn_ReplyPort->mp_SigBit);
67 If ln_Type is NT_REPLYMSG the I/O request must be removed from
68 the replyport's waiting queue.
70 if(iORequest->io_Message.mn_Node.ln_Type==NT_REPLYMSG)
72 /* Arbitrate for the message queue. */
73 Disable();
75 /* Remove the message */
76 Remove(&iORequest->io_Message.mn_Node);
77 Enable();
80 /* All done. Get returncode. */
81 return iORequest->io_Error;
83 AROS_LIBFUNC_EXIT
84 } /* WaitIO */