hello
I'd like to learn how to write my own device drivers so I started with th ldd3 book. During my first char device implementation I recognized a little problem:
everytime when function to read from device is invoked (from struct file_operation), its parameter - size_t count is equal 4096? How come?
I can make it work anyway but I don't understand why it happends? I read from that device with fread or fgetc but doesn't matter what size I put to invoking function, everytime it is 4096 in read function. Is that something wrong with my code or maybe it should work like that but I don't understand something?
it's in the 'f'
the difference between the stdio streams ((FILE *)s, fread() and fgetc()) and using file descriptors (read(), write()) is that the former are buffered, they are implemented by the libc in terms of the latter, they try to read/write bigger blocks (size BUFSIZ, which happens to be 4096) to speed up the operations. you can set the buffer size with e.g. setvbuf();
thx, I knew that there is som
thx, I knew that there is some kind of trick,
it helped me a lot