Re: max read size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> than the request. I executed on 3 different systems and saw that the
> maximum number of bytes returned were 132880, 136920, 6080. Where in the
> kernel is this max value stored.

the kernel impose no such restrictions on file system's implementations.
every file system can take a different approach when implementing its
filp->f_op->read method.
however, there are some standards you need to meet:
1) if an error occurred, and data could not be read, return an appropriate
   error code.
2) if the file system successfully read some byte, any number of bytes,
   return the number of bytes read.
3) if an error occurred during the read, and some bytes have already been
   read, return the number which was read, and on the next call to read
   return an error.
4) if x bytes were read, the filp->f_pos pointer must be advanced by x
   bytes.

so, a file system can decide to read only 1 byte each call to it's read,
or to try and read all the data the user asked for. its really up to the
file system designer ( and, obviously, there is a tradeoff ... )

however, usually the library routine (in libc) takes care to make
iterative calls to the system call, and try to fulfill the users request.


========================================================================
nir.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux