I have found the following functions (while studying the md driver), but I don't know how to use them correctly:
- open_by_dev_num(dev_t, mode);
- Probably to open device by its device number, but can I do it if devfs entry is not existing?
- _bdevname(dev_t, char *);
- This is probably to help while logging from the module.
- bd_claim(struct block_device, rdev_t);
- I have no idea how to use it, and what does it do...
- blkdev_put(struct block_device);
- Probably to "return" the driver to kernel? Oposite to open_by_devnum?
- bd_release(struct block_device);
- Probably to "release" the driver - opostite to bd_claim?
There are many other functions using page allocations and "synchronization", but I need just a simple read. I cannot find anything. Even this page sync would be OK, because it would help next time I would like/need to write a driver.
I hope, that someone would be interested in this topic. Probably some similar sample driver can be included in the next edition of the "Linux Device Drivers" book. After I would have a first successful read I would publish the code, so it would be easy to include it there.
Still I have no idea how to read from the character device.