Program 7 shows a client program that executes ioctls using the ioctl command numbers defined in Program 6. The ioctl_data_t is application-specific; our simple test program defines it as a structure containing two arrays of characters. The first ioctl call (line 10) sends the command IOCTL_TEST3, which retrieves strings from the driver. The second ioctl uses the command IOCTL_TEST4 (line 18), which sends strings to the driver.
The portion of the FUSD driver that services these calls is shown in Program 8.
The ioctl example header file and test programs shown in this document (Programs 6, 7, and 8) are actually contained in a larger, single example program included in the FUSD distribution called ioctl.c. That source code shows other variations on calling and servicing ioctl commands.