some fixes to accented characters
[tangerine.git] / rom / dos / lockdoslist.c
blob9cb1118534e2d512e08f673a9beaaba147fd76aa
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include <proto/exec.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH1(struct DosList *, LockDosList,
19 /* SYNOPSIS */
20 AROS_LHA(ULONG, flags, D1),
22 /* LOCATION */
23 struct DosLibrary *, DOSBase, 109, Dos)
25 /* FUNCTION
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.
32 INPUTS
33 flags - what lists to lock
35 RESULT
36 Handle to the dos list. This is not a direct pointer
37 to the first list element but to a pseudo element instead.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 HISTORY
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 *****************************************************************************/
56 AROS_LIBFUNC_INIT
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)))
65 return NULL;
67 if (flags & LDF_ALL)
69 if (flags & LDF_WRITE)
70 ObtainSemaphore(&di->di_DevLock);
71 else
72 ObtainSemaphoreShared(&di->di_DevLock);
75 if (flags & LDF_ENTRY)
77 if (flags & LDF_WRITE)
78 ObtainSemaphore(&di->di_EntryLock);
79 else
80 ObtainSemaphoreShared(&di->di_EntryLock);
83 if (flags & LDF_DELETE)
85 if (flags & LDF_WRITE)
86 ObtainSemaphore(&di->di_DeleteLock);
87 else
88 ObtainSemaphoreShared(&di->di_DeleteLock);
91 /* This strange thing came from MorphOS.
92 Forbid(); */
94 return (struct DosList *)&DOSBase->dl_DevInfo;
96 AROS_LIBFUNC_EXIT
97 } /* LockDosList */