MCPcopy Create free account
hub / github.com/apache/nuttx / add_interface

Function add_interface

drivers/video/max7456.c:1540–1569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1538 ****************************************************************************/
1539
1540static 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

Callers 1

max7456_registerFunction · 0.85

Calls 3

register_driverFunction · 0.85
strlcpyFunction · 0.50
strlcatFunction · 0.50

Tested by

no test coverage detected