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