Remove the vpp (returned underlying device vnode) argument from VOP_BMAP().
[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 *
08daea96 35 * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.34 2007/08/13 17:31:51 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 629vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset,
08daea96 630 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;
54078292 639 ap.a_doffsetp = doffsetp;
2d3e977e
MD
640 ap.a_runp = runp;
641 ap.a_runb = runb;
cbe54d63
MD
642
643 DO_OPS(ops, error, &ap, vop_bmap);
644 return(error);
2d3e977e
MD
645}
646
647int
81b5c339 648vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio)
2d3e977e
MD
649{
650 struct vop_strategy_args ap;
cbe54d63 651 int error;
2d3e977e
MD
652
653 ap.a_head.a_desc = &vop_strategy_desc;
0961aa92 654 ap.a_head.a_ops = ops;
2d3e977e 655 ap.a_vp = vp;
81b5c339 656 ap.a_bio = bio;
cbe54d63
MD
657
658 DO_OPS(ops, error, &ap, vop_strategy);
10f3fee5 659 if (error == 0 && bio->bio_buf->b_cmd != BUF_CMD_READ)
7d15906a 660 cache_update_fsmid_vp(vp);
cbe54d63 661 return(error);
2d3e977e
MD
662}
663
664int
0961aa92 665vop_print(struct vop_ops *ops, struct vnode *vp)
2d3e977e
MD
666{
667 struct vop_print_args ap;
cbe54d63 668 int error;
2d3e977e
MD
669
670 ap.a_head.a_desc = &vop_print_desc;
0961aa92 671 ap.a_head.a_ops = ops;
2d3e977e 672 ap.a_vp = vp;
cbe54d63
MD
673
674 DO_OPS(ops, error, &ap, vop_print);
675 return(error);
2d3e977e
MD
676}
677
678int
0961aa92
MD
679vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name,
680 register_t *retval)
2d3e977e
MD
681{
682 struct vop_pathconf_args ap;
cbe54d63 683 int error;
2d3e977e
MD
684
685 ap.a_head.a_desc = &vop_pathconf_desc;
0961aa92 686 ap.a_head.a_ops = ops;
2d3e977e
MD
687 ap.a_vp = vp;
688 ap.a_name = name;
689 ap.a_retval = retval;
cbe54d63
MD
690
691 DO_OPS(ops, error, &ap, vop_pathconf);
692 return(error);
2d3e977e
MD
693}
694
695int
0961aa92
MD
696vop_advlock(struct vop_ops *ops, struct vnode *vp, caddr_t id, int op,
697 struct flock *fl, int flags)
2d3e977e
MD
698{
699 struct vop_advlock_args ap;
cbe54d63 700 int error;
2d3e977e
MD
701
702 ap.a_head.a_desc = &vop_advlock_desc;
0961aa92 703 ap.a_head.a_ops = ops;
2d3e977e
MD
704 ap.a_vp = vp;
705 ap.a_id = id;
706 ap.a_op = op;
707 ap.a_fl = fl;
708 ap.a_flags = flags;
cbe54d63
MD
709
710 DO_OPS(ops, error, &ap, vop_advlock);
711 return(error);
2d3e977e
MD
712}
713
714int
0961aa92
MD
715vop_balloc(struct vop_ops *ops, struct vnode *vp, off_t startoffset,
716 int size, struct ucred *cred, int flags,
717 struct buf **bpp)
2d3e977e
MD
718{
719 struct vop_balloc_args ap;
cbe54d63 720 int error;
2d3e977e
MD
721
722 ap.a_head.a_desc = &vop_balloc_desc;
0961aa92 723 ap.a_head.a_ops = ops;
2d3e977e
MD
724 ap.a_vp = vp;
725 ap.a_startoffset = startoffset;
726 ap.a_size = size;
727 ap.a_cred = cred;
728 ap.a_flags = flags;
729 ap.a_bpp = bpp;
cbe54d63
MD
730
731 DO_OPS(ops, error, &ap, vop_balloc);
732 return(error);
2d3e977e
MD
733}
734
735int
0961aa92
MD
736vop_reallocblks(struct vop_ops *ops, struct vnode *vp,
737 struct cluster_save *buflist)
2d3e977e
MD
738{
739 struct vop_reallocblks_args ap;
cbe54d63 740 int error;
2d3e977e
MD
741
742 ap.a_head.a_desc = &vop_reallocblks_desc;
0961aa92 743 ap.a_head.a_ops = ops;
2d3e977e
MD
744 ap.a_vp = vp;
745 ap.a_buflist = buflist;
cbe54d63
MD
746
747 DO_OPS(ops, error, &ap, vop_reallocblks);
748 return(error);
2d3e977e
MD
749}
750
751int
0961aa92
MD
752vop_getpages(struct vop_ops *ops, struct vnode *vp, vm_page_t *m, int count,
753 int reqpage, vm_ooffset_t offset)
2d3e977e
MD
754{
755 struct vop_getpages_args ap;
cbe54d63 756 int error;
2d3e977e
MD
757
758 ap.a_head.a_desc = &vop_getpages_desc;
0961aa92 759 ap.a_head.a_ops = ops;
2d3e977e
MD
760 ap.a_vp = vp;
761 ap.a_m = m;
762 ap.a_count = count;
763 ap.a_reqpage = reqpage;
764 ap.a_offset = offset;
cbe54d63
MD
765
766 DO_OPS(ops, error, &ap, vop_getpages);
767 return(error);
2d3e977e
MD
768}
769
770int
0961aa92
MD
771vop_putpages(struct vop_ops *ops, struct vnode *vp, vm_page_t *m, int count,
772 int sync, int *rtvals, vm_ooffset_t offset)
2d3e977e
MD
773{
774 struct vop_putpages_args ap;
cbe54d63 775 int error;
2d3e977e
MD
776
777 ap.a_head.a_desc = &vop_putpages_desc;
0961aa92 778 ap.a_head.a_ops = ops;
2d3e977e
MD
779 ap.a_vp = vp;
780 ap.a_m = m;
781 ap.a_count = count;
782 ap.a_sync = sync;
783 ap.a_rtvals = rtvals;
784 ap.a_offset = offset;
cbe54d63
MD
785
786 DO_OPS(ops, error, &ap, vop_putpages);
7d15906a
MD
787 if (error == 0)
788 cache_update_fsmid_vp(vp);
cbe54d63 789 return(error);
2d3e977e
MD
790}
791
792int
54078292 793vop_freeblks(struct vop_ops *ops, struct vnode *vp, off_t offset, int length)
2d3e977e
MD
794{
795 struct vop_freeblks_args ap;
cbe54d63 796 int error;
2d3e977e
MD
797
798 ap.a_head.a_desc = &vop_freeblks_desc;
0961aa92 799 ap.a_head.a_ops = ops;
2d3e977e 800 ap.a_vp = vp;
54078292 801 ap.a_offset = offset;
2d3e977e 802 ap.a_length = length;
cbe54d63
MD
803
804 DO_OPS(ops, error, &ap, vop_freeblks);
805 return(error);
2d3e977e
MD
806}
807
2d3e977e 808int
0961aa92 809vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
87de5057 810 struct acl *aclp, struct ucred *cred)
2d3e977e
MD
811{
812 struct vop_getacl_args ap;
cbe54d63 813 int error;
2d3e977e
MD
814
815 ap.a_head.a_desc = &vop_getacl_desc;
0961aa92 816 ap.a_head.a_ops = ops;
2d3e977e
MD
817 ap.a_vp = vp;
818 ap.a_type = type;
819 ap.a_aclp = aclp;
820 ap.a_cred = cred;
cbe54d63
MD
821
822 DO_OPS(ops, error, &ap, vop_getacl);
823 return(error);
2d3e977e
MD
824}
825
826int
0961aa92 827vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
87de5057 828 struct acl *aclp, struct ucred *cred)
2d3e977e
MD
829{
830 struct vop_setacl_args ap;
cbe54d63 831 int error;
2d3e977e
MD
832
833 ap.a_head.a_desc = &vop_setacl_desc;
0961aa92 834 ap.a_head.a_ops = ops;
2d3e977e
MD
835 ap.a_vp = vp;
836 ap.a_type = type;
837 ap.a_aclp = aclp;
838 ap.a_cred = cred;
cbe54d63
MD
839
840 DO_OPS(ops, error, &ap, vop_setacl);
7d15906a
MD
841 if (error == 0)
842 cache_update_fsmid_vp(vp);
cbe54d63 843 return(error);
2d3e977e
MD
844}
845
846int
0961aa92 847vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
87de5057 848 struct acl *aclp, struct ucred *cred)
2d3e977e
MD
849{
850 struct vop_aclcheck_args ap;
cbe54d63 851 int error;
2d3e977e
MD
852
853 ap.a_head.a_desc = &vop_aclcheck_desc;
0961aa92 854 ap.a_head.a_ops = ops;
2d3e977e
MD
855 ap.a_vp = vp;
856 ap.a_type = type;
857 ap.a_aclp = aclp;
858 ap.a_cred = cred;
cbe54d63
MD
859
860 DO_OPS(ops, error, &ap, vop_aclcheck);
861 return(error);
2d3e977e
MD
862}
863
864int
0961aa92 865vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name,
87de5057 866 struct uio *uio, struct ucred *cred)
2d3e977e
MD
867{
868 struct vop_getextattr_args ap;
cbe54d63 869 int error;
2d3e977e
MD
870
871 ap.a_head.a_desc = &vop_getextattr_desc;
0961aa92 872 ap.a_head.a_ops = ops;
2d3e977e
MD
873 ap.a_vp = vp;
874 ap.a_name = name;
875 ap.a_uio = uio;
876 ap.a_cred = cred;
cbe54d63
MD
877
878 DO_OPS(ops, error, &ap, vop_getextattr);
879 return(error);
2d3e977e
MD
880}
881
882int
0961aa92 883vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name,
87de5057 884 struct uio *uio, struct ucred *cred)
2d3e977e
MD
885{
886 struct vop_setextattr_args ap;
cbe54d63 887 int error;
2d3e977e
MD
888
889 ap.a_head.a_desc = &vop_setextattr_desc;
0961aa92 890 ap.a_head.a_ops = ops;
2d3e977e
MD
891 ap.a_vp = vp;
892 ap.a_name = name;
893 ap.a_uio = uio;
894 ap.a_cred = cred;
cbe54d63
MD
895
896 DO_OPS(ops, error, &ap, vop_setextattr);
7d15906a
MD
897 if (error == 0)
898 cache_update_fsmid_vp(vp);
cbe54d63 899 return(error);
2d3e977e
MD
900}
901
cbe54d63 902int
2281065e
MD
903vop_mountctl(struct vop_ops *ops, int op, struct file *fp,
904 const void *ctl, int ctllen, void *buf, int buflen, int *res)
cbe54d63 905{
949ecb9b 906 struct vop_mountctl_args ap;
cbe54d63
MD
907 int error;
908
949ecb9b 909 ap.a_head.a_desc = &vop_mountctl_desc;
cbe54d63
MD
910 ap.a_head.a_ops = ops;
911 ap.a_op = op;
949ecb9b 912 ap.a_ctl = ctl;
2281065e 913 ap.a_fp = fp;
949ecb9b
MD
914 ap.a_ctllen = ctllen;
915 ap.a_buf = buf;
916 ap.a_buflen = buflen;
917 ap.a_res = res;
cbe54d63 918
949ecb9b 919 DO_OPS(ops, error, &ap, vop_mountctl);
cbe54d63 920 return(error);
0961aa92
MD
921}
922
fad57d0e
MD
923/*
924 * NEW API FUNCTIONS
925 *
926 * nresolve takes a locked ncp and a cred and resolves the ncp into a
927 * positive or negative hit.
928 *
929 * The namecache is automatically adjusted by this function. The ncp
930 * is left locked on return.
931 */
932int
28623bf9 933vop_nresolve(struct vop_ops *ops, struct nchandle *nch, struct ucred *cred)
fad57d0e
MD
934{
935 struct vop_nresolve_args ap;
936 int error;
937
938 ap.a_head.a_desc = &vop_nresolve_desc;
939 ap.a_head.a_ops = ops;
28623bf9 940 ap.a_nch = nch;
fad57d0e
MD
941 ap.a_cred = cred;
942
943 DO_OPS(ops, error, &ap, vop_nresolve);
944 return(error);
945}
946
947/*
948 * nlookupdotdot takes an unlocked directory, dvp, and looks up "..", returning
949 * a locked parent directory in *vpp. If an error occurs *vpp will be NULL.
950 */
951int
952vop_nlookupdotdot(struct vop_ops *ops, struct vnode *dvp,
953 struct vnode **vpp, struct ucred *cred)
954{
955 struct vop_nlookupdotdot_args ap;
956 int error;
957
958 ap.a_head.a_desc = &vop_nlookupdotdot_desc;
959 ap.a_head.a_ops = ops;
960 ap.a_dvp = dvp;
961 ap.a_vpp = vpp;
962 ap.a_cred = cred;
963
964 DO_OPS(ops, error, &ap, vop_nlookupdotdot);
965 return(error);
966}
967
968/*
969 * ncreate takes a locked, resolved ncp that typically represents a negative
970 * cache hit and creates the file or node specified by the ncp, cred, and
971 * vattr. If no error occurs a locked vnode is returned in *vpp.
972 *
973 * The namecache is automatically adjusted by this function. The ncp
974 * is left locked on return.
975 */
976int
28623bf9 977vop_ncreate(struct vop_ops *ops, struct nchandle *nch,
fad57d0e
MD
978 struct vnode **vpp, struct ucred *cred, struct vattr *vap)
979{
980 struct vop_ncreate_args ap;
981 int error;
982
983 ap.a_head.a_desc = &vop_ncreate_desc;
984 ap.a_head.a_ops = ops;
28623bf9 985 ap.a_nch = nch;
fad57d0e
MD
986 ap.a_vpp = vpp;
987 ap.a_cred = cred;
988 ap.a_vap = vap;
989
990 DO_OPS(ops, error, &ap, vop_ncreate);
7d15906a
MD
991 if (error == 0 && *vpp)
992 cache_update_fsmid_vp(*vpp);
fad57d0e
MD
993 return(error);
994}
995
996/*
997 * nmkdir takes a locked, resolved ncp that typically represents a negative
998 * cache hit and creates the directory specified by the ncp, cred, and
999 * vattr. If no error occurs a locked vnode is returned in *vpp.
1000 *
1001 * The namecache is automatically adjusted by this function. The ncp
1002 * is left locked on return.
1003 */
1004int
28623bf9 1005vop_nmkdir(struct vop_ops *ops, struct nchandle *nch,
fad57d0e
MD
1006 struct vnode **vpp, struct ucred *cred, struct vattr *vap)
1007{
1008 struct vop_nmkdir_args ap;
1009 int error;
1010
1011 ap.a_head.a_desc = &vop_nmkdir_desc;
1012 ap.a_head.a_ops = ops;
28623bf9 1013 ap.a_nch = nch;
fad57d0e
MD
1014 ap.a_vpp = vpp;
1015 ap.a_cred = cred;
1016 ap.a_vap = vap;
1017
1018 DO_OPS(ops, error, &ap, vop_nmkdir);
7d15906a
MD
1019 if (error == 0 && *vpp)
1020 cache_update_fsmid_vp(*vpp);
fad57d0e
MD
1021 return(error);
1022}
1023
1024/*
1025 * nmknod takes a locked, resolved ncp that typically represents a negative
1026 * cache hit and creates the node specified by the ncp, cred, and
1027 * vattr. If no error occurs a locked vnode is returned in *vpp.
1028 *
1029 * The namecache is automatically adjusted by this function. The ncp
1030 * is left locked on return.
1031 */
1032int
28623bf9 1033vop_nmknod(struct vop_ops *ops, struct nchandle *nch,
fad57d0e
MD
1034 struct vnode **vpp, struct ucred *cred, struct vattr *vap)
1035{
1036 struct vop_nmknod_args ap;
1037 int error;
1038
1039 ap.a_head.a_desc = &vop_nmknod_desc;
1040 ap.a_head.a_ops = ops;
28623bf9 1041 ap.a_nch = nch;
fad57d0e
MD
1042 ap.a_vpp = vpp;
1043 ap.a_cred = cred;
1044 ap.a_vap = vap;
1045
1046 DO_OPS(ops, error, &ap, vop_nmknod);
7d15906a
MD
1047 if (error == 0 && *vpp)
1048 cache_update_fsmid_vp(*vpp);
fad57d0e
MD
1049 return(error);
1050}
1051
1052/*
1053 * nlink takes a locked, resolved ncp that typically represents a negative
1054 * cache hit and creates the node specified by the ncp, cred, and
1055 * existing vnode. The passed vp must be locked and will remain locked
1056 * on return, as does the ncp, whether an error occurs or not.
1057 *
1058 * The namecache is automatically adjusted by this function. The ncp
1059 * is left locked on return.
1060 */
1061int
28623bf9 1062vop_nlink(struct vop_ops *ops, struct nchandle *nch,
fad57d0e
MD
1063 struct vnode *vp, struct ucred *cred)
1064{
1065 struct vop_nlink_args ap;
1066 int error;
1067
1068 ap.a_head.a_desc = &vop_nlink_desc;
1069 ap.a_head.a_ops = ops;
28623bf9 1070 ap.a_nch = nch;
fad57d0e
MD
1071 ap.a_vp = vp;
1072 ap.a_cred = cred;
1073
1074 DO_OPS(ops, error, &ap, vop_nlink);
7d15906a 1075 if (error == 0)
28623bf9 1076 cache_update_fsmid(nch);
fad57d0e
MD
1077 return(error);
1078}
1079
1080/*
1081 * nsymlink takes a locked, resolved ncp that typically represents a negative
1082 * cache hit and creates a symbolic link based on cred, vap, and target (the
1083 * contents of the link). If no error occurs a locked vnode is returned in
1084 * *vpp.
1085 *
1086 * The namecache is automatically adjusted by this function. The ncp
1087 * is left locked on return.
1088 */
1089int
28623bf9 1090vop_nsymlink(struct vop_ops *ops, struct nchandle *nch,
fad57d0e
MD
1091 struct vnode **vpp, struct ucred *cred,
1092 struct vattr *vap, char *target)
1093{
1094 struct vop_nsymlink_args ap;
1095 int error;
1096
1097 ap.a_head.a_desc = &vop_nsymlink_desc;
1098 ap.a_head.a_ops = ops;
28623bf9 1099 ap.a_nch = nch;
fad57d0e
MD
1100 ap.a_vpp = vpp;
1101 ap.a_cred = cred;
1102 ap.a_vap = vap;
1103 ap.a_target = target;
1104
1105 DO_OPS(ops, error, &ap, vop_nsymlink);
7d15906a 1106 if (error == 0)
28623bf9 1107 cache_update_fsmid(nch);
fad57d0e
MD
1108 return(error);
1109}
1110
1111/*
1112 * nwhiteout takes a locked, resolved ncp that can represent a positive or
1113 * negative hit and executes the whiteout function specified in flags.
1114 *
1115 * The namecache is automatically adjusted by this function. The ncp
1116 * is left locked on return.
1117 */
1118int
28623bf9 1119vop_nwhiteout(struct vop_ops *ops, struct nchandle *nch,
fad57d0e
MD
1120 struct ucred *cred, int flags)
1121{
1122 struct vop_nwhiteout_args ap;
1123 int error;
1124
1125 ap.a_head.a_desc = &vop_nwhiteout_desc;
1126 ap.a_head.a_ops = ops;
28623bf9 1127 ap.a_nch = nch;
fad57d0e
MD
1128 ap.a_cred = cred;
1129 ap.a_flags = flags;
1130
1131 DO_OPS(ops, error, &ap, vop_nwhiteout);
7d15906a 1132 if (error == 0)
28623bf9 1133 cache_update_fsmid(nch);
fad57d0e
MD
1134 return(error);
1135}
1136
1137/*
1138 * nremove takes a locked, resolved ncp that generally represents a
1139 * positive hit and removes the file.
1140 *
1141 * The namecache is automatically adjusted by this function. The ncp
1142 * is left locked on return.
1143 */
1144int
28623bf9 1145vop_nremove(struct vop_ops *ops, struct nchandle *nch, struct ucred *cred)
fad57d0e
MD
1146{
1147 struct vop_nremove_args ap;
1148 int error;
1149
1150 ap.a_head.a_desc = &vop_nremove_desc;
1151 ap.a_head.a_ops = ops;
28623bf9 1152 ap.a_nch = nch;
fad57d0e
MD
1153 ap.a_cred = cred;
1154
1155 DO_OPS(ops, error, &ap, vop_nremove);
7d15906a 1156 if (error == 0)
28623bf9 1157 cache_update_fsmid(nch);
fad57d0e
MD
1158 return(error);
1159}
1160
1161/*
1162 * nrmdir takes a locked, resolved ncp that generally represents a
1163 * directory and removes the directory.
1164 *
1165 * The namecache is automatically adjusted by this function. The ncp
1166 * is left locked on return.
1167 */
1168int
28623bf9 1169vop_nrmdir(struct vop_ops *ops, struct nchandle *nch, struct ucred *cred)
fad57d0e
MD
1170{
1171 struct vop_nrmdir_args ap;
1172 int error;
1173
1174 ap.a_head.a_desc = &vop_nrmdir_desc;
1175 ap.a_head.a_ops = ops;
28623bf9 1176 ap.a_nch = nch;
fad57d0e
MD
1177 ap.a_cred = cred;
1178
1179 DO_OPS(ops, error, &ap, vop_nrmdir);
7d15906a 1180 if (error == 0)
28623bf9 1181 cache_update_fsmid(nch);
fad57d0e
MD
1182 return(error);
1183}
1184
1185/*
1186 * nrename takes TWO locked, resolved ncp's and the cred of the caller
1187 * and renames the source ncp to the target ncp. The target ncp may
1188 * represent a positive or negative hit.
1189 *
1190 * The namecache is automatically adjusted by this function. The ncp
1191 * is left locked on return. The source ncp is typically changed to
1192 * a negative cache hit and the target ncp typically takes on the
1193 * source ncp's underlying file.
1194 */
1195int
28623bf9
MD
1196vop_nrename(struct vop_ops *ops, struct nchandle *fnch,
1197 struct nchandle *tnch, struct ucred *cred)
fad57d0e
MD
1198{
1199 struct vop_nrename_args ap;
1200 int error;
1201
1202 ap.a_head.a_desc = &vop_nrename_desc;
1203 ap.a_head.a_ops = ops;
28623bf9
MD
1204 ap.a_fnch = fnch;
1205 ap.a_tnch = tnch;
fad57d0e
MD
1206 ap.a_cred = cred;
1207
1208 DO_OPS(ops, error, &ap, vop_nrename);
7d15906a 1209 if (error == 0) {
28623bf9
MD
1210 cache_update_fsmid(fnch);
1211 cache_update_fsmid(tnch);
7d15906a 1212 }
fad57d0e
MD
1213 return(error);
1214}
1215
0961aa92
MD
1216/************************************************************************
1217 * PRIMARY VNODE OPERATIONS FORWARDING CALLS *
1218 ************************************************************************
1219 *
1220 * These procedures are called from VFSs such as unionfs and nullfs
1221 * when they wish to forward an operation on one VFS to another. The
1222 * argument structure/message is modified and then directly passed to the
1223 * appropriate routine. This routines may also be called by initiators
1224 * who have an argument structure in hand rather then discreet arguments.
1225 */
1226int
1227vop_vnoperate_ap(struct vop_generic_args *ap)
1228{
cbe54d63
MD
1229 struct vop_ops *ops;
1230 int error;
1231
1232 ops = ap->a_ops;
6ddb7618
MD
1233 error = VOCALL(ops, ap);
1234
1235 return (error);
1236}
1237
1238/*
1239 * This routine is called by the cache coherency layer to execute the actual
1240 * VFS operation. If a journaling layer is present we call though it, else
1241 * we call the native VOP functions.
1242 */
1243int
1244vop_cache_operate_ap(struct vop_generic_args *ap)
1245{
1246 struct vop_ops *ops;
1247 int error;
1248
1249 ops = ap->a_ops;
66a1ddf5
MD
1250 if (ops->head.vv_mount->mnt_vn_journal_ops)
1251 error = VOCALL(ops->head.vv_mount->mnt_vn_journal_ops, ap);
6ddb7618 1252 else
66a1ddf5 1253 error = VOCALL(ops->head.vv_mount->mnt_vn_norm_ops, ap);
6ddb7618
MD
1254 return (error);
1255}
1256
1257
1258/*
1259 * This routine is called by the journaling layer to execute the actual
1260 * VFS operation.
1261 */
1262int
1263vop_journal_operate_ap(struct vop_generic_args *ap)
1264{
1265 struct vop_ops *ops;
1266 int error;
1267
1268 ops = ap->a_ops;
66a1ddf5 1269 error = VOCALL(ops->head.vv_mount->mnt_vn_norm_ops, ap);
6ddb7618 1270
cbe54d63 1271 return (error);
0961aa92
MD
1272}
1273
0961aa92
MD
1274int
1275vop_open_ap(struct vop_open_args *ap)
1276{
cbe54d63
MD
1277 int error;
1278
1279 DO_OPS(ap->a_head.a_ops, error, ap, vop_open);
1280 return(error);
0961aa92
MD
1281}
1282
1283int
1284vop_close_ap(struct vop_close_args *ap)
1285{
cbe54d63
MD
1286 int error;
1287
1288 DO_OPS(ap->a_head.a_ops, error, ap, vop_close);
1289 return(error);
0961aa92
MD
1290}
1291
1292int
1293vop_access_ap(struct vop_access_args *ap)
1294{
cbe54d63
MD
1295 int error;
1296
1297 DO_OPS(ap->a_head.a_ops, error, ap, vop_access);
1298 return(error);
0961aa92
MD
1299}
1300
1301int
1302vop_getattr_ap(struct vop_getattr_args *ap)
1303{
cbe54d63
MD
1304 int error;
1305
1306 DO_OPS(ap->a_head.a_ops, error, ap, vop_getattr);
1307 return(error);
0961aa92
MD
1308}
1309
1310int
1311vop_setattr_ap(struct vop_setattr_args *ap)
1312{
cbe54d63
MD
1313 int error;
1314
1315 DO_OPS(ap->a_head.a_ops, error, ap, vop_setattr);
1316 return(error);
0961aa92
MD
1317}
1318
1319int
1320vop_read_ap(struct vop_read_args *ap)
1321{
cbe54d63
MD
1322 int error;
1323
1324 DO_OPS(ap->a_head.a_ops, error, ap, vop_read);
1325 return(error);
0961aa92
MD
1326}
1327
1328int
1329vop_write_ap(struct vop_write_args *ap)
1330{
cbe54d63
MD
1331 int error;
1332
1333 DO_OPS(ap->a_head.a_ops, error, ap, vop_write);
1334 return(error);
0961aa92
MD
1335}
1336
0961aa92
MD
1337int
1338vop_ioctl_ap(struct vop_ioctl_args *ap)
1339{
cbe54d63
MD
1340 int error;
1341
1342 DO_OPS(ap->a_head.a_ops, error, ap, vop_ioctl);
1343 return(error);
0961aa92
MD
1344}
1345
1346int
1347vop_poll_ap(struct vop_poll_args *ap)
1348{
cbe54d63
MD
1349 int error;
1350
1351 DO_OPS(ap->a_head.a_ops, error, ap, vop_poll);
1352 return(error);
0961aa92
MD
1353}
1354
1355int
1356vop_kqfilter_ap(struct vop_kqfilter_args *ap)
1357{
cbe54d63
MD
1358 int error;
1359
1360 DO_OPS(ap->a_head.a_ops, error, ap, vop_kqfilter);
1361 return(error);
0961aa92
MD
1362}
1363
1364int
1365vop_revoke_ap(struct vop_revoke_args *ap)
1366{
cbe54d63
MD
1367 int error;
1368
1369 DO_OPS(ap->a_head.a_ops, error, ap, vop_revoke);
1370 return(error);
0961aa92
MD
1371}
1372
1373int
1374vop_mmap_ap(struct vop_mmap_args *ap)
1375{
cbe54d63
MD
1376 int error;
1377
1378 DO_OPS(ap->a_head.a_ops, error, ap, vop_mmap);
1379 return(error);
0961aa92
MD
1380}
1381
1382int
1383vop_fsync_ap(struct vop_fsync_args *ap)
1384{
cbe54d63
MD
1385 int error;
1386
1387 DO_OPS(ap->a_head.a_ops, error, ap, vop_fsync);
1388 return(error);
0961aa92
MD
1389}
1390
0961aa92
MD
1391int
1392vop_readdir_ap(struct vop_readdir_args *ap)
1393{
cbe54d63
MD
1394 int error;
1395
1396 DO_OPS(ap->a_head.a_ops, error, ap, vop_readdir);
1397 return(error);
0961aa92
MD
1398}
1399
1400int
1401vop_readlink_ap(struct vop_readlink_args *ap)
1402{
cbe54d63
MD
1403 int error;
1404
1405 DO_OPS(ap->a_head.a_ops, error, ap, vop_readlink);
1406 return(error);
0961aa92
MD
1407}
1408
1409int
1410vop_inactive_ap(struct vop_inactive_args *ap)
1411{
cbe54d63
MD
1412 int error;
1413
1414 DO_OPS(ap->a_head.a_ops, error, ap, vop_inactive);
1415 return(error);
0961aa92
MD
1416}
1417
1418int
1419vop_reclaim_ap(struct vop_reclaim_args *ap)
1420{
cbe54d63
MD
1421 int error;
1422
1423 DO_OPS(ap->a_head.a_ops, error, ap, vop_reclaim);
1424 return(error);
0961aa92
MD
1425}
1426
0961aa92
MD
1427int
1428vop_bmap_ap(struct vop_bmap_args *ap)
1429{
cbe54d63
MD
1430 int error;
1431
1432 DO_OPS(ap->a_head.a_ops, error, ap, vop_bmap);
1433 return(error);
0961aa92
MD
1434}
1435
1436int
1437vop_strategy_ap(struct vop_strategy_args *ap)
1438{
cbe54d63
MD
1439 int error;
1440
1441 DO_OPS(ap->a_head.a_ops, error, ap, vop_strategy);
1442 return(error);
0961aa92
MD
1443}
1444
1445int
1446vop_print_ap(struct vop_print_args *ap)
1447{
cbe54d63
MD
1448 int error;
1449
1450 DO_OPS(ap->a_head.a_ops, error, ap, vop_print);
1451 return(error);
0961aa92
MD
1452}
1453
1454int
1455vop_pathconf_ap(struct vop_pathconf_args *ap)
1456{
cbe54d63
MD
1457 int error;
1458
1459 DO_OPS(ap->a_head.a_ops, error, ap, vop_pathconf);
1460 return(error);
0961aa92
MD
1461}
1462
1463int
1464vop_advlock_ap(struct vop_advlock_args *ap)
1465{
cbe54d63
MD
1466 int error;
1467
1468 DO_OPS(ap->a_head.a_ops, error, ap, vop_advlock);
1469 return(error);
0961aa92
MD
1470}
1471
1472int
1473vop_balloc_ap(struct vop_balloc_args *ap)
1474{
cbe54d63
MD
1475 int error;
1476
1477 DO_OPS(ap->a_head.a_ops, error, ap, vop_balloc);
1478 return(error);
0961aa92
MD
1479}
1480
1481int
1482vop_reallocblks_ap(struct vop_reallocblks_args *ap)
1483{
cbe54d63
MD
1484 int error;
1485
1486 DO_OPS(ap->a_head.a_ops, error, ap, vop_reallocblks);
1487 return(error);
0961aa92
MD
1488}
1489
1490int
1491vop_getpages_ap(struct vop_getpages_args *ap)
1492{
cbe54d63
MD
1493 int error;
1494
1495 DO_OPS(ap->a_head.a_ops, error, ap, vop_getpages);
1496 return(error);
0961aa92
MD
1497}
1498
1499int
1500vop_putpages_ap(struct vop_putpages_args *ap)
1501{
cbe54d63
MD
1502 int error;
1503
1504 DO_OPS(ap->a_head.a_ops, error, ap, vop_putpages);
1505 return(error);
0961aa92
MD
1506}
1507
1508int
1509vop_freeblks_ap(struct vop_freeblks_args *ap)
1510{
cbe54d63
MD
1511 int error;
1512
1513 DO_OPS(ap->a_head.a_ops, error, ap, vop_freeblks);
1514 return(error);
0961aa92
MD
1515}
1516
0961aa92
MD
1517int
1518vop_getacl_ap(struct vop_getacl_args *ap)
1519{
cbe54d63
MD
1520 int error;
1521
1522 DO_OPS(ap->a_head.a_ops, error, ap, vop_getacl);
1523 return(error);
0961aa92
MD
1524}
1525
1526int
1527vop_setacl_ap(struct vop_setacl_args *ap)
1528{
cbe54d63
MD
1529 int error;
1530
1531 DO_OPS(ap->a_head.a_ops, error, ap, vop_setacl);
1532 return(error);
0961aa92
MD
1533}
1534
1535int
1536vop_aclcheck_ap(struct vop_aclcheck_args *ap)
1537{
cbe54d63
MD
1538 int error;
1539
1540 DO_OPS(ap->a_head.a_ops, error, ap, vop_aclcheck);
1541 return(error);
0961aa92
MD
1542}
1543
1544int
1545vop_getextattr_ap(struct vop_getextattr_args *ap)
1546{
cbe54d63
MD
1547 int error;
1548
1549 DO_OPS(ap->a_head.a_ops, error, ap, vop_getextattr);
1550 return(error);
0961aa92
MD
1551}
1552
1553int
1554vop_setextattr_ap(struct vop_setextattr_args *ap)
1555{
cbe54d63
MD
1556 int error;
1557
1558 DO_OPS(ap->a_head.a_ops, error, ap, vop_setextattr);
1559 return(error);
0961aa92
MD
1560}
1561
cbe54d63 1562int
949ecb9b 1563vop_mountctl_ap(struct vop_mountctl_args *ap)
cbe54d63
MD
1564{
1565 int error;
1566
949ecb9b 1567 DO_OPS(ap->a_head.a_ops, error, ap, vop_mountctl);
cbe54d63 1568 return(error);
2d3e977e
MD
1569}
1570
fad57d0e
MD
1571int
1572vop_nresolve_ap(struct vop_nresolve_args *ap)
1573{
1574 int error;
1575
1576 DO_OPS(ap->a_head.a_ops, error, ap, vop_nresolve);
1577 return(error);
1578}
1579
1580int
1581vop_nlookupdotdot_ap(struct vop_nlookupdotdot_args *ap)
1582{
1583 int error;
1584
1585 DO_OPS(ap->a_head.a_ops, error, ap, vop_nlookupdotdot);
1586 return(error);
1587}
1588
1589int
1590vop_ncreate_ap(struct vop_ncreate_args *ap)
1591{
1592 int error;
1593
1594 DO_OPS(ap->a_head.a_ops, error, ap, vop_ncreate);
1595 return(error);
1596}
1597
1598int
1599vop_nmkdir_ap(struct vop_nmkdir_args *ap)
1600{
1601 int error;
1602
1603 DO_OPS(ap->a_head.a_ops, error, ap, vop_nmkdir);
1604 return(error);
1605}
1606
1607int
1608vop_nmknod_ap(struct vop_nmknod_args *ap)
1609{
1610 int error;
1611
1612 DO_OPS(ap->a_head.a_ops, error, ap, vop_nmknod);
1613 return(error);
1614}
1615
1616int
1617vop_nlink_ap(struct vop_nlink_args *ap)
1618{
1619 int error;
1620
1621 DO_OPS(ap->a_head.a_ops, error, ap, vop_nlink);
1622 return(error);
1623}
1624
1625int
1626vop_nsymlink_ap(struct vop_nsymlink_args *ap)
1627{
1628 int error;
1629
1630 DO_OPS(ap->a_head.a_ops, error, ap, vop_nsymlink);
1631 return(error);
1632}
1633
1634int
1635vop_nwhiteout_ap(struct vop_nwhiteout_args *ap)
1636{
1637 int error;
1638
1639 DO_OPS(ap->a_head.a_ops, error, ap, vop_nwhiteout);
1640 return(error);
1641}
1642
1643int
1644vop_nremove_ap(struct vop_nremove_args *ap)
1645{
1646 int error;
1647
1648 DO_OPS(ap->a_head.a_ops, error, ap, vop_nremove);
1649 return(error);
1650}
1651
1652int
1653vop_nrmdir_ap(struct vop_nrmdir_args *ap)
1654{
1655 int error;
1656
1657 DO_OPS(ap->a_head.a_ops, error, ap, vop_nrmdir);
1658 return(error);
1659}
1660
1661int
1662vop_nrename_ap(struct vop_nrename_args *ap)
1663{
1664 int error;
1665
1666 DO_OPS(ap->a_head.a_ops, error, ap, vop_nrename);
1667 return(error);
1668}
1669