>From: Matthijs van der Klip <matthijs.van.der.klip@xxxxxx>
>I would like to try to create an app that does the following:
>
>1) Register with dmapi.
>2) Tell dmapi I want to receive events when directory entries on a certain
> filesystem are added/deleted.
>3) On receipt of an event append the absolute path of the modified
> directory to a logfile.
Using XFS and the dmapi tests in cmd/xfstests/dmapi:
# mount -o dmapi /dev/hda12 /mnts/dmi1
# dm_create_session -i dean1
ret=0
newsid=1
# set_disp -s 1 /mnts/dmi1 DM_EVENT_CREATE DM_EVENT_REMOVE
# set_eventlist -s 1 /mnts/dmi1 DM_EVENT_CREATE DM_EVENT_REMOVE
# touch /mnts/dmi1/foo1&
[1] 771
#
# get_events 1
rlenp is 96
create: token=1 sequence=1
parent dir 5a659482b0bbecee0e000000000000004000000000000000
name foo1
mode bits mode 100644: perm rw- r-- r--, type Regular File
# respond_event 1 1 1 0
#
[1] + Done touch /mnts/dmi1/foo1&
To get actual pathnames, well that's different. Our HSM doesn't need the
pathname, and so...it's not till now that I see maybe dm_handle_to_path() in
libdm is broken. I'm sure someone who needs it could come up with a fix
easily enough :)
Dean
|