cd9660_vfsops.c (5a5fccc8e792522375133484f4cebc9f7da2c7d3) cd9660_vfsops.c (c24fda81c9fd87df7e4fe3a567cc0292078bc7bf)
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley
6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
7 * Support code is derived from software contributed to Berkeley
8 * by Atsushi Murai (amurai@spec.co.jp).

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

63MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
64
65static int cd9660_mount __P((struct mount *,
66 char *, caddr_t, struct nameidata *, struct proc *));
67static int cd9660_unmount __P((struct mount *, int, struct proc *));
68static int cd9660_root __P((struct mount *, struct vnode **));
69static int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *));
70static int cd9660_vget __P((struct mount *, ino_t, struct vnode **));
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley
6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
7 * Support code is derived from software contributed to Berkeley
8 * by Atsushi Murai (amurai@spec.co.jp).

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

63MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
64
65static int cd9660_mount __P((struct mount *,
66 char *, caddr_t, struct nameidata *, struct proc *));
67static int cd9660_unmount __P((struct mount *, int, struct proc *));
68static int cd9660_root __P((struct mount *, struct vnode **));
69static int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *));
70static int cd9660_vget __P((struct mount *, ino_t, struct vnode **));
71static int cd9660_fhtovp __P((struct mount *, struct fid *, struct sockaddr *,
72 struct vnode **, int *, struct ucred **));
71static int cd9660_fhtovp __P((struct mount *, struct fid *, struct vnode **));
72static int cd9660_checkexp __P((struct mount *, struct sockaddr *,
73 int *, struct ucred **));
73static int cd9660_vptofh __P((struct vnode *, struct fid *));
74
75static struct vfsops cd9660_vfsops = {
76 cd9660_mount,
77 vfs_stdstart,
78 cd9660_unmount,
79 cd9660_root,
80 vfs_stdquotactl,
81 cd9660_statfs,
82 vfs_stdsync,
83 cd9660_vget,
84 cd9660_fhtovp,
74static int cd9660_vptofh __P((struct vnode *, struct fid *));
75
76static struct vfsops cd9660_vfsops = {
77 cd9660_mount,
78 vfs_stdstart,
79 cd9660_unmount,
80 cd9660_root,
81 vfs_stdquotactl,
82 cd9660_statfs,
83 vfs_stdsync,
84 cd9660_vget,
85 cd9660_fhtovp,
86 cd9660_checkexp,
85 cd9660_vptofh,
86 cd9660_init,
87};
88VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY);
89
90
91/*
92 * Called by vfs_mountroot when iso is going to be mounted as root.

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

615 ushort ifid_len;
616 ushort ifid_pad;
617 int ifid_ino;
618 long ifid_start;
619};
620
621/* ARGSUSED */
622int
87 cd9660_vptofh,
88 cd9660_init,
89};
90VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY);
91
92
93/*
94 * Called by vfs_mountroot when iso is going to be mounted as root.

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

617 ushort ifid_len;
618 ushort ifid_pad;
619 int ifid_ino;
620 long ifid_start;
621};
622
623/* ARGSUSED */
624int
623cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
625cd9660_fhtovp(mp, fhp, vpp)
624 register struct mount *mp;
625 struct fid *fhp;
626 register struct mount *mp;
627 struct fid *fhp;
626 struct sockaddr *nam;
627 struct vnode **vpp;
628 struct vnode **vpp;
628 int *exflagsp;
629 struct ucred **credanonp;
630{
631 struct ifid *ifhp = (struct ifid *)fhp;
632 register struct iso_node *ip;
629{
630 struct ifid *ifhp = (struct ifid *)fhp;
631 register struct iso_node *ip;
633 register struct netcred *np;
634 register struct iso_mnt *imp = VFSTOISOFS(mp);
635 struct vnode *nvp;
636 int error;
637
638#ifdef ISOFS_DBG
639 printf("fhtovp: ino %d, start %ld\n",
640 ifhp->ifid_ino, ifhp->ifid_start);
641#endif
642
632 struct vnode *nvp;
633 int error;
634
635#ifdef ISOFS_DBG
636 printf("fhtovp: ino %d, start %ld\n",
637 ifhp->ifid_ino, ifhp->ifid_start);
638#endif
639
643 /*
644 * Get the export permission structure for this <mp, client> tuple.
645 */
646 np = vfs_export_lookup(mp, &imp->im_export, nam);
647 if (np == NULL)
648 return (EACCES);
649
650 if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
651 *vpp = NULLVP;
652 return (error);
653 }
654 ip = VTOI(nvp);
655 if (ip->inode.iso_mode == 0) {
656 vput(nvp);
657 *vpp = NULLVP;
658 return (ESTALE);
659 }
660 *vpp = nvp;
640 if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
641 *vpp = NULLVP;
642 return (error);
643 }
644 ip = VTOI(nvp);
645 if (ip->inode.iso_mode == 0) {
646 vput(nvp);
647 *vpp = NULLVP;
648 return (ESTALE);
649 }
650 *vpp = nvp;
651 return (0);
652}
653
654int
655cd9660_checkexp(mp, nam, exflagsp, credanonp)
656 struct mount *mp;
657 struct sockaddr *nam;
658 int *exflagsp;
659 struct ucred **credanonp;
660{
661 register struct netcred *np;
662 register struct iso_mnt *imp;
663
664 imp = VFSTOISOFS(mp);
665
666 /*
667 * Get the export permission structure for this <mp, client> tuple.
668 */
669 np = vfs_export_lookup(mp, &imp->im_export, nam);
670 if (np == NULL)
671 return (EACCES);
672
661 *exflagsp = np->netc_exflags;
662 *credanonp = &np->netc_anon;
663 return (0);
664}
665
666int
667cd9660_vget(mp, ino, vpp)
668 struct mount *mp;

--- 221 unchanged lines hidden ---
673 *exflagsp = np->netc_exflags;
674 *credanonp = &np->netc_anon;
675 return (0);
676}
677
678int
679cd9660_vget(mp, ino, vpp)
680 struct mount *mp;

--- 221 unchanged lines hidden ---