]>
git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vfs_support.c
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1998-1999 Apple Computer, Inc. All rights reserved.
31 * File: vfs/vfs_support.c
33 * The default VFS routines. A VFS plugin can use these
34 * functions in case it does not want to implement all. These functions
35 * take care of releasing locks and free up memory that they are
38 * nop_* routines always return 0 [success]
39 * err_* routines always return ENOTSUP
41 * This file could be auto-generated from vnode_if.src. but that needs
42 * support for freeing cnp.
45 * 15-Jul-1998 Earsh Nandkeshwar (earsh@apple.com)
46 * Fixed up readdirattr for its existance now.
47 * 18-Aug-1998 Umesh Vaishampayan (umeshv@apple.com)
51 #include <vfs/vfs_support.h>
52 #include <sys/kauth.h>
53 #include <sys/ubc.h> /* ubc_upl_abort_range() */
56 struct vnop_create_args
/* {
59 struct componentname *a_cnp;
60 struct vnode_vattr *a_vap;
61 vfs_context_t a_context;
65 nop_create(__unused
struct vnop_create_args
*ap
)
68 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
69 panic("nop_create: no name");
75 err_create(struct vnop_create_args
*ap
)
82 struct vnop_whiteout_args
/* {
84 struct componentname *a_cnp;
86 vfs_context_t a_context;
90 nop_whiteout(__unused
struct vnop_whiteout_args
*ap
)
96 err_whiteout(__unused
struct vnop_whiteout_args
*ap
)
102 struct vnop_mknod_args
/* {
104 struct vnode **a_vpp;
105 struct componentname *a_cnp;
106 struct vnode_vattr *a_vap;
107 vfs_context_t a_context;
111 nop_mknod(__unused
struct vnop_mknod_args
*ap
)
114 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
115 panic("nop_mknod: no name");
121 err_mknod(struct vnop_mknod_args
*ap
)
127 struct vnop_open_args
/* {
130 vfs_context_t a_context;
134 nop_open(__unused
struct vnop_open_args
*ap
)
140 err_open(__unused
struct vnop_open_args
*ap
)
146 struct vnop_close_args
/* {
149 vfs_context_t a_context;
153 nop_close(__unused
struct vnop_close_args
*ap
)
159 err_close(__unused
struct vnop_close_args
*ap
)
165 struct vnop_access_args
/* {
168 vfs_context_t a_context;
172 nop_access(__unused
struct vnop_access_args
*ap
)
178 err_access(__unused
struct vnop_access_args
*ap
)
184 struct vnop_getattr_args
/* {
186 struct vnode_vattr *a_vap;
187 vfs_context_t a_context;
191 nop_getattr(__unused
struct vnop_getattr_args
*ap
)
197 err_getattr(__unused
struct vnop_getattr_args
*ap
)
203 struct vnop_setattr_args
/* {
205 struct vnode_vattr *a_vap;
206 vfs_context_t a_context;
210 nop_setattr(__unused
struct vnop_setattr_args
*ap
)
216 err_setattr(__unused
struct vnop_setattr_args
*ap
)
221 struct vnop_read_args
/* {
225 vfs_context_t a_context;
229 nop_read(__unused
struct vnop_read_args
*ap
)
235 err_read(__unused
struct vnop_read_args
*ap
)
241 struct vnop_write_args
/* {
245 vfs_context_t a_context;
249 nop_write(__unused
struct vnop_write_args
*ap
)
255 err_write(__unused
struct vnop_write_args
*ap
)
261 struct vnop_ioctl_args
/* {
271 nop_ioctl(__unused
struct vnop_ioctl_args
*ap
)
277 err_ioctl(__unused
struct vnop_ioctl_args
*ap
)
283 struct vnop_select_args
/* {
293 nop_select(__unused
struct vnop_select_args
*ap
)
299 err_select(__unused
struct vnop_select_args
*ap
)
305 struct vnop_exchange_args
/* {
309 vfs_context_t a_context;
313 nop_exchange(__unused
struct vnop_exchange_args
*ap
)
319 err_exchange(__unused
struct vnop_exchange_args
*ap
)
325 struct vnop_revoke_args
/* {
328 vfs_context_t a_context;
332 nop_revoke(struct vnop_revoke_args
*ap
)
334 return vn_revoke(ap
->a_vp
, ap
->a_flags
, ap
->a_context
);
338 err_revoke(struct vnop_revoke_args
*ap
)
340 (void)nop_revoke(ap
);
345 struct vnop_mmap_args
/* {
353 nop_mmap(__unused
struct vnop_mmap_args
*ap
)
359 err_mmap(__unused
struct vnop_mmap_args
*ap
)
365 struct vnop_fsync_args
/* {
368 vfs_context_t a_context;
372 nop_fsync(__unused
struct vnop_fsync_args
*ap
)
378 err_fsync(__unused
struct vnop_fsync_args
*ap
)
384 struct vnop_remove_args
/* {
387 struct componentname *a_cnp;
389 vfs_context_t a_context;
393 nop_remove(__unused
struct vnop_remove_args
*ap
)
399 err_remove(struct vnop_remove_args
*ap
)
401 (void)nop_remove(ap
);
406 struct vnop_link_args
/* {
408 struct vnode *a_tdvp;
409 struct componentname *a_cnp;
410 vfs_context_t a_context;
414 nop_link(__unused
struct vnop_link_args
*ap
)
420 err_link(struct vnop_link_args
*ap
)
427 struct vnop_rename_args
/* {
428 struct vnode *a_fdvp;
430 struct componentname *a_fcnp;
431 struct vnode *a_tdvp;
433 struct componentname *a_tcnp;
434 vfs_context_t a_context;
438 nop_rename(__unused
struct vnop_rename_args
*ap
)
444 err_rename(struct vnop_rename_args
*ap
)
446 (void)nop_rename(ap
);
451 struct vnop_mkdir_args
/* {
453 struct vnode **a_vpp;
454 struct componentname *a_cnp;
455 struct vnode_vattr *a_vap;
456 vfs_context_t a_context;
460 nop_mkdir(__unused
struct vnop_mkdir_args
*ap
)
466 err_mkdir(__unused
struct vnop_mkdir_args
*ap
)
472 struct vnop_rmdir_args
/* {
475 struct componentname *a_cnp;
476 vfs_context_t a_context;
480 nop_rmdir(__unused
struct vnop_rmdir_args
*ap
)
486 err_rmdir(struct vnop_rmdir_args
*ap
)
493 struct vnop_symlink_args
/* {
495 struct vnode **a_vpp;
496 struct componentname *a_cnp;
497 struct vnode_vattr *a_vap;
499 vfs_context_t a_context;
503 nop_symlink(__unused
struct vnop_symlink_args
*ap
)
506 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
507 panic("nop_symlink: no name");
513 err_symlink(struct vnop_symlink_args
*ap
)
515 (void)nop_symlink(ap
);
520 struct vnop_readdir_args
/* {
526 vfs_context_t a_context;
530 nop_readdir(__unused
struct vnop_readdir_args
*ap
)
536 err_readdir(__unused
struct vnop_readdir_args
*ap
)
542 struct vnop_readdirattr_args
/* {
544 struct attrlist *a_alist;
550 u_long *a_actualcount;
551 vfs_context_t a_context;
555 nop_readdirattr(struct vnop_readdirattr_args
*ap
)
557 *(ap
->a_actualcount
) = 0;
558 *(ap
->a_eofflag
) = 0;
563 err_readdirattr(struct vnop_readdirattr_args
*ap
)
565 (void)nop_readdirattr(ap
);
570 struct vnop_readlink_args
/* {
573 vfs_context_t a_context;
577 nop_readlink(__unused
struct vnop_readlink_args
*ap
)
583 err_readlink(__unused
struct vnop_readlink_args
*ap
)
589 struct vnop_inactive_args
/* {
591 vfs_context_t a_context;
595 nop_inactive(__unused
struct vnop_inactive_args
*ap
)
601 err_inactive(struct vnop_inactive_args
*ap
)
603 (void)nop_inactive(ap
);
608 struct vnop_reclaim_args
/* {
610 vfs_context_t a_context;
614 nop_reclaim(__unused
struct vnop_reclaim_args
*ap
)
620 err_reclaim(__unused
struct vnop_reclaim_args
*ap
)
626 struct vnop_strategy_args
/* {
631 nop_strategy(__unused
struct vnop_strategy_args
*ap
)
637 err_strategy(__unused
struct vnop_strategy_args
*ap
)
643 struct vnop_pathconf_args
/* {
646 register_t *a_retval;
647 vfs_context_t a_context;
651 nop_pathconf(__unused
struct vnop_pathconf_args
*ap
)
657 err_pathconf(__unused
struct vnop_pathconf_args
*ap
)
663 struct vnop_advlock_args
/* {
669 vfs_context_t a_context;
673 nop_advlock(__unused
struct vnop_advlock_args
*ap
)
679 err_advlock(__unused
struct vnop_advlock_args
*ap
)
686 struct vnop_allocate_args
/* {
690 off_t *a_bytesallocated;
692 vfs_context_t a_context;
696 nop_allocate(struct vnop_allocate_args
*ap
)
698 *(ap
->a_bytesallocated
) = 0;
703 err_allocate(struct vnop_allocate_args
*ap
)
705 (void)nop_allocate(ap
);
709 struct vnop_bwrite_args
/* {
714 nop_bwrite(struct vnop_bwrite_args
*ap
)
716 return ((int)buf_bwrite(ap
->a_bp
));
720 err_bwrite(__unused
struct vnop_bwrite_args
*ap
)
726 struct vnop_pagein_args
/* {
729 vm_offset_t a_pl_offset,
733 vfs_context_t a_context;
737 nop_pagein(struct vnop_pagein_args
*ap
)
739 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
740 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
745 err_pagein(struct vnop_pagein_args
*ap
)
747 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
748 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
753 struct vnop_pageout_args
/* {
756 vm_offset_t a_pl_offset,
760 vfs_context_t a_context;
764 nop_pageout(struct vnop_pageout_args
*ap
)
766 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
767 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
772 err_pageout(struct vnop_pageout_args
*ap
)
774 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
775 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
780 struct vnop_searchfs
/* {
782 void *a_searchparams1;
783 void *a_searchparams2;
784 struct attrlist *a_searchattrs;
786 struct timeval *a_timelimit;
787 struct attrlist *a_returnattrs;
788 u_long *a_nummatches;
792 struct searchstate *a_searchstate;
793 vfs_context_t a_context;
797 nop_searchfs(struct vnop_searchfs_args
*ap
)
799 *(ap
->a_nummatches
) = 0;
804 err_searchfs(struct vnop_searchfs_args
*ap
)
806 (void)nop_searchfs(ap
);
810 struct vnop_copyfile_args
/*{
811 struct vnodeop_desc *a_desc;
813 struct vnode *a_tdvp;
815 struct componentname *a_tcnp;
820 nop_copyfile(__unused
struct vnop_copyfile_args
*ap
)
827 err_copyfile(struct vnop_copyfile_args
*ap
)
829 (void)nop_copyfile(ap
);
834 struct vnop_blktooff_args
/* {
841 nop_blktooff(struct vnop_blktooff_args
*ap
)
843 *ap
->a_offset
= (off_t
)-1; /* failure */
848 err_blktooff(struct vnop_blktooff_args
*ap
)
850 (void)nop_blktooff(ap
);
854 struct vnop_offtoblk_args
/* {
861 nop_offtoblk(struct vnop_offtoblk_args
*ap
)
863 *ap
->a_lblkno
= (daddr64_t
)-1; /* failure */
868 err_offtoblk(struct vnop_offtoblk_args
*ap
)
870 (void)nop_offtoblk(ap
);
874 struct vnop_blockmap_args
/* {
884 int nop_blockmap(__unused
struct vnop_blockmap_args
*ap
)
889 int err_blockmap(__unused
struct vnop_blockmap_args
*ap
)