]>
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
/* {
543 struct vnodeop_desc *a_desc;
545 struct attrlist *a_alist;
551 u_long *a_actualcount;
552 vfs_context_t a_context;
556 nop_readdirattr(struct vnop_readdirattr_args
*ap
)
558 *(ap
->a_actualcount
) = 0;
559 *(ap
->a_eofflag
) = 0;
564 err_readdirattr(struct vnop_readdirattr_args
*ap
)
566 (void)nop_readdirattr(ap
);
571 struct vnop_readlink_args
/* {
574 vfs_context_t a_context;
578 nop_readlink(__unused
struct vnop_readlink_args
*ap
)
584 err_readlink(__unused
struct vnop_readlink_args
*ap
)
590 struct vnop_inactive_args
/* {
592 vfs_context_t a_context;
596 nop_inactive(__unused
struct vnop_inactive_args
*ap
)
602 err_inactive(struct vnop_inactive_args
*ap
)
604 (void)nop_inactive(ap
);
609 struct vnop_reclaim_args
/* {
611 vfs_context_t a_context;
615 nop_reclaim(__unused
struct vnop_reclaim_args
*ap
)
621 err_reclaim(__unused
struct vnop_reclaim_args
*ap
)
627 struct vnop_strategy_args
/* {
632 nop_strategy(__unused
struct vnop_strategy_args
*ap
)
638 err_strategy(__unused
struct vnop_strategy_args
*ap
)
644 struct vnop_pathconf_args
/* {
648 vfs_context_t a_context;
652 nop_pathconf(__unused
struct vnop_pathconf_args
*ap
)
658 err_pathconf(__unused
struct vnop_pathconf_args
*ap
)
664 struct vnop_advlock_args
/* {
670 vfs_context_t a_context;
674 nop_advlock(__unused
struct vnop_advlock_args
*ap
)
680 err_advlock(__unused
struct vnop_advlock_args
*ap
)
687 struct vnop_allocate_args
/* {
691 off_t *a_bytesallocated;
693 vfs_context_t a_context;
697 nop_allocate(struct vnop_allocate_args
*ap
)
699 *(ap
->a_bytesallocated
) = 0;
704 err_allocate(struct vnop_allocate_args
*ap
)
706 (void)nop_allocate(ap
);
710 struct vnop_bwrite_args
/* {
715 nop_bwrite(struct vnop_bwrite_args
*ap
)
717 return ((int)buf_bwrite(ap
->a_bp
));
721 err_bwrite(__unused
struct vnop_bwrite_args
*ap
)
727 struct vnop_pagein_args
/* {
730 vm_offset_t a_pl_offset,
734 vfs_context_t a_context;
738 nop_pagein(struct vnop_pagein_args
*ap
)
740 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
741 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
746 err_pagein(struct vnop_pagein_args
*ap
)
748 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
749 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
754 struct vnop_pageout_args
/* {
757 vm_offset_t a_pl_offset,
761 vfs_context_t a_context;
765 nop_pageout(struct vnop_pageout_args
*ap
)
767 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
768 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
773 err_pageout(struct vnop_pageout_args
*ap
)
775 if ( !(ap
->a_flags
& UPL_NOCOMMIT
))
776 ubc_upl_abort_range(ap
->a_pl
, ap
->a_pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
| UPL_ABORT_ERROR
);
781 struct vnop_searchfs
/* {
783 void *a_searchparams1;
784 void *a_searchparams2;
785 struct attrlist *a_searchattrs;
787 struct timeval *a_timelimit;
788 struct attrlist *a_returnattrs;
789 u_long *a_nummatches;
793 struct searchstate *a_searchstate;
794 vfs_context_t a_context;
798 nop_searchfs(struct vnop_searchfs_args
*ap
)
800 *(ap
->a_nummatches
) = 0;
805 err_searchfs(struct vnop_searchfs_args
*ap
)
807 (void)nop_searchfs(ap
);
811 struct vnop_copyfile_args
/*{
812 struct vnodeop_desc *a_desc;
814 struct vnode *a_tdvp;
816 struct componentname *a_tcnp;
821 nop_copyfile(__unused
struct vnop_copyfile_args
*ap
)
828 err_copyfile(struct vnop_copyfile_args
*ap
)
830 (void)nop_copyfile(ap
);
835 struct vnop_blktooff_args
/* {
842 nop_blktooff(struct vnop_blktooff_args
*ap
)
844 *ap
->a_offset
= (off_t
)-1; /* failure */
849 err_blktooff(struct vnop_blktooff_args
*ap
)
851 (void)nop_blktooff(ap
);
855 struct vnop_offtoblk_args
/* {
862 nop_offtoblk(struct vnop_offtoblk_args
*ap
)
864 *ap
->a_lblkno
= (daddr64_t
)-1; /* failure */
869 err_offtoblk(struct vnop_offtoblk_args
*ap
)
871 (void)nop_offtoblk(ap
);
875 struct vnop_blockmap_args
/* {
885 int nop_blockmap(__unused
struct vnop_blockmap_args
*ap
)
890 int err_blockmap(__unused
struct vnop_blockmap_args
*ap
)