Hi,

The changelog for MacFUSE mentions that as of release 0.2.0, MacFUSE
contains support for the kqueue/kevent notification mechanism. Given
that any libc program can use this mechanism to listen for filesystem
events, I take this to mean that MacFUSE now has support for causing
those events to be generated -- i.e., a MacFUSE file system daemon can
cause notifications to be received by any other program listening for
EVFILT_VNODE events for a descriptor on that file system.

The changelog recommends reading the man page for kqueue(2), but as
far as I can tell this only details the mechanism for user programs to
set themselves up to receive events, rather than to generate them.
(Indeed, one would expect a FUSE-specific mechanism for generating
events on a FUSE filesystem.)

To illustrate what I am trying to achieve: consider a simple
filesystem containing a single file whose name is the current time
(for simplicity's sake, just hours and minutes without a colon). To
find out the time, the user can just check the contents of the
directory at the mount point. But the time appearing in a Finder
window will be the time at which that window was opened, rather than
the present time. To keep it updated, you would need to arrange for a
kevent to be sent every minute, e.g.:

// Assume callbacks exist for returning the value of the following
string
// as the sole filename residing at the root of the filesystem:

static char *clock_string = "0000";

int main(int argc, char **argv)
{
    pid_t pid = fork();

    if (pid < 0)
        return pid;
    else if (pid > 0)
        return fuse_main(argc, argv, &callbacks, NULL);
    else
    {
        struct timeval tp;
        char *old_clock_path = "/0000";
        while (gettimeofday(&tp) > -1)
        {
            usleep((60 - (tp.tv_sec % 60)) * 1000000 - tp.tv_usec);
            strncpy(&old_clock_path[1], clock_string, 4);
            struct tm *info = localtime(tp->tv_sec);
            sprintf(clock_string, "%2d%2d", info->tm_hour, info-
>tm_min);
            fuse_notify(old_clock_path, NOTE_RENAME);
        }
        return 0;
    }
}

Perhaps one would also have to notify of changes to the parent
directory. Anyway, the main thing I'm looking for is the functionality
of fuse_notify() above -- i.e. a "push" function rather than the
"pull" functions passed to fuse_main(). Does such functionality exist
in MacFUSE?

I have searched the archives and found a thread in which the same
question was asked, and Amit replied that it was theoretically
possible, but did not expand upon that:

http://groups.google.com/group/macfuse-devel/browse_thread/thread/de16dc338835b7b3/cc3f636d17d9e180

Many thanks,
Hamish


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"macfuse-devel" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/macfuse-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to