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

Function dfs_devfs_device_add

components/dfs/dfs_v2/filesystems/devfs/devfs.c:512–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512void dfs_devfs_device_add(rt_device_t device)
513{
514 int fd;
515 char path[512];
516
517 if (device)
518 {
519 rt_snprintf(path, 512, "/dev/%s", device->parent.name);
520
521 if (access(path, 0) != 0)
522 {
523 mode_t mode = dfs_devfs_device_to_mode(device);
524
525 dfs_devfs_mkdir(path, mode);
526
527 fd = open(path, O_RDWR | O_CREAT, mode);
528 if (fd >= 0)
529 {
530 close(fd);
531 }
532 }
533 }
534}
535
536int dfs_devfs_update(void)
537{

Callers 2

rt_device_registerFunction · 0.85
dfs_devfs_updateFunction · 0.85

Calls 6

rt_snprintfFunction · 0.85
dfs_devfs_device_to_modeFunction · 0.85
dfs_devfs_mkdirFunction · 0.85
accessFunction · 0.50
openFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected