MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dfs_file_set_fpos

Function dfs_file_set_fpos

components/dfs/dfs_v2/src/dfs_file.c:291–302  ·  view source on GitHub ↗

* @brief Set the current file position * * This function sets the file position (offset) in the file structure. * It must be used as a pair of dfs_file_get_fpos(). For regular files, pos lock is acquared * in dfs_file_get_fpos(), so it can be released directly after setting the position. * Otherwise, pos lock should be acquired first to avoid releasing it without being acquired. * * @param[

Source from the content-addressed store, hash-verified

289 * @param[in] fpos The new file position to set
290 */
291void dfs_file_set_fpos(struct dfs_file *file, off_t fpos)
292{
293 if (file)
294 {
295 if (file->vnode->type != FT_REGULAR)
296 {
297 rt_mutex_take(&file->pos_lock, RT_WAITING_FOREVER);
298 }
299 file->fpos = fpos;
300 rt_mutex_release(&file->pos_lock);
301 }
302}
303
304/**
305 * @brief Initialize a file structure

Callers 5

preadFunction · 0.85
pwriteFunction · 0.85
dfs_file_readFunction · 0.85
dfs_file_writeFunction · 0.85
dfs_file_lseekFunction · 0.85

Calls 2

rt_mutex_takeFunction · 0.85
rt_mutex_releaseFunction · 0.85

Tested by

no test coverage detected