yamt commented on code in PR #13498:
URL: https://github.com/apache/nuttx/pull/13498#discussion_r1818306698


##########
fs/vfs/fs_read.c:
##########
@@ -108,28 +184,63 @@ ssize_t file_read(FAR struct file *filep, FAR void *buf, 
size_t nbytes)
 }
 
 /****************************************************************************
- * Name: nx_read
+ * Name: file_read
  *
  * Description:
- *   nx_read() is an internal OS interface.  It is functionally similar to
+ *   file_read() is an internal OS interface.  It is functionally similar to
  *   the standard read() interface except:
  *
+ *    - It does not modify the errno variable,
+ *    - It is not a cancellation point,
+ *    - It accepts a file structure instance instead of file descriptor.
+ *
+ * Input Parameters:
+ *   filep  - File structure instance
+ *   buf    - User-provided to save the data
+ *   nbytes - The maximum size of the user-provided buffer
+ *
+ * Returned Value:
+ *   The positive non-zero number of bytes read on success, 0 on if an
+ *   end-of-file condition, or a negated errno value on any failure.
+ *
+ ****************************************************************************/
+
+ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes)
+{
+  struct iovec iov;
+  struct uio uio;
+
+  iov.iov_base = buf;
+  iov.iov_len = nbytes;
+  uio.uio_iov = &iov;
+  uio.uio_iovcnt = 1;
+  return file_readv(filep, &uio);
+}
+
+/****************************************************************************
+ * Name: nx_readv
+ *
+ * Description:
+ *   nx_readv() is an internal OS interface.  It is functionally similar to
+ *   the standard readv() interface except:
+ *
  *    - It does not modify the errno variable, and
  *    - It is not a cancellation point.
  *
  * Input Parameters:
  *   fd     - File descriptor to read from
- *   buf    - User-provided to save the data
- *   nbytes - The maximum size of the user-provided buffer
+ *   iov    - User-provided iovec to save the data
+ *   iovcnt - The number of iovec
  *
  * Returned Value:
  *   The positive non-zero number of bytes read on success, 0 on if an
  *   end-of-file condition, or a negated errno value on any failure.
  *
  ****************************************************************************/
 
-ssize_t nx_read(int fd, FAR void *buf, size_t nbytes)
+ssize_t nx_readv(int fd, FAR const struct iovec *iov, int iovcnt)
 {
+  struct uio uio;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to