grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / dos / lockrecords.c
blobc42019b429aa1fafbd90ccf845bcd8c8bf5f8a1a
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include "dos_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <dos/record.h>
14 #include <proto/dos.h>
16 AROS_LH2(BOOL, LockRecords,
18 /* SYNOPSIS */
19 AROS_LHA(struct RecordLock *, recArray, D1),
20 AROS_LHA(ULONG , timeout, D2),
22 /* LOCATION */
23 struct DosLibrary *, DOSBase, 46, Dos)
25 /* FUNCTION
26 Lock several records at the same time. The timeout specified is applied
27 to each lock to attempt. The array of RecordLock:s is terminated with
28 an entry where rec_FH is equal to NULL.
30 INPUTS
31 recArray - array of records to lock
32 timeout - maximum number of ticks to wait for a lock to be ready
34 RESULT
35 Success/failure indication. In case of a success, all the record locks
36 are locked. In case of failure, no record locks are locked.
38 NOTES
39 A set of records should always be locked in the same order so as to
40 reduce possiblities of deadlock.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 UnLockRecords()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct RecordLock *rLock = recArray;
57 while (BADDR(recArray->rec_FH) != NULL)
59 BPTR temp;
61 if (!LockRecord(recArray->rec_FH, recArray->rec_Offset,
62 recArray->rec_Length, recArray->rec_Mode, timeout))
64 temp = recArray->rec_FH;
65 UnLockRecords(rLock);
66 recArray->rec_FH = temp;
68 return DOSFALSE;
71 recArray++;
74 return DOSTRUE;
76 AROS_LIBFUNC_EXIT
77 } /* LockRecords */