AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
ioctl.c
Go to the documentation of this file.
1
4
5#include <core/system.h>
6#include <fs/vfs.h>
7#include <dev/dev.h>
8
19int vfs_ioctl(struct vnode *vnode, unsigned long request, void *argp)
20{
21 vfs_log(LOG_DEBUG, "vfs_ioctl(vnode=%p, request=%ld, argp=%p)\n", vnode, (int64_t) request, argp);
22
23 /* invalid request */
24 if (!vnode)
25 return -EINVAL;
26
27 /* a device node: the driver handles it */
28 if (ISDEV(vnode))
29 return kdev_ioctl(&VNODE_DEV(vnode), request, argp);
30
31 /* invalid request */
32 if (!vnode->fs)
33 return -EINVAL;
34
35 /* the filesystem doesn't support it */
36 if (!vnode->fs->vops.ioctl)
37 return -ENOSYS;
38
39 return vnode->fs->vops.ioctl(vnode, request, argp);
40}
41
#define VNODE_DEV(vnode)
Definition dev.h:79
int vfs_ioctl(struct vnode *vnode, unsigned long request, void *argp)
Passes an ioctl() request to a vnode's device driver, or to its filesystem.
Definition ioctl.c:19
int kdev_ioctl(struct devid *dd, int request, void *argp)
Passes an ioctl() to a device's driver.
Definition kdev.c:340
#define LOG_DEBUG
Definition printk.h:19
signed long long int int64_t
Definition stddef.h:19
struct vops vops
Definition vfs.h:104
A file in memory (a vnode): what its inode says, and the kernel's own state.
Definition vfs.h:113
struct fs * fs
Definition vfs.h:127
int(*) ioctl(struct vnode *vnode, int request, void *argp)
Definition vfs.h:74
#define ISDEV(vnode)
Definition vfs.h:209