2. The Solution

The solution to the inflexibility of the DTYPE macros is to not use them at all, but instead to rely on the fileops functions.

2.1. VOP_SETATTR(), a special case

In fdescfs, the setattr VOP is only permitted for files that are backed by a vnode--FIFOs and regular files. This would mean that there would need to be some way of identifying a vnode other than by file type. This was solved using the getvnode() function, which currently only checks DTYPE_VNODE and DTYPE_FIFO, but could be changed to check for an identifier in a struct file telling whether something is a vnode. In any case, this is left to getvnode(), which will be a lot easier to change.