Hi Pranay Well explained. Thank you. On 20 March 2015 at 11:46, Pranay Srivastava <pranjas@xxxxxxxxx> wrote: > Hi Sahil > > On Sun, Mar 15, 2015 at 10:17 AM, sahil aggarwal <sahil.agg15@xxxxxxxxx> wrote: >> hi all, >> >> Going through scull driver code, i see read function reads only till >> end of 1 quantum, so do kernel call read multiple times if count from >> q_pos exceeds quantum size limit.? >> >> >> Ref: ldd3. >> >> if(count > quantum - q_pos) >> count = quantum - q_pos; >> if(copy_to_user(buf, dptr->data[s_pos] + q_pos,count)){ >> retval = -EFAULT; >> goto out; >> } > > If you are not using the default read/write routines, then its up to > you to code that. > > Kernel doesn't do multiple read calls. It'll do only what you asked it > for no more but it can do less. For example, a file is say 100 KiB and > you are reading say 4KiB in a loop when do you stop? > > Simply put it's the user space application which is doing the looping > and repeatedly doing read calls because it assumes that file isn't > finished. > > So again when do you stop reading from the file, without knowing size > of the file.? > >> *f_pos += count; >> retval = count; >> >> Thanks >> Regards >> >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies@xxxxxxxxxxxxxxxxx >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > -- > ---P.K.S _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies