tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / disk / getunit.c
blob4e01f639a46c9cee8bec1a5736360fd6bebdd013
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: GetUnit() function.
6 Lang: english
7 */
9 #include <proto/disk.h>
10 #include <proto/exec.h>
11 #include <resources/disk.h>
13 AROS_LH1(struct DiscResourceUnit*, GetUnit,
14 AROS_LHA(struct DiscResourceUnit*, unitPointer, A1),
15 struct DiscResource *, DiskBase, 3, Disk)
17 AROS_LIBFUNC_INIT
19 struct DiscResourceUnit *old = DiskBase->dr_Current;
21 Disable();
22 if (DiskBase->dr_Flags & DRF_ACTIVE) {
23 AddTail(&DiskBase->dr_Waiting, &unitPointer->dru_Message.mn_Node);
24 Enable();
25 return NULL;
27 DiskBase->dr_Flags |= DRF_ACTIVE;
28 DiskBase->dr_Current = unitPointer;
29 DiskBase->dr_CurrTask = FindTask(0);
30 if (!old)
31 old = DiskBase->dr_Current;
32 Enable();
33 return old;
35 AROS_LIBFUNC_EXIT