2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <exec/lists.h>
11 #include <proto/exec.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
19 #include <dos/notify.h>
20 #include <proto/dos.h>
24 AROS_LH1(void, EndNotify
,
27 AROS_LHA(struct NotifyRequest
*, notify
, D1
),
30 struct DosLibrary
*, DOSBase
, 149, Dos
)
33 End a notification (quit notifying for a request previously sent with
37 notify - NotifyRequest used with StartNotify()
52 *****************************************************************************/
57 * Packet handlers love to replace nr_Handler of active requests with a pointer
58 * to own real message port. It's not possible to prevent this by (simple) external
60 * This is why we use packet I/O here on all architectures. If nr_Handler points
61 * to packet message port, the packet will be sent directly, bypassing IOFS layer.
62 * This is 100% safe because we don't pass any locks and/or filehandles here.
63 * If nr_Handler still points to IOFS device, packet I/O emulator will take care about
66 dopacket1(DOSBase
, NULL
, notify
->nr_Handler
, ACTION_REMOVE_NOTIFY
, (SIPTR
)notify
);
68 /* free fullname if it was built in StartNotify() */
69 if (notify
->nr_FullName
!= notify
->nr_Name
)
70 FreeVec(notify
->nr_FullName
);
72 /* if the filesystem has outstanding messages, they need to be replied */
73 if ((notify
->nr_Flags
& NRF_SEND_MESSAGE
) &&
74 ((notify
->nr_Flags
& NRF_WAIT_REPLY
) || notify
->nr_MsgCount
> 0))
76 struct MsgPort
*port
= notify
->nr_stuff
.nr_Msg
.nr_Port
;
77 struct NotifyMessage
*nm
, *tmp
;
79 notify
->nr_Flags
&= ~NRF_MAGIC
;
81 /* protect access to the message list */
84 /* loop over the messages */
85 ForeachNodeSafe(&port
->mp_MsgList
, nm
, tmp
) {
86 /* if its one of our notify messages */
87 if (nm
->nm_Class
== NOTIFY_CLASS
&&
88 nm
->nm_Code
== NOTIFY_CODE
&&
89 nm
->nm_NReq
== notify
) {
91 /* remove and reply */
92 Remove((struct Node
*) nm
);
93 ReplyMsg((struct Message
*) nm
);
95 /* decrement the count. bail early if we've done them all */
96 notify
->nr_MsgCount
--;
97 if (notify
->nr_MsgCount
== 0)
102 /* unlock the list */