2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include "dos_intern.h"
10 #include <exec/lists.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
17 #include <dos/notify.h>
18 #include <proto/dos.h>
22 AROS_LH1(void, EndNotify
,
25 AROS_LHA(struct NotifyRequest
*, notify
, D1
),
28 struct DosLibrary
*, DOSBase
, 149, Dos
)
32 End a notification (quit notifying for a request previously sent with
37 notify -- NotifyRequest used with StartNotify()
53 *****************************************************************************/
57 struct IOFileSys iofs
;
60 /* get the device pointer and dir lock. note that we don't just use
61 * nr_Handler here, because we also need to supply a unit pointer so
62 * packet.handler can get its mount context */
63 if ((dvp
= GetDeviceProc(notify
->nr_FullName
, NULL
)) == NULL
)
67 InitIOFS(&iofs
, FSA_REMOVE_NOTIFY
, DOSBase
);
68 iofs
.io_Union
.io_NOTIFY
.io_NotificationRequest
= notify
;
70 iofs
.IOFS
.io_Device
= (struct Device
*) dvp
->dvp_Port
;
72 /* take the root lock from either the doslist entry or from the devproc */
73 if (dvp
->dvp_Lock
== NULL
)
74 iofs
.IOFS
.io_Unit
= dvp
->dvp_DevNode
->dol_Ext
.dol_AROS
.dol_Unit
;
76 iofs
.IOFS
.io_Unit
= ((struct FileHandle
*) BADDR(dvp
->dvp_Lock
))->fh_Unit
;
83 } while (iofs
.io_DosError
!= 0 && ErrorReport(iofs
.io_DosError
, REPORT_LOCK
, 0, dvp
->dvp_Port
) == DOSFALSE
);
85 /* free fullname if it was built in StartNotify() */
86 if (notify
->nr_FullName
!= notify
->nr_Name
)
87 FreeVec(notify
->nr_FullName
);
89 /* if the filesystem has outstanding messages, they need to be replied */
90 if (notify
->nr_Flags
& NRF_SEND_MESSAGE
&&
91 (notify
->nr_Flags
& NRF_WAIT_REPLY
|| notify
->nr_MsgCount
> 0)) {
93 struct MsgPort
*port
= notify
->nr_stuff
.nr_Msg
.nr_Port
;
94 struct NotifyMessage
*nm
, *tmp
;
96 notify
->nr_Flags
&= ~NRF_MAGIC
;
98 /* protect access to the message list */
101 /* loop over the messages */
102 ForeachNodeSafe(&port
->mp_MsgList
, nm
, tmp
) {
103 /* if its one of our notify messages */
104 if (nm
->nm_Class
== NOTIFY_CLASS
&&
105 nm
->nm_Code
== NOTIFY_CODE
&&
106 nm
->nm_NReq
== notify
) {
108 /* remove and reply */
109 Remove((struct Node
*) nm
);
110 ReplyMsg((struct Message
*) nm
);
112 /* decrement the count. bail early if we've done them all */
113 notify
->nr_MsgCount
--;
114 if (notify
->nr_MsgCount
== 0)
119 /* unlock the list */
123 SetIoErr(iofs
.io_DosError
);