Prev, Top Notes, Next

Adventures In ioctl(2) Support
Decoding Request Numbers

The library uses a table
const explain_iocontrol_t *const explain_iocontrol_table[] =
{
    &explain_iocontrol_blkbszget,
    blah blah blah
    &explain_iocontrol_vt_waitactive,
}
Using manual OO techniques
struct explain_iocontrol_t
{
    const char *name;
    int number;
    int (*disambiguate)(int fildes, int request, const void *data);
    void (*print_data)(int fildes, int request, const void *data);
    void (*print_explanation)(int fildes, int request, const void *data);
    etc
};

libexplain/iocontrol.h
libexplain/iocontrol/table.c
libexplain/iocontrol/name.c