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