Create procfs_utils.c; File missed from last commit; + remove warning from mm_memalign.c (how did this work before?)

This commit is contained in:
Gregory Nutt
2013-12-14 08:53:23 -06:00
parent 623229057f
commit 9f01df47ea
8 changed files with 278 additions and 59 deletions
+44 -1
View File
@@ -134,7 +134,50 @@ extern "C" {
#define EXTERN extern
#endif
/* Nothing here yet */
/****************************************************************************
* Name: procfs_memcpy
*
* Description:
* procfs/ file data may be read by the user with different user buffer
* sizes to receive the data. If the amount of data to be returned is
* large or if the callers receive buffer is small, then multiple read
* operations will be required.
*
* If multiple read operations are required, then each read operation will
* be identical accept that file position (f_pos) will be incremented with
* each read: f_pos must be incremented by the read method after each
* read operation to provide the 'offset' for the next read.
*
* procfs_memcpy() is a helper function. Each read() method should
* provide data in a local data buffer ('src' and 'srclen'). This
* will transfer the data to the user receive buffer ('dest' and 'destlen'),
* respecting both (1) the size of the destination buffer so that it will
* write beyond the user receiver and (1) the file position, 'offset'.
*
* This function will skip over data until the under of bytes specified
* by 'offset' have been skipped. Then it will transfer data from the
* the procfs/ 'src' buffer into the user receive buffer. No more than
* 'destlen' bytes will be transferred.
*
* Input Parameters:
* src - The address of the intermediate procfs/ buffer containing the
* data to be returned.
* srclen - The number of bytes of data in the 'src' buffer
* dest - The address of the user's receive buffer.
* destlen - The size (in bytes) of the user's receive buffer.
* offset - On input, this is the number of bytes to skip before returning
* data; If bytes were skipped, this offset will be decremented.
* Data will not be transferred until this offset decrements to
* zero.
*
* Returned Value:
* The number of bytes actually transferred into the user's receive buffer.
*
****************************************************************************/
size_t procfs_memcpy(FAR const char *src, size_t srclen,
FAR char *dest, size_t destlen,
off_t *offset);
#undef EXTERN
#ifdef __cplusplus