Fix permissions set by FS.createDevice

This fixes a few issues with the FS.createDevice function:

1. The read and write permission bits were swapped. If only an input function was provided, then the write bit (instead of the read bit) was set, and vice-versa for an output function. This did not manifest normally because the default code path doesn't use createDevice at all, and the tests only ever set both functions at once.
2. If neither an input or an output function was provided, permissions were still set. This doesn't really hurt anything, but is superfluous.
3. The execute bit is set in all cases. I do not think that the execute bit ever needs to be set on a device.

I've also added tests to test devices that are read-only or write-only.