Silence warning.
[dragonfly.git] / sys / kern / vfs_vopops.c
CommitLineData
2d3e977e
MD
1/*
2 *
3 * Copyright (c) 2004 The DragonFly Project. All rights reserved.
4 *
5 * This code is derived from software contributed to The DragonFly Project
6 * by Matthew Dillon <dillon@backplane.com>
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * 3. Neither the name of The DragonFly Project nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific, prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
88e4088e 35 * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.26 2006/05/12 22:26:46 dillon Exp $
2d3e977e
MD
36 */
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/buf.h>
41#include <sys/conf.h>
42#include <sys/dirent.h>
43#include <sys/domain.h>
44#include <sys/eventhandler.h>
45#include <sys/fcntl.h>
46#include <sys/kernel.h>
47#include <sys/kthread.h>
48#include <sys/malloc.h>
49#include <sys/mbuf.h>
50#include <sys/mount.h>
51#include <sys/proc.h>
52#include <sys/namei.h>
53#include <sys/reboot.h>
54#include <sys/socket.h>
55#include <sys/stat.h>
56#include <sys/sysctl.h>
57#include <sys/syslog.h>
58#include <sys/vmmeter.h>
59#include <sys/vnode.h>
0961aa92 60#include <sys/vfsops.h>
2d3e977e
MD
61
62#include <machine/limits.h>
63
64#include <vm/vm.h>
65#include <vm/vm_object.h>
66#include <vm/vm_extern.h>
67#include <vm/vm_kern.h>
68#include <vm/pmap.h>
69#include <vm/vm_map.h>
70#include <vm/vm_page.h>
71#include <vm/vm_pager.h>
72#include <vm/vnode_pager.h>
73#include <vm/vm_zone.h>
74
75#include <sys/buf2.h>
76#include <sys/thread2.h>
77
2d3e977e
MD
78#define VDESCNAME(name) __CONCAT(__CONCAT(vop_,name),_desc)
79#define VARGSSTRUCT(name) struct __CONCAT(__CONCAT(vop_,name),_args)
80
88e4088e 81#define VNODEOP_DESC_INIT(name) \
2d3e977e
MD
82 struct vnodeop_desc VDESCNAME(name) = { \
83 __offsetof(struct vop_ops, __CONCAT(vop_, name)), \
88e4088e 84 #name }
2d3e977e
MD
85
86#define VNODEOP_DESC_INIT_SIMPLE(name) \
88e4088e 87 VNODEOP_DESC_INIT(name)
2d3e977e
MD
88
89VNODEOP_DESC_INIT_SIMPLE(default);
88e4088e
MD
90VNODEOP_DESC_INIT_SIMPLE(islocked);
91VNODEOP_DESC_INIT_SIMPLE(old_lookup);
92VNODEOP_DESC_INIT_SIMPLE(old_create);
93VNODEOP_DESC_INIT_SIMPLE(old_whiteout);
94VNODEOP_DESC_INIT_SIMPLE(old_mknod);
95VNODEOP_DESC_INIT_SIMPLE(open);
96VNODEOP_DESC_INIT_SIMPLE(close);
97VNODEOP_DESC_INIT_SIMPLE(access);
98VNODEOP_DESC_INIT_SIMPLE(getattr);
99VNODEOP_DESC_INIT_SIMPLE(setattr);
100VNODEOP_DESC_INIT_SIMPLE(read);
101VNODEOP_DESC_INIT_SIMPLE(write);
102VNODEOP_DESC_INIT_SIMPLE(ioctl);
103VNODEOP_DESC_INIT_SIMPLE(poll);
104VNODEOP_DESC_INIT_SIMPLE(kqfilter);
105VNODEOP_DESC_INIT_SIMPLE(revoke);
106VNODEOP_DESC_INIT_SIMPLE(mmap);
107VNODEOP_DESC_INIT_SIMPLE(fsync);
108VNODEOP_DESC_INIT_SIMPLE(old_remove);
109VNODEOP_DESC_INIT_SIMPLE(old_link);
110VNODEOP_DESC_INIT_SIMPLE(old_rename);
111
112VNODEOP_DESC_INIT_SIMPLE(old_mkdir);
113VNODEOP_DESC_INIT_SIMPLE(old_rmdir);
114VNODEOP_DESC_INIT_SIMPLE(old_symlink);
115VNODEOP_DESC_INIT_SIMPLE(readdir);
116VNODEOP_DESC_INIT_SIMPLE(readlink);
117VNODEOP_DESC_INIT_SIMPLE(inactive);
118VNODEOP_DESC_INIT_SIMPLE(reclaim);
119VNODEOP_DESC_INIT_SIMPLE(lock);
120VNODEOP_DESC_INIT_SIMPLE(unlock);
121VNODEOP_DESC_INIT_SIMPLE(bmap);
122VNODEOP_DESC_INIT_SIMPLE(strategy);
123VNODEOP_DESC_INIT_SIMPLE(print);
124VNODEOP_DESC_INIT_SIMPLE(pathconf);
125VNODEOP_DESC_INIT_SIMPLE(advlock);
126VNODEOP_DESC_INIT_SIMPLE(balloc);
127VNODEOP_DESC_INIT_SIMPLE(reallocblks);
128VNODEOP_DESC_INIT_SIMPLE(getpages);
129VNODEOP_DESC_INIT_SIMPLE(putpages);
130VNODEOP_DESC_INIT_SIMPLE(freeblks);
131VNODEOP_DESC_INIT_SIMPLE(getacl);
132VNODEOP_DESC_INIT_SIMPLE(setacl);
133VNODEOP_DESC_INIT_SIMPLE(aclcheck);
134VNODEOP_DESC_INIT_SIMPLE(getextattr);
135VNODEOP_DESC_INIT_SIMPLE(setextattr);
949ecb9b 136VNODEOP_DESC_INIT_SIMPLE(mountctl);
cbe54d63 137
88e4088e
MD
138VNODEOP_DESC_INIT_SIMPLE(nresolve);
139VNODEOP_DESC_INIT_SIMPLE(nlookupdotdot);
140VNODEOP_DESC_INIT_SIMPLE(ncreate);
141VNODEOP_DESC_INIT_SIMPLE(nmkdir);
142VNODEOP_DESC_INIT_SIMPLE(nmknod);
143VNODEOP_DESC_INIT_SIMPLE(nlink);
144VNODEOP_DESC_INIT_SIMPLE(nsymlink);
145VNODEOP_DESC_INIT_SIMPLE(nwhiteout);
146VNODEOP_DESC_INIT_SIMPLE(nremove);
147VNODEOP_DESC_INIT_SIMPLE(nrmdir);
148VNODEOP_DESC_INIT_SIMPLE(nrename);
fad57d0e 149
6ddb7618
MD
150#define DO_OPS(ops, error, ap, vop_field) \
151 error = ops->vop_field(ap);
2d3e977e 152
0961aa92
MD
153/************************************************************************
154 * PRIMARY HIGH LEVEL VNODE OPERATIONS CALLS *
155 ************************************************************************
156 *
157 * These procedures are called directly from the kernel and/or fileops
158 * code to perform file/device operations on the system.
e62afb5f
MD
159 *
160 * NOTE: The old namespace api functions such as vop_rename() are no longer
161 * available for general use and have been renamed to vop_old_*(). Only
162 * the code in vfs_default.c is allowed to call those ops.
0961aa92
MD
163 */
164
2d3e977e 165int
0961aa92 166vop_islocked(struct vop_ops *ops, struct vnode *vp, struct thread *td)
2d3e977e
MD
167{
168 struct vop_islocked_args ap;
cbe54d63 169 int error;
2d3e977e
MD
170
171 ap.a_head.a_desc = &vop_islocked_desc;
0961aa92 172 ap.a_head.a_ops = ops;
2d3e977e
MD
173 ap.a_vp = vp;
174 ap.a_td = td;
cbe54d63
MD
175
176 DO_OPS(ops, error, &ap, vop_islocked);
177 return(error);
2d3e977e
MD
178}
179
180int
e62afb5f 181vop_old_lookup(struct vop_ops *ops, struct vnode *dvp,
26b67a34 182 struct vnode **vpp, struct componentname *cnp)
2d3e977e 183{
e62afb5f 184 struct vop_old_lookup_args ap;
cbe54d63 185 int error;
2d3e977e 186
e62afb5f 187 ap.a_head.a_desc = &vop_old_lookup_desc;
0961aa92 188 ap.a_head.a_ops = ops;
2d3e977e 189 ap.a_dvp = dvp;
2d3e977e 190 ap.a_vpp = vpp;
2d3e977e 191 ap.a_cnp = cnp;
cbe54d63 192
e62afb5f 193 DO_OPS(ops, error, &ap, vop_old_lookup);
cbe54d63 194 return(error);
2d3e977e
MD
195}
196
197int
e62afb5f 198vop_old_create(struct vop_ops *ops, struct vnode *dvp,
0961aa92 199 struct vnode **vpp, struct componentname *cnp, struct vattr *vap)
2d3e977e 200{
e62afb5f 201 struct vop_old_create_args ap;
cbe54d63 202 int error;
2d3e977e 203
e62afb5f 204 ap.a_head.a_desc = &vop_old_create_desc;
0961aa92 205 ap.a_head.a_ops = ops;
2d3e977e 206 ap.a_dvp = dvp;
2d3e977e
MD
207 ap.a_vpp = vpp;
208 ap.a_cnp = cnp;
209 ap.a_vap = vap;
cbe54d63 210
e62afb5f 211 DO_OPS(ops, error, &ap, vop_old_create);
cbe54d63 212 return(error);
2d3e977e
MD
213}
214
215int
e62afb5f 216vop_old_whiteout(struct vop_ops *ops, struct vnode *dvp,
0961aa92 217 struct componentname *cnp, int flags)
2d3e977e 218{
e62afb5f 219 struct vop_old_whiteout_args ap;
cbe54d63 220 int error;
2d3e977e 221
e62afb5f 222 ap.a_head.a_desc = &vop_old_whiteout_desc;
0961aa92 223 ap.a_head.a_ops = ops;
2d3e977e 224 ap.a_dvp = dvp;
2d3e977e
MD
225 ap.a_cnp = cnp;
226 ap.a_flags = flags;
cbe54d63 227
e62afb5f 228 DO_OPS(ops, error, &ap, vop_old_whiteout);
cbe54d63 229 return(error);
2d3e977e
MD
230}
231
232int
e62afb5f 233vop_old_mknod(struct vop_ops *ops, struct vnode *dvp,
0961aa92 234 struct vnode **vpp, struct componentname *cnp, struct vattr *vap)
2d3e977e 235{
e62afb5f 236 struct vop_old_mknod_args ap;
cbe54d63 237 int error;
2d3e977e 238
e62afb5f 239 ap.a_head.a_desc = &vop_old_mknod_desc;
0961aa92 240 ap.a_head.a_ops = ops;
2d3e977e 241 ap.a_dvp = dvp;
2d3e977e
MD
242 ap.a_vpp = vpp;
243 ap.a_cnp = cnp;
244 ap.a_vap = vap;
cbe54d63 245
e62afb5f 246 DO_OPS(ops, error, &ap, vop_old_mknod);
cbe54d63 247 return(error);
2d3e977e
MD
248}
249
250int
0961aa92 251vop_open(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred,
87de5057 252 struct file *fp)
2d3e977e
MD
253{
254 struct vop_open_args ap;
cbe54d63 255 int error;
2d3e977e
MD
256
257 ap.a_head.a_desc = &vop_open_desc;
0961aa92 258 ap.a_head.a_ops = ops;
2d3e977e 259 ap.a_vp = vp;
fad57d0e 260 ap.a_fp = fp;
2d3e977e
MD
261 ap.a_mode = mode;
262 ap.a_cred = cred;
cbe54d63
MD
263
264 DO_OPS(ops, error, &ap, vop_open);
265 return(error);
2d3e977e
MD
266}
267
268int
87de5057 269vop_close(struct vop_ops *ops, struct vnode *vp, int fflag)
2d3e977e
MD
270{
271 struct vop_close_args ap;
cbe54d63 272 int error;
2d3e977e
MD
273
274 ap.a_head.a_desc = &vop_close_desc;
0961aa92 275 ap.a_head.a_ops = ops;
2d3e977e
MD
276 ap.a_vp = vp;
277 ap.a_fflag = fflag;
cbe54d63
MD
278
279 DO_OPS(ops, error, &ap, vop_close);
280 return(error);
2d3e977e
MD
281}
282
283int
87de5057 284vop_access(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred)
2d3e977e
MD
285{
286 struct vop_access_args ap;
cbe54d63 287 int error;
2d3e977e
MD
288
289 ap.a_head.a_desc = &vop_access_desc;
0961aa92 290 ap.a_head.a_ops = ops;
2d3e977e
MD
291 ap.a_vp = vp;
292 ap.a_mode = mode;
293 ap.a_cred = cred;
cbe54d63
MD
294
295 DO_OPS(ops, error, &ap, vop_access);
296 return(error);
2d3e977e
MD
297}
298
299int
87de5057 300vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap)
2d3e977e
MD
301{
302 struct vop_getattr_args ap;
dc1be39c 303 struct namecache *ncp;
cbe54d63 304 int error;
2d3e977e
MD
305
306 ap.a_head.a_desc = &vop_getattr_desc;
0961aa92 307 ap.a_head.a_ops = ops;
2d3e977e
MD
308 ap.a_vp = vp;
309 ap.a_vap = vap;
cbe54d63
MD
310
311 DO_OPS(ops, error, &ap, vop_getattr);
dc1be39c
MD
312 if ((ops->vv_flags & VVF_SUPPORTS_FSMID) == 0) {
313 if ((ncp = TAILQ_FIRST(&vp->v_namecache)) != NULL) {
314 if (ncp->nc_flag & NCF_FSMID) {
315 ncp->nc_flag &= ~NCF_FSMID;
316 ++ncp->nc_fsmid;
317 }
318 vap->va_fsmid = ncp->nc_fsmid;
319 }
320 }
cbe54d63 321 return(error);
2d3e977e
MD
322}
323
324int
0961aa92 325vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
87de5057 326 struct ucred *cred)
2d3e977e
MD
327{
328 struct vop_setattr_args ap;
cbe54d63 329 int error;
2d3e977e
MD
330
331 ap.a_head.a_desc = &vop_setattr_desc;
0961aa92 332 ap.a_head.a_ops = ops;
2d3e977e
MD
333 ap.a_vp = vp;
334 ap.a_vap = vap;
335 ap.a_cred = cred;
cbe54d63
MD
336
337 DO_OPS(ops, error, &ap, vop_setattr);
7d15906a
MD
338 if (error == 0)
339 cache_update_fsmid_vp(vp);
cbe54d63 340 return(error);
2d3e977e
MD
341}
342
343int
0961aa92
MD
344vop_read(struct vop_ops *ops, struct vnode *vp, struct uio *uio, int ioflag,
345 struct ucred *cred)
2d3e977e
MD
346{
347 struct vop_read_args ap;
cbe54d63 348 int error;
2d3e977e
MD
349
350 ap.a_head.a_desc = &vop_read_desc;
0961aa92 351 ap.a_head.a_ops = ops;
2d3e977e
MD
352 ap.a_vp = vp;
353 ap.a_uio = uio;
354 ap.a_ioflag = ioflag;
355 ap.a_cred = cred;
cbe54d63
MD
356
357 DO_OPS(ops, error, &ap, vop_read);
358 return(error);
2d3e977e
MD
359}
360
361int
0961aa92
MD
362vop_write(struct vop_ops *ops, struct vnode *vp, struct uio *uio, int ioflag,
363 struct ucred *cred)
2d3e977e
MD
364{
365 struct vop_write_args ap;
cbe54d63 366 int error;
2d3e977e
MD
367
368 ap.a_head.a_desc = &vop_write_desc;
0961aa92 369 ap.a_head.a_ops = ops;
2d3e977e
MD
370 ap.a_vp = vp;
371 ap.a_uio = uio;
372 ap.a_ioflag = ioflag;
373 ap.a_cred = cred;
cbe54d63
MD
374
375 DO_OPS(ops, error, &ap, vop_write);
7d15906a
MD
376 if (error == 0)
377 cache_update_fsmid_vp(vp);
cbe54d63 378 return(error);
2d3e977e
MD
379}
380
2d3e977e 381int
0961aa92 382vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command, caddr_t data,
87de5057 383 int fflag, struct ucred *cred)
2d3e977e
MD
384{
385 struct vop_ioctl_args ap;
cbe54d63 386 int error;
2d3e977e
MD
387
388 ap.a_head.a_desc = &vop_ioctl_desc;
0961aa92 389 ap.a_head.a_ops = ops;
2d3e977e
MD
390 ap.a_vp = vp;
391 ap.a_command = command;
392 ap.a_data = data;
393 ap.a_fflag = fflag;
394 ap.a_cred = cred;
cbe54d63
MD
395
396 DO_OPS(ops, error, &ap, vop_ioctl);
397 return(error);
2d3e977e
MD
398}
399
400int
87de5057 401vop_poll(struct vop_ops *ops, struct vnode *vp, int events, struct ucred *cred)
2d3e977e
MD
402{
403 struct vop_poll_args ap;
cbe54d63 404 int error;
2d3e977e
MD
405
406 ap.a_head.a_desc = &vop_poll_desc;
0961aa92 407 ap.a_head.a_ops = ops;
2d3e977e
MD
408 ap.a_vp = vp;
409 ap.a_events = events;
410 ap.a_cred = cred;
cbe54d63
MD
411
412 DO_OPS(ops, error, &ap, vop_poll);
413 return(error);
2d3e977e
MD
414}
415
416int
0961aa92 417vop_kqfilter(struct vop_ops *ops, struct vnode *vp, struct knote *kn)
2d3e977e
MD
418{
419 struct vop_kqfilter_args ap;
cbe54d63 420 int error;
2d3e977e
MD
421
422 ap.a_head.a_desc = &vop_kqfilter_desc;
0961aa92 423 ap.a_head.a_ops = ops;
2d3e977e
MD
424 ap.a_vp = vp;
425 ap.a_kn = kn;
cbe54d63
MD
426
427 DO_OPS(ops, error, &ap, vop_kqfilter);
428 return(error);
2d3e977e
MD
429}
430
431int
0961aa92 432vop_revoke(struct vop_ops *ops, struct vnode *vp, int flags)
2d3e977e
MD
433{
434 struct vop_revoke_args ap;
cbe54d63 435 int error;
2d3e977e
MD
436
437 ap.a_head.a_desc = &vop_revoke_desc;
0961aa92 438 ap.a_head.a_ops = ops;
2d3e977e
MD
439 ap.a_vp = vp;
440 ap.a_flags = flags;
cbe54d63
MD
441
442 DO_OPS(ops, error, &ap, vop_revoke);
443 return(error);
2d3e977e
MD
444}
445
446int
87de5057 447vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags, struct ucred *cred)
2d3e977e
MD
448{
449 struct vop_mmap_args ap;
cbe54d63 450 int error;
2d3e977e
MD
451
452 ap.a_head.a_desc = &vop_mmap_desc;
0961aa92 453 ap.a_head.a_ops = ops;
2d3e977e
MD
454 ap.a_vp = vp;
455 ap.a_fflags = fflags;
456 ap.a_cred = cred;
cbe54d63
MD
457
458 DO_OPS(ops, error, &ap, vop_mmap);
459 return(error);
2d3e977e
MD
460}
461
462int
87de5057 463vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor)
2d3e977e
MD
464{
465 struct vop_fsync_args ap;
cbe54d63 466 int error;
2d3e977e
MD
467
468 ap.a_head.a_desc = &vop_fsync_desc;
0961aa92 469 ap.a_head.a_ops = ops;
2d3e977e
MD
470 ap.a_vp = vp;
471 ap.a_waitfor = waitfor;
cbe54d63
MD
472
473 DO_OPS(ops, error, &ap, vop_fsync);
474 return(error);
2d3e977e
MD
475}
476
477int
e62afb5f 478vop_old_remove(struct vop_ops *ops, struct vnode *dvp,
0961aa92 479 struct vnode *vp, struct componentname *cnp)
2d3e977e 480{
e62afb5f 481 struct vop_old_remove_args ap;
cbe54d63 482 int error;
2d3e977e 483
e62afb5f 484 ap.a_head.a_desc = &vop_old_remove_desc;
0961aa92 485 ap.a_head.a_ops = ops;
2d3e977e 486 ap.a_dvp = dvp;
2d3e977e
MD
487 ap.a_vp = vp;
488 ap.a_cnp = cnp;
cbe54d63 489
e62afb5f 490 DO_OPS(ops, error, &ap, vop_old_remove);
cbe54d63 491 return(error);
2d3e977e
MD
492}
493
21739618 494int
e62afb5f 495vop_old_link(struct vop_ops *ops, struct vnode *tdvp,
0961aa92 496 struct vnode *vp, struct componentname *cnp)
2d3e977e 497{
e62afb5f 498 struct vop_old_link_args ap;
cbe54d63 499 int error;
2d3e977e 500
e62afb5f 501 ap.a_head.a_desc = &vop_old_link_desc;
0961aa92 502 ap.a_head.a_ops = ops;
2d3e977e 503 ap.a_tdvp = tdvp;
2d3e977e
MD
504 ap.a_vp = vp;
505 ap.a_cnp = cnp;
cbe54d63 506
e62afb5f 507 DO_OPS(ops, error, &ap, vop_old_link);
cbe54d63 508 return(error);
2d3e977e
MD
509}
510
511int
e62afb5f 512vop_old_rename(struct vop_ops *ops,
fad57d0e
MD
513 struct vnode *fdvp, struct vnode *fvp, struct componentname *fcnp,
514 struct vnode *tdvp, struct vnode *tvp, struct componentname *tcnp)
2d3e977e 515{
e62afb5f 516 struct vop_old_rename_args ap;
cbe54d63 517 int error;
2d3e977e 518
e62afb5f 519 ap.a_head.a_desc = &vop_old_rename_desc;
0961aa92 520 ap.a_head.a_ops = ops;
2d3e977e 521 ap.a_fdvp = fdvp;
2d3e977e
MD
522 ap.a_fvp = fvp;
523 ap.a_fcnp = fcnp;
524 ap.a_tdvp = tdvp;
2d3e977e
MD
525 ap.a_tvp = tvp;
526 ap.a_tcnp = tcnp;
cbe54d63 527
e62afb5f 528 DO_OPS(ops, error, &ap, vop_old_rename);
cbe54d63 529 return(error);
2d3e977e
MD
530}
531
532int
e62afb5f 533vop_old_mkdir(struct vop_ops *ops, struct vnode *dvp,
0961aa92 534 struct vnode **vpp, struct componentname *cnp, struct vattr *vap)
2d3e977e 535{
e62afb5f 536 struct vop_old_mkdir_args ap;
cbe54d63 537 int error;
2d3e977e 538
e62afb5f 539 ap.a_head.a_desc = &vop_old_mkdir_desc;
0961aa92 540 ap.a_head.a_ops = ops;
2d3e977e 541 ap.a_dvp = dvp;
2d3e977e
MD
542 ap.a_vpp = vpp;
543 ap.a_cnp = cnp;
544 ap.a_vap = vap;
cbe54d63 545
e62afb5f 546 DO_OPS(ops, error, &ap, vop_old_mkdir);
cbe54d63 547 return(error);
2d3e977e
MD
548}
549
550int
e62afb5f 551vop_old_rmdir(struct vop_ops *ops, struct vnode *dvp,
0961aa92 552 struct vnode *vp, struct componentname *cnp)
2d3e977e 553{
e62afb5f 554 struct vop_old_rmdir_args ap;
cbe54d63 555 int error;
2d3e977e 556
e62afb5f 557 ap.a_head.a_desc = &vop_old_rmdir_desc;
0961aa92 558 ap.a_head.a_ops = ops;
2d3e977e 559 ap.a_dvp = dvp;
2d3e977e
MD
560 ap.a_vp = vp;
561 ap.a_cnp = cnp;
cbe54d63 562
e62afb5f 563 DO_OPS(ops, error, &ap, vop_old_rmdir);
cbe54d63 564 return(error);
2d3e977e
MD
565}
566
567int
e62afb5f 568vop_old_symlink(struct vop_ops *ops, struct vnode *dvp,
0961aa92
MD
569 struct vnode **vpp, struct componentname *cnp,
570 struct vattr *vap, char *target)
2d3e977e 571{
e62afb5f 572 struct vop_old_symlink_args ap;
cbe54d63 573 int error;
2d3e977e 574
e62afb5f 575 ap.a_head.a_desc = &vop_old_symlink_desc;
0961aa92 576 ap.a_head.a_ops = ops;
2d3e977e 577 ap.a_dvp = dvp;
2d3e977e
MD
578 ap.a_vpp = vpp;
579 ap.a_cnp = cnp;
580 ap.a_vap = vap;
581 ap.a_target = target;
cbe54d63 582
e62afb5f 583 DO_OPS(ops, error, &ap, vop_old_symlink);
cbe54d63 584 return(error);
2d3e977e
MD
585}
586
587int
0961aa92
MD
588vop_readdir(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
589 struct ucred *cred, int *eofflag, int *ncookies, u_long **cookies)
2d3e977e
MD
590{
591 struct vop_readdir_args ap;
cbe54d63 592 int error;
2d3e977e
MD
593
594 ap.a_head.a_desc = &vop_readdir_desc;
0961aa92 595 ap.a_head.a_ops = ops;
2d3e977e
MD
596 ap.a_vp = vp;
597 ap.a_uio = uio;
598 ap.a_cred = cred;
599 ap.a_eofflag = eofflag;
600 ap.a_ncookies = ncookies;
601 ap.a_cookies = cookies;
cbe54d63
MD
602
603 DO_OPS(ops, error, &ap, vop_readdir);
604 return(error);
2d3e977e
MD
605}
606
607int
0961aa92
MD
608vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
609 struct ucred *cred)
2d3e977e
MD
610{
611 struct vop_readlink_args ap;
cbe54d63 612 int error;
2d3e977e
MD
613
614 ap.a_head.a_desc = &vop_readlink_desc;
0961aa92 615 ap.a_head.a_ops = ops;
2d3e977e
MD
616 ap.a_vp = vp;
617 ap.a_uio = uio;
618 ap.a_cred = cred;
cbe54d63
MD
619
620 DO_OPS(ops, error, &ap, vop_readlink);
621 return(error);
2d3e977e
MD
622}
623
624int
87de5057 625vop_inactive(struct vop_ops *ops, struct vnode *vp)
2d3e977e
MD
626{
627 struct vop_inactive_args ap;
cbe54d63 628 int error;
2d3e977e
MD
629
630 ap.a_head.a_desc = &vop_inactive_desc;
0961aa92 631 ap.a_head.a_ops = ops;
2d3e977e 632 ap.a_vp = vp;
cbe54d63
MD
633
634 DO_OPS(ops, error, &ap, vop_inactive);
635 return(error);
2d3e977e
MD
636}
637
638int
87de5057 639vop_reclaim(struct vop_ops *ops, struct vnode *vp)
2d3e977e
MD
640{
641 struct vop_reclaim_args ap;
cbe54d63 642 int error;
2d3e977e
MD
643
644 ap.a_head.a_desc = &vop_reclaim_desc;
0961aa92 645 ap.a_head.a_ops = ops;
2d3e977e 646 ap.a_vp = vp;
cbe54d63
MD
647
648 DO_OPS(ops, error, &ap, vop_reclaim);
649 return(error);
2d3e977e
MD
650}
651
652int
ca466bae 653vop_lock(struct vop_ops *ops, struct vnode *vp, int flags)
2d3e977e
MD
654{
655 struct vop_lock_args ap;
cbe54d63 656 int error;
2d3e977e
MD
657
658 ap.a_head.a_desc = &vop_lock_desc;
0961aa92 659 ap.a_head.a_ops = ops;
2d3e977e 660 ap.a_vp = vp;
2d3e977e 661 ap.a_flags = flags;
cbe54d63
MD
662
663 DO_OPS(ops, error, &ap, vop_lock);
664 return(error);
2d3e977e
MD
665}
666
667int
ca466bae 668vop_unlock(struct vop_ops *ops, struct vnode *vp, int flags)
2d3e977e
MD
669{
670 struct vop_unlock_args ap;
cbe54d63 671 int error;
2d3e977e
MD
672
673 ap.a_head.a_desc = &vop_unlock_desc;
0961aa92 674 ap.a_head.a_ops = ops;
2d3e977e 675 ap.a_vp = vp;
2d3e977e 676 ap.a_flags = flags;
cbe54d63
MD
677
678 DO_OPS(ops, error, &ap, vop_unlock);
679 return(error);
2d3e977e
MD
680}
681
682int
54078292
MD
683vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset,
684 struct vnode **vpp, off_t *doffsetp, int *runp, int *runb)
2d3e977e
MD
685{
686 struct vop_bmap_args ap;
cbe54d63 687 int error;
2d3e977e
MD
688
689 ap.a_head.a_desc = &vop_bmap_desc;
0961aa92 690 ap.a_head.a_ops = ops;
2d3e977e 691 ap.a_vp = vp;
54078292 692 ap.a_loffset = loffset;
2d3e977e 693 ap.a_vpp = vpp;
54078292 694 ap.a_doffsetp = doffsetp;
2d3e977e
MD
695 ap.a_runp = runp;
696 ap.a_runb = runb;
cbe54d63
MD
697
698 DO_OPS(ops, error, &ap, vop_bmap);
699 return(error);
2d3e977e
MD
700}
701
702int
81b5c339 703vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio)
2d3e977e
MD
704{
705 struct vop_strategy_args ap;
cbe54d63 706 int error;
2d3e977e
MD
707
708 ap.a_head.a_desc = &vop_strategy_desc;
0961aa92 709 ap.a_head.a_ops = ops;
2d3e977e 710 ap.a_vp = vp;
81b5c339 711 ap.a_bio = bio;
cbe54d63
MD
712
713 DO_OPS(ops, error, &ap, vop_strategy);
10f3fee5 714 if (error == 0 && bio->bio_buf->b_cmd != BUF_CMD_READ)
7d15906a 715 cache_update_fsmid_vp(vp);
cbe54d63 716 return(error);
2d3e977e
MD
717}
718
719int
0961aa92 720vop_print(struct vop_ops *ops, struct vnode *vp)
2d3e977e
MD
721{
722 struct vop_print_args ap;
cbe54d63 723 int error;
2d3e977e
MD
724
725 ap.a_head.a_desc = &vop_print_desc;
0961aa92 726 ap.a_head.a_ops = ops;
2d3e977e 727 ap.a_vp = vp;
cbe54d63
MD
728
729 DO_OPS(ops, error, &ap, vop_print);
730 return(error);
2d3e977e
MD
731}
732
733int
0961aa92
MD
734vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name,
735 register_t *retval)
2d3e977e
MD
736{
737 struct vop_pathconf_args ap;
cbe54d63 738 int error;
2d3e977e
MD
739
740 ap.a_head.a_desc = &vop_pathconf_desc;
0961aa92 741 ap.a_head.a_ops = ops;
2d3e977e
MD
742 ap.a_vp = vp;
743 ap.a_name = name;
744 ap.a_retval = retval;
cbe54d63
MD
745
746 DO_OPS(ops, error, &ap, vop_pathconf);
747 return(error);
2d3e977e
MD
748}
749
750int
0961aa92
MD
751vop_advlock(struct vop_ops *ops, struct vnode *vp, caddr_t id, int op,
752 struct flock *fl, int flags)
2d3e977e
MD
753{
754 struct vop_advlock_args ap;
cbe54d63 755 int error;
2d3e977e
MD
756
757 ap.a_head.a_desc = &vop_advlock_desc;
0961aa92 758 ap.a_head.a_ops = ops;
2d3e977e
MD
759 ap.a_vp = vp;
760 ap.a_id = id;
761 ap.a_op = op;
762 ap.a_fl = fl;
763 ap.a_flags = flags;
cbe54d63
MD
764
765 DO_OPS(ops, error, &ap, vop_advlock);
766 return(error);
2d3e977e
MD
767}
768
769int
0961aa92
MD
770vop_balloc(struct vop_ops *ops, struct vnode *vp, off_t startoffset,
771 int size, struct ucred *cred, int flags,
772 struct buf **bpp)
2d3e977e
MD
773{
774 struct vop_balloc_args ap;
cbe54d63 775 int error;
2d3e977e
MD
776
777 ap.a_head.a_desc = &vop_balloc_desc;
0961aa92 778 ap.a_head.a_ops = ops;
2d3e977e
MD
779 ap.a_vp = vp;
780 ap.a_startoffset = startoffset;
781 ap.a_size = size;
782 ap.a_cred = cred;
783 ap.a_flags = flags;
784 ap.a_bpp = bpp;
cbe54d63
MD
785
786 DO_OPS(ops, error, &ap, vop_balloc);
787 return(error);
2d3e977e
MD
788}
789
790int
0961aa92
MD
791vop_reallocblks(struct vop_ops *ops, struct vnode *vp,
792 struct cluster_save *buflist)
2d3e977e
MD
793{
794 struct vop_reallocblks_args ap;
cbe54d63 795 int error;
2d3e977e
MD
796
797 ap.a_head.a_desc = &vop_reallocblks_desc;
0961aa92 798 ap.a_head.a_ops = ops;
2d3e977e
MD
799 ap.a_vp = vp;
800 ap.a_buflist = buflist;
cbe54d63
MD
801
802 DO_OPS(ops, error, &ap, vop_reallocblks);
803 return(error);
2d3e977e
MD
804}
805
806int
0961aa92
MD
807vop_getpages(struct vop_ops *ops, struct vnode *vp, vm_page_t *m, int count,
808 int reqpage, vm_ooffset_t offset)
2d3e977e
MD
809{
810 struct vop_getpages_args ap;
cbe54d63 811 int error;
2d3e977e
MD
812
813 ap.a_head.a_desc = &vop_getpages_desc;
0961aa92 814 ap.a_head.a_ops = ops;
2d3e977e
MD
815 ap.a_vp = vp;
816 ap.a_m = m;
817 ap.a_count = count;
818 ap.a_reqpage = reqpage;
819 ap.a_offset = offset;
cbe54d63
MD
820
821 DO_OPS(ops, error, &ap, vop_getpages);
822 return(error);
2d3e977e
MD
823}
824
825int
0961aa92
MD
826vop_putpages(struct vop_ops *ops, struct vnode *vp, vm_page_t *m, int count,
827 int sync, int *rtvals, vm_ooffset_t offset)
2d3e977e
MD
828{
829 struct vop_putpages_args ap;
cbe54d63 830 int error;
2d3e977e
MD
831
832 ap.a_head.a_desc = &vop_putpages_desc;
0961aa92 833 ap.a_head.a_ops = ops;
2d3e977e
MD
834 ap.a_vp = vp;
835 ap.a_m = m;
836 ap.a_count = count;
837 ap.a_sync = sync;
838 ap.a_rtvals = rtvals;
839 ap.a_offset = offset;
cbe54d63
MD
840
841 DO_OPS(ops, error, &ap, vop_putpages);
7d15906a
MD
842 if (error == 0)
843 cache_update_fsmid_vp(vp);
cbe54d63 844 return(error);
2d3e977e
MD
845}
846
847int
54078292 848vop_freeblks(struct vop_ops *ops, struct vnode *vp, off_t offset, int length)
2d3e977e
MD
849{
850 struct vop_freeblks_args ap;
cbe54d63 851 int error;
2d3e977e
MD
852
853 ap.a_head.a_desc = &vop_freeblks_desc;
0961aa92 854 ap.a_head.a_ops = ops;
2d3e977e 855 ap.a_vp = vp;
54078292 856 ap.a_offset = offset;
2d3e977e 857 ap.a_length = length;
cbe54d63
MD
858
859 DO_OPS(ops, error, &ap, vop_freeblks);
860 return(error);
2d3e977e
MD
861}
862
2d3e977e 863int
0961aa92 864vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
87de5057 865 struct acl *aclp, struct ucred *cred)
2d3e977e
MD
866{
867 struct vop_getacl_args ap;
cbe54d63 868 int error;
2d3e977e
MD
869
870 ap.a_head.a_desc = &vop_getacl_desc;
0961aa92 871 ap.a_head.a_ops = ops;
2d3e977e
MD
872 ap.a_vp = vp;
873 ap.a_type = type;
874 ap.a_aclp = aclp;
875 ap.a_cred = cred;
cbe54d63
MD
876
877 DO_OPS(ops, error, &ap, vop_getacl);
878 return(error);
2d3e977e
MD
879}
880
881int
0961aa92 882vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
87de5057 883 struct acl *aclp, struct ucred *cred)
2d3e977e
MD
884{
885 struct vop_setacl_args ap;
cbe54d63 886 int error;
2d3e977e
MD
887
888 ap.a_head.a_desc = &vop_setacl_desc;
0961aa92 889 ap.a_head.a_ops = ops;
2d3e977e
MD
890 ap.a_vp = vp;
891 ap.a_type = type;
892 ap.a_aclp = aclp;
893 ap.a_cred = cred;
cbe54d63
MD
894
895 DO_OPS(ops, error, &ap, vop_setacl);
7d15906a
MD
896 if (error == 0)
897 cache_update_fsmid_vp(vp);
cbe54d63 898 return(error);
2d3e977e
MD
899}
900
901int
0961aa92 902vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
87de5057 903 struct acl *aclp, struct ucred *cred)
2d3e977e
MD
904{
905 struct vop_aclcheck_args ap;
cbe54d63 906 int error;
2d3e977e
MD
907
908 ap.a_head.a_desc = &vop_aclcheck_desc;
0961aa92 909 ap.a_head.a_ops = ops;
2d3e977e
MD
910 ap.a_vp = vp;
911 ap.a_type = type;
912 ap.a_aclp = aclp;
913 ap.a_cred = cred;
cbe54d63
MD
914
915 DO_OPS(ops, error, &ap, vop_aclcheck);
916 return(error);
2d3e977e
MD
917}
918
919int
0961aa92 920vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name,
87de5057 921 struct uio *uio, struct ucred *cred)
2d3e977e
MD
922{
923 struct vop_getextattr_args ap;
cbe54d63 924 int error;
2d3e977e
MD
925
926 ap.a_head.a_desc = &vop_getextattr_desc;
0961aa92 927 ap.a_head.a_ops = ops;
2d3e977e
MD
928 ap.a_vp = vp;
929 ap.a_name = name;
930 ap.a_uio = uio;
931 ap.a_cred = cred;
cbe54d63
MD
932
933 DO_OPS(ops, error, &ap, vop_getextattr);
934 return(error);
2d3e977e
MD
935}
936
937int
0961aa92 938vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name,
87de5057 939 struct uio *uio, struct ucred *cred)
2d3e977e
MD
940{
941 struct vop_setextattr_args ap;
cbe54d63 942 int error;
2d3e977e
MD
943
944 ap.a_head.a_desc = &vop_setextattr_desc;
0961aa92 945 ap.a_head.a_ops = ops;
2d3e977e
MD
946 ap.a_vp = vp;
947 ap.a_name = name;
948 ap.a_uio = uio;
949 ap.a_cred = cred;
cbe54d63
MD
950
951 DO_OPS(ops, error, &ap, vop_setextattr);
7d15906a
MD
952 if (error == 0)
953 cache_update_fsmid_vp(vp);
cbe54d63 954 return(error);
2d3e977e
MD
955}
956
cbe54d63 957int
2281065e
MD
958vop_mountctl(struct vop_ops *ops, int op, struct file *fp,
959 const void *ctl, int ctllen, void *buf, int buflen, int *res)
cbe54d63 960{
949ecb9b 961 struct vop_mountctl_args ap;
cbe54d63
MD
962 int error;
963
949ecb9b 964 ap.a_head.a_desc = &vop_mountctl_desc;
cbe54d63
MD
965 ap.a_head.a_ops = ops;
966 ap.a_op = op;
949ecb9b 967 ap.a_ctl = ctl;
2281065e 968 ap.a_fp = fp;
949ecb9b
MD
969 ap.a_ctllen = ctllen;
970 ap.a_buf = buf;
971 ap.a_buflen = buflen;
972 ap.a_res = res;
cbe54d63 973
949ecb9b 974 DO_OPS(ops, error, &ap, vop_mountctl);
cbe54d63 975 return(error);
0961aa92
MD
976}
977
fad57d0e
MD
978/*
979 * NEW API FUNCTIONS
980 *
981 * nresolve takes a locked ncp and a cred and resolves the ncp into a
982 * positive or negative hit.
983 *
984 * The namecache is automatically adjusted by this function. The ncp
985 * is left locked on return.
986 */
987int
988vop_nresolve(struct vop_ops *ops, struct namecache *ncp, struct ucred *cred)
989{
990 struct vop_nresolve_args ap;
991 int error;
992
993 ap.a_head.a_desc = &vop_nresolve_desc;
994 ap.a_head.a_ops = ops;
995 ap.a_ncp = ncp;
996 ap.a_cred = cred;
997
998 DO_OPS(ops, error, &ap, vop_nresolve);
999 return(error);
1000}
1001
1002/*
1003 * nlookupdotdot takes an unlocked directory, dvp, and looks up "..", returning
1004 * a locked parent directory in *vpp. If an error occurs *vpp will be NULL.
1005 */
1006int
1007vop_nlookupdotdot(struct vop_ops *ops, struct vnode *dvp,
1008 struct vnode **vpp, struct ucred *cred)
1009{
1010 struct vop_nlookupdotdot_args ap;
1011 int error;
1012
1013 ap.a_head.a_desc = &vop_nlookupdotdot_desc;
1014 ap.a_head.a_ops = ops;
1015 ap.a_dvp = dvp;
1016 ap.a_vpp = vpp;
1017 ap.a_cred = cred;
1018
1019 DO_OPS(ops, error, &ap, vop_nlookupdotdot);
1020 return(error);
1021}
1022
1023/*
1024 * ncreate takes a locked, resolved ncp that typically represents a negative
1025 * cache hit and creates the file or node specified by the ncp, cred, and
1026 * vattr. If no error occurs a locked vnode is returned in *vpp.
1027 *
1028 * The namecache is automatically adjusted by this function. The ncp
1029 * is left locked on return.
1030 */
1031int
1032vop_ncreate(struct vop_ops *ops, struct namecache *ncp,
1033 struct vnode **vpp, struct ucred *cred, struct vattr *vap)
1034{
1035 struct vop_ncreate_args ap;
1036 int error;
1037
1038 ap.a_head.a_desc = &vop_ncreate_desc;
1039 ap.a_head.a_ops = ops;
1040 ap.a_ncp = ncp;
1041 ap.a_vpp = vpp;
1042 ap.a_cred = cred;
1043 ap.a_vap = vap;
1044
1045 DO_OPS(ops, error, &ap, vop_ncreate);
7d15906a
MD
1046 if (error == 0 && *vpp)
1047 cache_update_fsmid_vp(*vpp);
fad57d0e
MD
1048 return(error);
1049}
1050
1051/*
1052 * nmkdir takes a locked, resolved ncp that typically represents a negative
1053 * cache hit and creates the directory specified by the ncp, cred, and
1054 * vattr. If no error occurs a locked vnode is returned in *vpp.
1055 *
1056 * The namecache is automatically adjusted by this function. The ncp
1057 * is left locked on return.
1058 */
1059int
1060vop_nmkdir(struct vop_ops *ops, struct namecache *ncp,
1061 struct vnode **vpp, struct ucred *cred, struct vattr *vap)
1062{
1063 struct vop_nmkdir_args ap;
1064 int error;
1065
1066 ap.a_head.a_desc = &vop_nmkdir_desc;
1067 ap.a_head.a_ops = ops;
1068 ap.a_ncp = ncp;
1069 ap.a_vpp = vpp;
1070 ap.a_cred = cred;
1071 ap.a_vap = vap;
1072
1073 DO_OPS(ops, error, &ap, vop_nmkdir);
7d15906a
MD
1074 if (error == 0 && *vpp)
1075 cache_update_fsmid_vp(*vpp);
fad57d0e
MD
1076 return(error);
1077}
1078
1079/*
1080 * nmknod takes a locked, resolved ncp that typically represents a negative
1081 * cache hit and creates the node specified by the ncp, cred, and
1082 * vattr. If no error occurs a locked vnode is returned in *vpp.
1083 *
1084 * The namecache is automatically adjusted by this function. The ncp
1085 * is left locked on return.
1086 */
1087int
1088vop_nmknod(struct vop_ops *ops, struct namecache *ncp,
1089 struct vnode **vpp, struct ucred *cred, struct vattr *vap)
1090{
1091 struct vop_nmknod_args ap;
1092 int error;
1093
1094 ap.a_head.a_desc = &vop_nmknod_desc;
1095 ap.a_head.a_ops = ops;
1096 ap.a_ncp = ncp;
1097 ap.a_vpp = vpp;
1098 ap.a_cred = cred;
1099 ap.a_vap = vap;
1100
1101 DO_OPS(ops, error, &ap, vop_nmknod);
7d15906a
MD
1102 if (error == 0 && *vpp)
1103 cache_update_fsmid_vp(*vpp);
fad57d0e
MD
1104 return(error);
1105}
1106
1107/*
1108 * nlink takes a locked, resolved ncp that typically represents a negative
1109 * cache hit and creates the node specified by the ncp, cred, and
1110 * existing vnode. The passed vp must be locked and will remain locked
1111 * on return, as does the ncp, whether an error occurs or not.
1112 *
1113 * The namecache is automatically adjusted by this function. The ncp
1114 * is left locked on return.
1115 */
1116int
1117vop_nlink(struct vop_ops *ops, struct namecache *ncp,
1118 struct vnode *vp, struct ucred *cred)
1119{
1120 struct vop_nlink_args ap;
1121 int error;
1122
1123 ap.a_head.a_desc = &vop_nlink_desc;
1124 ap.a_head.a_ops = ops;
1125 ap.a_ncp = ncp;
1126 ap.a_vp = vp;
1127 ap.a_cred = cred;
1128
1129 DO_OPS(ops, error, &ap, vop_nlink);
7d15906a
MD
1130 if (error == 0)
1131 cache_update_fsmid(ncp);
fad57d0e
MD
1132 return(error);
1133}
1134
1135/*
1136 * nsymlink takes a locked, resolved ncp that typically represents a negative
1137 * cache hit and creates a symbolic link based on cred, vap, and target (the
1138 * contents of the link). If no error occurs a locked vnode is returned in
1139 * *vpp.
1140 *
1141 * The namecache is automatically adjusted by this function. The ncp
1142 * is left locked on return.
1143 */
1144int
1145vop_nsymlink(struct vop_ops *ops, struct namecache *ncp,
1146 struct vnode **vpp, struct ucred *cred,
1147 struct vattr *vap, char *target)
1148{
1149 struct vop_nsymlink_args ap;
1150 int error;
1151
1152 ap.a_head.a_desc = &vop_nsymlink_desc;
1153 ap.a_head.a_ops = ops;
1154 ap.a_ncp = ncp;
1155 ap.a_vpp = vpp;
1156 ap.a_cred = cred;
1157 ap.a_vap = vap;
1158 ap.a_target = target;
1159
1160 DO_OPS(ops, error, &ap, vop_nsymlink);
7d15906a
MD
1161 if (error == 0)
1162 cache_update_fsmid(ncp);
fad57d0e
MD
1163 return(error);
1164}
1165
1166/*
1167 * nwhiteout takes a locked, resolved ncp that can represent a positive or
1168 * negative hit and executes the whiteout function specified in flags.
1169 *
1170 * The namecache is automatically adjusted by this function. The ncp
1171 * is left locked on return.
1172 */
1173int
1174vop_nwhiteout(struct vop_ops *ops, struct namecache *ncp,
1175 struct ucred *cred, int flags)
1176{
1177 struct vop_nwhiteout_args ap;
1178 int error;
1179
1180 ap.a_head.a_desc = &vop_nwhiteout_desc;
1181 ap.a_head.a_ops = ops;
1182 ap.a_ncp = ncp;
1183 ap.a_cred = cred;
1184 ap.a_flags = flags;
1185
1186 DO_OPS(ops, error, &ap, vop_nwhiteout);
7d15906a
MD
1187 if (error == 0)
1188 cache_update_fsmid(ncp);
fad57d0e
MD
1189 return(error);
1190}
1191
1192/*
1193 * nremove takes a locked, resolved ncp that generally represents a
1194 * positive hit and removes the file.
1195 *
1196 * The namecache is automatically adjusted by this function. The ncp
1197 * is left locked on return.
1198 */
1199int
1200vop_nremove(struct vop_ops *ops, struct namecache *ncp, struct ucred *cred)
1201{
1202 struct vop_nremove_args ap;
1203 int error;
1204
1205 ap.a_head.a_desc = &vop_nremove_desc;
1206 ap.a_head.a_ops = ops;
1207 ap.a_ncp = ncp;
1208 ap.a_cred = cred;
1209
1210 DO_OPS(ops, error, &ap, vop_nremove);
7d15906a
MD
1211 if (error == 0)
1212 cache_update_fsmid(ncp);
fad57d0e
MD
1213 return(error);
1214}
1215
1216/*
1217 * nrmdir takes a locked, resolved ncp that generally represents a
1218 * directory and removes the directory.
1219 *
1220 * The namecache is automatically adjusted by this function. The ncp
1221 * is left locked on return.
1222 */
1223int
1224vop_nrmdir(struct vop_ops *ops, struct namecache *ncp, struct ucred *cred)
1225{
1226 struct vop_nrmdir_args ap;
1227 int error;
1228
1229 ap.a_head.a_desc = &vop_nrmdir_desc;
1230 ap.a_head.a_ops = ops;
1231 ap.a_ncp = ncp;
1232 ap.a_cred = cred;
1233
1234 DO_OPS(ops, error, &ap, vop_nrmdir);
7d15906a
MD
1235 if (error == 0)
1236 cache_update_fsmid(ncp);
fad57d0e
MD
1237 return(error);
1238}
1239
1240/*
1241 * nrename takes TWO locked, resolved ncp's and the cred of the caller
1242 * and renames the source ncp to the target ncp. The target ncp may
1243 * represent a positive or negative hit.
1244 *
1245 * The namecache is automatically adjusted by this function. The ncp
1246 * is left locked on return. The source ncp is typically changed to
1247 * a negative cache hit and the target ncp typically takes on the
1248 * source ncp's underlying file.
1249 */
1250int
1251vop_nrename(struct vop_ops *ops, struct namecache *fncp,
1252 struct namecache *tncp, struct ucred *cred)
1253{
1254 struct vop_nrename_args ap;
1255 int error;
1256
1257 ap.a_head.a_desc = &vop_nrename_desc;
1258 ap.a_head.a_ops = ops;
1259 ap.a_fncp = fncp;
1260 ap.a_tncp = tncp;
1261 ap.a_cred = cred;
1262
1263 DO_OPS(ops, error, &ap, vop_nrename);
7d15906a
MD
1264 if (error == 0) {
1265 cache_update_fsmid(fncp);
1266 cache_update_fsmid(tncp);
1267 }
fad57d0e
MD
1268 return(error);
1269}
1270
0961aa92
MD
1271/************************************************************************
1272 * PRIMARY VNODE OPERATIONS FORWARDING CALLS *
1273 ************************************************************************
1274 *
1275 * These procedures are called from VFSs such as unionfs and nullfs
1276 * when they wish to forward an operation on one VFS to another. The
1277 * argument structure/message is modified and then directly passed to the
1278 * appropriate routine. This routines may also be called by initiators
1279 * who have an argument structure in hand rather then discreet arguments.
1280 */
1281int
1282vop_vnoperate_ap(struct vop_generic_args *ap)
1283{
cbe54d63
MD
1284 struct vop_ops *ops;
1285 int error;
1286
1287 ops = ap->a_ops;
6ddb7618
MD
1288 error = VOCALL(ops, ap);
1289
1290 return (error);
1291}
1292
1293/*
1294 * This routine is called by the cache coherency layer to execute the actual
1295 * VFS operation. If a journaling layer is present we call though it, else
1296 * we call the native VOP functions.
1297 */
1298int
1299vop_cache_operate_ap(struct vop_generic_args *ap)
1300{
1301 struct vop_ops *ops;
1302 int error;
1303
1304 ops = ap->a_ops;
1305 if (ops->vv_mount->mnt_vn_journal_ops)
1306 error = VOCALL(ops->vv_mount->mnt_vn_journal_ops, ap);
1307 else
1308 error = VOCALL(ops->vv_mount->mnt_vn_norm_ops, ap);
1309 return (error);
1310}
1311
1312
1313/*
1314 * This routine is called by the journaling layer to execute the actual
1315 * VFS operation.
1316 */
1317int
1318vop_journal_operate_ap(struct vop_generic_args *ap)
1319{
1320 struct vop_ops *ops;
1321 int error;
1322
1323 ops = ap->a_ops;
1324 error = VOCALL(ops->vv_mount->mnt_vn_norm_ops, ap);
1325
cbe54d63 1326 return (error);
0961aa92
MD
1327}
1328
1329int
1330vop_islocked_ap(struct vop_islocked_args *ap)
1331{
cbe54d63
MD
1332 int error;
1333
1334 DO_OPS(ap->a_head.a_ops, error, ap, vop_islocked);
1335 return(error);
0961aa92
MD
1336}
1337
0961aa92
MD
1338int
1339vop_open_ap(struct vop_open_args *ap)
1340{
cbe54d63
MD
1341 int error;
1342
1343 DO_OPS(ap->a_head.a_ops, error, ap, vop_open);
1344 return(error);
0961aa92
MD
1345}
1346
1347int
1348vop_close_ap(struct vop_close_args *ap)
1349{
cbe54d63
MD
1350 int error;
1351
1352 DO_OPS(ap->a_head.a_ops, error, ap, vop_close);
1353 return(error);
0961aa92
MD
1354}
1355
1356int
1357vop_access_ap(struct vop_access_args *ap)
1358{
cbe54d63
MD
1359 int error;
1360
1361 DO_OPS(ap->a_head.a_ops, error, ap, vop_access);
1362 return(error);
0961aa92
MD
1363}
1364
1365int
1366vop_getattr_ap(struct vop_getattr_args *ap)
1367{
cbe54d63
MD
1368 int error;
1369
1370 DO_OPS(ap->a_head.a_ops, error, ap, vop_getattr);
1371 return(error);
0961aa92
MD
1372}
1373
1374int
1375vop_setattr_ap(struct vop_setattr_args *ap)
1376{
cbe54d63
MD
1377 int error;
1378
1379 DO_OPS(ap->a_head.a_ops, error, ap, vop_setattr);
1380 return(error);
0961aa92
MD
1381}
1382
1383int
1384vop_read_ap(struct vop_read_args *ap)
1385{
cbe54d63
MD
1386 int error;
1387
1388 DO_OPS(ap->a_head.a_ops, error, ap, vop_read);
1389 return(error);
0961aa92
MD
1390}
1391
1392int
1393vop_write_ap(struct vop_write_args *ap)
1394{
cbe54d63
MD
1395 int error;
1396
1397 DO_OPS(ap->a_head.a_ops, error, ap, vop_write);
1398 return(error);
0961aa92
MD
1399}
1400
0961aa92
MD
1401int
1402vop_ioctl_ap(struct vop_ioctl_args *ap)
1403{
cbe54d63
MD
1404 int error;
1405
1406 DO_OPS(ap->a_head.a_ops, error, ap, vop_ioctl);
1407 return(error);
0961aa92
MD
1408}
1409
1410int
1411vop_poll_ap(struct vop_poll_args *ap)
1412{
cbe54d63
MD
1413 int error;
1414
1415 DO_OPS(ap->a_head.a_ops, error, ap, vop_poll);
1416 return(error);
0961aa92
MD
1417}
1418
1419int
1420vop_kqfilter_ap(struct vop_kqfilter_args *ap)
1421{
cbe54d63
MD
1422 int error;
1423
1424 DO_OPS(ap->a_head.a_ops, error, ap, vop_kqfilter);
1425 return(error);
0961aa92
MD
1426}
1427
1428int
1429vop_revoke_ap(struct vop_revoke_args *ap)
1430{
cbe54d63
MD
1431 int error;
1432
1433 DO_OPS(ap->a_head.a_ops, error, ap, vop_revoke);
1434 return(error);
0961aa92
MD
1435}
1436
1437int
1438vop_mmap_ap(struct vop_mmap_args *ap)
1439{
cbe54d63
MD
1440 int error;
1441
1442 DO_OPS(ap->a_head.a_ops, error, ap, vop_mmap);
1443 return(error);
0961aa92
MD
1444}
1445
1446int
1447vop_fsync_ap(struct vop_fsync_args *ap)
1448{
cbe54d63
MD
1449 int error;
1450
1451 DO_OPS(ap->a_head.a_ops, error, ap, vop_fsync);
1452 return(error);
0961aa92
MD
1453}
1454
0961aa92
MD
1455int
1456vop_readdir_ap(struct vop_readdir_args *ap)
1457{
cbe54d63
MD
1458 int error;
1459
1460 DO_OPS(ap->a_head.a_ops, error, ap, vop_readdir);
1461 return(error);
0961aa92
MD
1462}
1463
1464int
1465vop_readlink_ap(struct vop_readlink_args *ap)
1466{
cbe54d63
MD
1467 int error;
1468
1469 DO_OPS(ap->a_head.a_ops, error, ap, vop_readlink);
1470 return(error);
0961aa92
MD
1471}
1472
1473int
1474vop_inactive_ap(struct vop_inactive_args *ap)
1475{
cbe54d63
MD
1476 int error;
1477
1478 DO_OPS(ap->a_head.a_ops, error, ap, vop_inactive);
1479 return(error);
0961aa92
MD
1480}
1481
1482int
1483vop_reclaim_ap(struct vop_reclaim_args *ap)
1484{
cbe54d63
MD
1485 int error;
1486
1487 DO_OPS(ap->a_head.a_ops, error, ap, vop_reclaim);
1488 return(error);
0961aa92
MD
1489}
1490
1491int
1492vop_lock_ap(struct vop_lock_args *ap)
1493{
cbe54d63
MD
1494 int error;
1495
1496 DO_OPS(ap->a_head.a_ops, error, ap, vop_lock);
1497 return(error);
0961aa92
MD
1498}
1499
1500int
1501vop_unlock_ap(struct vop_unlock_args *ap)
1502{
cbe54d63
MD
1503 int error;
1504
1505 DO_OPS(ap->a_head.a_ops, error, ap, vop_unlock);
1506 return(error);
0961aa92
MD
1507}
1508
1509int
1510vop_bmap_ap(struct vop_bmap_args *ap)
1511{
cbe54d63
MD
1512 int error;
1513
1514 DO_OPS(ap->a_head.a_ops, error, ap, vop_bmap);
1515 return(error);
0961aa92
MD
1516}
1517
1518int
1519vop_strategy_ap(struct vop_strategy_args *ap)
1520{
cbe54d63
MD
1521 int error;
1522
1523 DO_OPS(ap->a_head.a_ops, error, ap, vop_strategy);
1524 return(error);
0961aa92
MD
1525}
1526
1527int
1528vop_print_ap(struct vop_print_args *ap)
1529{
cbe54d63
MD
1530 int error;
1531
1532 DO_OPS(ap->a_head.a_ops, error, ap, vop_print);
1533 return(error);
0961aa92
MD
1534}
1535
1536int
1537vop_pathconf_ap(struct vop_pathconf_args *ap)
1538{
cbe54d63
MD
1539 int error;
1540
1541 DO_OPS(ap->a_head.a_ops, error, ap, vop_pathconf);
1542 return(error);
0961aa92
MD
1543}
1544
1545int
1546vop_advlock_ap(struct vop_advlock_args *ap)
1547{
cbe54d63
MD
1548 int error;
1549
1550 DO_OPS(ap->a_head.a_ops, error, ap, vop_advlock);
1551 return(error);
0961aa92
MD
1552}
1553
1554int
1555vop_balloc_ap(struct vop_balloc_args *ap)
1556{
cbe54d63
MD
1557 int error;
1558
1559 DO_OPS(ap->a_head.a_ops, error, ap, vop_balloc);
1560 return(error);
0961aa92
MD
1561}
1562
1563int
1564vop_reallocblks_ap(struct vop_reallocblks_args *ap)
1565{
cbe54d63
MD
1566 int error;
1567
1568 DO_OPS(ap->a_head.a_ops, error, ap, vop_reallocblks);
1569 return(error);
0961aa92
MD
1570}
1571
1572int
1573vop_getpages_ap(struct vop_getpages_args *ap)
1574{
cbe54d63
MD
1575 int error;
1576
1577 DO_OPS(ap->a_head.a_ops, error, ap, vop_getpages);
1578 return(error);
0961aa92
MD
1579}
1580
1581int
1582vop_putpages_ap(struct vop_putpages_args *ap)
1583{
cbe54d63
MD
1584 int error;
1585
1586 DO_OPS(ap->a_head.a_ops, error, ap, vop_putpages);
1587 return(error);
0961aa92
MD
1588}
1589
1590int
1591vop_freeblks_ap(struct vop_freeblks_args *ap)
1592{
cbe54d63
MD
1593 int error;
1594
1595 DO_OPS(ap->a_head.a_ops, error, ap, vop_freeblks);
1596 return(error);
0961aa92
MD
1597}
1598
0961aa92
MD
1599int
1600vop_getacl_ap(struct vop_getacl_args *ap)
1601{
cbe54d63
MD
1602 int error;
1603
1604 DO_OPS(ap->a_head.a_ops, error, ap, vop_getacl);
1605 return(error);
0961aa92
MD
1606}
1607
1608int
1609vop_setacl_ap(struct vop_setacl_args *ap)
1610{
cbe54d63
MD
1611 int error;
1612
1613 DO_OPS(ap->a_head.a_ops, error, ap, vop_setacl);
1614 return(error);
0961aa92
MD
1615}
1616
1617int
1618vop_aclcheck_ap(struct vop_aclcheck_args *ap)
1619{
cbe54d63
MD
1620 int error;
1621
1622 DO_OPS(ap->a_head.a_ops, error, ap, vop_aclcheck);
1623 return(error);
0961aa92
MD
1624}
1625
1626int
1627vop_getextattr_ap(struct vop_getextattr_args *ap)
1628{
cbe54d63
MD
1629 int error;
1630
1631 DO_OPS(ap->a_head.a_ops, error, ap, vop_getextattr);
1632 return(error);
0961aa92
MD
1633}
1634
1635int
1636vop_setextattr_ap(struct vop_setextattr_args *ap)
1637{
cbe54d63
MD
1638 int error;
1639
1640 DO_OPS(ap->a_head.a_ops, error, ap, vop_setextattr);
1641 return(error);
0961aa92
MD
1642}
1643
cbe54d63 1644int
949ecb9b 1645vop_mountctl_ap(struct vop_mountctl_args *ap)
cbe54d63
MD
1646{
1647 int error;
1648
949ecb9b 1649 DO_OPS(ap->a_head.a_ops, error, ap, vop_mountctl);
cbe54d63 1650 return(error);
2d3e977e
MD
1651}
1652
fad57d0e
MD
1653int
1654vop_nresolve_ap(struct vop_nresolve_args *ap)
1655{
1656 int error;
1657
1658 DO_OPS(ap->a_head.a_ops, error, ap, vop_nresolve);
1659 return(error);
1660}
1661
1662int
1663vop_nlookupdotdot_ap(struct vop_nlookupdotdot_args *ap)
1664{
1665 int error;
1666
1667 DO_OPS(ap->a_head.a_ops, error, ap, vop_nlookupdotdot);
1668 return(error);
1669}
1670
1671int
1672vop_ncreate_ap(struct vop_ncreate_args *ap)
1673{
1674 int error;
1675
1676 DO_OPS(ap->a_head.a_ops, error, ap, vop_ncreate);
1677 return(error);
1678}
1679
1680int
1681vop_nmkdir_ap(struct vop_nmkdir_args *ap)
1682{
1683 int error;
1684
1685 DO_OPS(ap->a_head.a_ops, error, ap, vop_nmkdir);
1686 return(error);
1687}
1688
1689int
1690vop_nmknod_ap(struct vop_nmknod_args *ap)
1691{
1692 int error;
1693
1694 DO_OPS(ap->a_head.a_ops, error, ap, vop_nmknod);
1695 return(error);
1696}
1697
1698int
1699vop_nlink_ap(struct vop_nlink_args *ap)
1700{
1701 int error;
1702
1703 DO_OPS(ap->a_head.a_ops, error, ap, vop_nlink);
1704 return(error);
1705}
1706
1707int
1708vop_nsymlink_ap(struct vop_nsymlink_args *ap)
1709{
1710 int error;
1711
1712 DO_OPS(ap->a_head.a_ops, error, ap, vop_nsymlink);
1713 return(error);
1714}
1715
1716int
1717vop_nwhiteout_ap(struct vop_nwhiteout_args *ap)
1718{
1719 int error;
1720
1721 DO_OPS(ap->a_head.a_ops, error, ap, vop_nwhiteout);
1722 return(error);
1723}
1724
1725int
1726vop_nremove_ap(struct vop_nremove_args *ap)
1727{
1728 int error;
1729
1730 DO_OPS(ap->a_head.a_ops, error, ap, vop_nremove);
1731 return(error);
1732}
1733
1734int
1735vop_nrmdir_ap(struct vop_nrmdir_args *ap)
1736{
1737 int error;
1738
1739 DO_OPS(ap->a_head.a_ops, error, ap, vop_nrmdir);
1740 return(error);
1741}
1742
1743int
1744vop_nrename_ap(struct vop_nrename_args *ap)
1745{
1746 int error;
1747
1748 DO_OPS(ap->a_head.a_ops, error, ap, vop_nrename);
1749 return(error);
1750}
1751