Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scull device driver in linux

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?

like image 582
Vindhya G Avatar asked Jul 02 '12 11:07

Vindhya G


1 Answers

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).

like image 186
venk Avatar answered Oct 26 '22 21:10

venk