AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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
19
int
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
dev.h
VNODE_DEV
#define VNODE_DEV(vnode)
Definition
dev.h:79
system.h
vfs_ioctl
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
kdev_ioctl
int kdev_ioctl(struct devid *dd, int request, void *argp)
Passes an ioctl() to a device's driver.
Definition
kdev.c:340
LOG_DEBUG
#define LOG_DEBUG
Definition
printk.h:19
int64_t
signed long long int int64_t
Definition
stddef.h:19
fs::vops
struct vops vops
Definition
vfs.h:104
vnode
A file in memory (a vnode): what its inode says, and the kernel's own state.
Definition
vfs.h:113
vnode::fs
struct fs * fs
Definition
vfs.h:127
vops::ioctl
int(*) ioctl(struct vnode *vnode, int request, void *argp)
Definition
vfs.h:74
vfs.h
ISDEV
#define ISDEV(vnode)
Definition
vfs.h:209
kernel
fs
ioctl.c
Generated by
1.18.0