xref: /xnu-12377.41.6/bsd/vfs/vfs_support.c (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
1 /*
2  * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
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.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
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.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 /*
29  * Copyright (c) 1998-1999 Apple Computer, Inc.  All rights reserved.
30  *
31  *  File:  vfs/vfs_support.c
32  *
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
36  *	supposed to.
37  *
38  *	nop_* routines always return 0 [success]
39  *	err_* routines always return ENOTSUP
40  *
41  *	This file could be auto-generated from vnode_if.src. but that needs
42  *	support for freeing cnp.
43  *
44  * HISTORY
45  *  15-Jul-1998 Earsh Nandkeshwar ([email protected])
46  *      Fixed up readdirattr for its existance now.
47  *  18-Aug-1998 Umesh Vaishampayan ([email protected])
48  *      Created.
49  */
50 
51 #include <vfs/vfs_support.h>
52 #include <sys/kauth.h>
53 #include <sys/ubc.h>    /* ubc_upl_abort_range() */
54 
55 
56 struct vnop_create_args /* {
57                          *  struct vnode *a_dvp;
58                          *  struct vnode **a_vpp;
59                          *  struct componentname *a_cnp;
60                          *  struct vnode_vattr *a_vap;
61                          *  vfs_context_t a_context;
62                          *  } */;
63 
64 int
nop_create(__unused struct vnop_create_args * ap)65 nop_create(__unused struct vnop_create_args *ap)
66 {
67 #if DIAGNOSTIC
68 	if ((ap->a_cnp->cn_flags & HASBUF) == 0) {
69 		panic("nop_create: no name");
70 	}
71 #endif
72 	return 0;
73 }
74 
75 int
err_create(struct vnop_create_args * ap)76 err_create(struct vnop_create_args *ap)
77 {
78 	(void)nop_create(ap);
79 	return ENOTSUP;
80 }
81 
82 
83 struct vnop_whiteout_args /* {
84                            *  struct vnode *a_dvp;
85                            *  struct componentname *a_cnp;
86                            *  int a_flags;
87                            *  vfs_context_t a_context;
88                            *  } */;
89 
90 int
nop_whiteout(__unused struct vnop_whiteout_args * ap)91 nop_whiteout(__unused struct vnop_whiteout_args *ap)
92 {
93 	return 0;
94 }
95 
96 int
err_whiteout(__unused struct vnop_whiteout_args * ap)97 err_whiteout(__unused struct vnop_whiteout_args *ap)
98 {
99 	return ENOTSUP;
100 }
101 
102 
103 struct vnop_mknod_args /* {
104                         *  struct vnode *a_dvp;
105                         *  struct vnode **a_vpp;
106                         *  struct componentname *a_cnp;
107                         *  struct vnode_vattr *a_vap;
108                         *  vfs_context_t a_context;
109                         *  } */;
110 
111 int
nop_mknod(__unused struct vnop_mknod_args * ap)112 nop_mknod(__unused struct vnop_mknod_args *ap)
113 {
114 #if DIAGNOSTIC
115 	if ((ap->a_cnp->cn_flags & HASBUF) == 0) {
116 		panic("nop_mknod: no name");
117 	}
118 #endif
119 	return 0;
120 }
121 
122 int
err_mknod(struct vnop_mknod_args * ap)123 err_mknod(struct vnop_mknod_args *ap)
124 {
125 	(void)nop_mknod(ap);
126 	return ENOTSUP;
127 }
128 
129 struct vnop_open_args /* {
130                        *  struct vnode *a_vp;
131                        *  int  a_mode;
132                        *  vfs_context_t a_context;
133                        *  } */;
134 
135 int
nop_open(__unused struct vnop_open_args * ap)136 nop_open(__unused struct vnop_open_args *ap)
137 {
138 	return 0;
139 }
140 
141 int
err_open(__unused struct vnop_open_args * ap)142 err_open(__unused struct vnop_open_args *ap)
143 {
144 	return ENOTSUP;
145 }
146 
147 
148 struct vnop_close_args /* {
149                         *  struct vnode *a_vp;
150                         *  int  a_fflag;
151                         *  vfs_context_t a_context;
152                         *  } */;
153 
154 int
nop_close(__unused struct vnop_close_args * ap)155 nop_close(__unused struct vnop_close_args *ap)
156 {
157 	return 0;
158 }
159 
160 int
err_close(__unused struct vnop_close_args * ap)161 err_close(__unused struct vnop_close_args *ap)
162 {
163 	return ENOTSUP;
164 }
165 
166 
167 struct vnop_access_args /* {
168                          *  struct vnode *a_vp;
169                          *  int  a_mode;
170                          *  vfs_context_t a_context;
171                          *  } */;
172 
173 int
nop_access(__unused struct vnop_access_args * ap)174 nop_access(__unused struct vnop_access_args *ap)
175 {
176 	return 0;
177 }
178 
179 int
err_access(__unused struct vnop_access_args * ap)180 err_access(__unused struct vnop_access_args *ap)
181 {
182 	return ENOTSUP;
183 }
184 
185 
186 struct vnop_getattr_args /* {
187                           *  struct vnode *a_vp;
188                           *  struct vnode_vattr *a_vap;
189                           *  vfs_context_t a_context;
190                           *  } */;
191 
192 int
nop_getattr(__unused struct vnop_getattr_args * ap)193 nop_getattr(__unused struct vnop_getattr_args *ap)
194 {
195 	return 0;
196 }
197 
198 int
err_getattr(__unused struct vnop_getattr_args * ap)199 err_getattr(__unused struct vnop_getattr_args *ap)
200 {
201 	return ENOTSUP;
202 }
203 
204 
205 struct vnop_setattr_args /* {
206                           *  struct vnode *a_vp;
207                           *  struct vnode_vattr *a_vap;
208                           *  vfs_context_t a_context;
209                           *  } */;
210 
211 int
nop_setattr(__unused struct vnop_setattr_args * ap)212 nop_setattr(__unused struct vnop_setattr_args *ap)
213 {
214 	return 0;
215 }
216 
217 int
err_setattr(__unused struct vnop_setattr_args * ap)218 err_setattr(__unused struct vnop_setattr_args *ap)
219 {
220 	return ENOTSUP;
221 }
222 
223 struct vnop_read_args /*  {
224                        *  struct vnode *a_vp;
225                        *  struct uio *a_uio;
226                        *  int a_ioflag;
227                        *  vfs_context_t a_context;
228                        *  } */;
229 
230 int
nop_read(__unused struct vnop_read_args * ap)231 nop_read(__unused struct vnop_read_args *ap)
232 {
233 	return 0;
234 }
235 
236 int
err_read(__unused struct vnop_read_args * ap)237 err_read(__unused struct vnop_read_args *ap)
238 {
239 	return ENOTSUP;
240 }
241 
242 
243 struct vnop_write_args /*  {
244                         *  struct vnode *a_vp;
245                         *  struct uio *a_uio;
246                         *  int a_ioflag;
247                         *  vfs_context_t a_context;
248                         *  } */;
249 
250 int
nop_write(__unused struct vnop_write_args * ap)251 nop_write(__unused struct vnop_write_args *ap)
252 {
253 	return 0;
254 }
255 
256 int
err_write(__unused struct vnop_write_args * ap)257 err_write(__unused struct vnop_write_args *ap)
258 {
259 	return ENOTSUP;
260 }
261 
262 
263 struct vnop_ioctl_args /* {
264                         *  struct vnode *a_vp;
265                         *  u_long a_command;
266                         *  caddr_t a_data;
267                         *  int a_fflag;
268                         *  kauth_cred_t a_cred;
269                         *  struct proc *a_p;
270                         *  } */;
271 
272 int
nop_ioctl(__unused struct vnop_ioctl_args * ap)273 nop_ioctl(__unused struct vnop_ioctl_args *ap)
274 {
275 	return 0;
276 }
277 
278 int
err_ioctl(__unused struct vnop_ioctl_args * ap)279 err_ioctl(__unused struct vnop_ioctl_args *ap)
280 {
281 	return ENOTSUP;
282 }
283 
284 
285 struct vnop_select_args /* {
286                          *  struct vnode *a_vp;
287                          *  int a_which;
288                          *  int a_fflags;
289                          *  kauth_cred_t a_cred;
290                          *  void *a_wql;
291                          *  struct proc *a_p;
292                          *  } */;
293 
294 int
nop_select(__unused struct vnop_select_args * ap)295 nop_select(__unused struct vnop_select_args *ap)
296 {
297 	return 0;
298 }
299 
300 int
err_select(__unused struct vnop_select_args * ap)301 err_select(__unused struct vnop_select_args *ap)
302 {
303 	return ENOTSUP;
304 }
305 
306 
307 struct vnop_exchange_args /* {
308                            *  struct vnode *a_fvp;
309                            *  struct vnode *a_tvp;
310                            *  int a_options;
311                            *  vfs_context_t a_context;
312                            *  } */;
313 
314 int
nop_exchange(__unused struct vnop_exchange_args * ap)315 nop_exchange(__unused struct vnop_exchange_args *ap)
316 {
317 	return 0;
318 }
319 
320 int
err_exchange(__unused struct vnop_exchange_args * ap)321 err_exchange(__unused struct vnop_exchange_args *ap)
322 {
323 	return ENOTSUP;
324 }
325 
326 
327 struct vnop_revoke_args /* {
328                          *  struct vnode *a_vp;
329                          *  int a_flags;
330                          *  vfs_context_t a_context;
331                          *  } */;
332 
333 int
nop_revoke(struct vnop_revoke_args * ap)334 nop_revoke(struct vnop_revoke_args *ap)
335 {
336 	return vn_revoke(ap->a_vp, ap->a_flags, ap->a_context);
337 }
338 
339 int
err_revoke(struct vnop_revoke_args * ap)340 err_revoke(struct vnop_revoke_args *ap)
341 {
342 	(void)nop_revoke(ap);
343 	return ENOTSUP;
344 }
345 
346 
347 struct vnop_mmap_args /* {
348                        *  struct vnode *a_vp;
349                        *  int a_fflags;
350                        *  kauth_cred_t a_cred;
351                        *  struct proc *a_p;
352                        *  } */;
353 
354 int
nop_mmap(__unused struct vnop_mmap_args * ap)355 nop_mmap(__unused struct vnop_mmap_args *ap)
356 {
357 	return 0;
358 }
359 
360 int
err_mmap(__unused struct vnop_mmap_args * ap)361 err_mmap(__unused struct vnop_mmap_args *ap)
362 {
363 	return ENOTSUP;
364 }
365 
366 
367 struct vnop_fsync_args /* {
368                         *  struct vnode *a_vp;
369                         *  int a_waitfor;
370                         *  vfs_context_t a_context;
371                         *  } */;
372 
373 int
nop_fsync(__unused struct vnop_fsync_args * ap)374 nop_fsync(__unused struct vnop_fsync_args *ap)
375 {
376 	return 0;
377 }
378 
379 int
err_fsync(__unused struct vnop_fsync_args * ap)380 err_fsync(__unused struct vnop_fsync_args *ap)
381 {
382 	return ENOTSUP;
383 }
384 
385 
386 struct vnop_remove_args /* {
387                          *  struct vnode *a_dvp;
388                          *  struct vnode *a_vp;
389                          *  struct componentname *a_cnp;
390                          *  int a_flags;
391                          *  vfs_context_t a_context;
392                          *  } */;
393 
394 int
nop_remove(__unused struct vnop_remove_args * ap)395 nop_remove(__unused struct vnop_remove_args *ap)
396 {
397 	return 0;
398 }
399 
400 int
err_remove(struct vnop_remove_args * ap)401 err_remove(struct vnop_remove_args *ap)
402 {
403 	(void)nop_remove(ap);
404 	return ENOTSUP;
405 }
406 
407 
408 struct vnop_link_args /* {
409                        *  struct vnode *a_vp;
410                        *  struct vnode *a_tdvp;
411                        *  struct componentname *a_cnp;
412                        *  vfs_context_t a_context;
413                        *  } */;
414 
415 int
nop_link(__unused struct vnop_link_args * ap)416 nop_link(__unused struct vnop_link_args *ap)
417 {
418 	return 0;
419 }
420 
421 int
err_link(struct vnop_link_args * ap)422 err_link(struct vnop_link_args *ap)
423 {
424 	(void)nop_link(ap);
425 	return ENOTSUP;
426 }
427 
428 
429 struct vnop_rename_args /* {
430                          *  struct vnode *a_fdvp;
431                          *  struct vnode *a_fvp;
432                          *  struct componentname *a_fcnp;
433                          *  struct vnode *a_tdvp;
434                          *  struct vnode *a_tvp;
435                          *  struct componentname *a_tcnp;
436                          *  vfs_context_t a_context;
437                          *  } */;
438 
439 int
nop_rename(__unused struct vnop_rename_args * ap)440 nop_rename(__unused struct vnop_rename_args *ap)
441 {
442 	return 0;
443 }
444 
445 int
err_rename(struct vnop_rename_args * ap)446 err_rename(struct vnop_rename_args *ap)
447 {
448 	(void)nop_rename(ap);
449 	return ENOTSUP;
450 }
451 
452 
453 struct vnop_mkdir_args /* {
454                         *  struct vnode *a_dvp;
455                         *  struct vnode **a_vpp;
456                         *  struct componentname *a_cnp;
457                         *  struct vnode_vattr *a_vap;
458                         *  vfs_context_t a_context;
459                         *  } */;
460 
461 int
nop_mkdir(__unused struct vnop_mkdir_args * ap)462 nop_mkdir(__unused struct vnop_mkdir_args *ap)
463 {
464 	return 0;
465 }
466 
467 int
err_mkdir(__unused struct vnop_mkdir_args * ap)468 err_mkdir(__unused struct vnop_mkdir_args *ap)
469 {
470 	return ENOTSUP;
471 }
472 
473 
474 struct vnop_rmdir_args /* {
475                         *  struct vnode *a_dvp;
476                         *  struct vnode *a_vp;
477                         *  struct componentname *a_cnp;
478                         *  vfs_context_t a_context;
479                         *  } */;
480 
481 int
nop_rmdir(__unused struct vnop_rmdir_args * ap)482 nop_rmdir(__unused struct vnop_rmdir_args *ap)
483 {
484 	return 0;
485 }
486 
487 int
err_rmdir(struct vnop_rmdir_args * ap)488 err_rmdir(struct vnop_rmdir_args *ap)
489 {
490 	(void)nop_rmdir(ap);
491 	return ENOTSUP;
492 }
493 
494 
495 struct vnop_symlink_args /* {
496                           *  struct vnode *a_dvp;
497                           *  struct vnode **a_vpp;
498                           *  struct componentname *a_cnp;
499                           *  struct vnode_vattr *a_vap;
500                           *  char *a_target;
501                           *  vfs_context_t a_context;
502                           *  } */;
503 
504 int
nop_symlink(__unused struct vnop_symlink_args * ap)505 nop_symlink(__unused struct vnop_symlink_args *ap)
506 {
507 #if DIAGNOSTIC
508 	if ((ap->a_cnp->cn_flags & HASBUF) == 0) {
509 		panic("nop_symlink: no name");
510 	}
511 #endif
512 	return 0;
513 }
514 
515 int
err_symlink(struct vnop_symlink_args * ap)516 err_symlink(struct vnop_symlink_args *ap)
517 {
518 	(void)nop_symlink(ap);
519 	return ENOTSUP;
520 }
521 
522 
523 struct vnop_readdir_args /* {
524                           *  vnode_t a_vp;
525                           *  struct uio *a_uio;
526                           *  int a_flags;
527                           *  int *a_eofflag;
528                           *  int *a_numdirent;
529                           *  vfs_context_t a_context;
530                           *  } */;
531 
532 int
nop_readdir(__unused struct vnop_readdir_args * ap)533 nop_readdir(__unused struct vnop_readdir_args *ap)
534 {
535 	return 0;
536 }
537 
538 int
err_readdir(__unused struct vnop_readdir_args * ap)539 err_readdir(__unused struct vnop_readdir_args *ap)
540 {
541 	return ENOTSUP;
542 }
543 
544 
545 struct vnop_readdirattr_args /* {
546                               *  struct vnodeop_desc *a_desc;
547                               *  vnode_t a_vp;
548                               *  struct attrlist *a_alist;
549                               *  struct uio *a_uio;
550                               *  u_long a_maxcount;
551                               *  u_long a_options;
552                               *  u_long *a_newstate;
553                               *  int *a_eofflag;
554                               *  u_long *a_actualcount;
555                               *  vfs_context_t a_context;
556                               *  } */;
557 
558 int
nop_readdirattr(struct vnop_readdirattr_args * ap)559 nop_readdirattr(struct vnop_readdirattr_args *ap)
560 {
561 	*(ap->a_actualcount) = 0;
562 	*(ap->a_eofflag) = 0;
563 	return 0;
564 }
565 
566 int
err_readdirattr(struct vnop_readdirattr_args * ap)567 err_readdirattr(struct vnop_readdirattr_args *ap)
568 {
569 	(void)nop_readdirattr(ap);
570 	return ENOTSUP;
571 }
572 
573 
574 struct vnop_readlink_args /* {
575                            *  struct vnode *vp;
576                            *  struct uio *uio;
577                            *  vfs_context_t a_context;
578                            *  } */;
579 
580 int
nop_readlink(__unused struct vnop_readlink_args * ap)581 nop_readlink(__unused struct vnop_readlink_args *ap)
582 {
583 	return 0;
584 }
585 
586 int
err_readlink(__unused struct vnop_readlink_args * ap)587 err_readlink(__unused struct vnop_readlink_args *ap)
588 {
589 	return ENOTSUP;
590 }
591 
592 
593 struct vnop_inactive_args /* {
594                            *  struct vnode *a_vp;
595                            *  vfs_context_t a_context;
596                            *  } */;
597 
598 int
nop_inactive(__unused struct vnop_inactive_args * ap)599 nop_inactive(__unused struct vnop_inactive_args *ap)
600 {
601 	return 0;
602 }
603 
604 int
err_inactive(struct vnop_inactive_args * ap)605 err_inactive(struct vnop_inactive_args *ap)
606 {
607 	(void)nop_inactive(ap);
608 	return ENOTSUP;
609 }
610 
611 
612 struct vnop_reclaim_args /* {
613                           *  struct vnode *a_vp;
614                           *  vfs_context_t a_context;
615                           *  } */;
616 
617 int
nop_reclaim(__unused struct vnop_reclaim_args * ap)618 nop_reclaim(__unused struct vnop_reclaim_args *ap)
619 {
620 	return 0;
621 }
622 
623 int
err_reclaim(__unused struct vnop_reclaim_args * ap)624 err_reclaim(__unused struct vnop_reclaim_args *ap)
625 {
626 	return ENOTSUP;
627 }
628 
629 
630 struct vnop_strategy_args /* {
631                            *  struct buf *a_bp;
632                            *  } */;
633 
634 int
nop_strategy(__unused struct vnop_strategy_args * ap)635 nop_strategy(__unused struct vnop_strategy_args *ap)
636 {
637 	return 0;
638 }
639 
640 int
err_strategy(__unused struct vnop_strategy_args * ap)641 err_strategy(__unused struct vnop_strategy_args *ap)
642 {
643 	return ENOTSUP;
644 }
645 
646 
647 struct vnop_pathconf_args /* {
648                            *  struct vnode *a_vp;
649                            *  int a_name;
650                            *  int32_t *a_retval;
651                            *  vfs_context_t a_context;
652                            *  } */;
653 
654 int
nop_pathconf(__unused struct vnop_pathconf_args * ap)655 nop_pathconf(__unused struct vnop_pathconf_args *ap)
656 {
657 	return 0;
658 }
659 
660 int
err_pathconf(__unused struct vnop_pathconf_args * ap)661 err_pathconf(__unused struct vnop_pathconf_args *ap)
662 {
663 	return ENOTSUP;
664 }
665 
666 
667 struct vnop_advlock_args /* {
668                           *  struct vnode *a_vp;
669                           *  caddr_t a_id;
670                           *  int a_op;
671                           *  struct flock *a_fl;
672                           *  int a_flags;
673                           *  vfs_context_t a_context;
674                           *  } */;
675 
676 int
nop_advlock(__unused struct vnop_advlock_args * ap)677 nop_advlock(__unused struct vnop_advlock_args *ap)
678 {
679 	return 0;
680 }
681 
682 int
err_advlock(__unused struct vnop_advlock_args * ap)683 err_advlock(__unused struct vnop_advlock_args *ap)
684 {
685 	return ENOTSUP;
686 }
687 
688 
689 
690 struct vnop_allocate_args /* {
691                            *  struct vnode *a_vp;
692                            *  off_t a_length;
693                            *  u_int32_t a_flags;
694                            *  off_t *a_bytesallocated;
695                            *  off_t a_offset;
696                            *  vfs_context_t a_context;
697                            *  } */;
698 
699 int
nop_allocate(struct vnop_allocate_args * ap)700 nop_allocate(struct vnop_allocate_args *ap)
701 {
702 	*(ap->a_bytesallocated) = 0;
703 	return 0;
704 }
705 
706 int
err_allocate(struct vnop_allocate_args * ap)707 err_allocate(struct vnop_allocate_args *ap)
708 {
709 	(void)nop_allocate(ap);
710 	return ENOTSUP;
711 }
712 
713 struct vnop_bwrite_args /* {
714                          *  struct buf *a_bp;
715                          *  } */;
716 
717 int
nop_bwrite(struct vnop_bwrite_args * ap)718 nop_bwrite(struct vnop_bwrite_args *ap)
719 {
720 	return (int)buf_bwrite(ap->a_bp);
721 }
722 
723 int
err_bwrite(__unused struct vnop_bwrite_args * ap)724 err_bwrite(__unused struct vnop_bwrite_args *ap)
725 {
726 	return ENOTSUP;
727 }
728 
729 
730 struct vnop_pagein_args /* {
731                          *  struct vnode        *a_vp,
732                          *  upl_t		a_pl,
733                          *  vm_offset_t	a_pl_offset,
734                          *  off_t		a_foffset,
735                          *  size_t		a_size,
736                          *  int		a_flags
737                          *  vfs_context_t a_context;
738                          *  } */;
739 
740 int
nop_pagein(struct vnop_pagein_args * ap)741 nop_pagein(struct vnop_pagein_args *ap)
742 {
743 	if (!(ap->a_flags & UPL_NOCOMMIT)) {
744 		assert(ap->a_size <= UINT32_MAX);
745 		ubc_upl_abort_range(ap->a_pl, ap->a_pl_offset, (upl_size_t)ap->a_size, UPL_ABORT_FREE_ON_EMPTY | UPL_ABORT_ERROR);
746 	}
747 	return EINVAL;
748 }
749 
750 int
err_pagein(struct vnop_pagein_args * ap)751 err_pagein(struct vnop_pagein_args *ap)
752 {
753 	if (!(ap->a_flags & UPL_NOCOMMIT)) {
754 		assert(ap->a_size <= UINT32_MAX);
755 		ubc_upl_abort_range(ap->a_pl, ap->a_pl_offset, (upl_size_t)ap->a_size, UPL_ABORT_FREE_ON_EMPTY | UPL_ABORT_ERROR);
756 	}
757 	return ENOTSUP;
758 }
759 
760 
761 struct vnop_pageout_args /* {
762                           *  struct vnode       *a_vp,
763                           *  upl_t		a_pl,
764                           *  vm_offset_t	a_pl_offset,
765                           *  off_t		a_foffset,
766                           *  size_t		a_size,
767                           *  int		a_flags
768                           *  vfs_context_t a_context;
769                           *  } */;
770 
771 int
nop_pageout(struct vnop_pageout_args * ap)772 nop_pageout(struct vnop_pageout_args *ap)
773 {
774 	if (!(ap->a_flags & UPL_NOCOMMIT)) {
775 		assert(ap->a_size <= UINT32_MAX);
776 		ubc_upl_abort_range(ap->a_pl, ap->a_pl_offset, (upl_size_t)ap->a_size, UPL_ABORT_FREE_ON_EMPTY | UPL_ABORT_ERROR);
777 	}
778 	return EINVAL;
779 }
780 
781 int
err_pageout(struct vnop_pageout_args * ap)782 err_pageout(struct vnop_pageout_args *ap)
783 {
784 	if (!(ap->a_flags & UPL_NOCOMMIT)) {
785 		assert(ap->a_size <= UINT32_MAX);
786 		ubc_upl_abort_range(ap->a_pl, ap->a_pl_offset, (upl_size_t)ap->a_size, UPL_ABORT_FREE_ON_EMPTY | UPL_ABORT_ERROR);
787 	}
788 	return ENOTSUP;
789 }
790 
791 
792 struct vnop_searchfs /* {
793                       *  struct vnode *a_vp;
794                       *  void *a_searchparams1;
795                       *  void *a_searchparams2;
796                       *  struct attrlist *a_searchattrs;
797                       *  u_long a_maxmatches;
798                       *  struct timeval *a_timelimit;
799                       *  struct attrlist *a_returnattrs;
800                       *  u_long *a_nummatches;
801                       *  u_long a_scriptcode;
802                       *  u_long a_options;
803                       *  struct uio	*a_uio;
804                       *  struct searchstate	*a_searchstate;
805                       *  vfs_context_t a_context;
806                       *  } */;
807 
808 int
nop_searchfs(struct vnop_searchfs_args * ap)809 nop_searchfs(struct vnop_searchfs_args *ap)
810 {
811 	*(ap->a_nummatches) = 0;
812 	return 0;
813 }
814 
815 int
err_searchfs(struct vnop_searchfs_args * ap)816 err_searchfs(struct vnop_searchfs_args *ap)
817 {
818 	(void)nop_searchfs(ap);
819 	return ENOTSUP;
820 }
821 
822 struct vnop_copyfile_args /*{
823                            *  struct vnodeop_desc *a_desc;
824                            *  struct vnode *a_fvp;
825                            *  struct vnode *a_tdvp;
826                            *  struct vnode *a_tvp;
827                            *  struct componentname *a_tcnp;
828                            *  int a_flags;
829                            *  }*/;
830 
831 int
nop_copyfile(__unused struct vnop_copyfile_args * ap)832 nop_copyfile(__unused struct vnop_copyfile_args *ap)
833 {
834 	return 0;
835 }
836 
837 
838 int
err_copyfile(struct vnop_copyfile_args * ap)839 err_copyfile(struct vnop_copyfile_args *ap)
840 {
841 	(void)nop_copyfile(ap);
842 	return ENOTSUP;
843 }
844 
845 
846 struct vnop_blktooff_args /* {
847                            *  struct vnode *a_vp;
848                            *  daddr64_t a_lblkno;
849                            *  off_t *a_offset;
850                            *  } */;
851 
852 int
nop_blktooff(struct vnop_blktooff_args * ap)853 nop_blktooff(struct vnop_blktooff_args *ap)
854 {
855 	*ap->a_offset = (off_t)-1;      /* failure */
856 	return 0;
857 }
858 
859 int
err_blktooff(struct vnop_blktooff_args * ap)860 err_blktooff(struct vnop_blktooff_args *ap)
861 {
862 	(void)nop_blktooff(ap);
863 	return ENOTSUP;
864 }
865 
866 struct vnop_offtoblk_args /* {
867                            *  struct vnode *a_vp;
868                            *  off_t a_offset;
869                            *  daddr64_t *a_lblkno;
870                            *  } */;
871 
872 int
nop_offtoblk(struct vnop_offtoblk_args * ap)873 nop_offtoblk(struct vnop_offtoblk_args *ap)
874 {
875 	*ap->a_lblkno = (daddr64_t)-1;  /* failure */
876 	return 0;
877 }
878 
879 int
err_offtoblk(struct vnop_offtoblk_args * ap)880 err_offtoblk(struct vnop_offtoblk_args *ap)
881 {
882 	(void)nop_offtoblk(ap);
883 	return ENOTSUP;
884 }
885 
886 struct vnop_blockmap_args /* {
887                            *  struct vnode *a_vp;
888                            *  off_t a_foffset;
889                            *  size_t a_size;
890                            *  daddr64_t *a_bpn;
891                            *  size_t *a_run;
892                            *  void *a_poff;
893                            *  int a_flags;
894                            *  } */;
895 
896 int
nop_blockmap(__unused struct vnop_blockmap_args * ap)897 nop_blockmap(__unused struct vnop_blockmap_args *ap)
898 {
899 	return 0;
900 }
901 
902 int
err_blockmap(__unused struct vnop_blockmap_args * ap)903 err_blockmap(__unused struct vnop_blockmap_args *ap)
904 {
905 	return ENOTSUP;
906 }
907 
908 struct vnop_monitor_args /* {
909                           *    struct vnodeop_desc *a_desc;
910                           *    vnode_t a_vp;
911                           *    uint32_t a_events;
912                           *    uint32_t a_flags;
913                           *    void *a_handle;
914                           *    vfs_context_t a_context;
915                           *} */;
916 
917 int
nop_monitor(__unused struct vnop_monitor_args * ap)918 nop_monitor(__unused struct vnop_monitor_args *ap)
919 {
920 	return 0;
921 }
922 
923 int
err_monitor(__unused struct vnop_monitor_args * ap)924 err_monitor(__unused struct vnop_monitor_args *ap)
925 {
926 	return ENOTSUP;
927 }
928