If the conditions of the filter are met, then a C function that implements the filter is called. The prototype of the function is as follows:
That is, the name of the filter function is composed from the filter name and the attribute type. The function receives at least two arguments: a pointer to the data that fits the type, and a pointer to the size of the data being passed.
Note that having the filter name and attribute type in the function's name could be easily done in C++ using methods and overloaded prototypes. This information is included in the function name because the code should be C, a requirement for portability.8
For example, for the first example in Section sec-fist-filt-ex, the prototype would be:
and for the third example it would be:
Filter functions should behave like system calls, returning 0 (zero) upon success, and a non-zero integer if any failure occurred. Failure codes are assumed to be errno values.
To write a new filter, all one must do is write a simple C function that manipulates the data as needed. There is no need to worry about what vnode operations this would have to apply to, where the information is stored, when to allocate or free vnodes, most errors, and so on. All these are handled automatically by FiST.