update from mycroft
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 6 Dec 1994 14:11:24 +0000 (06:11 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 6 Dec 1994 14:11:24 +0000 (06:11 -0800)
SCCS-vsn: sys/isofs/cd9660/cd9660_bmap.c 8.4
SCCS-vsn: sys/isofs/cd9660/cd9660_node.h 8.4
SCCS-vsn: sys/isofs/cd9660/cd9660_rrip.h 8.2
SCCS-vsn: sys/isofs/cd9660/iso.h 8.4
SCCS-vsn: sys/isofs/cd9660/cd9660_lookup.c 8.5
SCCS-vsn: sys/isofs/cd9660/cd9660_node.c 8.5
SCCS-vsn: sys/isofs/cd9660/cd9660_rrip.c 8.6
SCCS-vsn: sys/isofs/cd9660/cd9660_util.c 8.3
SCCS-vsn: sys/isofs/cd9660/cd9660_vfsops.c 8.8
SCCS-vsn: sys/isofs/cd9660/cd9660_vnops.c 8.14

usr/src/sys/isofs/cd9660/cd9660_bmap.c
usr/src/sys/isofs/cd9660/cd9660_lookup.c
usr/src/sys/isofs/cd9660/cd9660_node.c
usr/src/sys/isofs/cd9660/cd9660_node.h
usr/src/sys/isofs/cd9660/cd9660_rrip.c
usr/src/sys/isofs/cd9660/cd9660_rrip.h
usr/src/sys/isofs/cd9660/cd9660_util.c
usr/src/sys/isofs/cd9660/cd9660_vfsops.c
usr/src/sys/isofs/cd9660/cd9660_vnops.c
usr/src/sys/isofs/cd9660/iso.h

index 0d4fd86..bfc84e3 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_bmap.c       8.3 (Berkeley) %G%
+ *     @(#)cd9660_bmap.c       8.4 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -39,7 +39,7 @@ cd9660_bmap(ap)
 {
        struct iso_node *ip = VTOI(ap->a_vp);
        daddr_t lblkno = ap->a_bn;
 {
        struct iso_node *ip = VTOI(ap->a_vp);
        daddr_t lblkno = ap->a_bn;
-       long bsize;
+       int bshift;
 
        /*
         * Check for underlying vnode requests and ensure that logical
 
        /*
         * Check for underlying vnode requests and ensure that logical
@@ -53,8 +53,8 @@ cd9660_bmap(ap)
        /*
         * Compute the requested block number
         */
        /*
         * Compute the requested block number
         */
-       bsize = ip->i_mnt->logical_block_size;
-       *ap->a_bnp = (ip->iso_start + lblkno) * btodb(bsize);
+       bshift = ip->i_mnt->im_bshift;
+       *ap->a_bnp = (ip->iso_start + lblkno) << (bshift - DEV_BSHIFT);
 
        /*
         * Determine maximum number of readahead blocks following the
 
        /*
         * Determine maximum number of readahead blocks following the
@@ -63,14 +63,14 @@ cd9660_bmap(ap)
        if (ap->a_runp) {
                int nblk;
 
        if (ap->a_runp) {
                int nblk;
 
-               nblk = (ip->i_size - (lblkno + 1) * bsize) / bsize;
+               nblk = (ip->i_size >> bshift) - (lblkno + 1);
                if (nblk <= 0)
                        *ap->a_runp = 0;
                if (nblk <= 0)
                        *ap->a_runp = 0;
-               else if (nblk >= MAXBSIZE/bsize)
-                       *ap->a_runp = MAXBSIZE/bsize - 1;
+               else if (nblk >= (MAXBSIZE >> bshift))
+                       *ap->a_runp = (MAXBSIZE >> bshift) - 1;
                else
                        *ap->a_runp = nblk;
        }
 
                else
                        *ap->a_runp = nblk;
        }
 
-       return 0;
+       return (0);
 }
 }
index 11152d1..7342db8 100644 (file)
@@ -11,7 +11,7 @@
  *
  *     from: @(#)ufs_lookup.c  7.33 (Berkeley) 5/19/91
  *
  *
  *     from: @(#)ufs_lookup.c  7.33 (Berkeley) 5/19/91
  *
- *     @(#)cd9660_lookup.c     8.4 (Berkeley) %G%
+ *     @(#)cd9660_lookup.c     8.5 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -81,6 +81,7 @@ cd9660_lookup(ap)
        doff_t endsearch;               /* offset to end directory search */
        struct vnode *pdp;              /* saved dp during symlink work */
        struct vnode *tdp;              /* returned by cd9660_vget_internal */
        doff_t endsearch;               /* offset to end directory search */
        struct vnode *pdp;              /* saved dp during symlink work */
        struct vnode *tdp;              /* returned by cd9660_vget_internal */
+       u_long bmask;                   /* block offset mask */
        int lockparent;                 /* 1 => lockparent flag is set */
        int wantparent;                 /* 1 => wantparent or lockparent flag */
        int error;
        int lockparent;                 /* 1 => lockparent flag is set */
        int wantparent;                 /* 1 => wantparent or lockparent flag */
        int error;
@@ -127,7 +128,7 @@ cd9660_lookup(ap)
                        return (error);
 #ifdef PARANOID
                if ((vdp->v_flag & VROOT) && (flags & ISDOTDOT))
                        return (error);
 #ifdef PARANOID
                if ((vdp->v_flag & VROOT) && (flags & ISDOTDOT))
-                       panic("ufs_lookup: .. through root");
+                       panic("cd9660_lookup: .. through root");
 #endif
                /*
                 * Get the next vnode in the path.
 #endif
                /*
                 * Get the next vnode in the path.
@@ -190,6 +191,7 @@ cd9660_lookup(ap)
         * profiling time and hence has been removed in the interest
         * of simplicity.
         */
         * profiling time and hence has been removed in the interest
         * of simplicity.
         */
+       bmask = imp->im_bmask;
        if (nameiop != LOOKUP || dp->i_diroff == 0 ||
            dp->i_diroff > dp->i_size) {
                entryoffsetinblock = 0;
        if (nameiop != LOOKUP || dp->i_diroff == 0 ||
            dp->i_diroff > dp->i_size) {
                entryoffsetinblock = 0;
@@ -197,15 +199,13 @@ cd9660_lookup(ap)
                numdirpasses = 1;
        } else {
                dp->i_offset = dp->i_diroff;
                numdirpasses = 1;
        } else {
                dp->i_offset = dp->i_diroff;
-               entryoffsetinblock = iso_blkoff(imp, dp->i_offset);
-               if (entryoffsetinblock != 0) {
-                       if (error = iso_blkatoff(dp, dp->i_offset, &bp))
+               if ((entryoffsetinblock = dp->i_offset & bmask) &&
+                   (error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp)))
                                return (error);
                                return (error);
-               }
                numdirpasses = 2;
                iso_nchstats.ncs_2passes++;
        }
                numdirpasses = 2;
                iso_nchstats.ncs_2passes++;
        }
-       endsearch = roundup(dp->i_size, imp->logical_block_size);
+       endsearch = dp->i_size;
        
 searchloop:
        while (dp->i_offset < endsearch) {
        
 searchloop:
        while (dp->i_offset < endsearch) {
@@ -214,10 +214,11 @@ searchloop:
                 * read the next directory block.
                 * Release previous if it exists.
                 */
                 * read the next directory block.
                 * Release previous if it exists.
                 */
-               if (iso_blkoff(imp, dp->i_offset) == 0) {
+               if ((dp->i_offset & bmask) == 0) {
                        if (bp != NULL)
                                brelse(bp);
                        if (bp != NULL)
                                brelse(bp);
-                       if (error = iso_blkatoff(dp, dp->i_offset, &bp))
+                       if (error =
+                           VOP_BLKATOFF(vdp, (off_t)dp->i_offset, NULL, &bp))
                                return (error);
                        entryoffsetinblock = 0;
                }
                                return (error);
                        entryoffsetinblock = 0;
                }
@@ -225,13 +226,13 @@ searchloop:
                 * Get pointer to next entry.
                 */
                ep = (struct iso_directory_record *)
                 * Get pointer to next entry.
                 */
                ep = (struct iso_directory_record *)
-                       (bp->b_un.b_addr + entryoffsetinblock);
+                       ((char *)bp->b_data + entryoffsetinblock);
                
                
-               reclen = isonum_711 (ep->length);
+               reclen = isonum_711(ep->length);
                if (reclen == 0) {
                        /* skip to next block, if any */
                        dp->i_offset =
                if (reclen == 0) {
                        /* skip to next block, if any */
                        dp->i_offset =
-                               roundup(dp->i_offset, imp->logical_block_size);
+                           (dp->i_offset & ~bmask) + imp->logical_block_size;
                        continue;
                }
                
                        continue;
                }
                
@@ -243,15 +244,15 @@ searchloop:
                        /* entries are not allowed to cross boundaries */
                        break;
                
                        /* entries are not allowed to cross boundaries */
                        break;
                
-               /*
-                * Check for a name match.
-                */
                namelen = isonum_711(ep->name_len);
                
                if (reclen < ISO_DIRECTORY_RECORD_SIZE + namelen)
                        /* illegal entry, stop */
                        break;
                
                namelen = isonum_711(ep->name_len);
                
                if (reclen < ISO_DIRECTORY_RECORD_SIZE + namelen)
                        /* illegal entry, stop */
                        break;
                
+               /*
+                * Check for a name match.
+                */
                switch (imp->iso_ftype) {
                default:
                        if ((!(isonum_711(ep->flags)&4)) == !assoc) {
                switch (imp->iso_ftype) {
                default:
                        if ((!(isonum_711(ep->flags)&4)) == !assoc) {
@@ -262,10 +263,9 @@ searchloop:
                                            && ep->name[0] == ((flags & ISDOTDOT) ? 1 : 0)) {
                                                /*
                                                 * Save directory entry's inode number and
                                            && ep->name[0] == ((flags & ISDOTDOT) ? 1 : 0)) {
                                                /*
                                                 * Save directory entry's inode number and
-                                                * reclen in ndp->ni_ufs area, and release
-                                                * directory buffer.
+                                                * release directory buffer.
                                                 */
                                                 */
-                                               isodirino(&dp->i_ino,ep,imp);
+                                               dp->i_ino = isodirino(ep, imp);
                                                goto found;
                                        }
                                        if (namelen != 1
                                                goto found;
                                        }
                                        if (namelen != 1
@@ -274,7 +274,7 @@ searchloop:
                                } else if (!(res = isofncmp(name,len,
                                                            ep->name,namelen))) {
                                        if (isonum_711(ep->flags)&2)
                                } else if (!(res = isofncmp(name,len,
                                                            ep->name,namelen))) {
                                        if (isonum_711(ep->flags)&2)
-                                               isodirino(&ino,ep,imp);
+                                               ino = isodirino(ep, imp);
                                        else
                                                ino = dbtob(bp->b_blkno)
                                                        + entryoffsetinblock;
                                        else
                                                ino = dbtob(bp->b_blkno)
                                                        + entryoffsetinblock;
@@ -291,7 +291,7 @@ searchloop:
                        break;
                case ISO_FTYPE_RRIP:
                        if (isonum_711(ep->flags)&2)
                        break;
                case ISO_FTYPE_RRIP:
                        if (isonum_711(ep->flags)&2)
-                               isodirino(&ino,ep,imp);
+                               ino = isodirino(ep, imp);
                        else
                                ino = dbtob(bp->b_blkno) + entryoffsetinblock;
                        dp->i_ino = ino;
                        else
                                ino = dbtob(bp->b_blkno) + entryoffsetinblock;
                        dp->i_ino = ino;
@@ -309,15 +309,17 @@ searchloop:
 foundino:
                dp->i_ino = ino;
                if (saveoffset != dp->i_offset) {
 foundino:
                dp->i_ino = ino;
                if (saveoffset != dp->i_offset) {
-                       if (iso_lblkno(imp,dp->i_offset)
-                           != iso_lblkno(imp,saveoffset)) {
+                       if (lblkno(imp, dp->i_offset) !=
+                           lblkno(imp, saveoffset)) {
                                if (bp != NULL)
                                        brelse(bp);
                                if (bp != NULL)
                                        brelse(bp);
-                               if (error = iso_blkatoff(dp, saveoffset, &bp))
+                               if (error = VOP_BLKATOFF(vdp,
+                                   (off_t)saveoffset, NULL, &bp))
                                        return (error);
                        }
                                        return (error);
                        }
-                       ep = (struct iso_directory_record *)(bp->b_un.b_addr
-                                                            + iso_blkoff(imp,saveoffset));
+                       entryoffsetinblock = saveoffset & bmask;
+                       ep = (struct iso_directory_record *)
+                               ((char *)bp->b_data + entryoffsetinblock);
                        dp->i_offset = saveoffset;
                }
                goto found;
                        dp->i_offset = saveoffset;
                }
                goto found;
@@ -335,6 +337,7 @@ notfound:
        }
        if (bp != NULL)
                brelse(bp);
        }
        if (bp != NULL)
                brelse(bp);
+
        /*
         * Insert name into cache (as non-existent) if appropriate.
         */
        /*
         * Insert name into cache (as non-existent) if appropriate.
         */
@@ -347,8 +350,6 @@ notfound:
 found:
        if (numdirpasses == 2)
                iso_nchstats.ncs_pass2++;
 found:
        if (numdirpasses == 2)
                iso_nchstats.ncs_pass2++;
-       if (bp != NULL)
-               brelse(bp);
        
        /*
         * Found component in pathname.
        
        /*
         * Found component in pathname.
@@ -384,8 +385,10 @@ found:
         */
        if (flags & ISDOTDOT) {
                VOP_UNLOCK(pdp);        /* race to get the inode */
         */
        if (flags & ISDOTDOT) {
                VOP_UNLOCK(pdp);        /* race to get the inode */
-               if (error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp,
-                                                dp->i_ino != ino, ep)) {
+               error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp,
+                                            dp->i_ino != ino, ep);
+               brelse(bp);
+               if (error) {
                        VOP_LOCK(pdp);
                        return (error);
                }
                        VOP_LOCK(pdp);
                        return (error);
                }
@@ -396,11 +399,14 @@ found:
                }
                *vpp = tdp;
        } else if (dp->i_number == dp->i_ino) {
                }
                *vpp = tdp;
        } else if (dp->i_number == dp->i_ino) {
+               brelse(bp);
                VREF(vdp);      /* we want ourself, ie "." */
                *vpp = vdp;
        } else {
                VREF(vdp);      /* we want ourself, ie "." */
                *vpp = vdp;
        } else {
-               if (error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp,
-                                                dp->i_ino != ino, ep))
+               error = cd9660_vget_internal(vdp->v_mount, dp->i_ino, &tdp,
+                                            dp->i_ino != ino, ep);
+               brelse(bp);
+               if (error)
                        return (error);
                if (!lockparent || !(flags & ISLASTCN))
                        VOP_UNLOCK(pdp);
                        return (error);
                if (!lockparent || !(flags & ISLASTCN))
                        VOP_UNLOCK(pdp);
@@ -416,28 +422,37 @@ found:
 }
 
 /*
 }
 
 /*
- * Return buffer with contents of block "offset"
- * from the beginning of directory "ip".  If "res"
- * is non-zero, fill it in with a pointer to the
+ * Return buffer with the contents of block "offset" from the beginning of
+ * directory "ip".  If "res" is non-zero, fill it in with a pointer to the
  * remaining space in the directory.
  */
  * remaining space in the directory.
  */
-iso_blkatoff(ip, offset, bpp)
-       struct iso_node *ip;
-       doff_t offset;
-       struct buf **bpp;
+int
+cd9660_blkatoff(ap)
+       struct vop_blkatoff_args /* {
+               struct vnode *a_vp;
+               off_t a_offset;
+               char **a_res;
+               struct buf **a_bpp;
+       } */ *ap;
 {
 {
-       register struct iso_mnt *imp = ip->i_mnt;
-       daddr_t lbn = iso_lblkno(imp,offset);
-       int bsize = iso_blksize(imp,ip,lbn);
+       struct iso_node *ip;
+       register struct iso_mnt *imp;
        struct buf *bp;
        struct buf *bp;
-       int error;
+       daddr_t lbn;
+       int bsize, error;
+
+       ip = VTOI(ap->a_vp);
+       imp = ip->i_mnt;
+       lbn = lblkno(imp, ap->a_offset);
+       bsize = blksize(imp, ip, lbn);
        
        
-       if (error = bread(ITOV(ip),lbn,bsize,NOCRED,&bp)) {
+       if (error = bread(ap->a_vp, lbn, bsize, NOCRED, &bp)) {
                brelse(bp);
                brelse(bp);
-               *bpp = 0;
+               *ap->a_bpp = NULL;
                return (error);
        }
                return (error);
        }
-       *bpp = bp;
-       
+       if (ap->a_res)
+               *ap->a_res = (char *)bp->b_data + blkoff(imp, ap->a_offset);
+       *ap->a_bpp = bp;
        return (0);
 }
        return (0);
 }
index e4a8513..ee9efd0 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_node.c       8.4 (Berkeley) %G%
+ *     @(#)cd9660_node.c       8.5 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -246,7 +246,7 @@ cd9660_reclaim(ap)
  * File attributes
  */
 void
  * File attributes
  */
 void
-cd9660_defattr(isodir,inop,bp)
+cd9660_defattr(isodir, inop, bp)
        struct iso_directory_record *isodir;
        struct iso_node *inop;
        struct buf *bp;
        struct iso_directory_record *isodir;
        struct iso_node *inop;
        struct buf *bp;
@@ -268,13 +268,14 @@ cd9660_defattr(isodir,inop,bp)
                inop->inode.iso_links = 1;
        }
        if (!bp
                inop->inode.iso_links = 1;
        }
        if (!bp
-           && ((imp = inop->i_mnt)->im_flags&ISOFSMNT_EXTATT)
+           && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT)
            && (off = isonum_711(isodir->ext_attr_length))) {
            && (off = isonum_711(isodir->ext_attr_length))) {
-               iso_blkatoff(inop,-off * imp->logical_block_size,&bp2);
+               VOP_BLKATOFF(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL,
+                            &bp2);
                bp = bp2;
        }
        if (bp) {
                bp = bp2;
        }
        if (bp) {
-               ap = (struct iso_extended_attributes *)bp->b_un.b_addr;
+               ap = (struct iso_extended_attributes *)bp->b_data;
                
                if (isonum_711(ap->version) == 1) {
                        if (!(ap->perm[0]&0x40))
                
                if (isonum_711(ap->version) == 1) {
                        if (!(ap->perm[0]&0x40))
@@ -318,13 +319,14 @@ cd9660_deftstamp(isodir,inop,bp)
        int off;
        
        if (!bp
        int off;
        
        if (!bp
-           && ((imp = inop->i_mnt)->im_flags&ISOFSMNT_EXTATT)
+           && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT)
            && (off = isonum_711(isodir->ext_attr_length))) {
            && (off = isonum_711(isodir->ext_attr_length))) {
-               iso_blkatoff(inop,-off * imp->logical_block_size,&bp2);
+               VOP_BLKATOFF(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL,
+                            &bp2);
                bp = bp2;
        }
        if (bp) {
                bp = bp2;
        }
        if (bp) {
-               ap = (struct iso_extended_attributes *)bp->b_un.b_addr;
+               ap = (struct iso_extended_attributes *)bp->b_data;
                
                if (isonum_711(ap->version) == 1) {
                        if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
                
                if (isonum_711(ap->version) == 1) {
                        if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
@@ -347,8 +349,8 @@ cd9660_deftstamp(isodir,inop,bp)
 
 int
 cd9660_tstamp_conv7(pi,pu)
 
 int
 cd9660_tstamp_conv7(pi,pu)
-char *pi;
-struct timeval *pu;
+       u_char *pi;
+       struct timespec *pu;
 {
        int i;
        int crtime, days;
 {
        int i;
        int crtime, days;
@@ -363,8 +365,8 @@ struct timeval *pu;
        tz = pi[6];
        
        if (y < 1970) {
        tz = pi[6];
        
        if (y < 1970) {
-               pu->tv_sec  = 0;
-               pu->tv_usec = 0;
+               pu->ts_sec  = 0;
+               pu->ts_nsec = 0;
                return 0;
        } else {
 #ifdef ORIGINAL
                return 0;
        } else {
 #ifdef ORIGINAL
@@ -384,17 +386,17 @@ struct timeval *pu;
                if (-48 <= tz && tz <= 52)
                        crtime -= tz * 15 * 60;
        }
                if (-48 <= tz && tz <= 52)
                        crtime -= tz * 15 * 60;
        }
-       pu->tv_sec  = crtime;
-       pu->tv_usec = 0;
+       pu->ts_sec  = crtime;
+       pu->ts_nsec = 0;
        return 1;
 }
 
        return 1;
 }
 
-static unsigned
+static u_int
 cd9660_chars2ui(begin,len)
 cd9660_chars2ui(begin,len)
-       unsigned char *begin;
+       u_char *begin;
        int len;
 {
        int len;
 {
-       unsigned rc;
+       u_int rc;
        
        for (rc = 0; --len >= 0;) {
                rc *= 10;
        
        for (rc = 0; --len >= 0;) {
                rc *= 10;
@@ -405,10 +407,10 @@ cd9660_chars2ui(begin,len)
 
 int
 cd9660_tstamp_conv17(pi,pu)
 
 int
 cd9660_tstamp_conv17(pi,pu)
-       unsigned char *pi;
-       struct timeval *pu;
+       u_char *pi;
+       struct timespec *pu;
 {
 {
-       unsigned char buf[7];
+       u_char buf[7];
        
        /* year:"0001"-"9999" -> -1900  */
        buf[0] = cd9660_chars2ui(pi,4) - 1900;
        
        /* year:"0001"-"9999" -> -1900  */
        buf[0] = cd9660_chars2ui(pi,4) - 1900;
@@ -434,12 +436,14 @@ cd9660_tstamp_conv17(pi,pu)
        return cd9660_tstamp_conv7(buf,pu);
 }
 
        return cd9660_tstamp_conv7(buf,pu);
 }
 
-void
-isodirino(inump,isodir,imp)
-       ino_t *inump;
+ino_t
+isodirino(isodir, imp)
        struct iso_directory_record *isodir;
        struct iso_mnt *imp;
 {
        struct iso_directory_record *isodir;
        struct iso_mnt *imp;
 {
-       *inump = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length))
-                * imp->logical_block_size;
+       ino_t ino;
+
+       ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length))
+             << imp->im_bshift;
+       return (ino);
 }
 }
index 1c8aae9..45a0e98 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_node.h       8.3 (Berkeley) %G%
+ *     @(#)cd9660_node.h       8.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -101,6 +101,9 @@ int cd9660_unlock __P((struct vop_unlock_args *));
 int cd9660_strategy __P((struct vop_strategy_args *));
 int cd9660_print __P((struct vop_print_args *));
 int cd9660_islocked __P((struct vop_islocked_args *));
 int cd9660_strategy __P((struct vop_strategy_args *));
 int cd9660_print __P((struct vop_print_args *));
 int cd9660_islocked __P((struct vop_islocked_args *));
+int cd9660_pathconf __P((struct vop_pathconf_args *));
+int cd9660_blkatoff __P((struct vop_blkatoff_args *));
+
 void cd9660_defattr __P((struct iso_directory_record *,
                        struct iso_node *, struct buf *));
 void cd9660_deftstamp __P((struct iso_directory_record *,
 void cd9660_defattr __P((struct iso_directory_record *,
                        struct iso_node *, struct buf *));
 void cd9660_deftstamp __P((struct iso_directory_record *,
@@ -108,6 +111,9 @@ void cd9660_deftstamp __P((struct iso_directory_record *,
 struct vnode *cd9660_ihashget __P((dev_t, ino_t));
 void cd9660_ihashins __P((struct iso_node *));
 void cd9660_ihashrem __P((struct iso_node *));
 struct vnode *cd9660_ihashget __P((dev_t, ino_t));
 void cd9660_ihashins __P((struct iso_node *));
 void cd9660_ihashrem __P((struct iso_node *));
+int cd9660_tstamp_conv7 __P((u_char *, struct timespec *));
+int cd9660_tstamp_conv17 __P((u_char *, struct timespec *));
+ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
 #ifdef ISODEVMAP
 struct iso_dnode *iso_dmap __P((dev_t, ino_t, int));
 void iso_dunmap __P((dev_t));
 #ifdef ISODEVMAP
 struct iso_dnode *iso_dmap __P((dev_t, ino_t, int));
 void iso_dunmap __P((dev_t));
index 0b7b0ff..2d50666 100644 (file)
@@ -9,10 +9,11 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_rrip.c       8.5 (Berkeley) %G%
+ *     @(#)cd9660_rrip.c       8.6 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/namei.h>
 #include <sys/buf.h>
 #include <sys/file.h>
 #include <sys/namei.h>
 #include <sys/buf.h>
 #include <sys/file.h>
@@ -37,10 +38,10 @@ cd9660_rrip_attr(p,ana)
        ISO_RRIP_ATTR *p;
        ISO_RRIP_ANALYZE *ana;
 {
        ISO_RRIP_ATTR *p;
        ISO_RRIP_ANALYZE *ana;
 {
-       ana->inop->inode.iso_mode = isonum_731(p->mode_l);
-       ana->inop->inode.iso_uid = (uid_t)isonum_731(p->uid_l);
-       ana->inop->inode.iso_gid = (gid_t)isonum_731(p->gid_l);
-       ana->inop->inode.iso_links = isonum_731(p->links_l);
+       ana->inop->inode.iso_mode = isonum_733(p->mode);
+       ana->inop->inode.iso_uid = isonum_733(p->uid);
+       ana->inop->inode.iso_gid = isonum_733(p->gid);
+       ana->inop->inode.iso_links = isonum_733(p->links);
        ana->fields &= ~ISO_SUSP_ATTR;
        return ISO_SUSP_ATTR;
 }
        ana->fields &= ~ISO_SUSP_ATTR;
        return ISO_SUSP_ATTR;
 }
@@ -285,7 +286,7 @@ cd9660_rrip_tstamp(p,ana)
        ISO_RRIP_TSTAMP *p;
        ISO_RRIP_ANALYZE *ana;
 {
        ISO_RRIP_TSTAMP *p;
        ISO_RRIP_ANALYZE *ana;
 {
-       unsigned char *ptime;
+       u_char *ptime;
        
        ptime = p->time;
        
        
        ptime = p->time;
        
@@ -298,7 +299,7 @@ cd9660_rrip_tstamp(p,ana)
                        cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime);
                        ptime += 7;
                } else
                        cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime);
                        ptime += 7;
                } else
-                       bzero(&ana->inop->inode.iso_mtime,sizeof(struct timeval));
+                       bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec));
                
                if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
                        cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime);
                
                if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
                        cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime);
@@ -319,7 +320,7 @@ cd9660_rrip_tstamp(p,ana)
                        cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_mtime);
                        ptime += 17;
                } else
                        cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_mtime);
                        ptime += 17;
                } else
-                       bzero(&ana->inop->inode.iso_mtime,sizeof(struct timeval));
+                       bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec));
                
                if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
                        cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_atime);
                
                if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
                        cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_atime);
@@ -353,10 +354,10 @@ cd9660_rrip_device(p,ana)
        ISO_RRIP_DEVICE *p;
        ISO_RRIP_ANALYZE *ana;
 {
        ISO_RRIP_DEVICE *p;
        ISO_RRIP_ANALYZE *ana;
 {
-       unsigned high, low;
+       u_int high, low;
        
        
-       high = isonum_733(p->dev_t_high_l);
-       low  = isonum_733(p->dev_t_low_l);
+       high = isonum_733(p->dev_t_high);
+       low  = isonum_733(p->dev_t_low);
        
        if (high == 0)
                ana->inop->inode.iso_rdev = makedev(major(low), minor(low));
        
        if (high == 0)
                ana->inop->inode.iso_rdev = makedev(major(low), minor(low));
@@ -498,11 +499,12 @@ cd9660_rrip_loop(isodir,ana,table)
                        if (ana->iso_ce_blk >= ana->imp->volume_space_size
                            || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size
                            || bread(ana->imp->im_devvp,
                        if (ana->iso_ce_blk >= ana->imp->volume_space_size
                            || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size
                            || bread(ana->imp->im_devvp,
-                                    ana->iso_ce_blk * ana->imp->logical_block_size / DEV_BSIZE,
-                                    ana->imp->logical_block_size,NOCRED,&bp))
+                                    ana->iso_ce_blk <<
+                                    (ana->imp->im_bshift - DEV_BSHIFT),
+                                    ana->imp->logical_block_size, NOCRED, &bp))
                                /* what to do now? */
                                break;
                                /* what to do now? */
                                break;
-                       phead = (ISO_SUSP_HEADER *)(bp->b_un.b_addr + ana->iso_ce_off);
+                       phead = (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off);
                        pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len);
                } else
                        break;
                        pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len);
                } else
                        break;
index 68e1829..cbc6b73 100644 (file)
@@ -9,33 +9,27 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_rrip.h       8.1 (Berkeley) %G%
+ *     @(#)cd9660_rrip.h       8.2 (Berkeley) %G%
  */
 
 typedef struct {
  */
 
 typedef struct {
-       char          type              [ISODCL (  0,    1)];
-       unsigned char length            [ISODCL (  2,    2)]; /* 711 */
-       unsigned char version           [ISODCL (  3,    3)];
+       char   type                     [ISODCL (  0,    1)];
+       u_char length                   [ISODCL (  2,    2)]; /* 711 */
+       u_char version                  [ISODCL (  3,    3)];
 } ISO_SUSP_HEADER;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
 } ISO_SUSP_HEADER;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
-       char mode_l                     [ISODCL (  4,    7)]; /* 731 */
-       char mode_m                     [ISODCL (  8,   11)]; /* 732 */
-       char links_l                    [ISODCL ( 12,   15)]; /* 731 */
-       char links_m                    [ISODCL ( 16,   19)]; /* 732 */
-       char uid_l                      [ISODCL ( 20,   23)]; /* 731 */
-       char uid_m                      [ISODCL ( 24,   27)]; /* 732 */
-       char gid_l                      [ISODCL ( 28,   31)]; /* 731 */
-       char gid_m                      [ISODCL ( 32,   35)]; /* 732 */
+       char mode                       [ISODCL (  4,   11)]; /* 733 */
+       char links                      [ISODCL ( 12,   19)]; /* 733 */
+       char uid                        [ISODCL ( 20,   27)]; /* 733 */
+       char gid                        [ISODCL ( 28,   35)]; /* 733 */
 } ISO_RRIP_ATTR;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
 } ISO_RRIP_ATTR;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
-       char dev_t_high_l               [ISODCL (  4,    7)]; /* 731 */
-       char dev_t_high_m               [ISODCL (  8,   11)]; /* 732 */
-       char dev_t_low_l                [ISODCL ( 12,   15)]; /* 731 */
-       char dev_t_low_m                [ISODCL ( 16,   19)]; /* 732 */
+       char dev_t_high                 [ISODCL (  4,   11)]; /* 733 */
+       char dev_t_low                  [ISODCL ( 12,   19)]; /* 733 */
 } ISO_RRIP_DEVICE;
 
 #define        ISO_SUSP_CFLAG_CONTINUE 0x01
 } ISO_RRIP_DEVICE;
 
 #define        ISO_SUSP_CFLAG_CONTINUE 0x01
@@ -48,7 +42,7 @@ typedef struct {
 typedef struct {
        u_char cflag                    [ISODCL (  1,    1)];
        u_char clen                     [ISODCL (  2,    2)];
 typedef struct {
        u_char cflag                    [ISODCL (  1,    1)];
        u_char clen                     [ISODCL (  2,    2)];
-       u_char name                     [0];
+       u_char name                     [1];                    /* XXX */
 } ISO_RRIP_SLINK_COMPONENT;
 #define        ISO_RRIP_SLSIZ  2
 
 } ISO_RRIP_SLINK_COMPONENT;
 #define        ISO_RRIP_SLSIZ  2
 
@@ -89,13 +83,13 @@ typedef struct {
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
-       unsigned char flags             [ISODCL (  4,    4)];
-       unsigned char time              [ISODCL (  5,    5)];
+       u_char flags                    [ISODCL (  4,    4)];
+       u_char time                     [ISODCL (  5,    5)];
 } ISO_RRIP_TSTAMP;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
 } ISO_RRIP_TSTAMP;
 
 typedef struct {
        ISO_SUSP_HEADER                 h;
-       unsigned char flags             [ISODCL (  4,    4)];
+       u_char flags                    [ISODCL (  4,    4)];
 } ISO_RRIP_IDFLAG;
 
 typedef struct {
 } ISO_RRIP_IDFLAG;
 
 typedef struct {
index f7752d0..154481c 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_util.c       8.2 (Berkeley) %G%
+ *     @(#)cd9660_util.c       8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 
 #include <isofs/cd9660/iso.h>
 
 
 #include <isofs/cd9660/iso.h>
 
-#ifdef __notanymore__
-int
-isonum_711 (p)
-unsigned char *p;
-{
-       return (*p);
-}
-
-int
-isonum_712 (p)
-signed char *p;
-{
-       return (*p);
-}
-
-int
-isonum_721 (p)
-unsigned char *p;
-{
-       /* little endian short */
-#if BYTE_ORDER != LITTLE_ENDIAN
-       printf ("isonum_721 called on non little-endian machine!\n");
-#endif
-
-       return *(short *)p;
-}
-
-int
-isonum_722 (p)
-unsigned char *p;
-{
-        /* big endian short */
-#if BYTE_ORDER != BIG_ENDIAN
-        printf ("isonum_722 called on non big-endian machine!\n");
-#endif
-
-       return *(short *)p;
-}
-
-int
-isonum_723 (p)
-unsigned char *p;
-{
-#if BYTE_ORDER == BIG_ENDIAN
-        return isonum_722 (p + 2);
-#elif BYTE_ORDER == LITTLE_ENDIAN
-       return isonum_721 (p);
-#else
-       printf ("isonum_723 unsupported byte order!\n");
-       return 0;
-#endif
-}
-
-int
-isonum_731 (p)
-unsigned char *p;
-{
-        /* little endian long */
-#if BYTE_ORDER != LITTLE_ENDIAN
-        printf ("isonum_731 called on non little-endian machine!\n");
-#endif
-
-       return *(long *)p;
-}
-
-int
-isonum_732 (p)
-unsigned char *p;
-{
-        /* big endian long */
-#if BYTE_ORDER != BIG_ENDIAN
-        printf ("isonum_732 called on non big-endian machine!\n");
-#endif
-
-       return *(long *)p;
-}
-
-int
-isonum_733 (p)
-unsigned char *p;
-{
-#if BYTE_ORDER == BIG_ENDIAN
-        return isonum_732 (p + 4);
-#elif BYTE_ORDER == LITTLE_ENDIAN
-       return isonum_731 (p);
-#else
-       printf ("isonum_733 unsupported byte order!\n");
-       return 0;
-#endif
-}
-#endif /* __notanymore__ */
-
 /*
  * translate and compare a filename
  * Note: Version number plus ';' may be omitted.
  */
 int
 /*
  * translate and compare a filename
  * Note: Version number plus ';' may be omitted.
  */
 int
-isofncmp(unsigned char *fn,int fnlen,unsigned char *isofn,int isolen)
+isofncmp(fn, fnlen, isofn, isolen)
+       u_char *fn, *isofn;
+       int fnlen, isolen;
 {
        int i, j;
        char c;
 {
        int i, j;
        char c;
@@ -184,9 +94,12 @@ isofncmp(unsigned char *fn,int fnlen,unsigned char *isofn,int isolen)
  * translate a filename
  */
 void
  * translate a filename
  */
 void
-isofntrans(unsigned char *infn,int infnlen,
-          unsigned char *outfn,unsigned short *outfnlen,
-          int original,int assoc)
+isofntrans(infn, infnlen, outfn, outfnlen, original, assoc)
+       u_char *infn, *outfn;
+       int infnlen;
+       u_short *outfnlen;
+       int original;
+       int assoc;
 {
        int fnidx = 0;
        
 {
        int fnidx = 0;
        
index eb01961..9ef3cc9 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_vfsops.c     8.7 (Berkeley) %G%
+ *     @(#)cd9660_vfsops.c     8.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -35,6 +35,7 @@
 extern int enodev ();
 
 struct vfsops cd9660_vfsops = {
 extern int enodev ();
 
 struct vfsops cd9660_vfsops = {
+       MOUNT_CD9660,
        cd9660_mount,
        cd9660_start,
        cd9660_unmount,
        cd9660_mount,
        cd9660_start,
        cd9660_unmount,
@@ -232,11 +233,11 @@ static iso_mountfs(devvp, mp, p, argp)
        iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
        
        for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) {
        iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
        
        for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) {
-               if (error = bread (devvp, btodb(iso_blknum * iso_bsize),
-                                  iso_bsize, NOCRED, &bp))
+               if (error = bread(devvp, iso_blknum * btodb(iso_bsize),
+                                 iso_bsize, NOCRED, &bp))
                        goto out;
                
                        goto out;
                
-               vdp = (struct iso_volume_descriptor *)bp->b_un.b_addr;
+               vdp = (struct iso_volume_descriptor *)bp->b_data;
                if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) {
                        error = EINVAL;
                        goto out;
                if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) {
                        error = EINVAL;
                        goto out;
@@ -288,7 +289,7 @@ static iso_mountfs(devvp, mp, p, argp)
        
        mp->mnt_data = (qaddr_t)isomp;
        mp->mnt_stat.f_fsid.val[0] = (long)dev;
        
        mp->mnt_data = (qaddr_t)isomp;
        mp->mnt_stat.f_fsid.val[0] = (long)dev;
-       mp->mnt_stat.f_fsid.val[1] = MOUNT_CD9660;
+       mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_CD9660);
        mp->mnt_maxsymlinklen = 0;
        mp->mnt_flag |= MNT_LOCAL;
        isomp->im_mountp = mp;
        mp->mnt_maxsymlinklen = 0;
        mp->mnt_flag |= MNT_LOCAL;
        isomp->im_mountp = mp;
@@ -299,13 +300,13 @@ static iso_mountfs(devvp, mp, p, argp)
        
        /* Check the Rock Ridge Extention support */
        if (!(argp->flags & ISOFSMNT_NORRIP)) {
        
        /* Check the Rock Ridge Extention support */
        if (!(argp->flags & ISOFSMNT_NORRIP)) {
-               if (error = bread (isomp->im_devvp,
-                                  (isomp->root_extent + isonum_711(rootp->ext_attr_length))
-                                  * isomp->logical_block_size / DEV_BSIZE,
-                                  isomp->logical_block_size,NOCRED,&bp))
+               if (error = bread(isomp->im_devvp,
+                                 (isomp->root_extent + isonum_711(rootp->ext_attr_length)) <<
+                                 (isomp->im_bshift - DEV_BSHIFT),
+                                 isomp->logical_block_size, NOCRED, &bp))
                    goto out;
                
                    goto out;
                
-               rootp = (struct iso_directory_record *)bp->b_un.b_addr;
+               rootp = (struct iso_directory_record *)bp->b_data;
                
                if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
                    argp->flags  |= ISOFSMNT_NORRIP;
                
                if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
                    argp->flags  |= ISOFSMNT_NORRIP;
@@ -413,9 +414,7 @@ cd9660_root(mp, vpp)
        struct iso_mnt *imp = VFSTOISOFS(mp);
        struct iso_directory_record *dp =
            (struct iso_directory_record *)imp->root;
        struct iso_mnt *imp = VFSTOISOFS(mp);
        struct iso_directory_record *dp =
            (struct iso_directory_record *)imp->root;
-       ino_t ino;
-       
-       isodirino(&ino, dp, imp);
+       ino_t ino = isodirino(dp, imp);
        
        /*
         * With RRIP we must use the `.' entry of the root directory.
        
        /*
         * With RRIP we must use the `.' entry of the root directory.
@@ -454,7 +453,11 @@ cd9660_statfs(mp, sbp, p)
        
        isomp = VFSTOISOFS(mp);
 
        
        isomp = VFSTOISOFS(mp);
 
-       sbp->f_type = MOUNT_CD9660;
+#ifdef COMPAT_09
+       sbp->f_type = 5;
+#else
+       sbp->f_type = 0;
+#endif
        sbp->f_bsize = isomp->logical_block_size;
        sbp->f_iosize = sbp->f_bsize;   /* XXX */
        sbp->f_blocks = isomp->volume_space_size;
        sbp->f_bsize = isomp->logical_block_size;
        sbp->f_iosize = sbp->f_bsize;   /* XXX */
        sbp->f_blocks = isomp->volume_space_size;
@@ -468,6 +471,8 @@ cd9660_statfs(mp, sbp, p)
                bcopy((caddr_t)mp->mnt_stat.f_mntfromname,
                        (caddr_t)&sbp->f_mntfromname[0], MNAMELEN);
        }
                bcopy((caddr_t)mp->mnt_stat.f_mntfromname,
                        (caddr_t)&sbp->f_mntfromname[0], MNAMELEN);
        }
+       strncpy(&sbp->f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN);
+       sbp->f_fstypename[MFSNAMELEN] = '\0';
        /* Use the first spare for flags: */
        sbp->f_spare[0] = isomp->im_flags;
        return 0;
        /* Use the first spare for flags: */
        sbp->f_spare[0] = isomp->im_flags;
        return 0;
@@ -612,14 +617,14 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
        if (isodir == 0) {
                int lbn, off;
 
        if (isodir == 0) {
                int lbn, off;
 
-               lbn = iso_lblkno(imp, ino);
+               lbn = lblkno(imp, ino);
                if (lbn >= imp->volume_space_size) {
                        vput(vp);
                        printf("fhtovp: lbn exceed volume space %d\n", lbn);
                        return (ESTALE);
                }
        
                if (lbn >= imp->volume_space_size) {
                        vput(vp);
                        printf("fhtovp: lbn exceed volume space %d\n", lbn);
                        return (ESTALE);
                }
        
-               off = iso_blkoff(imp, ino);
+               off = blkoff(imp, ino);
                if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) {
                        vput(vp);
                        printf("fhtovp: crosses block boundary %d\n",
                if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) {
                        vput(vp);
                        printf("fhtovp: crosses block boundary %d\n",
@@ -628,7 +633,7 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
                }
        
                error = bread(imp->im_devvp,
                }
        
                error = bread(imp->im_devvp,
-                             btodb(lbn * imp->logical_block_size),
+                             lbn << (imp->im_bshift - DEV_BSHIFT),
                              imp->logical_block_size, NOCRED, &bp);
                if (error) {
                        vput(vp);
                              imp->logical_block_size, NOCRED, &bp);
                if (error) {
                        vput(vp);
@@ -675,7 +680,7 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
                ip->iso_start = ino >> imp->im_bshift;
                if (bp != 0)
                        brelse(bp);
                ip->iso_start = ino >> imp->im_bshift;
                if (bp != 0)
                        brelse(bp);
-               if (error = iso_blkatoff(ip, 0, &bp)) {
+               if (error = VOP_BLKATOFF(vp, (off_t)0, NULL, &bp)) {
                        vput(vp);
                        return (error);
                }
                        vput(vp);
                        return (error);
                }
@@ -694,9 +699,10 @@ cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
        default:        /* ISO_FTYPE_9660 */
            {
                struct buf *bp2;
        default:        /* ISO_FTYPE_9660 */
            {
                struct buf *bp2;
+               int off;
                if ((imp->im_flags & ISOFSMNT_EXTATT)
                if ((imp->im_flags & ISOFSMNT_EXTATT)
-                   && isonum_711(isodir->ext_attr_length))
-                       iso_blkatoff(ip, -isonum_711(isodir->ext_attr_length),
+                   && (off = isonum_711(isodir->ext_attr_length)))
+                       VOP_BLKATOFF(vp, (off_t)-(off << imp->im_bshift), NULL,
                                     &bp2);
                else
                        bp2 = NULL;
                                     &bp2);
                else
                        bp2 = NULL;
index 8a9ec37..6b81d2d 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)cd9660_vnops.c      8.13 (Berkeley) %G%
+ *     @(#)cd9660_vnops.c      8.14 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -54,10 +54,10 @@ cd9660_mknod(ndp, vap, cred, p)
        struct iso_node *ip;
        struct iso_dnode *dp;
        int error;
        struct iso_node *ip;
        struct iso_dnode *dp;
        int error;
-       
+
        vp = ndp->ni_vp;
        ip = VTOI(vp);
        vp = ndp->ni_vp;
        ip = VTOI(vp);
-       
+
        if (ip->i_mnt->iso_ftype != ISO_FTYPE_RRIP
            || vap->va_type != vp->v_type
            || (vap->va_type != VCHR && vap->va_type != VBLK)) {
        if (ip->i_mnt->iso_ftype != ISO_FTYPE_RRIP
            || vap->va_type != vp->v_type
            || (vap->va_type != VCHR && vap->va_type != VBLK)) {
@@ -66,7 +66,7 @@ cd9660_mknod(ndp, vap, cred, p)
                vput(ndp->ni_vp);
                return (EINVAL);
        }
                vput(ndp->ni_vp);
                return (EINVAL);
        }
-       
+
        dp = iso_dmap(ip->i_dev,ip->i_number,1);
        if (ip->inode.iso_rdev == vap->va_rdev || vap->va_rdev == VNOVAL) {
                /* same as the unmapped one, delete the mapping */
        dp = iso_dmap(ip->i_dev,ip->i_number,1);
        if (ip->inode.iso_rdev == vap->va_rdev || vap->va_rdev == VNOVAL) {
                /* same as the unmapped one, delete the mapping */
@@ -75,7 +75,7 @@ cd9660_mknod(ndp, vap, cred, p)
        } else
                /* enter new mapping */
                dp->d_dev = vap->va_rdev;
        } else
                /* enter new mapping */
                dp->d_dev = vap->va_rdev;
-       
+
        /*
         * Remove inode so that it will be reloaded by iget and
         * checked to see if it is an alias of an existing entry
        /*
         * Remove inode so that it will be reloaded by iget and
         * checked to see if it is an alias of an existing entry
@@ -143,7 +143,7 @@ cd9660_access(ap)
        struct ucred *cred = ap->a_cred;
        mode_t mask, mode = ap->a_mode;
        gid_t *gp;
        struct ucred *cred = ap->a_cred;
        mode_t mask, mode = ap->a_mode;
        gid_t *gp;
-       int i, error;
+       int i;
 
        /* User id 0 always gets access. */
        if (cred->cr_uid == 0)
 
        /* User id 0 always gets access. */
        if (cred->cr_uid == 0)
@@ -274,7 +274,7 @@ cd9660_read(ap)
        off_t diff;
        int rasize, error = 0;
        long size, n, on;
        off_t diff;
        int rasize, error = 0;
        long size, n, on;
-       
+
        if (uio->uio_resid == 0)
                return (0);
        if (uio->uio_offset < 0)
        if (uio->uio_resid == 0)
                return (0);
        if (uio->uio_offset < 0)
@@ -282,27 +282,27 @@ cd9660_read(ap)
        ip->i_flag |= IN_ACCESS;
        imp = ip->i_mnt;
        do {
        ip->i_flag |= IN_ACCESS;
        imp = ip->i_mnt;
        do {
-               lbn = iso_lblkno(imp, uio->uio_offset);
-               on = iso_blkoff(imp, uio->uio_offset);
-               n = min((unsigned)(imp->logical_block_size - on),
+               lbn = lblkno(imp, uio->uio_offset);
+               on = blkoff(imp, uio->uio_offset);
+               n = min((u_int)(imp->logical_block_size - on),
                        uio->uio_resid);
                diff = (off_t)ip->i_size - uio->uio_offset;
                if (diff <= 0)
                        return (0);
                if (diff < n)
                        n = diff;
                        uio->uio_resid);
                diff = (off_t)ip->i_size - uio->uio_offset;
                if (diff <= 0)
                        return (0);
                if (diff < n)
                        n = diff;
-               size = iso_blksize(imp, ip, lbn);
+               size = blksize(imp, ip, lbn);
                rablock = lbn + 1;
                if (doclusterread) {
                rablock = lbn + 1;
                if (doclusterread) {
-                       if (iso_lblktosize(imp, rablock) <= ip->i_size)
+                       if (lblktosize(imp, rablock) <= ip->i_size)
                                error = cluster_read(vp, (off_t)ip->i_size,
                                                     lbn, size, NOCRED, &bp);
                                error = cluster_read(vp, (off_t)ip->i_size,
                                                     lbn, size, NOCRED, &bp);
-                       else 
+                       else
                                error = bread(vp, lbn, size, NOCRED, &bp);
                } else {
                        if (vp->v_lastr + 1 == lbn &&
                                error = bread(vp, lbn, size, NOCRED, &bp);
                } else {
                        if (vp->v_lastr + 1 == lbn &&
-                           iso_lblktosize(imp, rablock) < ip->i_size) {
-                               rasize = iso_blksize(imp, ip, rablock);
+                           lblktosize(imp, rablock) < ip->i_size) {
+                               rasize = blksize(imp, ip, rablock);
                                error = breadn(vp, lbn, size, &rablock,
                                               &rasize, 1, NOCRED, &bp);
                        } else
                                error = breadn(vp, lbn, size, &rablock,
                                               &rasize, 1, NOCRED, &bp);
                        } else
@@ -315,7 +315,7 @@ cd9660_read(ap)
                        return (error);
                }
 
                        return (error);
                }
 
-               error = uiomove(bp->b_un.b_addr + on, (int)n, uio);
+               error = uiomove(bp->b_data + on, (int)n, uio);
                if (n + on == imp->logical_block_size ||
                    uio->uio_offset == (off_t)ip->i_size)
                        bp->b_flags |= B_AGE;
                if (n + on == imp->logical_block_size ||
                    uio->uio_offset == (off_t)ip->i_size)
                        bp->b_flags |= B_AGE;
@@ -329,7 +329,7 @@ int
 cd9660_ioctl(ap)
        struct vop_ioctl_args /* {
                struct vnode *a_vp;
 cd9660_ioctl(ap)
        struct vop_ioctl_args /* {
                struct vnode *a_vp;
-               int  a_command;
+               u_long a_command;
                caddr_t  a_data;
                int  a_fflag;
                struct ucred *a_cred;
                caddr_t  a_data;
                int  a_fflag;
                struct ucred *a_cred;
@@ -413,39 +413,39 @@ struct isoreaddir {
        int ncookies;
 };
 
        int ncookies;
 };
 
-static int
+int
 iso_uiodir(idp,dp,off)
        struct isoreaddir *idp;
        struct dirent *dp;
        off_t off;
 {
        int error;
 iso_uiodir(idp,dp,off)
        struct isoreaddir *idp;
        struct dirent *dp;
        off_t off;
 {
        int error;
-       
+
        dp->d_name[dp->d_namlen] = 0;
        dp->d_reclen = DIRSIZ(dp);
        dp->d_name[dp->d_namlen] = 0;
        dp->d_reclen = DIRSIZ(dp);
-       
+
        if (idp->uio->uio_resid < dp->d_reclen) {
                idp->eofflag = 0;
                return (-1);
        }
        if (idp->uio->uio_resid < dp->d_reclen) {
                idp->eofflag = 0;
                return (-1);
        }
-       
+
        if (idp->cookies) {
                if (idp->ncookies <= 0) {
                        idp->eofflag = 0;
                        return (-1);
                }
        if (idp->cookies) {
                if (idp->ncookies <= 0) {
                        idp->eofflag = 0;
                        return (-1);
                }
-               
+
                *idp->cookies++ = off;
                --idp->ncookies;
        }
                *idp->cookies++ = off;
                --idp->ncookies;
        }
-       
+
        if (error = uiomove(dp,dp->d_reclen,idp->uio))
                return (error);
        idp->uio_off = off;
        return (0);
 }
 
        if (error = uiomove(dp,dp->d_reclen,idp->uio))
                return (error);
        idp->uio_off = off;
        return (0);
 }
 
-static int
+int
 iso_shipdir(idp)
        struct isoreaddir *idp;
 {
 iso_shipdir(idp)
        struct isoreaddir *idp;
 {
@@ -453,14 +453,14 @@ iso_shipdir(idp)
        int cl, sl, assoc;
        int error;
        char *cname, *sname;
        int cl, sl, assoc;
        int error;
        char *cname, *sname;
-       
+
        cl = idp->current.d_namlen;
        cname = idp->current.d_name;
        if (assoc = cl > 1 && *cname == ASSOCCHAR) {
                cl--;
                cname++;
        }
        cl = idp->current.d_namlen;
        cname = idp->current.d_name;
        if (assoc = cl > 1 && *cname == ASSOCCHAR) {
                cl--;
                cname++;
        }
-       
+
        dp = &idp->saveent;
        sname = dp->d_name;
        if (!(sl = dp->d_namlen)) {
        dp = &idp->saveent;
        sname = dp->d_name;
        if (!(sl = dp->d_namlen)) {
@@ -510,19 +510,22 @@ cd9660_readdir(ap)
 {
        register struct uio *uio = ap->a_uio;
        struct isoreaddir *idp;
 {
        register struct uio *uio = ap->a_uio;
        struct isoreaddir *idp;
+       struct vnode *vdp = ap->a_vp;
+       struct iso_node *dp;
+       struct iso_mnt *imp;
+       struct buf *bp = NULL;
+       struct iso_directory_record *ep;
        int entryoffsetinblock;
        int entryoffsetinblock;
+       doff_t endsearch;
+       u_long bmask;
        int error = 0;
        int error = 0;
-       int endsearch;
-       struct iso_directory_record *ep;
-       u_short elen;
        int reclen;
        int reclen;
-       struct iso_mnt *imp;
-       struct iso_node *ip;
-       struct buf *bp = NULL;
-       
-       ip = VTOI(ap->a_vp);
-       imp = ip->i_mnt;
-       
+       u_short namelen;
+
+       dp = VTOI(vdp);
+       imp = dp->i_mnt;
+       bmask = imp->im_bmask;
+
        MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK);
        idp->saveent.d_namlen = idp->assocent.d_namlen = 0;
        /*
        MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK);
        idp->saveent.d_namlen = idp->assocent.d_namlen = 0;
        /*
@@ -536,58 +539,54 @@ cd9660_readdir(ap)
        idp->cookies = ap->a_cookies;
        idp->ncookies = ap->a_ncookies;
        idp->curroff = uio->uio_offset;
        idp->cookies = ap->a_cookies;
        idp->ncookies = ap->a_ncookies;
        idp->curroff = uio->uio_offset;
-       
-       entryoffsetinblock = iso_blkoff(imp, idp->curroff);
-       if (entryoffsetinblock != 0) {
-               if (error = iso_blkatoff(ip, idp->curroff, &bp)) {
-                       FREE(idp,M_TEMP);
-                       return (error);
-               }
+
+       if ((entryoffsetinblock = idp->curroff & bmask) &&
+           (error = VOP_BLKATOFF(vdp, (off_t)idp->curroff, NULL, &bp))) {
+               FREE(idp, M_TEMP);
+               return (error);
        }
        }
-       
-       endsearch = roundup(ip->i_size, imp->logical_block_size);
-       
+       endsearch = dp->i_size;
+
        while (idp->curroff < endsearch) {
                /*
                 * If offset is on a block boundary,
                 * read the next directory block.
                 * Release previous if it exists.
                 */
        while (idp->curroff < endsearch) {
                /*
                 * If offset is on a block boundary,
                 * read the next directory block.
                 * Release previous if it exists.
                 */
-               
-               if (iso_blkoff(imp, idp->curroff) == 0) {
+               if ((idp->curroff & bmask) == 0) {
                        if (bp != NULL)
                                brelse(bp);
                        if (bp != NULL)
                                brelse(bp);
-                       if (error = iso_blkatoff(ip, idp->curroff, &bp))
+                       if (error =
+                           VOP_BLKATOFF(vdp, (off_t)idp->curroff, NULL, &bp))
                                break;
                        entryoffsetinblock = 0;
                }
                /*
                 * Get pointer to next entry.
                 */
                                break;
                        entryoffsetinblock = 0;
                }
                /*
                 * Get pointer to next entry.
                 */
-               
                ep = (struct iso_directory_record *)
                ep = (struct iso_directory_record *)
-                       (bp->b_un.b_addr + entryoffsetinblock);
-               
-               reclen = isonum_711 (ep->length);
+                       ((char *)bp->b_data + entryoffsetinblock);
+
+               reclen = isonum_711(ep->length);
                if (reclen == 0) {
                        /* skip to next block, if any */
                        idp->curroff =
                if (reclen == 0) {
                        /* skip to next block, if any */
                        idp->curroff =
-                               roundup(idp->curroff, imp->logical_block_size);
+                           (idp->curroff & ~bmask) + imp->logical_block_size;
                        continue;
                }
                        continue;
                }
-               
+
                if (reclen < ISO_DIRECTORY_RECORD_SIZE) {
                        error = EINVAL;
                        /* illegal entry, stop */
                        break;
                }
                if (reclen < ISO_DIRECTORY_RECORD_SIZE) {
                        error = EINVAL;
                        /* illegal entry, stop */
                        break;
                }
-               
+
                if (entryoffsetinblock + reclen > imp->logical_block_size) {
                        error = EINVAL;
                        /* illegal directory, so stop looking */
                        break;
                }
                if (entryoffsetinblock + reclen > imp->logical_block_size) {
                        error = EINVAL;
                        /* illegal directory, so stop looking */
                        break;
                }
-               
+
                idp->current.d_namlen = isonum_711(ep->name_len);
 
                if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) {
                idp->current.d_namlen = isonum_711(ep->name_len);
 
                if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) {
@@ -595,20 +594,20 @@ cd9660_readdir(ap)
                        /* illegal entry, stop */
                        break;
                }
                        /* illegal entry, stop */
                        break;
                }
-               
+
                if (isonum_711(ep->flags)&2)
                if (isonum_711(ep->flags)&2)
-                       isodirino(&idp->current.d_fileno,ep,imp);
+                       idp->current.d_fileno = isodirino(ep, imp);
                else
                        idp->current.d_fileno = dbtob(bp->b_blkno) +
                                entryoffsetinblock;
                else
                        idp->current.d_fileno = dbtob(bp->b_blkno) +
                                entryoffsetinblock;
-               
+
                idp->curroff += reclen;
 
                switch (imp->iso_ftype) {
                case ISO_FTYPE_RRIP:
                idp->curroff += reclen;
 
                switch (imp->iso_ftype) {
                case ISO_FTYPE_RRIP:
-                       cd9660_rrip_getname(ep,idp->current.d_name, &elen,
+                       cd9660_rrip_getname(ep,idp->current.d_name, &namelen,
                                           &idp->current.d_fileno,imp);
                                           &idp->current.d_fileno,imp);
-                       idp->current.d_namlen = (u_char)elen;
+                       idp->current.d_namlen = (u_char)namelen;
                        if (idp->current.d_namlen)
                                error = iso_uiodir(idp,&idp->current,idp->curroff);
                        break;
                        if (idp->current.d_namlen)
                                error = iso_uiodir(idp,&idp->current,idp->curroff);
                        break;
@@ -625,10 +624,10 @@ cd9660_readdir(ap)
                                break;
                        default:
                                isofntrans(ep->name,idp->current.d_namlen,
                                break;
                        default:
                                isofntrans(ep->name,idp->current.d_namlen,
-                                          idp->current.d_name, &elen,
+                                          idp->current.d_name, &namelen,
                                           imp->iso_ftype == ISO_FTYPE_9660,
                                           isonum_711(ep->flags)&4);
                                           imp->iso_ftype == ISO_FTYPE_9660,
                                           isonum_711(ep->flags)&4);
-                               idp->current.d_namlen = (u_char)elen;
+                               idp->current.d_namlen = (u_char)namelen;
                                if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
                                        error = iso_shipdir(idp);
                                else
                                if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
                                        error = iso_shipdir(idp);
                                else
@@ -638,26 +637,28 @@ cd9660_readdir(ap)
                }
                if (error)
                        break;
                }
                if (error)
                        break;
-               
+
                entryoffsetinblock += reclen;
        }
                entryoffsetinblock += reclen;
        }
-       
+
        if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) {
                idp->current.d_namlen = 0;
                error = iso_shipdir(idp);
        }
        if (error < 0)
                error = 0;
        if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) {
                idp->current.d_namlen = 0;
                error = iso_shipdir(idp);
        }
        if (error < 0)
                error = 0;
-       
+
        if (bp)
                brelse (bp);
        if (bp)
                brelse (bp);
+
        uio->uio_offset = idp->uio_off;
        *ap->a_eofflag = idp->eofflag;
        uio->uio_offset = idp->uio_off;
        *ap->a_eofflag = idp->eofflag;
-       
-       FREE(idp,M_TEMP);
-       
+
+       FREE(idp, M_TEMP);
+
        return (error);
 }
        return (error);
 }
+
 /*
  * Return target name of a symbolic link
  * Shouldn't we get the parent vnode and read the data from there?
 /*
  * Return target name of a symbolic link
  * Shouldn't we get the parent vnode and read the data from there?
@@ -676,30 +677,27 @@ cd9660_readlink(ap)
        } */ *ap;
 {
        ISONODE *ip;
        } */ *ap;
 {
        ISONODE *ip;
-       ISODIR  *dirp;                   
+       ISODIR  *dirp;
        ISOMNT  *imp;
        struct  buf *bp;
        ISOMNT  *imp;
        struct  buf *bp;
-       struct  uio *uio;
        u_short symlen;
        int     error;
        char    *symname;
        ino_t   ino;
        u_short symlen;
        int     error;
        char    *symname;
        ino_t   ino;
-       
+
        ip  = VTOI(ap->a_vp);
        imp = ip->i_mnt;
        ip  = VTOI(ap->a_vp);
        imp = ip->i_mnt;
-       uio = ap->a_uio;
-       
+
        if (imp->iso_ftype != ISO_FTYPE_RRIP)
                return (EINVAL);
        if (imp->iso_ftype != ISO_FTYPE_RRIP)
                return (EINVAL);
-       
+
        /*
         * Get parents directory record block that this inode included.
         */
        error = bread(imp->im_devvp,
        /*
         * Get parents directory record block that this inode included.
         */
        error = bread(imp->im_devvp,
-                     (daddr_t)((ip->i_number&~imp->im_bmask) / DEV_BSIZE),
-                     imp->logical_block_size,
-                     NOCRED,
-                     &bp);
+                     (ip->i_number >> imp->im_bshift) <<
+                     (imp->im_bshift - DEV_BSHIFT),
+                     imp->logical_block_size, NOCRED, &bp);
        if (error) {
                brelse(bp);
                return (EINVAL);
        if (error) {
                brelse(bp);
                return (EINVAL);
@@ -708,7 +706,7 @@ cd9660_readlink(ap)
        /*
         * Setup the directory pointer for this inode
         */
        /*
         * Setup the directory pointer for this inode
         */
-       dirp = (ISODIR *)(bp->b_un.b_addr + (ip->i_number & imp->im_bmask));
+       dirp = (ISODIR *)(bp->b_data + (ip->i_number & imp->im_bmask));
 
        /*
         * Just make sure, we have a right one....
 
        /*
         * Just make sure, we have a right one....
@@ -719,7 +717,7 @@ cd9660_readlink(ap)
                brelse(bp);
                return (EINVAL);
        }
                brelse(bp);
                return (EINVAL);
        }
-       
+
        /*
         * Now get a buffer
         * Abuse a namei buffer for now.
        /*
         * Now get a buffer
         * Abuse a namei buffer for now.
@@ -852,21 +850,6 @@ cd9660_unlock(ap)
        return (0);
 }
 
        return (0);
 }
 
-/*
- * Check for a locked inode.
- */
-int
-cd9660_islocked(ap)
-       struct vop_islocked_args /* {
-               struct vnode *a_vp;
-       } */ *ap;
-{
-
-       if (VTOI(ap->a_vp)->i_flag & IN_LOCKED)
-               return (1);
-       return (0);
-}
-
 /*
  * Calculate the logical to physical mapping if not done already,
  * then call the device strategy routine.
 /*
  * Calculate the logical to physical mapping if not done already,
  * then call the device strategy routine.
@@ -915,10 +898,66 @@ cd9660_print(ap)
                struct vnode *a_vp;
        } */ *ap;
 {
                struct vnode *a_vp;
        } */ *ap;
 {
+
        printf("tag VT_ISOFS, isofs vnode\n");
        return (0);
 }
 
        printf("tag VT_ISOFS, isofs vnode\n");
        return (0);
 }
 
+/*
+ * Check for a locked inode.
+ */
+int
+cd9660_islocked(ap)
+       struct vop_islocked_args /* {
+               struct vnode *a_vp;
+       } */ *ap;
+{
+
+       if (VTOI(ap->a_vp)->i_flag & IN_LOCKED)
+               return (1);
+       return (0);
+}
+
+/*
+ * Return POSIX pathconf information applicable to cd9660 filesystems.
+ */
+int
+cd9660_pathconf(ap)
+       struct vop_pathconf_args /* {
+               struct vnode *a_vp;
+               int a_name;
+               register_t *a_retval;
+       } */ *ap;
+{
+
+       switch (ap->a_name) {
+       case _PC_LINK_MAX:
+               *ap->a_retval = 1;
+               return (0);
+       case _PC_NAME_MAX:
+               if (VTOI(ap->a_vp)->i_mnt->iso_ftype == ISO_FTYPE_RRIP)
+                       *ap->a_retval = NAME_MAX;
+               else
+                       *ap->a_retval = 37;
+               return (0);
+       case _PC_PATH_MAX:
+               *ap->a_retval = PATH_MAX;
+               return (0);
+       case _PC_PIPE_BUF:
+               *ap->a_retval = PIPE_BUF;
+               return (0);
+       case _PC_CHOWN_RESTRICTED:
+               *ap->a_retval = 1;
+               return (0);
+       case _PC_NO_TRUNC:
+               *ap->a_retval = 1;
+               return (0);
+       default:
+               return (EINVAL);
+       }
+       /* NOTREACHED */
+}
+
 /*
  * Unsupported operation
  */
 /*
  * Unsupported operation
  */
@@ -954,12 +993,8 @@ int         lease_check __P((struct vop_lease_args *));
 #define cd9660_rmdir ((int (*) __P((struct  vop_rmdir_args *)))cd9660_enotsupp)
 #define cd9660_symlink \
        ((int (*) __P((struct vop_symlink_args *)))cd9660_enotsupp)
 #define cd9660_rmdir ((int (*) __P((struct  vop_rmdir_args *)))cd9660_enotsupp)
 #define cd9660_symlink \
        ((int (*) __P((struct vop_symlink_args *)))cd9660_enotsupp)
-#define cd9660_pathconf \
-       ((int (*) __P((struct vop_pathconf_args *)))cd9660_enotsupp)
 #define cd9660_advlock \
        ((int (*) __P((struct vop_advlock_args *)))cd9660_enotsupp)
 #define cd9660_advlock \
        ((int (*) __P((struct vop_advlock_args *)))cd9660_enotsupp)
-#define cd9660_blkatoff \
-       ((int (*) __P((struct  vop_blkatoff_args *)))cd9660_enotsupp)
 #define cd9660_valloc ((int(*) __P(( \
                struct vnode *pvp, \
                int mode, \
 #define cd9660_valloc ((int(*) __P(( \
                struct vnode *pvp, \
                int mode, \
@@ -974,7 +1009,7 @@ int         lease_check __P((struct vop_lease_args *));
        ((int (*) __P((struct  vop_bwrite_args *)))cd9660_enotsupp)
 
 /*
        ((int (*) __P((struct  vop_bwrite_args *)))cd9660_enotsupp)
 
 /*
- * Global vfs data structures for nfs
+ * Global vfs data structures for cd9660
  */
 int (**cd9660_vnodeop_p)();
 struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
  */
 int (**cd9660_vnodeop_p)();
 struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
index e18f886..c83e069 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)iso.h       8.3 (Berkeley) %G%
+ *     @(#)iso.h       8.4 (Berkeley) %G%
  */
 
 #define ISODCL(from, to) (to - from + 1)
  */
 
 #define ISODCL(from, to) (to - from + 1)
@@ -68,37 +68,37 @@ struct iso_primary_descriptor {
 struct iso_directory_record {
        char length                     [ISODCL (1, 1)]; /* 711 */
        char ext_attr_length            [ISODCL (2, 2)]; /* 711 */
 struct iso_directory_record {
        char length                     [ISODCL (1, 1)]; /* 711 */
        char ext_attr_length            [ISODCL (2, 2)]; /* 711 */
-       unsigned char extent            [ISODCL (3, 10)]; /* 733 */
-       unsigned char size              [ISODCL (11, 18)]; /* 733 */
+       u_char extent                   [ISODCL (3, 10)]; /* 733 */
+       u_char size                     [ISODCL (11, 18)]; /* 733 */
        char date                       [ISODCL (19, 25)]; /* 7 by 711 */
        char flags                      [ISODCL (26, 26)];
        char file_unit_size             [ISODCL (27, 27)]; /* 711 */
        char interleave                 [ISODCL (28, 28)]; /* 711 */
        char volume_sequence_number     [ISODCL (29, 32)]; /* 723 */
        char name_len                   [ISODCL (33, 33)]; /* 711 */
        char date                       [ISODCL (19, 25)]; /* 7 by 711 */
        char flags                      [ISODCL (26, 26)];
        char file_unit_size             [ISODCL (27, 27)]; /* 711 */
        char interleave                 [ISODCL (28, 28)]; /* 711 */
        char volume_sequence_number     [ISODCL (29, 32)]; /* 723 */
        char name_len                   [ISODCL (33, 33)]; /* 711 */
-       char name                       [0];
+       char name                       [1];                    /* XXX */
 };
 /* can't take sizeof(iso_directory_record), because of possible alignment
    of the last entry (34 instead of 33) */
 #define ISO_DIRECTORY_RECORD_SIZE      33
 
 struct iso_extended_attributes {
 };
 /* can't take sizeof(iso_directory_record), because of possible alignment
    of the last entry (34 instead of 33) */
 #define ISO_DIRECTORY_RECORD_SIZE      33
 
 struct iso_extended_attributes {
-       unsigned char owner             [ISODCL (1, 4)]; /* 723 */
-       unsigned char group             [ISODCL (5, 8)]; /* 723 */
-       unsigned char perm              [ISODCL (9, 10)]; /* 9.5.3 */
+       u_char owner                    [ISODCL (1, 4)]; /* 723 */
+       u_char group                    [ISODCL (5, 8)]; /* 723 */
+       u_char perm                     [ISODCL (9, 10)]; /* 9.5.3 */
        char ctime                      [ISODCL (11, 27)]; /* 8.4.26.1 */
        char mtime                      [ISODCL (28, 44)]; /* 8.4.26.1 */
        char xtime                      [ISODCL (45, 61)]; /* 8.4.26.1 */
        char ftime                      [ISODCL (62, 78)]; /* 8.4.26.1 */
        char recfmt                     [ISODCL (79, 79)]; /* 711 */
        char recattr                    [ISODCL (80, 80)]; /* 711 */
        char ctime                      [ISODCL (11, 27)]; /* 8.4.26.1 */
        char mtime                      [ISODCL (28, 44)]; /* 8.4.26.1 */
        char xtime                      [ISODCL (45, 61)]; /* 8.4.26.1 */
        char ftime                      [ISODCL (62, 78)]; /* 8.4.26.1 */
        char recfmt                     [ISODCL (79, 79)]; /* 711 */
        char recattr                    [ISODCL (80, 80)]; /* 711 */
-       unsigned char reclen            [ISODCL (81, 84)]; /* 723 */
+       u_char reclen                   [ISODCL (81, 84)]; /* 723 */
        char system_id                  [ISODCL (85, 116)]; /* achars */
        char system_use                 [ISODCL (117, 180)];
        char version                    [ISODCL (181, 181)]; /* 711 */
        char len_esc                    [ISODCL (182, 182)]; /* 711 */
        char reserved                   [ISODCL (183, 246)];
        char system_id                  [ISODCL (85, 116)]; /* achars */
        char system_use                 [ISODCL (117, 180)];
        char version                    [ISODCL (181, 181)]; /* 711 */
        char len_esc                    [ISODCL (182, 182)]; /* 711 */
        char reserved                   [ISODCL (183, 246)];
-       unsigned char len_au            [ISODCL (247, 250)]; /* 723 */
+       u_char len_au                   [ISODCL (247, 250)]; /* 723 */
 };
 
 /* CD-ROM Format type */
 };
 
 /* CD-ROM Format type */
@@ -134,10 +134,10 @@ struct iso_mnt {
 
 #define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
 
 
 #define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
 
-#define iso_blkoff(imp, loc) ((loc) & (imp)->im_bmask)
-#define iso_lblkno(imp, loc) ((loc) >> (imp)->im_bshift)
-#define iso_blksize(imp, ip, lbn) ((imp)->logical_block_size)
-#define iso_lblktosize(imp, blk) ((blk) << (imp)->im_bshift)
+#define blkoff(imp, loc)       ((loc) & (imp)->im_bmask)
+#define lblktosize(imp, blk)   ((blk) << (imp)->im_bshift)
+#define lblkno(imp, loc)       ((loc) >> (imp)->im_bshift)
+#define blksize(imp, ip, lbn)  ((imp)->logical_block_size)
 
 int cd9660_mount __P((struct mount *,
            char *, caddr_t, struct nameidata *, struct proc *));
 
 int cd9660_mount __P((struct mount *,
            char *, caddr_t, struct nameidata *, struct proc *));
@@ -153,8 +153,6 @@ int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
 int cd9660_vptofh __P((struct vnode *, struct fid *));
 int cd9660_init __P(());
 
 int cd9660_vptofh __P((struct vnode *, struct fid *));
 int cd9660_init __P(());
 
-struct iso_node;
-int iso_blkatoff __P((struct iso_node *ip, long offset, struct buf **bpp)); 
 int cd9660_mountroot __P((void)); 
 
 extern int (**cd9660_vnodeop_p)();
 int cd9660_mountroot __P((void)); 
 
 extern int (**cd9660_vnodeop_p)();
@@ -163,65 +161,79 @@ extern int (**cd9660_specop_p)();
 extern int (**cd9660_fifoop_p)();
 #endif
 
 extern int (**cd9660_fifoop_p)();
 #endif
 
-extern inline int
+static __inline int
 isonum_711(p)
 isonum_711(p)
-       unsigned char *p;
+       u_char *p;
 {
        return *p;
 }
 
 {
        return *p;
 }
 
-extern inline int
+static __inline int
 isonum_712(p)
        char *p;
 {
        return *p;
 }
 
 isonum_712(p)
        char *p;
 {
        return *p;
 }
 
-extern inline int
-isonum_721(p)
-       unsigned char *p;
+#ifndef UNALIGNED_ACCESS
+
+static __inline int
+isonum_723(p)
+       u_char *p;
 {
 {
-       return *p|((char)p[1] << 8);
+       return *p|(p[1] << 8);
 }
 
 }
 
-extern inline int
-isonum_722(p)
-       unsigned char *p;
+static __inline int
+isonum_733(p)
+       u_char *p;
 {
 {
-       return ((char)*p << 8)|p[1];
+       return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
 }
 
 }
 
-extern inline int
+#else /* UNALIGNED_ACCESS */
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+static __inline int
 isonum_723(p)
 isonum_723(p)
-       unsigned char *p;
+       u_char *p
 {
 {
-       return isonum_721(p);
+       return *(u_int16t *)p;
 }
 
 }
 
-extern inline int
-isonum_731(p)
-       unsigned char *p;
+static __inline int
+isonum_733(p)
+       u_char *p;
 {
 {
-       return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
+       return *(u_int32t *)p;
 }
 
 }
 
-extern inline int
-isonum_732(p)
-       unsigned char *p;
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+
+static __inline int
+isonum_723(p)
+       u_char *p
 {
 {
-       return (*p << 24)|(p[1] << 16)|(p[2] << 8)|p[3];
+       return *(u_int16t *)(p + 2);
 }
 
 }
 
-extern inline int
+static __inline int
 isonum_733(p)
 isonum_733(p)
-       unsigned char *p;
+       u_char *p;
 {
 {
-       return isonum_731(p);
+       return *(u_int32t *)(p + 4);
 }
 
 }
 
-int isofncmp __P((unsigned char *, int, unsigned char *, int));
-void isofntrans __P((unsigned char *, int, unsigned char *, unsigned short *,
-                    int, int));
+#endif
+
+#endif /* UNALIGNED_ACCESS */
+
+int isofncmp __P((u_char *, int, u_char *, int));
+void isofntrans __P((u_char *, int, u_char *, u_short *, int, int));
+ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
 
 /*
  * Associated files have a leading '='.
 
 /*
  * Associated files have a leading '='.