title: using sysfs show() and store() functions
body: <p>I have 2 questions regarding using these functions. I don't completely understand the documentation written <a href="https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt" rel="nofollow noreferrer">here</a>:</p>
  
  <blockquote>
    <p>sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the
    method. Sysfs will call the method exactly once for each read or
    write. This forces the following behavior on the method
    implementations: </p>
    
    <ul>
    <li><p>On read(2), the show() method should fill the entire buffer. 
    Recall that an attribute should only be exporting one value, or an
    array of similar values, so this shouldn't be that expensive. </p>
    
    <p>This allows userspace to do partial reads and forward seeks
    arbitrarily over the entire file at will. If userspace seeks back to
    zero or does a pread(2) with an offset of '0' the show() method will
    be called again, rearmed, to fill the buffer.</p></li>
    <li><p>On write(2), sysfs expects the entire buffer to be passed during the
    first write. Sysfs then passes the entire buffer to the store() method.
    A terminating null is added after the data on stores. This makes
    functions like sysfs_streq() safe to use.</p>
    
    <p>When writing sysfs files, userspace processes should first read the
    entire file, modify the values it wishes to change, then write the
    entire buffer back. </p></li>
    </ul>
  </blockquote>
  
  <p>First, when I read/write to the sysfs attribute file with <code>read/write</code>, am I guaranteed that the buffer I read to / the buffer in the <code>store</code> function will have all of the bytes I wanted to read in that function, and not call it in several chunks?</p>
  
  <p>Also, how is the null character added? That is, suppose I wrote n bytes, will the amount of written bytes be n in the function parameter, and the null char will be placed at n+1?</p>
  
  <p>thanks</p>