]>
git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vfs_support.c
24a1fa77aa443b1095f89bfb7a0b6dee6d10ce42
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;
382 nop_select(struct vop_select_args
*ap
)
388 err_select(struct vop_select_args
*ap
)
394 struct vop_exchange_args
/* {
397 struct ucred *a_cred;
402 nop_exchange(struct vop_exchange_args
*ap
)
408 err_exchange(struct vop_exchange_args
*ap
)
414 struct vop_revoke_args
/* {
420 nop_revoke(struct vop_revoke_args
*ap
)
422 return (vop_revoke(ap
));
426 err_revoke(struct vop_revoke_args
*ap
)
428 (void)nop_revoke(ap
);
433 struct vop_mmap_args
/* {
436 struct ucred *a_cred;
441 nop_mmap(struct vop_mmap_args
*ap
)
447 err_mmap(struct vop_mmap_args
*ap
)
453 struct vop_fsync_args
/* {
455 struct ucred *a_cred;
461 nop_fsync(struct vop_fsync_args
*ap
)
467 err_fsync(struct vop_fsync_args
*ap
)
473 struct vop_seek_args
/* {
477 struct ucred *a_cred;
481 nop_seek(struct vop_seek_args
*ap
)
487 err_seek(struct vop_seek_args
*ap
)
493 struct vop_remove_args
/* {
496 struct componentname *a_cnp;
500 nop_remove(struct vop_remove_args
*ap
)
502 if (ap
->a_dvp
== ap
->a_vp
)
511 err_remove(struct vop_remove_args
*ap
)
513 (void)nop_remove(ap
);
518 struct vop_link_args
/* {
520 struct vnode *a_tdvp;
521 struct componentname *a_cnp;
525 nop_link(struct vop_link_args
*ap
)
528 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
529 panic("nop_link: no name");
531 VOP_ABORTOP(ap
->a_tdvp
, ap
->a_cnp
);
537 err_link(struct vop_link_args
*ap
)
544 struct vop_rename_args
/* {
545 struct vnode *a_fdvp;
547 struct componentname *a_fcnp;
548 struct vnode *a_tdvp;
550 struct componentname *a_tcnp;
554 nop_rename(struct vop_rename_args
*ap
)
557 if ((ap
->a_tcnp
->cn_flags
& HASBUF
) == 0 ||
558 (ap
->a_fcnp
->cn_flags
& HASBUF
) == 0)
559 panic("nop_rename: no name");
561 VOP_ABORTOP(ap
->a_tdvp
, ap
->a_tcnp
);
562 if (ap
->a_tdvp
== ap
->a_tvp
)
568 VOP_ABORTOP(ap
->a_fdvp
, ap
->a_fcnp
);
575 err_rename(struct vop_rename_args
*ap
)
577 (void)nop_rename(ap
);
582 struct vop_mkdir_args
/* {
584 struct vnode **a_vpp;
585 struct componentname *a_cnp;
590 nop_mkdir(struct vop_mkdir_args
*ap
)
593 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
594 panic("nop_mkdir: no name");
596 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
602 err_mkdir(struct vop_mkdir_args
*ap
)
609 struct vop_rmdir_args
/* {
612 struct componentname *a_cnp;
616 nop_rmdir(struct vop_rmdir_args
*ap
)
624 err_rmdir(struct vop_rmdir_args
*ap
)
631 struct vop_symlink_args
/* {
633 struct vnode **a_vpp;
634 struct componentname *a_cnp;
640 nop_symlink(struct vop_symlink_args
*ap
)
643 if ((ap
->a_cnp
->cn_flags
& HASBUF
) == 0)
644 panic("nop_symlink: no name");
646 VOP_ABORTOP(ap
->a_dvp
, ap
->a_cnp
);
652 err_symlink(struct vop_symlink_args
*ap
)
654 (void)nop_symlink(ap
);
659 struct vop_readdir_args
/* {
662 struct ucred *a_cred;
669 nop_readdir(struct vop_readdir_args
*ap
)
675 err_readdir(struct vop_readdir_args
*ap
)
681 struct vop_readdirattr_args
/* {
683 struct attrlist *a_alist;
689 u_long *a_actualcount;
691 struct ucred *a_cred;
695 nop_readdirattr(struct vop_readdirattr_args
*ap
)
697 *(ap
->a_actualcount
) = 0;
698 *(ap
->a_eofflag
) = 0;
703 err_readdirattr(struct vop_readdirattr_args
*ap
)
705 (void)nop_readdirattr(ap
);
710 struct vop_readlink_args
/* {
717 nop_readlink(struct vop_readlink_args
*ap
)
723 err_readlink(struct vop_readlink_args
*ap
)
729 struct vop_abortop_args
/* {
731 struct componentname *a_cnp;
735 nop_abortop(struct vop_abortop_args
*ap
)
737 if ((ap
->a_cnp
->cn_flags
& (HASBUF
| SAVESTART
)) == HASBUF
)
738 FREE_ZONE(ap
->a_cnp
->cn_pnbuf
, ap
->a_cnp
->cn_pnlen
, M_NAMEI
);
743 err_abortop(struct vop_abortop_args
*ap
)
745 (void)nop_abortop(ap
);
750 struct vop_inactive_args
/* {
756 nop_inactive(struct vop_inactive_args
*ap
)
758 VOP_UNLOCK(ap
->a_vp
, 0, ap
->a_p
);
763 err_inactive(struct vop_inactive_args
*ap
)
765 (void)nop_inactive(ap
);
770 struct vop_reclaim_args
/* {
776 nop_reclaim(struct vop_reclaim_args
*ap
)
782 err_reclaim(struct vop_reclaim_args
*ap
)
788 struct vop_lock_args
/* {
795 nop_lock(struct vop_lock_args
*ap
)
797 return (vop_nolock(ap
));
801 err_lock(struct vop_lock_args
*ap
)
808 struct vop_unlock_args
/* {
815 nop_unlock(struct vop_unlock_args
*ap
)
817 return (vop_nounlock(ap
));
821 err_unlock(struct vop_unlock_args
*ap
)
823 (void)nop_unlock(ap
);
828 struct vop_bmap_args
/* {
837 nop_bmap(struct vop_bmap_args
*ap
)
843 err_bmap(struct vop_bmap_args
*ap
)
849 struct vop_strategy_args
/* {
854 nop_strategy(struct vop_strategy_args
*ap
)
860 err_strategy(struct vop_strategy_args
*ap
)
866 struct vop_print_args
/* {
871 nop_print(struct vop_print_args
*ap
)
877 err_print(struct vop_print_args
*ap
)
883 struct vop_islocked_args
/* {
888 nop_islocked(struct vop_islocked_args
*ap
)
890 return (vop_noislocked(ap
));
894 err_islocked(struct vop_islocked_args
*ap
)
896 (void)nop_islocked(ap
);
901 struct vop_pathconf_args
/* {
904 register_t *a_retval;
908 nop_pathconf(struct vop_pathconf_args
*ap
)
914 err_pathconf(struct vop_pathconf_args
*ap
)
920 struct vop_advlock_args
/* {
929 nop_advlock(struct vop_advlock_args
*ap
)
935 err_advlock(struct vop_advlock_args
*ap
)
941 struct vop_blkatoff_args
/* {
949 nop_blkatoff(struct vop_blkatoff_args
*ap
)
956 err_blkatoff(struct vop_blkatoff_args
*ap
)
958 (void)nop_blkatoff(ap
);
963 struct vop_valloc_args
/* {
966 struct ucred *a_cred;
967 struct vnode **a_vpp;
971 nop_valloc(struct vop_valloc_args
*ap
)
978 err_valloc(struct vop_valloc_args
*ap
)
980 (void)nop_valloc(ap
);
985 struct vop_reallocblks_args
/* {
987 struct cluster_save *a_buflist;
991 nop_reallocblks(struct vop_reallocblks_args
*ap
)
997 err_reallocblks(struct vop_reallocblks_args
*ap
)
1003 struct vop_vfree_args
/* {
1004 struct vnode *a_pvp;
1010 nop_vfree(struct vop_vfree_args
*ap
)
1016 err_vfree(struct vop_vfree_args
*ap
)
1018 return (EOPNOTSUPP
);
1022 struct vop_truncate_args
/* {
1026 struct ucred *a_cred;
1031 nop_truncate(struct vop_truncate_args
*ap
)
1037 err_truncate(struct vop_truncate_args
*ap
)
1039 return (EOPNOTSUPP
);
1043 struct vop_allocate_args
/* {
1047 off_t *a_bytesallocated;
1048 struct ucred *a_cred;
1053 nop_allocate(struct vop_allocate_args
*ap
)
1055 *(ap
->a_bytesallocated
) = 0;
1060 err_allocate(struct vop_allocate_args
*ap
)
1062 (void)nop_allocate(ap
);
1063 return (EOPNOTSUPP
);
1067 struct vop_update_args
/* {
1069 struct timeval *a_access;
1070 struct timeval *a_modify;
1075 nop_update(struct vop_update_args
*ap
)
1081 err_update(struct vop_update_args
*ap
)
1083 return (EOPNOTSUPP
);
1087 struct vop_pgrd_args
/* {
1090 struct ucred *a_cred;
1094 nop_pgrd(struct vop_pgrd_args
*ap
)
1100 err_pgrd(struct vop_pgrd_args
*ap
)
1102 return (EOPNOTSUPP
);
1106 struct vop_pgwr_args
/* {
1109 struct ucred *a_cred;
1110 vm_offset_t a_offset;
1114 nop_pgwr(struct vop_pgwr_args
*ap
)
1120 err_pgwr(struct vop_pgwr_args
*ap
)
1122 return (EOPNOTSUPP
);
1126 struct vop_bwrite_args
/* {
1131 nop_bwrite(struct vop_bwrite_args
*ap
)
1133 return (bwrite(ap
->a_bp
));
1137 err_bwrite(struct vop_bwrite_args
*ap
)
1139 return (EOPNOTSUPP
);
1143 struct vop_pagein_args
/* {
1146 vm_offset_t a_pl_offset,
1149 struct ucred *a_cred,
1154 nop_pagein(struct vop_pagein_args
*ap
)
1156 kernel_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1161 err_pagein(struct vop_pagein_args
*ap
)
1163 kernel_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1164 return (EOPNOTSUPP
);
1168 struct vop_pageout_args
/* {
1171 vm_offset_t a_pl_offset,
1174 struct ucred *a_cred,
1179 nop_pageout(struct vop_pageout_args
*ap
)
1181 kernel_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1186 err_pageout(struct vop_pageout_args
*ap
)
1188 kernel_upl_abort(ap
->a_pl
, UPL_ABORT_ERROR
);
1189 return (EOPNOTSUPP
);
1193 struct vop_devblocksize_args
/* {
1195 register_t *a_retval;
1199 nop_devblocksize(struct vop_devblocksize_args
*ap
)
1201 /* XXX default value because the call sites do not check error */
1202 *ap
->a_retval
= 512;
1207 err_devblocksize(struct vop_devblocksize_args
*ap
)
1209 (void)nop_devblocksize(ap
);
1210 return (EOPNOTSUPP
);
1214 struct vop_searchfs
/* {
1216 void *a_searchparams1;
1217 void *a_searchparams2;
1218 struct attrlist *a_searchattrs;
1219 u_long a_maxmatches;
1220 struct timeval *a_timelimit;
1221 struct attrlist *a_returnattrs;
1222 u_long *a_nummatches;
1223 u_long a_scriptcode;
1226 struct searchstate *a_searchstate;
1230 nop_searchfs(struct vop_searchfs_args
*ap
)
1232 *(ap
->a_nummatches
) = 0;
1237 err_searchfs(struct vop_searchfs_args
*ap
)
1239 (void)nop_searchfs(ap
);
1240 return (EOPNOTSUPP
);
1243 struct vop_copyfile_args
/*{
1244 struct vnodeop_desc *a_desc;
1245 struct vnode *a_fvp;
1246 struct vnode *a_tdvp;
1247 struct vnode *a_tvp;
1248 struct componentname *a_tcnp;
1253 nop_copyfile(struct vop_copyfile_args
*ap
)
1255 if (ap
->a_tdvp
== ap
->a_tvp
)
1267 err_copyfile(struct vop_copyfile_args
*ap
)
1269 (void)nop_copyfile(ap
);
1270 return (EOPNOTSUPP
);
1274 struct vop_blktooff_args
/* {
1281 nop_blktooff(struct vop_blktooff_args
*ap
)
1283 *ap
->a_offset
= (off_t
)-1; /* failure */
1288 err_blktooff(struct vop_blktooff_args
*ap
)
1290 (void)nop_blktooff(ap
);
1291 return (EOPNOTSUPP
);
1294 struct vop_offtoblk_args
/* {
1301 nop_offtoblk(struct vop_offtoblk_args
*ap
)
1303 *ap
->a_lblkno
= (daddr_t
)-1; /* failure */
1308 err_offtoblk(struct vop_offtoblk_args
*ap
)
1310 (void)nop_offtoblk(ap
);
1311 return (EOPNOTSUPP
);
1314 struct vop_cmap_args
/* {
1323 int nop_cmap(struct vop_cmap_args
*ap
)
1328 int err_cmap(struct vop_cmap_args
*ap
)
1330 return (EOPNOTSUPP
);