2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
8 #include <aros/debug.h>
9 #include <proto/exec.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
15 #include <proto/dos.h>
17 AROS_LH1(struct DosList
*, LockDosList
,
20 AROS_LHA(ULONG
, flags
, D1
),
23 struct DosLibrary
*, DOSBase
, 109, Dos
)
26 Waits until the desired dos lists are free then gets a lock on them.
27 A handle is returned that can be used for FindDosEntry().
28 Calls to this function nest, i.e. you must call UnLockDosList()
29 as often as you called LockDosList(). Always lock all lists
30 at once - do not try to get a lock on one of them then on another.
33 flags - what lists to lock
36 Handle to the dos list. This is not a direct pointer
37 to the first list element but to a pseudo element instead.
50 04-06-07 sonic merged back from MorphOS source code
51 29-10-95 digulla automatically created from
52 dos_lib.fd and clib/dos_protos.h
54 *****************************************************************************/
58 struct DosInfo
*di
= BADDR(DOSBase
->dl_Root
->rn_Info
);
60 D(bug("LockDosList: flags = $%lx\n", flags
));
62 if (((flags
& (LDF_READ
|LDF_WRITE
)) != LDF_READ
&&
63 (flags
& (LDF_READ
|LDF_WRITE
)) != LDF_WRITE
) ||
64 (flags
& ~(LDF_READ
|LDF_WRITE
|LDF_DEVICES
|LDF_VOLUMES
|LDF_ASSIGNS
|LDF_ENTRY
|LDF_DELETE
)))
69 if (flags
& LDF_WRITE
)
70 ObtainSemaphore(&di
->di_DevLock
);
72 ObtainSemaphoreShared(&di
->di_DevLock
);
75 if (flags
& LDF_ENTRY
)
77 if (flags
& LDF_WRITE
)
78 ObtainSemaphore(&di
->di_EntryLock
);
80 ObtainSemaphoreShared(&di
->di_EntryLock
);
83 if (flags
& LDF_DELETE
)
85 if (flags
& LDF_WRITE
)
86 ObtainSemaphore(&di
->di_DeleteLock
);
88 ObtainSemaphoreShared(&di
->di_DeleteLock
);
91 /* This strange thing came from MorphOS.
94 return (struct DosList
*)&DOSBase
->dl_DevInfo
;