]>
git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vfs_support.c
e6dcdaa158de4c112680df8093082999511b2f81
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Copyright (c) 1998-1999 Apple Computer, Inc. All rights reserved.
33 * File: vfs/vfs_support.c
35 * The default VFS routines. A VFS plugin can use these
36 * functions in case it does not want to implement all. These functions
37 * take care of releasing locks and free up memory that they are
40 * nop_* routines always return 0 [success]
41 * err_* routines always return ENOTSUP
43 * This file could be auto-generated from vnode_if.src. but that needs
44 * support for freeing cnp.
47 * 15-Jul-1998 Earsh Nandkeshwar (earsh@apple.com)
48 * Fixed up readdirattr for its existance now.
49 * 18-Aug-1998 Umesh Vaishampayan (umeshv@apple.com)
53 #include <vfs/vfs_support.h>
54 #include <sys/kauth.h>
57 struct vnop_create_args
/* {
60 struct componentname *a_cnp;
61 struct vnode_vattr *a_vap;
62 vfs_context_t a_context;
66 nop_create(struct vnop_create_args
*ap
)
69 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
70 panic("nop_create: no name");
76 err_create(struct vnop_create_args
*ap
)
83 struct vnop_whiteout_args
/* {
85 struct componentname *a_cnp;
87 vfs_context_t a_context;
91 nop_whiteout(struct vnop_whiteout_args
*ap
)
97 err_whiteout(struct vnop_whiteout_args
*ap
)
103 struct vnop_mknod_args
/* {
105 struct vnode **a_vpp;
106 struct componentname *a_cnp;
107 struct vnode_vattr *a_vap;
108 vfs_context_t a_context;
112 nop_mknod(struct vnop_mknod_args
*ap
)
115 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
116 panic("nop_mknod: no name");
122 err_mknod(struct vnop_mknod_args
*ap
)
128 struct vnop_open_args
/* {
131 vfs_context_t a_context;
135 nop_open(struct vnop_open_args
*ap
)
141 err_open(struct vnop_open_args
*ap
)
147 struct vnop_close_args
/* {
150 vfs_context_t a_context;
154 nop_close(struct vnop_close_args
*ap
)
160 err_close(struct vnop_close_args
*ap
)
166 struct vnop_access_args
/* {
169 vfs_context_t a_context;
173 nop_access(struct vnop_access_args
*ap
)
179 err_access(struct vnop_access_args
*ap
)
185 struct vnop_getattr_args
/* {
187 struct vnode_vattr *a_vap;
188 vfs_context_t a_context;
192 nop_getattr(struct vnop_getattr_args
*ap
)
198 err_getattr(struct vnop_getattr_args
*ap
)
204 struct vnop_setattr_args
/* {
206 struct vnode_vattr *a_vap;
207 vfs_context_t a_context;
211 nop_setattr(struct vnop_setattr_args
*ap
)
217 err_setattr(struct vnop_setattr_args
*ap
)
223 struct vnop_getattrlist_args
/* {
225 struct attrlist *a_alist;
228 vfs_context a_context;
232 nop_getattrlist(struct vnop_getattrlist_args
*ap
)
238 err_getattrlist(struct vnop_getattrlist_args
*ap
)
244 struct vnop_setattrlist_args
/* {
246 struct attrlist *a_alist;
249 vfs_context_t a_context;
253 nop_setattrlist(struct vnop_setattrlist_args
*ap
)
259 err_setattrlist(struct vnop_setattrlist_args
*ap
)
265 struct vnop_read_args
/* {
269 vfs_context_t a_context;
273 nop_read(struct vnop_read_args
*ap
)
279 err_read(struct vnop_read_args
*ap
)
285 struct vnop_write_args
/* {
289 vfs_context_t a_context;
293 nop_write(struct vnop_write_args
*ap
)
299 err_write(struct vnop_write_args
*ap
)
305 struct vnop_ioctl_args
/* {
315 nop_ioctl(__unused
struct vnop_ioctl_args
*ap
)
321 err_ioctl(struct vnop_ioctl_args
*ap
)
327 struct vnop_select_args
/* {
337 nop_select(__unused
struct vnop_select_args
*ap
)
343 err_select(struct vnop_select_args
*ap
)
349 struct vnop_exchange_args
/* {
353 vfs_context_t a_context;
357 nop_exchange(struct vnop_exchange_args
*ap
)
363 err_exchange(struct vnop_exchange_args
*ap
)
369 struct vnop_revoke_args
/* {
372 vfs_context_t a_context;
376 nop_revoke(struct vnop_revoke_args
*ap
)
378 return vn_revoke(ap
->a_vp
, ap
->a_flags
, ap
->a_context
);
382 err_revoke(struct vnop_revoke_args
*ap
)
384 (void)nop_revoke(ap
);
389 struct vnop_mmap_args
/* {
397 nop_mmap(__unused
struct vnop_mmap_args
*ap
)
403 err_mmap(struct vnop_mmap_args
*ap
)
409 struct vnop_fsync_args
/* {
412 vfs_context_t a_context;
416 nop_fsync(struct vnop_fsync_args
*ap
)
422 err_fsync(struct vnop_fsync_args
*ap
)
428 struct vnop_remove_args
/* {
431 struct componentname *a_cnp;
433 vfs_context_t a_context;
437 nop_remove(struct vnop_remove_args
*ap
)
443 err_remove(struct vnop_remove_args
*ap
)
445 (void)nop_remove(ap
);
450 struct vnop_link_args
/* {
452 struct vnode *a_tdvp;
453 struct componentname *a_cnp;
454 vfs_context_t a_context;
458 nop_link(struct vnop_link_args
*ap
)
464 err_link(struct vnop_link_args
*ap
)
471 struct vnop_rename_args
/* {
472 struct vnode *a_fdvp;
474 struct componentname *a_fcnp;
475 struct vnode *a_tdvp;
477 struct componentname *a_tcnp;
478 vfs_context_t a_context;
482 nop_rename(struct vnop_rename_args
*ap
)
488 err_rename(struct vnop_rename_args
*ap
)
490 (void)nop_rename(ap
);
495 struct vnop_mkdir_args
/* {
497 struct vnode **a_vpp;
498 struct componentname *a_cnp;
499 struct vnode_vattr *a_vap;
500 vfs_context_t a_context;
504 nop_mkdir(struct vnop_mkdir_args
*ap
)
510 err_mkdir(struct vnop_mkdir_args
*ap
)
516 struct vnop_rmdir_args
/* {
519 struct componentname *a_cnp;
520 vfs_context_t a_context;
524 nop_rmdir(struct vnop_rmdir_args
*ap
)
530 err_rmdir(struct vnop_rmdir_args
*ap
)
537 struct vnop_symlink_args
/* {
539 struct vnode **a_vpp;
540 struct componentname *a_cnp;
541 struct vnode_vattr *a_vap;
543 vfs_context_t a_context;
547 nop_symlink(struct vnop_symlink_args
*ap
)
550 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
551 panic("nop_symlink: no name");
557 err_symlink(struct vnop_symlink_args
*ap
)
559 (void)nop_symlink(ap
);
564 struct vnop_readdir_args
/* {
570 vfs_context_t a_context;
574 nop_readdir(struct vnop_readdir_args
*ap
)
580 err_readdir(struct vnop_readdir_args
*ap
)
586 struct vnop_readdirattr_args
/* {
588 struct attrlist *a_alist;
594 u_long *a_actualcount;
595 vfs_context_t a_context;
599 nop_readdirattr(struct vnop_readdirattr_args
*ap
)
601 *(ap
->a_actualcount
) = 0;
602 *(ap
->a_eofflag
) = 0;
607 err_readdirattr(struct vnop_readdirattr_args
*ap
)
609 (void)nop_readdirattr(ap
);
614 struct vnop_readlink_args
/* {
617 vfs_context_t a_context;
621 nop_readlink(struct vnop_readlink_args
*ap
)
627 err_readlink(struct vnop_readlink_args
*ap
)
633 struct vnop_inactive_args
/* {
635 vfs_context_t a_context;
639 nop_inactive(struct vnop_inactive_args
*ap
)
645 err_inactive(struct vnop_inactive_args
*ap
)
647 (void)nop_inactive(ap
);
652 struct vnop_reclaim_args
/* {
654 vfs_context_t a_context;
658 nop_reclaim(struct vnop_reclaim_args
*ap
)
664 err_reclaim(struct vnop_reclaim_args
*ap
)
670 struct vnop_strategy_args
/* {
675 nop_strategy(struct vnop_strategy_args
*ap
)
681 err_strategy(struct vnop_strategy_args
*ap
)
687 struct vnop_pathconf_args
/* {
690 register_t *a_retval;
691 vfs_context_t a_context;
695 nop_pathconf(struct vnop_pathconf_args
*ap
)
701 err_pathconf(struct vnop_pathconf_args
*ap
)
707 struct vnop_advlock_args
/* {
713 vfs_context_t a_context;
717 nop_advlock(struct vnop_advlock_args
*ap
)
723 err_advlock(struct vnop_advlock_args
*ap
)
730 struct vnop_allocate_args
/* {
734 off_t *a_bytesallocated;
736 vfs_context_t a_context;
740 nop_allocate(struct vnop_allocate_args
*ap
)
742 *(ap
->a_bytesallocated
) = 0;
747 err_allocate(struct vnop_allocate_args
*ap
)
749 (void)nop_allocate(ap
);
753 struct vnop_bwrite_args
/* {
758 nop_bwrite(struct vnop_bwrite_args
*ap
)
760 return ((int)buf_bwrite(ap
->a_bp
));
764 err_bwrite(struct vnop_bwrite_args
*ap
)
770 struct vnop_pagein_args
/* {
773 vm_offset_t a_pl_offset,
777 vfs_context_t a_context;
781 nop_pagein(struct vnop_pagein_args
*ap
)
783 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
784 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
789 err_pagein(struct vnop_pagein_args
*ap
)
791 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
792 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
797 struct vnop_pageout_args
/* {
800 vm_offset_t a_pl_offset,
804 vfs_context_t a_context;
808 nop_pageout(struct vnop_pageout_args
*ap
)
810 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
811 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
816 err_pageout(struct vnop_pageout_args
*ap
)
818 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
819 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
824 struct vnop_searchfs
/* {
826 void *a_searchparams1;
827 void *a_searchparams2;
828 struct attrlist *a_searchattrs;
830 struct timeval *a_timelimit;
831 struct attrlist *a_returnattrs;
832 u_long *a_nummatches;
836 struct searchstate *a_searchstate;
837 vfs_context_t a_context;
841 nop_searchfs(struct vnop_searchfs_args
*ap
)
843 *(ap
->a_nummatches
) = 0;
848 err_searchfs(struct vnop_searchfs_args
*ap
)
850 (void)nop_searchfs(ap
);
854 struct vnop_copyfile_args
/*{
855 struct vnodeop_desc *a_desc;
857 struct vnode *a_tdvp;
859 struct componentname *a_tcnp;
864 nop_copyfile(struct vnop_copyfile_args
*ap
)
871 err_copyfile(struct vnop_copyfile_args
*ap
)
873 (void)nop_copyfile(ap
);
878 struct vnop_blktooff_args
/* {
885 nop_blktooff(struct vnop_blktooff_args
*ap
)
887 *ap
->a_offset
= (off_t
)-1; /* failure */
892 err_blktooff(struct vnop_blktooff_args
*ap
)
894 (void)nop_blktooff(ap
);
898 struct vnop_offtoblk_args
/* {
905 nop_offtoblk(struct vnop_offtoblk_args
*ap
)
907 *ap
->a_lblkno
= (daddr64_t
)-1; /* failure */
912 err_offtoblk(struct vnop_offtoblk_args
*ap
)
914 (void)nop_offtoblk(ap
);
918 struct vnop_blockmap_args
/* {
928 int nop_blockmap(struct vnop_blockmap_args
*ap
)
933 int err_blockmap(struct vnop_blockmap_args
*ap
)