Linux Block Device - Looking for a Simple Example

869 views Asked by At

I was trying for a linux virtual block device, My requirement is while running cat /dev/mydevice must return some string which I created in the kernel program, (I dont have to write any data to drive, Basically create a Block device which helps to understand how block device works ).

I tried with the example provided in this blog. But once i run cat /dev/sbd0 it is going to infinite loop. And I am not getting any log from any method in the block driver to understand how the flow happens in the block driver.

Can some one explain how the flow happens in the block device in linux kernel?.

Also I tried the Link+ editor, still i couldn't found any sample block device in the Link+ examples. I could see a lot of sbd.c programs online, but due to the library compatibility with latest kernel, most didn't compile(I am a linux naive user).

The kernel I am using is 4.4 in Ubuntu 16.04

0

There are 0 answers