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