Hi Erik, Thanks. I got it. I am writing simple module and testing them. I am trying to write a MACRO to define my own LOGLEVEL for the printk statement See it below: #define PDEBUG (Level, fmt, args...) do { if (Level == 0) printk("MYDRV:"fmt, ##args) else if (Level ==1) printk("MYDRV:<%s> " fmt, __FUNCTION__, ##args) } while0 Can you suggest some more extra detailed log levels that I can add ti this MACRO? - Mukund On 3/26/08, Erik Mouw <mouw@xxxxxxxxxxxx> wrote: > On Wed, Mar 26, 2008 at 02:33:58PM -0700, bhanu nani wrote: > > I have completed reading the LLD3 and The Design of Unix Operating Sysem. > > I have just started writing my own version of LLD example drivers. > > My machine runs on FC8. > > > > Theoritically, understand that the buffercache only avialable for > > Block driver not char devices. I wrote a scull type char driver. > > > > I do this from the APP: > > fwrite(buf, 1, 2, fd) > > rewind() > > fread(buf, 1, 1, fd) > > fwrite(buf, 1, 1, fd) > > > > During the fread operation, driver gets a read of 4096 bytes from the > > application whereas the application is trying ot read only 1 byte. > > This looks like file system buffer cache.??? > > No, what you see is libc buffering. Just strace your program and you > will see it issueing a 4096 byte read() system call. Also note that > read() takes a file descriptor and not a pointer to a FILE structure. > > If you really want to read/write a single byte, use read()/write() > instead of fread()/fwrite() (and lseek() instead of rewind()). > > > Erik > > -- > Erik Mouw -- mouw@xxxxxxxxxxxx > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFH6shB/PlVHJtIto0RAqngAJ91Qs13v+tuuTYslbpQHAhtesEqKwCgh9Qp > gvypOi7BTrVezeYOcJ0WTD8= > =AIa8 > -----END PGP SIGNATURE----- > > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ