]>
git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vfs_support.c
3eeabf3efbffef6c04eb74e8e28a1b9cbc2ebaf3
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1998-1999 Apple Computer, Inc. All rights reserved.
25 * File: vfs/vfs_support.c
27 * The default VFS routines. A VFS plugin can use these
28 * functions in case it does not want to implement all. These functions
29 * take care of releasing locks and free up memory that they are
32 * nop_* routines always return 0 [success]
33 * err_* routines always return EOPNOTSUPP
35 * This file could be auto-generated from vnode_if.src. but that needs
36 * support for freeing cnp.
39 * 15-Jul-1998 Earsh Nandkeshwar (earsh@apple.com)
40 * Fixed up readdirattr for its existance now.
41 * 18-Aug-1998 Umesh Vaishampayan (umeshv@apple.com)
45 #include <vfs/vfs_support.h>
48 struct vop_create_args
/* {
51 struct componentname *a_cnp;
56 nop_create(struct vop_create_args
*ap
)
59 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
60 panic("nop_create: no name");
62 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
68 err_create(struct vop_create_args
*ap
)
75 struct vop_whiteout_args
/* {
77 struct componentname *a_cnp;
82 nop_whiteout(struct vop_whiteout_args
*ap
)
88 err_whiteout(struct vop_whiteout_args
*ap
)
94 struct vop_mknod_args
/* {
97 struct componentname *a_cnp;
102 nop_mknod(struct vop_mknod_args
*ap
)
105 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
106 panic("nop_mknod: no name");
108 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
114 err_mknod(struct vop_mknod_args
*ap
)
121 struct vop_mkcomplex_args
/* {
123 struct vnode **a_vpp,
124 struct componentname *a_cnp,
130 nop_mkcomplex(struct vop_mkcomplex_args
*ap
)
133 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
134 panic("nop_mkcomplex: no name");
136 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
142 err_mkcomplex(struct vop_mkcomplex_args
*ap
)
144 (void)nop_mkcomplex(ap
);
149 struct vop_open_args
/* {
152 struct ucred *a_cred;
157 nop_open(struct vop_open_args
*ap
)
163 err_open(struct vop_open_args
*ap
)
169 struct vop_close_args
/* {
172 struct ucred *a_cred;
177 nop_close(struct vop_close_args
*ap
)
183 err_close(struct vop_close_args
*ap
)
189 struct vop_access_args
/* {
192 struct ucred *a_cred;
197 nop_access(struct vop_access_args
*ap
)
203 err_access(struct vop_access_args
*ap
)
209 struct vop_getattr_args
/* {
212 struct ucred *a_cred;
217 nop_getattr(struct vop_getattr_args
*ap
)
223 err_getattr(struct vop_getattr_args
*ap
)
229 struct vop_setattr_args
/* {
232 struct ucred *a_cred;
237 nop_setattr(struct vop_setattr_args
*ap
)
243 err_setattr(struct vop_setattr_args
*ap
)
249 struct vop_getattrlist_args
/* {
251 struct attrlist *a_alist;
253 struct ucred *a_cred;
258 nop_getattrlist(struct vop_getattrlist_args
*ap
)
264 err_getattrlist(struct vop_getattrlist_args
*ap
)
270 struct vop_setattrlist_args
/* {
272 struct attrlist *a_alist;
274 struct ucred *a_cred;
279 nop_setattrlist(struct vop_setattrlist_args
*ap
)
285 err_setattrlist(struct vop_setattrlist_args
*ap
)
291 struct vop_read_args
/* {
295 struct ucred *a_cred;
299 nop_read(struct vop_read_args
*ap
)
305 err_read(struct vop_read_args
*ap
)
311 struct vop_write_args
/* {
315 struct ucred *a_cred;
319 nop_write(struct vop_write_args
*ap
)
325 err_write(struct vop_write_args
*ap
)
331 struct vop_lease_args
/* {
334 struct ucred *a_cred;
339 nop_lease(struct vop_lease_args
*ap
)
345 err_lease(struct vop_lease_args
*ap
)
351 struct vop_ioctl_args
/* {
356 struct ucred *a_cred;
361 nop_ioctl(struct vop_ioctl_args
*ap
)
367 err_ioctl(struct vop_ioctl_args
*ap
)
373 struct vop_select_args
/* {
377 struct ucred *a_cred;
383 nop_select(struct vop_select_args
*ap
)
389 err_select(struct vop_select_args
*ap
)
395 struct vop_exchange_args
/* {
398 struct ucred *a_cred;
403 nop_exchange(struct vop_exchange_args
*ap
)
409 err_exchange(struct vop_exchange_args
*ap
)
415 struct vop_revoke_args
/* {
421 nop_revoke(struct vop_revoke_args
*ap
)
423 return (vop_revoke(ap
));
427 err_revoke(struct vop_revoke_args
*ap
)
429 (void)nop_revoke(ap
);
434 struct vop_mmap_args
/* {
437 struct ucred *a_cred;
442 nop_mmap(struct vop_mmap_args
*ap
)
448 err_mmap(struct vop_mmap_args
*ap
)
454 struct vop_fsync_args
/* {
456 struct ucred *a_cred;
462 nop_fsync(struct vop_fsync_args
*ap
)
468 err_fsync(struct vop_fsync_args
*ap
)
474 struct vop_seek_args
/* {
478 struct ucred *a_cred;
482 nop_seek(struct vop_seek_args
*ap
)
488 err_seek(struct vop_seek_args
*ap
)
494 struct vop_remove_args
/* {
497 struct componentname *a_cnp;
501 nop_remove(struct vop_remove_args
*ap
)
503 if (ap
->a_dvp
== ap
->a_vp
)
512 err_remove(struct vop_remove_args
*ap
)
514 (void)nop_remove(ap
);
519 struct vop_link_args
/* {
521 struct vnode *a_tdvp;
522 struct componentname *a_cnp;
526 nop_link(struct vop_link_args
*ap
)
529 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
530 panic("nop_link: no name");
532 VOP_ABORTOP(ap
->a_tdvp
, ap
->a_cnp
);
538 err_link(struct vop_link_args
*ap
)
545 struct vop_rename_args
/* {
546 struct vnode *a_fdvp;
548 struct componentname *a_fcnp;
549 struct vnode *a_tdvp;
551 struct componentname *a_tcnp;
555 nop_rename(struct vop_rename_args
*ap
)
558 if ((ap
->a_tcnp
->cn_flags
& HASBUF
) == 0 ||
559 (ap
->a_fcnp
->cn_flags
& HASBUF
) == 0)
560 panic("nop_rename: no name");
562 VOP_ABORTOP(ap
->a_tdvp
, ap
->a_tcnp
);
563 if (ap
->a_tdvp
== ap
->a_tvp
)
569 VOP_ABORTOP(ap
->a_fdvp
, ap
->a_fcnp
);
576 err_rename(struct vop_rename_args
*ap
)
578 (void)nop_rename(ap
);
583 struct vop_mkdir_args
/* {
585 struct vnode **a_vpp;
586 struct componentname *a_cnp;
591 nop_mkdir(struct vop_mkdir_args
*ap
)
594 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
595 panic("nop_mkdir: no name");
597 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
603 err_mkdir(struct vop_mkdir_args
*ap
)
610 struct vop_rmdir_args
/* {
613 struct componentname *a_cnp;
617 nop_rmdir(struct vop_rmdir_args
*ap
)
625 err_rmdir(struct vop_rmdir_args
*ap
)
632 struct vop_symlink_args
/* {
634 struct vnode **a_vpp;
635 struct componentname *a_cnp;
641 nop_symlink(struct vop_symlink_args
*ap
)
644 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
645 panic("nop_symlink: no name");
647 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
653 err_symlink(struct vop_symlink_args
*ap
)
655 (void)nop_symlink(ap
);
660 struct vop_readdir_args
/* {
663 struct ucred *a_cred;
670 nop_readdir(struct vop_readdir_args
*ap
)
676 err_readdir(struct vop_readdir_args
*ap
)
682 struct vop_readdirattr_args
/* {
684 struct attrlist *a_alist;
690 u_long *a_actualcount;
692 struct ucred *a_cred;
696 nop_readdirattr(struct vop_readdirattr_args
*ap
)
698 *(ap
->a_actualcount
) = 0;
699 *(ap
->a_eofflag
) = 0;
704 err_readdirattr(struct vop_readdirattr_args
*ap
)
706 (void)nop_readdirattr(ap
);
711 struct vop_readlink_args
/* {
718 nop_readlink(struct vop_readlink_args
*ap
)
724 err_readlink(struct vop_readlink_args
*ap
)
730 struct vop_abortop_args
/* {
732 struct componentname *a_cnp;
736 nop_abortop(struct vop_abortop_args
*ap
)
738 if ((ap
->a_cnp
->cn_flags
& (HASBUF
| SAVESTART
)) == HASBUF
)
739 FREE_ZONE(ap
->a_cnp
->cn_pnbuf
, ap
->a_cnp
->cn_pnlen
, M_NAMEI
);
744 err_abortop(struct vop_abortop_args
*ap
)
746 (void)nop_abortop(ap
);
751 struct vop_inactive_args
/* {
757 nop_inactive(struct vop_inactive_args
*ap
)
759 VOP_UNLOCK(ap
->a_vp
, 0, ap
->a_p
);
764 err_inactive(struct vop_inactive_args
*ap
)
766 (void)nop_inactive(ap
);
771 struct vop_reclaim_args
/* {
777 nop_reclaim(struct vop_reclaim_args
*ap
)
783 err_reclaim(struct vop_reclaim_args
*ap
)
789 struct vop_lock_args
/* {
796 nop_lock(struct vop_lock_args
*ap
)
798 return (vop_nolock(ap
));
802 err_lock(struct vop_lock_args
*ap
)
809 struct vop_unlock_args
/* {
816 nop_unlock(struct vop_unlock_args
*ap
)
818 return (vop_nounlock(ap
));
822 err_unlock(struct vop_unlock_args
*ap
)
824 (void)nop_unlock(ap
);
829 struct vop_bmap_args
/* {
838 nop_bmap(struct vop_bmap_args
*ap
)
844 err_bmap(struct vop_bmap_args
*ap
)
850 struct vop_strategy_args
/* {
855 nop_strategy(struct vop_strategy_args
*ap
)
861 err_strategy(struct vop_strategy_args
*ap
)
867 struct vop_print_args
/* {
872 nop_print(struct vop_print_args
*ap
)
878 err_print(struct vop_print_args
*ap
)
884 struct vop_islocked_args
/* {
889 nop_islocked(struct vop_islocked_args
*ap
)
891 return (vop_noislocked(ap
));
895 err_islocked(struct vop_islocked_args
*ap
)
897 (void)nop_islocked(ap
);
902 struct vop_pathconf_args
/* {
905 register_t *a_retval;
909 nop_pathconf(struct vop_pathconf_args
*ap
)
915 err_pathconf(struct vop_pathconf_args
*ap
)
921 struct vop_advlock_args
/* {
930 nop_advlock(struct vop_advlock_args
*ap
)
936 err_advlock(struct vop_advlock_args
*ap
)
942 struct vop_blkatoff_args
/* {
950 nop_blkatoff(struct vop_blkatoff_args
*ap
)
957 err_blkatoff(struct vop_blkatoff_args
*ap
)
959 (void)nop_blkatoff(ap
);
964 struct vop_valloc_args
/* {
967 struct ucred *a_cred;
968 struct vnode **a_vpp;
972 nop_valloc(struct vop_valloc_args
*ap
)
979 err_valloc(struct vop_valloc_args
*ap
)
981 (void)nop_valloc(ap
);
986 struct vop_reallocblks_args
/* {
988 struct cluster_save *a_buflist;
992 nop_reallocblks(struct vop_reallocblks_args
*ap
)
998 err_reallocblks(struct vop_reallocblks_args
*ap
)
1000 return (EOPNOTSUPP
);
1004 struct vop_vfree_args
/* {
1005 struct vnode *a_pvp;
1011 nop_vfree(struct vop_vfree_args
*ap
)
1017 err_vfree(struct vop_vfree_args
*ap
)
1019 return (EOPNOTSUPP
);
1023 struct vop_truncate_args
/* {
1027 struct ucred *a_cred;
1032 nop_truncate(struct vop_truncate_args
*ap
)
1038 err_truncate(struct vop_truncate_args
*ap
)
1040 return (EOPNOTSUPP
);
1044 struct vop_allocate_args
/* {
1048 off_t *a_bytesallocated;
1050 struct ucred *a_cred;
1055 nop_allocate(struct vop_allocate_args
*ap
)
1057 *(ap
->a_bytesallocated
) = 0;
1062 err_allocate(struct vop_allocate_args
*ap
)
1064 (void)nop_allocate(ap
);
1065 return (EOPNOTSUPP
);
1069 struct vop_update_args
/* {
1071 struct timeval *a_access;
1072 struct timeval *a_modify;
1077 nop_update(struct vop_update_args
*ap
)
1083 err_update(struct vop_update_args
*ap
)
1085 return (EOPNOTSUPP
);
1089 struct vop_pgrd_args
/* {
1092 struct ucred *a_cred;
1096 nop_pgrd(struct vop_pgrd_args
*ap
)
1102 err_pgrd(struct vop_pgrd_args
*ap
)
1104 return (EOPNOTSUPP
);
1108 struct vop_pgwr_args
/* {
1111 struct ucred *a_cred;
1112 vm_offset_t a_offset;
1116 nop_pgwr(struct vop_pgwr_args
*ap
)
1122 err_pgwr(struct vop_pgwr_args
*ap
)
1124 return (EOPNOTSUPP
);
1128 struct vop_bwrite_args
/* {
1133 nop_bwrite(struct vop_bwrite_args
*ap
)
1135 return (bwrite(ap
->a_bp
));
1139 err_bwrite(struct vop_bwrite_args
*ap
)
1141 return (EOPNOTSUPP
);
1145 struct vop_pagein_args
/* {
1148 vm_offset_t a_pl_offset,
1151 struct ucred *a_cred,
1156 nop_pagein(struct vop_pagein_args
*ap
)
1158 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1163 err_pagein(struct vop_pagein_args
*ap
)
1165 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1166 return (EOPNOTSUPP
);
1170 struct vop_pageout_args
/* {
1173 vm_offset_t a_pl_offset,
1176 struct ucred *a_cred,
1181 nop_pageout(struct vop_pageout_args
*ap
)
1183 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1188 err_pageout(struct vop_pageout_args
*ap
)
1190 ubc_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1191 return (EOPNOTSUPP
);
1195 struct vop_devblocksize_args
/* {
1197 register_t *a_retval;
1201 nop_devblocksize(struct vop_devblocksize_args
*ap
)
1203 /* XXX default value because the call sites do not check error */
1204 *ap
->a_retval
= 512;
1209 err_devblocksize(struct vop_devblocksize_args
*ap
)
1211 (void)nop_devblocksize(ap
);
1212 return (EOPNOTSUPP
);
1216 struct vop_searchfs
/* {
1218 void *a_searchparams1;
1219 void *a_searchparams2;
1220 struct attrlist *a_searchattrs;
1221 u_long a_maxmatches;
1222 struct timeval *a_timelimit;
1223 struct attrlist *a_returnattrs;
1224 u_long *a_nummatches;
1225 u_long a_scriptcode;
1228 struct searchstate *a_searchstate;
1232 nop_searchfs(struct vop_searchfs_args
*ap
)
1234 *(ap
->a_nummatches
) = 0;
1239 err_searchfs(struct vop_searchfs_args
*ap
)
1241 (void)nop_searchfs(ap
);
1242 return (EOPNOTSUPP
);
1245 struct vop_copyfile_args
/*{
1246 struct vnodeop_desc *a_desc;
1247 struct vnode *a_fvp;
1248 struct vnode *a_tdvp;
1249 struct vnode *a_tvp;
1250 struct componentname *a_tcnp;
1255 nop_copyfile(struct vop_copyfile_args
*ap
)
1257 if (ap
->a_tdvp
== ap
->a_tvp
)
1269 err_copyfile(struct vop_copyfile_args
*ap
)
1271 (void)nop_copyfile(ap
);
1272 return (EOPNOTSUPP
);
1276 struct vop_blktooff_args
/* {
1283 nop_blktooff(struct vop_blktooff_args
*ap
)
1285 *ap
->a_offset
= (off_t
)-1; /* failure */
1290 err_blktooff(struct vop_blktooff_args
*ap
)
1292 (void)nop_blktooff(ap
);
1293 return (EOPNOTSUPP
);
1296 struct vop_offtoblk_args
/* {
1303 nop_offtoblk(struct vop_offtoblk_args
*ap
)
1305 *ap
->a_lblkno
= (daddr_t
)-1; /* failure */
1310 err_offtoblk(struct vop_offtoblk_args
*ap
)
1312 (void)nop_offtoblk(ap
);
1313 return (EOPNOTSUPP
);
1316 struct vop_cmap_args
/* {
1325 int nop_cmap(struct vop_cmap_args
*ap
)
1330 int err_cmap(struct vop_cmap_args
*ap
)
1332 return (EOPNOTSUPP
);