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

Function char_dev_fopen

components/fal/src/fal_rtt.c:415–436  ·  view source on GitHub ↗

RT-Thread device filesystem interface */

Source from the content-addressed store, hash-verified

413
414/* RT-Thread device filesystem interface */
415static int char_dev_fopen(struct dfs_file *fd)
416{
417 struct fal_char_device *part = (struct fal_char_device *) fd->vnode->data;
418
419 RT_ASSERT(part != RT_NULL);
420
421 switch (fd->flags & O_ACCMODE)
422 {
423 case O_RDONLY:
424 break;
425 case O_WRONLY:
426 case O_RDWR:
427 /* erase partition when device file open */
428 fal_partition_erase_all(part->fal_part);
429 break;
430 default:
431 break;
432 }
433 DFS_FILE_POS(fd) = 0;
434
435 return RT_EOK;
436}
437
438static int char_dev_fread(struct dfs_file *fd, void *buf, rt_size_t count)
439{

Callers

nothing calls this directly

Calls 1

fal_partition_erase_allFunction · 0.85

Tested by

no test coverage detected