title: how big can i2c_msg.buf size be?
body: <p>I am trying to use the i2c interface on an embedded device.</p>
  
  <p>in <code>i2c-dev.h</code> (the userspace header file, not the kernel same-named one!) the i2c_msg is defined as </p>
  
  <pre><code>struct i2c_msg {
      __u16 addr; // slave address
      unsigned short flags;
      short len;      // msg length
      char *buf;      // pointer to msg data
  };
  </code></pre>
  
  <p>and I am reading up on <code>struct i2c_msg</code> from <code>&lt;kernel root&gt;/Documentation/i2c</code>, but it doesn't seem to mention anywhere how big can the <code>*buf</code> array be (i.e. wht would the maxsize of <code>len</code> be). </p>
  
  <p>The nearest of an answer I have come across is in doc-file <code>writing-clients:327</code> , where it states that: </p>
  
  <blockquote>
    <p>..., the third the number of bytes to read/write (must be less than the length of the buffer, also should be less than 64k since msg.len is u16.)</p>
  </blockquote>
  
  <p>but this refers to i2c function "i2c_master_send". so it is not apparent what is going on,</p>
  
  <p>Can <code>buf[len-1]</code> really go up to 64k? ie. can I send up to 64kBytes of data in one write operation (&amp; to one device) down the i2c bus ?</p>
  
  <p>Thank you for your help.</p>