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