2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: RemAssignList() - Remove an entry from a multi-dir assign.
9 #include <aros/debug.h>
10 #include "dos_intern.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH2(LONG
, RemAssignList
,
21 AROS_LHA(STRPTR
, name
, D1
),
22 AROS_LHA(BPTR
, lock
, D2
),
25 struct DosLibrary
*, DOSBase
, 106, Dos
)
28 Remove an entry from a multi-dir assign. The entry removed will be
29 the first one that the SameLock() function called on the 'lock'
30 parameter returns that they belong to the same object.
32 The entry for this lock will be remove from the lock, and the
33 lock for the entry in the list will be unlocked.
36 name - Name of the device to remove lock from. This should
37 not contain the trailing ':'.
38 lock - Lock on the object to remove from the list.
41 success - Have we actually succeeded
48 If this is the first lock in a list, this will not set
49 dol_Device/dol_Unit correctly. This will be fixed shortly.
55 *****************************************************************************/
58 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
60 struct DosList
*dl
= NULL
;
63 D(bug("RemAssignList: name = \"%s\", lock = $%lx\n", name
, lock
));
64 dl
= LockDosList(LDF_ASSIGNS
| LDF_WRITE
);
66 while (!res
&& (dl
= FindDosEntry(dl
, name
, LDF_ASSIGNS
)))
68 struct AssignList
*al
, *lastal
= NULL
;
70 al
= dl
->dol_misc
.dol_assign
.dol_List
;
73 We have a matching element, lets find the correct
74 member to remove. Initially check the inline lock.
77 if (SameLock(dl
->dol_Lock
, lock
) == LOCK_SAME
)
80 This is a bit tricky, me move the first element
81 in the list to the header
83 dl
->dol_misc
.dol_assign
.dol_List
= al
->al_Next
;
85 dl
->dol_Lock
= al
->al_Lock
;
93 if (SameLock(al
->al_Lock
, lock
) == LOCK_SAME
)
95 /* Remove this element. Singly linked list */
98 /* First element of list... */
99 dl
->dol_misc
.dol_assign
.dol_List
= al
->al_Next
;
103 lastal
->al_Next
= al
->al_Next
;
117 } /* in the assignlist */
119 } /* the assign exists */
121 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);
126 } /* RemAssignList */