* @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
| 1493 | * @note The actual supported commands and their semantics depend on the underlying device driver |
| 1494 | */ |
| 1495 | int 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 |
no test coverage detected