|
|
# Device model
|
|
|
|
|
|
> I found these structures while searching through the kernel
|
|
|
|
|
|
## Device Struct
|
|
|
|
|
|
- name
|
|
|
- get_tty : this is a member only used by TTY devices. This seems to be a dirth hack planned to be removed
|
|
|
- init : Called to initialize the device
|
|
|
- open : Call to open the device, called with a minor ID and a pointer to an allocated file structure[^1]
|
|
|
};
|
|
|
|
|
|
## File Operation struct
|
|
|
|
|
|
This is related to devices which seems to have a file structure/allocated file to them. Some function pointers can be NULL if the related operation can't be done to this device/file (read or write)
|
|
|
|
|
|
- release : "Close" the opened file in this instance (Release it)
|
|
|
- read
|
|
|
- write
|
|
|
- lseek
|
|
|
- ioctl : Is that for setting up the file/device?
|
|
|
|
|
|
[^1]: For instance giving to the display a pointer to the "/dev/display" file? |
|
|
\ No newline at end of file |