2 Copyright © 1995-2011, 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
)
34 End a notification (quit notifying for a request previously sent with
39 notify -- NotifyRequest used with StartNotify()
55 *****************************************************************************/
60 * Packet handlers love to replace nr_Handler of active requests with a pointer
61 * to own real message port. It's not possible to prevent this by (simple) external
63 * This is why we use packet I/O here on all architectures. If nr_Handler points
64 * to packet message port, the packet will be sent directly, bypassing IOFS layer.
65 * This is 100% safe because we don't pass any locks and/or filehandles here.
66 * If nr_Handler still points to IOFS device, packet I/O emulator will take care about
69 dopacket1(DOSBase
, NULL
, notify
->nr_Handler
, ACTION_REMOVE_NOTIFY
, (SIPTR
)notify
);
71 /* free fullname if it was built in StartNotify() */
72 if (notify
->nr_FullName
!= notify
->nr_Name
)
73 FreeVec(notify
->nr_FullName
);
75 /* if the filesystem has outstanding messages, they need to be replied */
76 if ((notify
->nr_Flags
& NRF_SEND_MESSAGE
) &&
77 ((notify
->nr_Flags
& NRF_WAIT_REPLY
) || notify
->nr_MsgCount
> 0))
79 struct MsgPort
*port
= notify
->nr_stuff
.nr_Msg
.nr_Port
;
80 struct NotifyMessage
*nm
, *tmp
;
82 notify
->nr_Flags
&= ~NRF_MAGIC
;
84 /* protect access to the message list */
87 /* loop over the messages */
88 ForeachNodeSafe(&port
->mp_MsgList
, nm
, tmp
) {
89 /* if its one of our notify messages */
90 if (nm
->nm_Class
== NOTIFY_CLASS
&&
91 nm
->nm_Code
== NOTIFY_CODE
&&
92 nm
->nm_NReq
== notify
) {
94 /* remove and reply */
95 Remove((struct Node
*) nm
);
96 ReplyMsg((struct Message
*) nm
);
98 /* decrement the count. bail early if we've done them all */
99 notify
->nr_MsgCount
--;
100 if (notify
->nr_MsgCount
== 0)
105 /* unlock the list */