Deleted Added
full compact
vfs_default.c (85340) vfs_default.c (91690)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed
6 * to Berkeley by John Heidemann of the UCLA Ficus project.
7 *
8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 *
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed
6 * to Berkeley by John Heidemann of the UCLA Ficus project.
7 *
8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 *
39 * $FreeBSD: head/sys/kern/vfs_default.c 85340 2001-10-23 01:23:41Z dillon $
39 * $FreeBSD: head/sys/kern/vfs_default.c 91690 2002-03-05 15:38:49Z eivind $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/bio.h>
45#include <sys/buf.h>
46#include <sys/conf.h>
47#include <sys/kernel.h>

--- 56 unchanged lines hidden (view full) ---

104 { NULL, NULL }
105};
106
107static struct vnodeopv_desc default_vnodeop_opv_desc =
108 { &default_vnodeop_p, default_vnodeop_entries };
109
110VNODEOP_SET(default_vnodeop_opv_desc);
111
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/bio.h>
45#include <sys/buf.h>
46#include <sys/conf.h>
47#include <sys/kernel.h>

--- 56 unchanged lines hidden (view full) ---

104 { NULL, NULL }
105};
106
107static struct vnodeopv_desc default_vnodeop_opv_desc =
108 { &default_vnodeop_p, default_vnodeop_entries };
109
110VNODEOP_SET(default_vnodeop_opv_desc);
111
112/*
113 * Series of placeholder functions for various error returns for
114 * VOPs.
115 */
116
112int
113vop_eopnotsupp(struct vop_generic_args *ap)
114{
115 /*
116 printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name);
117 */
118
119 return (EOPNOTSUPP);

--- 22 unchanged lines hidden (view full) ---

142
143int
144vop_null(struct vop_generic_args *ap)
145{
146
147 return (0);
148}
149
117int
118vop_eopnotsupp(struct vop_generic_args *ap)
119{
120 /*
121 printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name);
122 */
123
124 return (EOPNOTSUPP);

--- 22 unchanged lines hidden (view full) ---

147
148int
149vop_null(struct vop_generic_args *ap)
150{
151
152 return (0);
153}
154
155/*
156 * Used to make a defined VOP fall back to the default VOP.
157 */
150int
151vop_defaultop(struct vop_generic_args *ap)
152{
153
154 return (VOCALL(default_vnodeop_p, ap->a_desc->vdesc_offset, ap));
155}
156
158int
159vop_defaultop(struct vop_generic_args *ap)
160{
161
162 return (VOCALL(default_vnodeop_p, ap->a_desc->vdesc_offset, ap));
163}
164
165/*
166 * Helper function to panic on some bad VOPs in some filesystems.
167 */
157int
158vop_panic(struct vop_generic_args *ap)
159{
160
161 panic("filesystem goof: vop_panic[%s]", ap->a_desc->vdesc_name);
162}
163
168int
169vop_panic(struct vop_generic_args *ap)
170{
171
172 panic("filesystem goof: vop_panic[%s]", ap->a_desc->vdesc_name);
173}
174
175/*
176 * vop_std<something> and vop_no<something> are default functions for use by
177 * filesystems that need the "default reasonable" implementation for a
178 * particular operation.
179 *
180 * The documentation for the operations they implement exists (if it exists)
181 * in the VOP_<SOMETHING>(9) manpage (all uppercase).
182 */
183
184/*
185 * Default vop for filesystems that do not support name lookup
186 */
164static int
165vop_nolookup(ap)
166 struct vop_lookup_args /* {
167 struct vnode *a_dvp;
168 struct vnode **a_vpp;
169 struct componentname *a_cnp;
170 } */ *ap;
171{

--- 21 unchanged lines hidden (view full) ---

193 vprint("", ap->a_vp);
194 vprint("", ap->a_bp->b_vp);
195 ap->a_bp->b_ioflags |= BIO_ERROR;
196 ap->a_bp->b_error = EOPNOTSUPP;
197 bufdone(ap->a_bp);
198 return (EOPNOTSUPP);
199}
200
187static int
188vop_nolookup(ap)
189 struct vop_lookup_args /* {
190 struct vnode *a_dvp;
191 struct vnode **a_vpp;
192 struct componentname *a_cnp;
193 } */ *ap;
194{

--- 21 unchanged lines hidden (view full) ---

216 vprint("", ap->a_vp);
217 vprint("", ap->a_bp->b_vp);
218 ap->a_bp->b_ioflags |= BIO_ERROR;
219 ap->a_bp->b_error = EOPNOTSUPP;
220 bufdone(ap->a_bp);
221 return (EOPNOTSUPP);
222}
223
224/*
225 * vop_stdpathconf:
226 *
227 * Standard implementation of POSIX pathconf, to get information about limits
228 * for a filesystem.
229 * Override per filesystem for the case where the filesystem has smaller
230 * limits.
231 */
201int
202vop_stdpathconf(ap)
203 struct vop_pathconf_args /* {
204 struct vnode *a_vp;
205 int a_name;
206 int *a_retval;
207 } */ *ap;
208{

--- 42 unchanged lines hidden (view full) ---

251#ifndef DEBUG_LOCKS
252 return (lockmgr(&vp->v_lock, ap->a_flags, &vp->v_interlock, ap->a_td));
253#else
254 return (debuglockmgr(&vp->v_lock, ap->a_flags, &vp->v_interlock,
255 ap->a_td, "vop_stdlock", vp->filename, vp->line));
256#endif
257}
258
232int
233vop_stdpathconf(ap)
234 struct vop_pathconf_args /* {
235 struct vnode *a_vp;
236 int a_name;
237 int *a_retval;
238 } */ *ap;
239{

--- 42 unchanged lines hidden (view full) ---

282#ifndef DEBUG_LOCKS
283 return (lockmgr(&vp->v_lock, ap->a_flags, &vp->v_interlock, ap->a_td));
284#else
285 return (debuglockmgr(&vp->v_lock, ap->a_flags, &vp->v_interlock,
286 ap->a_td, "vop_stdlock", vp->filename, vp->line));
287#endif
288}
289
290/* See above. */
259int
260vop_stdunlock(ap)
261 struct vop_unlock_args /* {
262 struct vnode *a_vp;
263 int a_flags;
264 struct thread *a_td;
265 } */ *ap;
266{
267 struct vnode *vp = ap->a_vp;
268
269 return (lockmgr(&vp->v_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock,
270 ap->a_td));
271}
272
291int
292vop_stdunlock(ap)
293 struct vop_unlock_args /* {
294 struct vnode *a_vp;
295 int a_flags;
296 struct thread *a_td;
297 } */ *ap;
298{
299 struct vnode *vp = ap->a_vp;
300
301 return (lockmgr(&vp->v_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock,
302 ap->a_td));
303}
304
305/* See above. */
273int
274vop_stdislocked(ap)
275 struct vop_islocked_args /* {
276 struct vnode *a_vp;
277 struct thread *a_td;
278 } */ *ap;
279{
280
281 return (lockstatus(&ap->a_vp->v_lock, ap->a_td));
282}
283
306int
307vop_stdislocked(ap)
308 struct vop_islocked_args /* {
309 struct vnode *a_vp;
310 struct thread *a_td;
311 } */ *ap;
312{
313
314 return (lockstatus(&ap->a_vp->v_lock, ap->a_td));
315}
316
317/* Mark the vnode inactive */
284int
285vop_stdinactive(ap)
286 struct vop_inactive_args /* {
287 struct vnode *a_vp;
288 struct thread *a_td;
289 } */ *ap;
290{
291

--- 215 unchanged lines hidden (view full) ---

507 struct mount **a_mpp;
508 } */ *ap;
509{
510
511 *(ap->a_mpp) = ap->a_vp->v_mount;
512 return (0);
513}
514
318int
319vop_stdinactive(ap)
320 struct vop_inactive_args /* {
321 struct vnode *a_vp;
322 struct thread *a_td;
323 } */ *ap;
324{
325

--- 215 unchanged lines hidden (view full) ---

541 struct mount **a_mpp;
542 } */ *ap;
543{
544
545 *(ap->a_mpp) = ap->a_vp->v_mount;
546 return (0);
547}
548
549/* Create the VM system backing object for this vnode */
515int
516vop_stdcreatevobject(ap)
517 struct vop_createvobject_args /* {
518 struct vnode *vp;
519 struct ucred *cred;
520 struct thread *td;
521 } */ *ap;
522{

--- 42 unchanged lines hidden (view full) ---

565
566 KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
567 vp->v_flag |= VOBJBUF;
568
569retn:
570 return (error);
571}
572
550int
551vop_stdcreatevobject(ap)
552 struct vop_createvobject_args /* {
553 struct vnode *vp;
554 struct ucred *cred;
555 struct thread *td;
556 } */ *ap;
557{

--- 42 unchanged lines hidden (view full) ---

600
601 KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
602 vp->v_flag |= VOBJBUF;
603
604retn:
605 return (error);
606}
607
608/* Destroy the VM system object associated with this vnode */
573int
574vop_stddestroyvobject(ap)
575 struct vop_destroyvobject_args /* {
576 struct vnode *vp;
577 } */ *ap;
578{
579 struct vnode *vp = ap->a_vp;
580 vm_object_t obj = vp->v_object;

--- 41 unchanged lines hidden (view full) ---

622 struct vnode *vp = ap->a_vp;
623 struct vm_object **objpp = ap->a_objpp;
624
625 if (objpp)
626 *objpp = vp->v_object;
627 return (vp->v_object ? 0 : EINVAL);
628}
629
609int
610vop_stddestroyvobject(ap)
611 struct vop_destroyvobject_args /* {
612 struct vnode *vp;
613 } */ *ap;
614{
615 struct vnode *vp = ap->a_vp;
616 vm_object_t obj = vp->v_object;

--- 41 unchanged lines hidden (view full) ---

658 struct vnode *vp = ap->a_vp;
659 struct vm_object **objpp = ap->a_objpp;
660
661 if (objpp)
662 *objpp = vp->v_object;
663 return (vp->v_object ? 0 : EINVAL);
664}
665
666/* XXX Needs good comment and VOP_BMAP(9) manpage */
630int
631vop_stdbmap(ap)
632 struct vop_bmap_args /* {
633 struct vnode *a_vp;
634 daddr_t a_bn;
635 struct vnode **a_vpp;
636 daddr_t *a_bnp;
637 int *a_runp;

--- 7 unchanged lines hidden (view full) ---

645 *ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize);
646 if (ap->a_runp != NULL)
647 *ap->a_runp = 0;
648 if (ap->a_runb != NULL)
649 *ap->a_runb = 0;
650 return (0);
651}
652
667int
668vop_stdbmap(ap)
669 struct vop_bmap_args /* {
670 struct vnode *a_vp;
671 daddr_t a_bn;
672 struct vnode **a_vpp;
673 daddr_t *a_bnp;
674 int *a_runp;

--- 7 unchanged lines hidden (view full) ---

682 *ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize);
683 if (ap->a_runp != NULL)
684 *ap->a_runp = 0;
685 if (ap->a_runb != NULL)
686 *ap->a_runb = 0;
687 return (0);
688}
689
690/* XXX Needs good comment and more info in the manpage (VOP_GETPAGES(9)). */
653int
654vop_stdgetpages(ap)
655 struct vop_getpages_args /* {
656 struct vnode *a_vp;
657 vm_page_t *a_m;
658 int a_count;
659 int a_reqpage;
660 vm_ooffset_t a_offset;
661 } */ *ap;
662{
663
664 return vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
665 ap->a_count, ap->a_reqpage);
666}
667
691int
692vop_stdgetpages(ap)
693 struct vop_getpages_args /* {
694 struct vnode *a_vp;
695 vm_page_t *a_m;
696 int a_count;
697 int a_reqpage;
698 vm_ooffset_t a_offset;
699 } */ *ap;
700{
701
702 return vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
703 ap->a_count, ap->a_reqpage);
704}
705
706/* XXX Needs good comment and more info in the manpage (VOP_PUTPAGES(9)). */
668int
669vop_stdputpages(ap)
670 struct vop_putpages_args /* {
671 struct vnode *a_vp;
672 vm_page_t *a_m;
673 int a_count;
674 int a_sync;
675 int *a_rtvals;

--- 4 unchanged lines hidden (view full) ---

680 return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
681 ap->a_sync, ap->a_rtvals);
682}
683
684
685
686/*
687 * vfs default ops
707int
708vop_stdputpages(ap)
709 struct vop_putpages_args /* {
710 struct vnode *a_vp;
711 vm_page_t *a_m;
712 int a_count;
713 int a_sync;
714 int *a_rtvals;

--- 4 unchanged lines hidden (view full) ---

719 return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
720 ap->a_sync, ap->a_rtvals);
721}
722
723
724
725/*
726 * vfs default ops
688 * used to fill the vfs fucntion table to get reasonable default return values.
727 * used to fill the vfs function table to get reasonable default return values.
689 */
690int
691vfs_stdmount (mp, path, data, ndp, td)
692 struct mount *mp;
693 char *path;
694 caddr_t data;
695 struct nameidata *ndp;
696 struct thread *td;
697{
698 return (0);
699}
700
728 */
729int
730vfs_stdmount (mp, path, data, ndp, td)
731 struct mount *mp;
732 char *path;
733 caddr_t data;
734 struct nameidata *ndp;
735 struct thread *td;
736{
737 return (0);
738}
739
701int
740int
702vfs_stdunmount (mp, mntflags, td)
703 struct mount *mp;
704 int mntflags;
705 struct thread *td;
706{
707 return (0);
708}
709
741vfs_stdunmount (mp, mntflags, td)
742 struct mount *mp;
743 int mntflags;
744 struct thread *td;
745{
746 return (0);
747}
748
710int
749int
711vfs_stdroot (mp, vpp)
712 struct mount *mp;
713 struct vnode **vpp;
714{
715 return (EOPNOTSUPP);
716}
717
750vfs_stdroot (mp, vpp)
751 struct mount *mp;
752 struct vnode **vpp;
753{
754 return (EOPNOTSUPP);
755}
756
718int
757int
719vfs_stdstatfs (mp, sbp, td)
720 struct mount *mp;
721 struct statfs *sbp;
722 struct thread *td;
723{
724 return (EOPNOTSUPP);
725}
726
727int
728vfs_stdvptofh (vp, fhp)
729 struct vnode *vp;
730 struct fid *fhp;
731{
732 return (EOPNOTSUPP);
733}
734
758vfs_stdstatfs (mp, sbp, td)
759 struct mount *mp;
760 struct statfs *sbp;
761 struct thread *td;
762{
763 return (EOPNOTSUPP);
764}
765
766int
767vfs_stdvptofh (vp, fhp)
768 struct vnode *vp;
769 struct fid *fhp;
770{
771 return (EOPNOTSUPP);
772}
773
735int
774int
736vfs_stdstart (mp, flags, td)
737 struct mount *mp;
738 int flags;
739 struct thread *td;
740{
741 return (0);
742}
743

--- 66 unchanged lines hidden ---
775vfs_stdstart (mp, flags, td)
776 struct mount *mp;
777 int flags;
778 struct thread *td;
779{
780 return (0);
781}
782

--- 66 unchanged lines hidden ---