|
File notify question. |
Posted on: 2014/2/12 16:33
#1 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
I'm looking at the fs_notify_test.c example, and it does notify about files in sub directory's, but is possible to make it notify about changes in sub directory’s also?
And also it be nice if notified about deleting and creating directories. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/16 12:17
#2 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@LiveForIt
This is important, the program I'm writing depends on best possible notification service, so if anyone can help. I need to be notified when directory’s are created, when they are deleted, when files are changed or created or replaced. I need to know if there is changes in sub directory’s of directory I'm monitoring. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/16 17:36
#3 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2008/1/6 17:56 From Pennsylvania, USA
Posts: 1326
|
@LiveForIt
I just did some testing with the waitnotify command. If I wait on a directory, any activity in that directory (files, new sub-directories, deleted directories etc.) causes the wait to end. The waitnotify command at OS4Depot includes the source code which may be of some help. |
|
_________________
Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450 |
||
|
Re: File notify question. |
Posted on: 2014/2/16 18:04
#4 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@xenic
Excellent, I have a look. Thanks. Edited by LiveForIt on 2014/2/17 11:06:38
|
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/16 21:43
#5 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2006/12/1 18:01 From Copenhagen, Denmark
Posts: 1112
|
@LiveForIt
Don't forget that depending on the filesystem (I believe), it may differ whether activity in a subdir of a subdir will be visible/notified "two layers above". You should make sure you test the features you need in a situation with multiple layers of subdirectories. Best regards, Niels |
|
|
Re: File notify question. |
Posted on: 2014/2/16 22:10
#6 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2006/11/30 11:30 From Finland
Posts: 1690
|
@nbache
Quote:
If ADO_DOSMethodOnly is set to TRUE notifications will work the same no matter what the underlying filesystem is (see autodoc for more details). |
|
|
Re: File notify question. |
Posted on: 2014/2/17 7:23
#7 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@xenic
The example does not inform me what has changed, so it can't be used, but thanks anyway. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/17 10:20
#8 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
This is my test code for NotifyMessage, but NotifyMessage does not give any useful info about anything...
Class and Code is always the same values, and the mssage name is always NULL. I don't get what this is for :-/
#include <exec/types.h>
|
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/17 10:45
#9 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2006/11/30 11:30 From Finland
Posts: 1690
|
@LiveForIt
Why do you insist on using message notification type when hook notification type gives more information? Quote:
Also if you want consistent behavior between filesystems it's recommended to use ADO_DOSMethodOnly that I mentioned before. |
|
|
Re: File notify question. |
Posted on: 2014/2/17 11:04
#10 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@salass00
It was the first thing I tried. Because it did not provide information about sub directory’s. Signaling and Messaging work on subdirectories. Also I don't know what I'm doing wrong whit AllocSysObjectTags,because its only works when setting up the struct Notify manually. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/17 12:59
#11 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@salass00
Some thing is not right whit AllocSysObjectsTags().
nr= AllocSysObjectTags( DOS_NOTIFYREQUEST,
result: Name: (null) Flag: 0 HOOK: 5DDCEAA4
if (nr = AllocVec(sizeof(struct NotifyRequest), MEMF_CLEAR ) )
result: Name: ram: Flag: 32 HOOK: 5C673CD4 |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/17 13:07
#12 |
---|---|---|
Just popping in
![]() ![]() Joined:
2007/5/15 12:42 From Austria
Posts: 104
|
@LiveForIt
Quote: Some thing is not right whit AllocSysObjectsTags(). Yeah, you are using the wrong function. AllocDosObjectTags() is what you're looking for. (edit: changed AllocDosObject() to AllocDosObjectTags() |
|
|
Re: File notify question. |
Posted on: 2014/2/17 13:37
#13 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@Gazelle
Thanks that worked. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 2014/2/17 17:00
#14 |
---|---|---|
Just can't stay away
![]() ![]() Joined:
2006/11/30 11:30 From Finland
Posts: 1690
|
@LiveForIt
For the future in case you didn't already know ![]() AllocSysObjectTags()/FreeSysObject() is for ASOT_#? objects AllocDosObjectTags()/FreeDosObject() is for DOS_#? objects |
|
|
Re: File notify question. |
Posted on: 2014/2/17 17:22
#15 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/11/20 16:26 From Norway
Posts: 2740
|
@salass00
OK thanks, but this API has clearly some limitations. Anyway, two things Notification API, needs to support: * Rename: (Do it the correct way, not say the file is deleted when they are not deleted.) * Support for Sub directory’s. |
|
_________________
(NutsAboutAmiga) Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps. |
||
|
Re: File notify question. |
Posted on: 6/18 1:48
#16 |
---|---|---|
Just popping in
![]() ![]() Joined:
2015/9/28 23:42 From Bettendorf, IA, USA
Posts: 215
|
@salass00
I needed to update my notification module to handle multiple files being watched. So it requires the hook mode since can't have over 15 signals. I have it all working, but one thing I don't like that needs to be updated: notifyMultiHookFunc(struct Hook *hook,APTR resv UNUSED,struct NotifyHookMsg *msg) msg->nhm_Name only gives me the FilePart of the path I originally specified. Seems like no big deal, but what if I have multiple files of the same name but from different drawers being watched? I need to know specifically which one it is. I need the entire path that I specified to watch. nhm_Path could be added for entire path. But for now, what do I do? |
|
_________________
Workbench Explorer - A better way to browse drawers |
||
|
Re: File notify question. |
Posted on: 6/18 8:38
#17 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/12/4 23:15 Posts: 2146
|
@mritter0
Use a separate hook for each notification you setup. The hooks will call the same function but you can use the hook data to provide that function with the extra data you need. |
|
|
Re: File notify question. |
Posted on: 6/18 20:17
#18 |
---|---|---|
Just popping in
![]() ![]() Joined:
2015/9/28 23:42 From Bettendorf, IA, USA
Posts: 215
|
@broadblues
Thanks for the idea. That is what I did. Hopefully the full path will be added so I can use 1 global hook instead of multiple hooks. |
|
|
Re: File notify question. |
Posted on: 6/18 20:29
#19 |
---|---|---|
Home away from home
![]() ![]() Joined:
2006/12/4 23:15 Posts: 2146
|
@mritter0
Since you need to set the hook for each directory / file monitored seprate hooks is the correct way to go, to avoid race type conditions on more complex hook data. But there is also the "DOSFileDirNotify.resource" which since version 53.81 can setup a global hook to monitor all notification activity. I use this for my activityMonitor application which before that needed to set 1000s of notifications up. See SDK:Include/include_h/resources/filedirnotify.h |
|