From the course: Linux Device Drivers
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Implement block driver operations - Linux Tutorial
From the course: Linux Device Drivers
Implement block driver operations
- [Instructor] Let's talk about the operation struct for block drivers and some of the functions. So we'll look at the struct block device operations briefly, and we'll see that the struct gendisk is important because it's what references that struct of operations. And then we'll pick a couple functions, open and ioctl, to briefly discuss. Like character drivers which has the file_operations struct block drivers have an operations struct, as well, and very similarly, the fields in there are pointers to the functions to implement the API. And it has an open, release, and an ioctl like character drivers do. But there's some stuff different, too. The commands like open, release, and so forth, are called in the block driver when stuff like a mount is done. Again, the ordinary IO with a block device is not done through read and write functions. Each disk has an instance of the struct gendisk and it's in that struct that we find…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.