2 Copyright © 1995-2013, 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(CONST_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 removed 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.
55 *****************************************************************************/
59 struct DosList
*dl
= NULL
;
62 D(bug("RemAssignList: name = \"%s\", lock = $%lx\n", name
, lock
));
63 dl
= LockDosList(LDF_ASSIGNS
| LDF_WRITE
);
65 while (!res
&& (dl
= FindDosEntry(dl
, name
, LDF_ASSIGNS
)))
67 struct AssignList
*al
, *lastal
= NULL
;
69 al
= dl
->dol_misc
.dol_assign
.dol_List
;
72 We have a matching element, lets find the correct
73 member to remove. Initially check the inline lock.
76 if (SameLock(dl
->dol_Lock
, lock
) == LOCK_SAME
)
79 This is a bit tricky, me move the first element
80 in the list to the header
87 dl
->dol_misc
.dol_assign
.dol_List
= al
->al_Next
;
88 dl
->dol_Lock
= al
->al_Lock
;
103 if (SameLock(al
->al_Lock
, lock
) == LOCK_SAME
)
105 /* Remove this element. Singly linked list */
108 /* First element of list... */
109 dl
->dol_misc
.dol_assign
.dol_List
= al
->al_Next
;
113 lastal
->al_Next
= al
->al_Next
;
127 } /* in the assignlist */
129 } /* the assign exists */
131 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);
136 } /* RemAssignList */