next up previous contents
Next: 4.7.1 Filter Examples Up: 4. The FiST Language Previous: 4.6 Variables

4.7 Filters

A key idea in FiST is the use of filters. Filters are functions that act much like Unix filters -- programs that may be concatenated with the shell pipe symbol | (a vertical bar). A filter accepts data as input, manipulates it, and then passes it on.

A filter is defined as follows: %filter filtername fsindex attr [ { conditions } ] where filtername is the name of the filter; e.g., ``gzip,'' ``compress,'' ``crypt,'' ``DES,'' and ``rot13.'' fsindex refers to the positional parameter of the file system such as $$, $1, and so on. attr refers to the attribute of the vnode, e.g. %name, %owner, %mode, or the vnode operation name such as vn_read, vn_open, etc.

An optional set of conditions may be supplied, enclosed in curly braces. If all the conditions are met, the filter will be applied. Conditions are separated by a semicolon. Each condition is a boolean expression using C syntax binary operators &&, ||, ==, !=, etc.


Erez Zadok