| 1538 | ****************************************************************************/ |
| 1539 | |
| 1540 | static int add_interface(FAR const char *path, |
| 1541 | FAR const char *name, |
| 1542 | FAR const struct file_operations *fops, |
| 1543 | mode_t mode, FAR void *private) |
| 1544 | { |
| 1545 | char buf[128]; |
| 1546 | |
| 1547 | /* Start with calling @path the interface name. */ |
| 1548 | |
| 1549 | strlcpy(buf, path, sizeof(buf)); |
| 1550 | |
| 1551 | /* Is the interface actually in a directory named @path? */ |
| 1552 | |
| 1553 | if (name != NULL) |
| 1554 | { |
| 1555 | /* Convert @path to a directory name. */ |
| 1556 | |
| 1557 | strlcat(buf, "/", sizeof(buf)); |
| 1558 | |
| 1559 | /* Append the real interface name. */ |
| 1560 | |
| 1561 | strlcat(buf, name, sizeof(buf)); |
| 1562 | } |
| 1563 | |
| 1564 | /* Register the interface in the usual way. NuttX will build the |
| 1565 | * (pseudo-)directory for us. |
| 1566 | */ |
| 1567 | |
| 1568 | return register_driver(buf, fops, mode, private); |
| 1569 | } |
| 1570 | |
| 1571 | /**************************************************************************** |
| 1572 | * Public Functions |
no test coverage detected