I am reading linux device driver book of rubini,corbet and hartmen.I did not understand these lines about scull device driver.This is what book says
The only real operation performed on the device is truncating it to a length of 0 when the device is opened for writing. This is performed because, by design, overwriting a scull device with a shorter file results in a shorter device data area.
Would be great help if someone explain how trimming is exactly done?What do you mean by overwriting a scull device with shorter file?
The scull device in the book is simply an area of memory (RAM). So, when one overwrites it with a shorter file, it simply becomes a smaller area of memory (a.k.a shorter device data area). Therefore, when the device is opened for writing, the length should be truncated to 0 bytes (because we have not written anything yet. We have just opened it for writing).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With