Other Mount file from character device

I'd like to create a character device that serves as a single file's filesystem. Thus, I created my own device implementing read, write and mmap methods.

For the experiment, I wish my device to be mounted by regular high-level filesystem and represent a dynamic library available for loading by other processes.

So far I was able to create the device using the following code (Part of kernel module).

Code:
static struct cdevsw my_device =
{
    // Implement the methods
    .d_open = my_open,
    .d_close = my_close,
    .d_read = my_read,
    ...
};

int my_major_index = cdevsw_add (-1 /* auto select index */, &my_device);
dev = makedev (my_major_index, 0);
void * device_node = devfs_make_node (dev,
                                      DEVFS_CHAR,
                                      UID_ROOT,
                                      GID_WHEEL,
                                      MY_PERMISSION,
                                      "my_device");

now I wish to go to the mount phase, so my question is whether I just need to mount it, copy my file into this new mount drive and that's it ?

thanks,
 
Back
Top