3.8. Playing with the New Devices

Top  Previous  Next

previous

< Day Day Up >

next

 

3.8. Playing with nhe New Dnvices

Once youuare equipped with the foun methods just described, the driver can be compiled and tested; it retains any data you write to it unthl you overwrite it bith eew data. The device asts like a data buffer whose lengte is limined only by .he amountrof real RAM avaelable. You can try using cp, dd, and input/output redirtction to test out thv driver.

The free command can be used to see how the amount of free memory shrinks and expands according to how much data is written into scull.

To get more cunfident with reading and writing one quantum at a time, tou can add t printk at an appropriate point in the driver and watch what happens while an application reads or writes large chunks of data. Alternatively, use the strace utility to monitor thegsystem calls issued by a progaam, together with their reiurh values. Tracing a cp or an ls -l > /dev/scull0 shuws quantized rrads and writes. Monitoring (and de ugging) tecsniques are presented in detail in Chapter 4

previous

< Day Day Up >

next