[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: catch mount event
>From: "Francis Qu" <francis@raidzone.com>
>Hi there,
>
>In my DMAPI application, I'd like to catch the mount event of xfs file system.
> After init service and create session, I set DM_EVENT_MOUNT and dm_set_disp,
>then I dm_get_events. Now the program is waiting for mount event to come.
>
>When I
>
>mount -o dmapi -t xfs /dev/xxx /mnt
>
>and it mounts, but the program doesn't catch the mount event.
Are you setting that mount event on the global handle?
(DM_GLOBAL_HANP, DM_GLOBAL_HLEN)
In cmds/xfstests/dmapi there are dmapi test tools. You can look at
src/suite1/cmd/set_disp.c to see how it sets the mount event using the global
handle.
Using those test tools, I can catch the mount event:
# dm_create_session
ret=0
newsid=1
# set_disp -s 1 -G DM_EVENT_MOUNT
# get_events -f 1
[now do your mount command, and the get_events will return...]
rlenp is 128
mount: token=9 sequence=9
fs handle 0998cbba8d08fbb2
mtpt handle <BAD HANDLE, hlen 0>
mtpt path /mnts/dmi1
media desig ide0(3,12)
root handle 0998cbba8d08fbb20e000000000000004000000000000000
mode 0
# respond_event 1 9 1 0
[now the filesystem is mounted]
Dean