]>
git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vfs_support.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1998-1999 Apple Computer, Inc. All rights reserved.
28 * File: vfs/vfs_support.c
30 * The default VFS routines. A VFS plugin can use these
31 * functions in case it does not want to implement all. These functions
32 * take care of releasing locks and free up memory that they are
35 * nop_* routines always return 0 [success]
36 * err_* routines always return EOPNOTSUPP
38 * This file could be auto-generated from vnode_if.src. but that needs
39 * support for freeing cnp.
42 * 15-Jul-1998 Earsh Nandkeshwar (earsh@apple.com)
43 * Fixed up readdirattr for its existance now.
44 * 18-Aug-1998 Umesh Vaishampayan (umeshv@apple.com)
48 #include <vfs/vfs_support.h>
51 struct vop_create_args
/* {
54 struct componentname *a_cnp;
59 nop_create(struct vop_create_args
*ap
)
62 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
63 panic("nop_create: no name");
65 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
71 err_create(struct vop_create_args
*ap
)
78 struct vop_whiteout_args
/* {
80 struct componentname *a_cnp;
85 nop_whiteout(struct vop_whiteout_args
*ap
)
91 err_whiteout(struct vop_whiteout_args
*ap
)
97 struct vop_mknod_args
/* {
100 struct componentname *a_cnp;
105 nop_mknod(struct vop_mknod_args
*ap
)
108 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
109 panic("nop_mknod: no name");
111 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
117 err_mknod(struct vop_mknod_args
*ap
)
124 struct vop_mkcomplex_args
/* {
126 struct vnode **a_vpp,
127 struct componentname *a_cnp,
133 nop_mkcomplex(struct vop_mkcomplex_args
*ap
)
136 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
137 panic("nop_mkcomplex: no name");
139 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
145 err_mkcomplex(struct vop_mkcomplex_args
*ap
)
147 (void)nop_mkcomplex(ap
);
152 struct vop_open_args
/* {
155 struct ucred *a_cred;
160 nop_open(struct vop_open_args
*ap
)
166 err_open(struct vop_open_args
*ap
)
172 struct vop_close_args
/* {
175 struct ucred *a_cred;
180 nop_close(struct vop_close_args
*ap
)
186 err_close(struct vop_close_args
*ap
)
192 struct vop_access_args
/* {
195 struct ucred *a_cred;
200 nop_access(struct vop_access_args
*ap
)
206 err_access(struct vop_access_args
*ap
)
212 struct vop_getattr_args
/* {
215 struct ucred *a_cred;
220 nop_getattr(struct vop_getattr_args
*ap
)
226 err_getattr(struct vop_getattr_args
*ap
)
232 struct vop_setattr_args
/* {
235 struct ucred *a_cred;
240 nop_setattr(struct vop_setattr_args
*ap
)
246 err_setattr(struct vop_setattr_args
*ap
)
252 struct vop_getattrlist_args
/* {
254 struct attrlist *a_alist;
256 struct ucred *a_cred;
261 nop_getattrlist(struct vop_getattrlist_args
*ap
)
267 err_getattrlist(struct vop_getattrlist_args
*ap
)
273 struct vop_setattrlist_args
/* {
275 struct attrlist *a_alist;
277 struct ucred *a_cred;
282 nop_setattrlist(struct vop_setattrlist_args
*ap
)
288 err_setattrlist(struct vop_setattrlist_args
*ap
)
294 struct vop_read_args
/* {
298 struct ucred *a_cred;
302 nop_read(struct vop_read_args
*ap
)
308 err_read(struct vop_read_args
*ap
)
314 struct vop_write_args
/* {
318 struct ucred *a_cred;
322 nop_write(struct vop_write_args
*ap
)
328 err_write(struct vop_write_args
*ap
)
334 struct vop_lease_args
/* {
337 struct ucred *a_cred;
342 nop_lease(struct vop_lease_args
*ap
)
348 err_lease(struct vop_lease_args
*ap
)
354 struct vop_ioctl_args
/* {
359 struct ucred *a_cred;
364 nop_ioctl(struct vop_ioctl_args
*ap
)
370 err_ioctl(struct vop_ioctl_args
*ap
)
376 struct vop_select_args
/* {
380 struct ucred *a_cred;
386 nop_select(struct vop_select_args
*ap
)
392 err_select(struct vop_select_args
*ap
)
398 struct vop_exchange_args
/* {
401 struct ucred *a_cred;
406 nop_exchange(struct vop_exchange_args
*ap
)
412 err_exchange(struct vop_exchange_args
*ap
)
418 struct vop_revoke_args
/* {
424 nop_revoke(struct vop_revoke_args
*ap
)
426 return (vop_revoke(ap
));
430 err_revoke(struct vop_revoke_args
*ap
)
432 (void)nop_revoke(ap
);
437 struct vop_mmap_args
/* {
440 struct ucred *a_cred;
445 nop_mmap(struct vop_mmap_args
*ap
)
451 err_mmap(struct vop_mmap_args
*ap
)
457 struct vop_fsync_args
/* {
459 struct ucred *a_cred;
465 nop_fsync(struct vop_fsync_args
*ap
)
471 err_fsync(struct vop_fsync_args
*ap
)
477 struct vop_seek_args
/* {
481 struct ucred *a_cred;
485 nop_seek(struct vop_seek_args
*ap
)
491 err_seek(struct vop_seek_args
*ap
)
497 struct vop_remove_args
/* {
500 struct componentname *a_cnp;
504 nop_remove(struct vop_remove_args
*ap
)
506 if (ap
->a_dvp
== ap
->a_vp
)
515 err_remove(struct vop_remove_args
*ap
)
517 (void)nop_remove(ap
);
522 struct vop_link_args
/* {
524 struct vnode *a_tdvp;
525 struct componentname *a_cnp;
529 nop_link(struct vop_link_args
*ap
)
532 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
533 panic("nop_link: no name");
535 VOP_ABORTOP(ap
->a_tdvp
, ap
->a_cnp
);
541 err_link(struct vop_link_args
*ap
)
548 struct vop_rename_args
/* {
549 struct vnode *a_fdvp;
551 struct componentname *a_fcnp;
552 struct vnode *a_tdvp;
554 struct componentname *a_tcnp;
558 nop_rename(struct vop_rename_args
*ap
)
561 if ((ap
->a_tcnp
->cn_flags
& HASBUF
) == 0 ||
562 (ap
->a_fcnp
->cn_flags
& HASBUF
) == 0)
563 panic("nop_rename: no name");
565 VOP_ABORTOP(ap
->a_tdvp
, ap
->a_tcnp
);
566 if (ap
->a_tdvp
== ap
->a_tvp
)
572 VOP_ABORTOP(ap
->a_fdvp
, ap
->a_fcnp
);
579 err_rename(struct vop_rename_args
*ap
)
581 (void)nop_rename(ap
);
586 struct vop_mkdir_args
/* {
588 struct vnode **a_vpp;
589 struct componentname *a_cnp;
594 nop_mkdir(struct vop_mkdir_args
*ap
)
597 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
598 panic("nop_mkdir: no name");
600 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
606 err_mkdir(struct vop_mkdir_args
*ap
)
613 struct vop_rmdir_args
/* {
616 struct componentname *a_cnp;
620 nop_rmdir(struct vop_rmdir_args
*ap
)
628 err_rmdir(struct vop_rmdir_args
*ap
)
635 struct vop_symlink_args
/* {
637 struct vnode **a_vpp;
638 struct componentname *a_cnp;
644 nop_symlink(struct vop_symlink_args
*ap
)
647 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
648 panic("nop_symlink: no name");
650 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
656 err_symlink(struct vop_symlink_args
*ap
)
658 (void)nop_symlink(ap
);
663 struct vop_readdir_args
/* {
666 struct ucred *a_cred;
673 nop_readdir(struct vop_readdir_args
*ap
)
679 err_readdir(struct vop_readdir_args
*ap
)
685 struct vop_readdirattr_args
/* {
687 struct attrlist *a_alist;
693 u_long *a_actualcount;
695 struct ucred *a_cred;
699 nop_readdirattr(struct vop_readdirattr_args
*ap
)
701 *(ap
->a_actualcount
) = 0;
702 *(ap
->a_eofflag
) = 0;
707 err_readdirattr(struct vop_readdirattr_args
*ap
)
709 (void)nop_readdirattr(ap
);
714 struct vop_readlink_args
/* {
721 nop_readlink(struct vop_readlink_args
*ap
)
727 err_readlink(struct vop_readlink_args
*ap
)
733 struct vop_abortop_args
/* {
735 struct componentname *a_cnp;
739 nop_abortop(struct vop_abortop_args
*ap
)
741 if ((ap
->a_cnp
->cn_flags
& (HASBUF
| SAVESTART
)) == HASBUF
)
742 FREE_ZONE(ap
->a_cnp
->cn_pnbuf
, ap
->a_cnp
->cn_pnlen
, M_NAMEI
);
747 err_abortop(struct vop_abortop_args
*ap
)
749 (void)nop_abortop(ap
);
754 struct vop_inactive_args
/* {
760 nop_inactive(struct vop_inactive_args
*ap
)
762 VOP_UNLOCK(ap
->a_vp
, 0, ap
->a_p
);
767 err_inactive(struct vop_inactive_args
*ap
)
769 (void)nop_inactive(ap
);
774 struct vop_reclaim_args
/* {
780 nop_reclaim(struct vop_reclaim_args
*ap
)
786 err_reclaim(struct vop_reclaim_args
*ap
)
792 struct vop_lock_args
/* {
799 nop_lock(struct vop_lock_args
*ap
)
801 return (vop_nolock(ap
));
805 err_lock(struct vop_lock_args
*ap
)
812 struct vop_unlock_args
/* {
819 nop_unlock(struct vop_unlock_args
*ap
)
821 return (vop_nounlock(ap
));
825 err_unlock(struct vop_unlock_args
*ap
)
827 (void)nop_unlock(ap
);
832 struct vop_bmap_args
/* {
841 nop_bmap(struct vop_bmap_args
*ap
)
847 err_bmap(struct vop_bmap_args
*ap
)
853 struct vop_strategy_args
/* {
858 nop_strategy(struct vop_strategy_args
*ap
)
864 err_strategy(struct vop_strategy_args
*ap
)
870 struct vop_print_args
/* {
875 nop_print(struct vop_print_args
*ap
)
881 err_print(struct vop_print_args
*ap
)
887 struct vop_islocked_args
/* {
892 nop_islocked(struct vop_islocked_args
*ap
)
894 return (vop_noislocked(ap
));
898 err_islocked(struct vop_islocked_args
*ap
)
900 (void)nop_islocked(ap
);
905 struct vop_pathconf_args
/* {
908 register_t *a_retval;
912 nop_pathconf(struct vop_pathconf_args
*ap
)
918 err_pathconf(struct vop_pathconf_args
*ap
)
924 struct vop_advlock_args
/* {
933 nop_advlock(struct vop_advlock_args
*ap
)
939 err_advlock(struct vop_advlock_args
*ap
)
945 struct vop_blkatoff_args
/* {
953 nop_blkatoff(struct vop_blkatoff_args
*ap
)
960 err_blkatoff(struct vop_blkatoff_args
*ap
)
962 (void)nop_blkatoff(ap
);
967 struct vop_valloc_args
/* {
970 struct ucred *a_cred;
971 struct vnode **a_vpp;
975 nop_valloc(struct vop_valloc_args
*ap
)
982 err_valloc(struct vop_valloc_args
*ap
)
984 (void)nop_valloc(ap
);
989 struct vop_reallocblks_args
/* {
991 struct cluster_save *a_buflist;
995 nop_reallocblks(struct vop_reallocblks_args
*ap
)
1001 err_reallocblks(struct vop_reallocblks_args
*ap
)
1003 return (EOPNOTSUPP
);
1007 struct vop_vfree_args
/* {
1008 struct vnode *a_pvp;
1014 nop_vfree(struct vop_vfree_args
*ap
)
1020 err_vfree(struct vop_vfree_args
*ap
)
1022 return (EOPNOTSUPP
);
1026 struct vop_truncate_args
/* {
1030 struct ucred *a_cred;
1035 nop_truncate(struct vop_truncate_args
*ap
)
1041 err_truncate(struct vop_truncate_args
*ap
)
1043 return (EOPNOTSUPP
);
1047 struct vop_allocate_args
/* {
1051 off_t *a_bytesallocated;
1053 struct ucred *a_cred;
1058 nop_allocate(struct vop_allocate_args
*ap
)
1060 *(ap
->a_bytesallocated
) = 0;
1065 err_allocate(struct vop_allocate_args
*ap
)
1067 (void)nop_allocate(ap
);
1068 return (EOPNOTSUPP
);
1072 struct vop_update_args
/* {
1074 struct timeval *a_access;
1075 struct timeval *a_modify;
1080 nop_update(struct vop_update_args
*ap
)
1086 err_update(struct vop_update_args
*ap
)
1088 return (EOPNOTSUPP
);
1092 struct vop_pgrd_args
/* {
1095 struct ucred *a_cred;
1099 nop_pgrd(struct vop_pgrd_args
*ap
)
1105 err_pgrd(struct vop_pgrd_args
*ap
)
1107 return (EOPNOTSUPP
);
1111 struct vop_pgwr_args
/* {
1114 struct ucred *a_cred;
1115 vm_offset_t a_offset;
1119 nop_pgwr(struct vop_pgwr_args
*ap
)
1125 err_pgwr(struct vop_pgwr_args
*ap
)
1127 return (EOPNOTSUPP
);
1131 struct vop_bwrite_args
/* {
1136 nop_bwrite(struct vop_bwrite_args
*ap
)
1138 return (bwrite(ap
->a_bp
));
1142 err_bwrite(struct vop_bwrite_args
*ap
)
1144 return (EOPNOTSUPP
);
1148 struct vop_pagein_args
/* {
1151 vm_offset_t a_pl_offset,
1154 struct ucred *a_cred,
1159 nop_pagein(struct vop_pagein_args
*ap
)
1161 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1166 err_pagein(struct vop_pagein_args
*ap
)
1168 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1169 return (EOPNOTSUPP
);
1173 struct vop_pageout_args
/* {
1176 vm_offset_t a_pl_offset,
1179 struct ucred *a_cred,
1184 nop_pageout(struct vop_pageout_args
*ap
)
1186 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1191 err_pageout(struct vop_pageout_args
*ap
)
1193 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1194 return (EOPNOTSUPP
);
1198 struct vop_devblocksize_args
/* {
1200 register_t *a_retval;
1204 nop_devblocksize(struct vop_devblocksize_args
*ap
)
1206 /* XXX default value because the call sites do not check error */
1207 *ap
->a_retval
= 512;
1212 err_devblocksize(struct vop_devblocksize_args
*ap
)
1214 (void)nop_devblocksize(ap
);
1215 return (EOPNOTSUPP
);
1219 struct vop_searchfs
/* {
1221 void *a_searchparams1;
1222 void *a_searchparams2;
1223 struct attrlist *a_searchattrs;
1224 u_long a_maxmatches;
1225 struct timeval *a_timelimit;
1226 struct attrlist *a_returnattrs;
1227 u_long *a_nummatches;
1228 u_long a_scriptcode;
1231 struct searchstate *a_searchstate;
1235 nop_searchfs(struct vop_searchfs_args
*ap
)
1237 *(ap
->a_nummatches
) = 0;
1242 err_searchfs(struct vop_searchfs_args
*ap
)
1244 (void)nop_searchfs(ap
);
1245 return (EOPNOTSUPP
);
1248 struct vop_copyfile_args
/*{
1249 struct vnodeop_desc *a_desc;
1250 struct vnode *a_fvp;
1251 struct vnode *a_tdvp;
1252 struct vnode *a_tvp;
1253 struct componentname *a_tcnp;
1258 nop_copyfile(struct vop_copyfile_args
*ap
)
1260 if (ap
->a_tdvp
== ap
->a_tvp
)
1272 err_copyfile(struct vop_copyfile_args
*ap
)
1274 (void)nop_copyfile(ap
);
1275 return (EOPNOTSUPP
);
1279 struct vop_blktooff_args
/* {
1286 nop_blktooff(struct vop_blktooff_args
*ap
)
1288 *ap
->a_offset
= (off_t
)-1; /* failure */
1293 err_blktooff(struct vop_blktooff_args
*ap
)
1295 (void)nop_blktooff(ap
);
1296 return (EOPNOTSUPP
);
1299 struct vop_offtoblk_args
/* {
1306 nop_offtoblk(struct vop_offtoblk_args
*ap
)
1308 *ap
->a_lblkno
= (daddr_t
)-1; /* failure */
1313 err_offtoblk(struct vop_offtoblk_args
*ap
)
1315 (void)nop_offtoblk(ap
);
1316 return (EOPNOTSUPP
);
1319 struct vop_cmap_args
/* {
1328 int nop_cmap(struct vop_cmap_args
*ap
)
1333 int err_cmap(struct vop_cmap_args
*ap
)
1335 return (EOPNOTSUPP
);