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