I would like to create a way to redefine the methods of reading, writing and displaying (on the page) in one file without load to implement the whole new file system.
Therefore, I am exploring the possibility of using a block device. for example, my device will be a dynamic library that can be downloaded by other processes.
So far I have managed to create a device using the following code (written in the macOS kernel extension, but should be compatible with every BSD-based OS).
static struct cdevsw my_device =
{
.d_open = my_open,
.d_close = my_close,
.d_read = my_read,
...
};
int my_major_index = cdevsw_add (-1 , &my_device);
dev = makedev (my_major_index, 0);
void * device_node = devfs_make_node (dev,
DEVFS_BLOCK,
UID_ROOT,
GID_WHEEL,
MY_PERMISSION,
"my_device");
And after this instance, I displayed the device under /dev/my_device,
, dlopen ( dlopen("/dev/my_device") HFS + dylib ?