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).
--- 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 * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
39 * $Id: cd9660_vnops.c,v 1.44 1997/10/16 10:47:47 phk Exp $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/namei.h>
45#include <sys/kernel.h>
46#include <sys/stat.h>
47#include <sys/sysctl.h>
--- 16 unchanged lines hidden (view full) ---
64static int cd9660_read __P((struct vop_read_args *));
65struct isoreaddir;
66static int iso_uiodir __P((struct isoreaddir *idp, struct dirent *dp,
67 off_t off));
68static int iso_shipdir __P((struct isoreaddir *idp));
69static int cd9660_readdir __P((struct vop_readdir_args *));
70static int cd9660_readlink __P((struct vop_readlink_args *ap));
71static int cd9660_abortop __P((struct vop_abortop_args *));
72static int cd9660_lock __P((struct vop_lock_args *));
73static int cd9660_unlock __P((struct vop_unlock_args *));
74static int cd9660_strategy __P((struct vop_strategy_args *));
75static int cd9660_print __P((struct vop_print_args *));
76static int cd9660_islocked __P((struct vop_islocked_args *));
77
78/*
79 * Setattr call. Only allowed for block and character special devices.
80 */
81int
82cd9660_setattr(ap)
83 struct vop_setattr_args /* {
84 struct vnodeop_desc *a_desc;
--- 628 unchanged lines hidden (view full) ---
713 } */ *ap;
714{
715 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
716 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
717 return (0);
718}
719
720/*
721 * Lock an inode.
722 */
723static int
724cd9660_lock(ap)
725 struct vop_lock_args /* {
726 struct vnode *a_vp;
727 int a_flags;
728 struct proc *a_p;
729 } */ *ap;
730{
731 struct vnode *vp = ap->a_vp;
732
733 return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags, &vp->v_interlock,
734 ap->a_p));
735}
736
737/*
738 * Unlock an inode.
739 */
740static int
741cd9660_unlock(ap)
742 struct vop_unlock_args /* {
743 struct vnode *a_vp;
744 int a_flags;
745 struct proc *a_p;
746 } */ *ap;
747{
748 struct vnode *vp = ap->a_vp;
749
750 return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags | LK_RELEASE,
751 &vp->v_interlock, ap->a_p));
752}
753
754/*
755 * Calculate the logical to physical mapping if not done already,
756 * then call the device strategy routine.
757 */
758static int
759cd9660_strategy(ap)
760 struct vop_strategy_args /* {
761 struct buf *a_bp;
762 } */ *ap;
--- 37 unchanged lines hidden (view full) ---
800 } */ *ap;
801{
802
803 printf("tag VT_ISOFS, isofs vnode\n");
804 return (0);
805}
806
807/*
808 * Check for a locked inode.
809 */
810int
811cd9660_islocked(ap)
812 struct vop_islocked_args /* {
813 struct vnode *a_vp;
814 } */ *ap;
815{
816
817 return (lockstatus(&VTOI(ap->a_vp)->i_lock));
818}
819
820/*
821 * Return POSIX pathconf information applicable to cd9660 filesystems.
822 */
823int
824cd9660_pathconf(ap)
825 struct vop_pathconf_args /* {
826 struct vnode *a_vp;
827 int a_name;
828 register_t *a_retval;
--- 35 unchanged lines hidden (view full) ---
864struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
865 { &vop_default_desc, (vop_t *) vn_default_error },
866 { &vop_abortop_desc, (vop_t *) cd9660_abortop },
867 { &vop_access_desc, (vop_t *) cd9660_access },
868 { &vop_bmap_desc, (vop_t *) cd9660_bmap },
869 { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup },
870 { &vop_getattr_desc, (vop_t *) cd9660_getattr },
871 { &vop_inactive_desc, (vop_t *) cd9660_inactive },
872 { &vop_islocked_desc, (vop_t *) cd9660_islocked },
873 { &vop_lock_desc, (vop_t *) cd9660_lock },
874 { &vop_lookup_desc, (vop_t *) vfs_cache_lookup },
875 { &vop_pathconf_desc, (vop_t *) cd9660_pathconf },
876 { &vop_print_desc, (vop_t *) cd9660_print },
877 { &vop_read_desc, (vop_t *) cd9660_read },
878 { &vop_readdir_desc, (vop_t *) cd9660_readdir },
879 { &vop_readlink_desc, (vop_t *) cd9660_readlink },
880 { &vop_reclaim_desc, (vop_t *) cd9660_reclaim },
881 { &vop_setattr_desc, (vop_t *) cd9660_setattr },
882 { &vop_strategy_desc, (vop_t *) cd9660_strategy },
883 { &vop_unlock_desc, (vop_t *) cd9660_unlock },
884 { NULL, NULL }
885};
886static struct vnodeopv_desc cd9660_vnodeop_opv_desc =
887 { &cd9660_vnodeop_p, cd9660_vnodeop_entries };
888VNODEOP_SET(cd9660_vnodeop_opv_desc);
889
890/*
891 * Special device vnode ops
892 */
893vop_t **cd9660_specop_p;
894struct vnodeopv_entry_desc cd9660_specop_entries[] = {
895 { &vop_default_desc, (vop_t *) spec_vnoperate },
896 { &vop_access_desc, (vop_t *) cd9660_access },
897 { &vop_getattr_desc, (vop_t *) cd9660_getattr },
898 { &vop_inactive_desc, (vop_t *) cd9660_inactive },
899 { &vop_islocked_desc, (vop_t *) cd9660_islocked },
900 { &vop_lock_desc, (vop_t *) cd9660_lock },
901 { &vop_print_desc, (vop_t *) cd9660_print },
902 { &vop_reclaim_desc, (vop_t *) cd9660_reclaim },
903 { &vop_setattr_desc, (vop_t *) cd9660_setattr },
904 { &vop_unlock_desc, (vop_t *) cd9660_unlock },
905 { NULL, NULL }
906};
907static struct vnodeopv_desc cd9660_specop_opv_desc =
908 { &cd9660_specop_p, cd9660_specop_entries };
909VNODEOP_SET(cd9660_specop_opv_desc);
910
911vop_t **cd9660_fifoop_p;
912struct vnodeopv_entry_desc cd9660_fifoop_entries[] = {
913 { &vop_default_desc, (vop_t *) fifo_vnoperate },
914 { &vop_access_desc, (vop_t *) cd9660_access },
915 { &vop_getattr_desc, (vop_t *) cd9660_getattr },
916 { &vop_inactive_desc, (vop_t *) cd9660_inactive },
917 { &vop_islocked_desc, (vop_t *) cd9660_islocked },
918 { &vop_lock_desc, (vop_t *) cd9660_lock },
919 { &vop_print_desc, (vop_t *) cd9660_print },
920 { &vop_reclaim_desc, (vop_t *) cd9660_reclaim },
921 { &vop_setattr_desc, (vop_t *) cd9660_setattr },
922 { &vop_unlock_desc, (vop_t *) cd9660_unlock },
923 { NULL, NULL }
924};
925static struct vnodeopv_desc cd9660_fifoop_opv_desc =
926 { &cd9660_fifoop_p, cd9660_fifoop_entries };
927
928VNODEOP_SET(cd9660_fifoop_opv_desc);
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).
--- 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 * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
39 * $Id: cd9660_vnops.c,v 1.44 1997/10/16 10:47:47 phk Exp $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/namei.h>
45#include <sys/kernel.h>
46#include <sys/stat.h>
47#include <sys/sysctl.h>
--- 16 unchanged lines hidden (view full) ---
64static int cd9660_read __P((struct vop_read_args *));
65struct isoreaddir;
66static int iso_uiodir __P((struct isoreaddir *idp, struct dirent *dp,
67 off_t off));
68static int iso_shipdir __P((struct isoreaddir *idp));
69static int cd9660_readdir __P((struct vop_readdir_args *));
70static int cd9660_readlink __P((struct vop_readlink_args *ap));
71static int cd9660_abortop __P((struct vop_abortop_args *));
72static int cd9660_lock __P((struct vop_lock_args *));
73static int cd9660_unlock __P((struct vop_unlock_args *));
74static int cd9660_strategy __P((struct vop_strategy_args *));
75static int cd9660_print __P((struct vop_print_args *));
76static int cd9660_islocked __P((struct vop_islocked_args *));
77
78/*
79 * Setattr call. Only allowed for block and character special devices.
80 */
81int
82cd9660_setattr(ap)
83 struct vop_setattr_args /* {
84 struct vnodeop_desc *a_desc;
--- 628 unchanged lines hidden (view full) ---
713 } */ *ap;
714{
715 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
716 zfree(namei_zone, ap->a_cnp->cn_pnbuf);
717 return (0);
718}
719
720/*
721 * Lock an inode.
722 */
723static int
724cd9660_lock(ap)
725 struct vop_lock_args /* {
726 struct vnode *a_vp;
727 int a_flags;
728 struct proc *a_p;
729 } */ *ap;
730{
731 struct vnode *vp = ap->a_vp;
732
733 return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags, &vp->v_interlock,
734 ap->a_p));
735}
736
737/*
738 * Unlock an inode.
739 */
740static int
741cd9660_unlock(ap)
742 struct vop_unlock_args /* {
743 struct vnode *a_vp;
744 int a_flags;
745 struct proc *a_p;
746 } */ *ap;
747{
748 struct vnode *vp = ap->a_vp;
749
750 return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags | LK_RELEASE,
751 &vp->v_interlock, ap->a_p));
752}
753
754/*
755 * Calculate the logical to physical mapping if not done already,
756 * then call the device strategy routine.
757 */
758static int
759cd9660_strategy(ap)
760 struct vop_strategy_args /* {
761 struct buf *a_bp;
762 } */ *ap;
--- 37 unchanged lines hidden (view full) ---
800 } */ *ap;
801{
802
803 printf("tag VT_ISOFS, isofs vnode\n");
804 return (0);
805}
806
807/*
808 * Check for a locked inode.
809 */
810int
811cd9660_islocked(ap)
812 struct vop_islocked_args /* {
813 struct vnode *a_vp;
814 } */ *ap;
815{
816
817 return (lockstatus(&VTOI(ap->a_vp)->i_lock));
818}
819
820/*
821 * Return POSIX pathconf information applicable to cd9660 filesystems.
822 */
823int
824cd9660_pathconf(ap)
825 struct vop_pathconf_args /* {
826 struct vnode *a_vp;
827 int a_name;
828 register_t *a_retval;
--- 35 unchanged lines hidden (view full) ---
864struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
865 { &vop_default_desc, (vop_t *) vn_default_error },
866 { &vop_abortop_desc, (vop_t *) cd9660_abortop },
867 { &vop_access_desc, (vop_t *) cd9660_access },
868 { &vop_bmap_desc, (vop_t *) cd9660_bmap },
869 { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup },
870 { &vop_getattr_desc, (vop_t *) cd9660_getattr },
871 { &vop_inactive_desc, (vop_t *) cd9660_inactive },
872 { &vop_islocked_desc, (vop_t *) cd9660_islocked },
873 { &vop_lock_desc, (vop_t *) cd9660_lock },
874 { &vop_lookup_desc, (vop_t *) vfs_cache_lookup },
875 { &vop_pathconf_desc, (vop_t *) cd9660_pathconf },
876 { &vop_print_desc, (vop_t *) cd9660_print },
877 { &vop_read_desc, (vop_t *) cd9660_read },
878 { &vop_readdir_desc, (vop_t *) cd9660_readdir },
879 { &vop_readlink_desc, (vop_t *) cd9660_readlink },
880 { &vop_reclaim_desc, (vop_t *) cd9660_reclaim },
881 { &vop_setattr_desc, (vop_t *) cd9660_setattr },
882 { &vop_strategy_desc, (vop_t *) cd9660_strategy },
883 { &vop_unlock_desc, (vop_t *) cd9660_unlock },
884 { NULL, NULL }
885};
886static struct vnodeopv_desc cd9660_vnodeop_opv_desc =
887 { &cd9660_vnodeop_p, cd9660_vnodeop_entries };
888VNODEOP_SET(cd9660_vnodeop_opv_desc);
889
890/*
891 * Special device vnode ops
892 */
893vop_t **cd9660_specop_p;
894struct vnodeopv_entry_desc cd9660_specop_entries[] = {
895 { &vop_default_desc, (vop_t *) spec_vnoperate },
896 { &vop_access_desc, (vop_t *) cd9660_access },
897 { &vop_getattr_desc, (vop_t *) cd9660_getattr },
898 { &vop_inactive_desc, (vop_t *) cd9660_inactive },
899 { &vop_islocked_desc, (vop_t *) cd9660_islocked },
900 { &vop_lock_desc, (vop_t *) cd9660_lock },
901 { &vop_print_desc, (vop_t *) cd9660_print },
902 { &vop_reclaim_desc, (vop_t *) cd9660_reclaim },
903 { &vop_setattr_desc, (vop_t *) cd9660_setattr },
904 { &vop_unlock_desc, (vop_t *) cd9660_unlock },
905 { NULL, NULL }
906};
907static struct vnodeopv_desc cd9660_specop_opv_desc =
908 { &cd9660_specop_p, cd9660_specop_entries };
909VNODEOP_SET(cd9660_specop_opv_desc);
910
911vop_t **cd9660_fifoop_p;
912struct vnodeopv_entry_desc cd9660_fifoop_entries[] = {
913 { &vop_default_desc, (vop_t *) fifo_vnoperate },
914 { &vop_access_desc, (vop_t *) cd9660_access },
915 { &vop_getattr_desc, (vop_t *) cd9660_getattr },
916 { &vop_inactive_desc, (vop_t *) cd9660_inactive },
917 { &vop_islocked_desc, (vop_t *) cd9660_islocked },
918 { &vop_lock_desc, (vop_t *) cd9660_lock },
919 { &vop_print_desc, (vop_t *) cd9660_print },
920 { &vop_reclaim_desc, (vop_t *) cd9660_reclaim },
921 { &vop_setattr_desc, (vop_t *) cd9660_setattr },
922 { &vop_unlock_desc, (vop_t *) cd9660_unlock },
923 { NULL, NULL }
924};
925static struct vnodeopv_desc cd9660_fifoop_opv_desc =
926 { &cd9660_fifoop_p, cd9660_fifoop_entries };
927
928VNODEOP_SET(cd9660_fifoop_opv_desc);