AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
close.c
Go to the documentation of this file.
1
4
5
#include <
core/system.h
>
6
#include <
core/panic.h
>
7
#include <
fs/vfs.h
>
8
18
int
vfs_close
(
struct
vnode
*
vnode
)
19
{
20
vfs_log(
LOG_DEBUG
,
"vfs_close(vnode=%p)\n"
,
vnode
);
21
22
/* invalid request */
23
if
(!
vnode
|| !
vnode
->
fs
)
24
return
-EINVAL;
25
26
if
(!
vnode
->
ref
)
27
panic
(
"closing an already closed vnode"
);
28
29
vnode
->
ref
--;
30
31
/* filesystems without a close operation keep their vnodes around */
32
if
(!
vnode
->
ref
&&
vnode
->
fs
->
vops
.
close
)
33
return
vnode
->
fs
->
vops
.
close
(
vnode
);
34
35
return
0;
36
}
panic
#define panic(s)
Definition
panic.h:15
vfs_close
int vfs_close(struct vnode *vnode)
Drops a reference to a vnode.
Definition
close.c:18
panic.h
system.h
LOG_DEBUG
#define LOG_DEBUG
Definition
printk.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::ref
size_t ref
how many references there are to it
Definition
vfs.h:133
vnode::fs
struct fs * fs
Definition
vfs.h:127
vops::close
int(*) close(struct vnode *vnode)
Definition
vfs.h:75
vfs.h
kernel
fs
close.c
Generated by
1.18.0