Document the generate_mask function.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Sanity-check the flags for mask generation.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>