hammer2 -- Remove tmpfs scaffold.
[dragonfly.git] / sys / vfs / hammer2 / hammer2_vnops.c
CommitLineData
703720e4
MD
1#include <sys/param.h>
2#include <sys/systm.h>
3#include <sys/kernel.h>
4#include <sys/fcntl.h>
5#include <sys/buf.h>
6#include <sys/proc.h>
7#include <sys/namei.h>
8#include <sys/mount.h>
9#include <sys/vnode.h>
10
11#include "hammer2.h"
12
13
14/*
15 * Last reference to a vnode is going away but it is still cached.
16 */
17int
18hammer2_inactive(struct vop_inactive_args *ap)
19{
20 struct vnode *vp;
21 struct hammer2_inode *ip;
22 struct hammer2_mount *hmp;
23
24 kprintf("hammer2_inactive\n");
25
26 vp = ap->a_vp;
27 ip = VTOI(vp);
703720e4
MD
28
29 return (0);
30}
31
32/*
33 * Reclaim a vnode so that it can be reused; after the inode is
34 * disassociated, the filesystem must manage it alone.
35 */
36int
37hammer2_reclaim(struct vop_reclaim_args *ap)
38{
39 struct vnode *vp;
40 struct hammer2_inode *ip;
41 struct hammer2_mount *hmp;
42
43 kprintf("hammer2_reclaim\n");
44
45 /* Is the vnode locked? Must it be on exit? */
46
47 vp = ap->a_vp;
48 ip = VTOI(vp);
0e92b724 49 hmp = ip->mp;
703720e4
MD
50
51 vp->v_data = NULL;
0e92b724 52 ip->vp = NULL;
703720e4
MD
53
54 return (0);
55}
56
57
58int
59hammer2_fsync(struct vop_fsync_args *ap)
60{
61 kprintf("hammer2_fsync\n");
62 return (EOPNOTSUPP);
63}
64
65int
66hammer2_access(struct vop_access_args *ap)
67{
68 kprintf("hammer2_access\n");
69 return (0);
70}
71
72int
73hammer2_getattr(struct vop_getattr_args *ap)
74{
75 struct vnode *vp;
76 struct vattr *vap;
77 struct hammer2_inode *ip;
78
79 vp = ap->a_vp;
80 vap = ap->a_vap;
81
82 kprintf("hammer2_getattr\n");
83
84 ip = VTOI(vp);
85 hammer2_inode_lock_sh(ip);
86
87 vap->va_type = vp->v_type;
88 vap->va_mode = 0777;
89 vap->va_nlink = 1;
90 vap->va_uid = 0;
91 vap->va_gid = 0;
92 vap->va_size = 0;
93 vap->va_blocksize = PAGE_SIZE;
94 vap->va_flags = 0;
95
96 hammer2_inode_unlock_sh(ip);
97
98 return (0);
99}
100
101int
102hammer2_readdir(struct vop_readdir_args *ap)
103{
104 kprintf("hammer2_readdir\n");
105 return (EOPNOTSUPP);
106}
107
108int
109hammer2_read(struct vop_read_args *ap)
110{
47902fef
VS
111 return (EOPNOTSUPP);
112}
703720e4 113
47902fef
VS
114int
115hammer2_write(struct vop_write_args *ap)
116{
117 return (EOPNOTSUPP);
703720e4
MD
118}
119
120int
121hammer2_nresolve(struct vop_nresolve_args *ap)
122{
123 kprintf("hammer2_nresolve\n");
47902fef 124 return (EOPNOTSUPP);
703720e4
MD
125}
126
127int
128hammer2_bmap(struct vop_bmap_args *ap)
129{
130 kprintf("hammer2_bmap\n");
131 return (EOPNOTSUPP);
132}
133
134int
135hammer2_open(struct vop_open_args *ap)
136{
137 kprintf("hammer2_open\n");
138 return vop_stdopen(ap);
139}
140
141int
142hammer2_strategy(struct vop_strategy_args *ap)
143{
144 struct vnode *vp;
145 struct bio *biop;
146 struct buf *bp;
147 struct hammer2_inode *ip;
148 int error;
149
150 vp = ap->a_vp;
151 biop = ap->a_bio;
152 bp = biop->bio_buf;
153 ip = VTOI(vp);
154
155 switch(bp->b_cmd) {
156 case (BUF_CMD_READ):
157 case (BUF_CMD_WRITE):
158 default:
159 bp->b_error = error = EINVAL;
160 bp->b_flags |= B_ERROR;
161 biodone(biop);
162 break;
163 }
164
165 return (error);
166}
167
168struct vop_ops hammer2_vnode_vops = {
169 .vop_default = vop_defaultop,
170 .vop_fsync = hammer2_fsync,
171 .vop_getpages = vop_stdgetpages,
172 .vop_putpages = vop_stdputpages,
173 .vop_access = hammer2_access,
174 .vop_getattr = hammer2_getattr,
47902fef
VS
175 .vop_readdir = hammer2_readdir,
176 .vop_read = hammer2_read,
177 .vop_write = hammer2_write,
703720e4
MD
178 .vop_open = hammer2_open,
179 .vop_inactive = hammer2_inactive,
180 .vop_reclaim = hammer2_reclaim,
181 .vop_nresolve = hammer2_nresolve,
182
47902fef
VS
183 .vop_bmap = hammer2_bmap,
184 .vop_strategy = hammer2_strategy,
703720e4
MD
185};
186
187struct vop_ops hammer2_spec_vops = {
188
189};
190
191struct vop_ops hammer2_fifo_vops = {
192
193};