U S E R - L E V E L A P I
The final component of the user-level API is known as the node monitor.
Although the node monitor is not part of the class hierarchy defined above, it
is still part of the C++ API. The node monitor is a service that lets programs
ask to receive notification of changes in a file system. You can ask to be told
when a change is made to
the contents of a directory
the name of an entry
any properties of an entry (i.e., the stat information)
any attribute of an entry
Application programs use the node monitor to dynamically respond to
changes made by a user. The BeOS Web browser, NetPositive, stores its book-
marks as files in a directory and monitors the directory for changes to update
its bookmark menu. Other programs monitor data files so that if changes are
made to the data file, the program can refresh the in-memory version being
used. Many other uses of the node monitor are possible. These examples just
demonstrate two possibilities.
Through a wrapper API around the lower-level node monitor, a program
can also receive notifications when
a volume is mounted
a volume is unmounted
In the same way that a query sends notifications to a port for live updates,
the node monitor sends messages to a port when something interesting hap-
pens. An "interesting" event is one that matches the changes a program
expresses interest in. For example, a program can ask to only receive no-
tifications of changes to the attributes of a file; if the monitored file were
renamed, no notification would be sent.
The node monitor watches a specific file or entry. If a program wishes to
receive notifications for changes to any file in a directory, it must issue a node
monitor request for all the files in that directory. If a program only wishes to
receive notifications for file creations or deletions in a directory, then it only
needs to watch the directory.
There are no sophisticated classes built up around the node monitor. Pro-
grams access the node monitor through two simple C++ functions,
Using the API
Although our discussion of the BeOS C++ Storage Kit provides a nice high-
level overview, it doesn't give a flavor for the details of programming the API.
Practical File System Design:The Be File System
, Dominic Giampaolo