r/linuxdev • u/FeatureSpace • Sep 19 '16
Block Device Development Tutor?
Can someone refer me to an experienced Linux kernel developer who might be willing to teach me the finer details of implementing high performance Linux block devices?
I'm willing to pay a kernel dev to teach me over Skype, taking me through existing block device code such as: https://lwn.net/Articles/58720/ and linux/drivers/block/loop.c
I ultimately want to develop a block device that works somewhat like loop.c, but instead of the target being a filesystem image file, the target is a user mode process that manages the filesystem image (and can now provide instrumentation, encryption, etc). Does something like this already exist?
I am a decent C/C++ developer and Linux user with zero experience in kernel development.
2
u/kiafaldorius Sep 20 '16
There are probably better ways to implement what you want. I wouldn't recommend mucking kernel-space with user-space...lots of things can go wrong...specifically with security and stability.
On Linux, you have a few choices:
As others have suggested, FUSE. Look into it, it's actually pretty cool and relatively easy to work with...google scriptfs or fusefit I think it already implements what you think you want.
tmpfs or a real fs directory. With tmpfs you allocate a chunk of ram as a filesystem. The idea here is you use a real directory/file and then watch for events through filesystem watchers inotify(7) and epoll(7). If you can use the epoll system, it actually turns out to be really efficient, I've used this multiple times and it works very well. Using tmpfs speeds things up substantially.
Named pipes via mkfifo and/or mknod This might actually be the best for what you want---just a single special file to do all the magic. For directions on usage Google: linux named pipe