Re: [RFC] Provide a file system API


Thomas, Ramesh
 

On 07/26/2016 06:36 PM, Ramesh Thomas wrote:


/**
* @brief File seek
*
* Moves the file position to a new location in the file. The offset is
added
* to file position based on the 'from' parameter.
*
* @param zfp Pointer to the file object
* @param offset Relative location to move the file pointer to
* @param from Relative location from where offset is to be calculated.
* SEEK_SET = from beginning of file
* SEE_CUR = from current position,
* SEEK_END = from end of file.
*
* @retval 0 Success
* @retval -ERRNO errno code if error.
*/
int fs_seek(ZFILE *zfp, long offset, int from);
I would like to simplify this and always move the pointer relative to
beginning of file. The other options can be easily accomplished by
ftell() + offset and fsize() + offset, if necessary.

/**
* @brief File seek
*
* Moves the file position to a new location in the file.
*
* @param zfp Pointer to the file object
* @param offset New location to move the file pointer to
*
* @retval 0 Success
* @retval -ERRNO errno code if error.
*/
int fs_seek(ZFILE *zfp, long offset);

-Ramesh

Join devel@lists.zephyrproject.org to automatically receive all group messages.