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

Function dfs_file_ioctl

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

* @brief Perform device-specific control operations * * This function performs device-specific control operations on an open file descriptor. * It is typically used for operations that cannot be expressed by regular file operations. * * @param[in] file Pointer to the file structure to perform ioctl on * @param[in] cmd Device-dependent request code * @param[in,out] args Pointer to optional a

Source from the content-addressed store, hash-verified

1493 * @note The actual supported commands and their semantics depend on the underlying device driver
1494 */
1495int dfs_file_ioctl(struct dfs_file *file, int cmd, void *args)
1496{
1497 size_t ret = 0;
1498
1499 if (file)
1500 {
1501 if (file->fops && file->fops->ioctl)
1502 {
1503 if (dfs_is_mounted(file->vnode->mnt) == 0)
1504 {
1505 ret = file->fops->ioctl(file, cmd, args);
1506 }
1507 else
1508 {
1509 ret = -EINVAL;
1510 }
1511 }
1512 else
1513 {
1514 ret = -ENOSYS;
1515 }
1516 }
1517 else
1518 {
1519 ret = -EBADF;
1520 }
1521
1522 return ret;
1523}
1524
1525/**
1526 * @brief Perform file control operations

Callers 1

fcntlFunction · 0.70

Calls 1

dfs_is_mountedFunction · 0.85

Tested by

no test coverage detected