Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/isofs/cd9660 Apply a late patch submitted by the author ...



details:   https://anonhg.NetBSD.org/src/rev/3efffc4a2843
branches:  trunk
changeset: 486000:3efffc4a2843
user:      scw <scw%NetBSD.org@localhost>
date:      Wed May 10 20:35:35 2000 +0000

description:
Apply a late patch submitted by the author of PR kern/7951 (Joachim
Kuebart) which modifies the behaviour of cd9660 filesystem support to
favour using RockRidge extensions in place of Joliet if both formats
are present on a CD-ROM.

diffstat:

 sys/isofs/cd9660/cd9660_vfsops.c |  134 +++++++++++++++++++++++---------------
 1 files changed, 80 insertions(+), 54 deletions(-)

diffs (194 lines):

diff -r ff8ee7b1368b -r 3efffc4a2843 sys/isofs/cd9660/cd9660_vfsops.c
--- a/sys/isofs/cd9660/cd9660_vfsops.c  Wed May 10 20:28:33 2000 +0000
+++ b/sys/isofs/cd9660/cd9660_vfsops.c  Wed May 10 20:35:35 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.46 2000/03/30 12:13:31 augustss Exp $      */
+/*     $NetBSD: cd9660_vfsops.c,v 1.47 2000/05/10 20:35:35 scw Exp $   */
 
 /*-
  * Copyright (c) 1994
@@ -107,6 +107,7 @@
  */
 #define ROOTNAME       "root_device"
 
+static int iso_makemp __P((struct iso_mnt *isomp, struct buf *bp, int *ea_len));
 static int iso_mountfs __P((struct vnode *devvp, struct mount *mp,
                struct proc *p, struct iso_args *argp));
 
@@ -236,6 +237,47 @@
 }
 
 /*
+ * Make a mount point from a volume descriptor
+ */
+static int
+iso_makemp(isomp, bp, ea_len)
+       struct iso_mnt *isomp;
+       struct buf *bp;
+       int *ea_len;
+{
+       struct iso_primary_descriptor *pri;
+       int logical_block_size;
+       struct iso_directory_record *rootp;
+
+       pri = (struct iso_primary_descriptor *)bp->b_data;
+       
+       logical_block_size = isonum_723 (pri->logical_block_size);
+       
+       if (logical_block_size < DEV_BSIZE || logical_block_size > MAXBSIZE
+           || (logical_block_size & (logical_block_size - 1)) != 0)
+               return -1;
+       
+       rootp = (struct iso_directory_record *)pri->root_directory_record;
+       
+       isomp->logical_block_size = logical_block_size;
+       isomp->volume_space_size = isonum_733 (pri->volume_space_size);
+       memcpy(isomp->root, rootp, sizeof(isomp->root));
+       isomp->root_extent = isonum_733 (rootp->extent);
+       isomp->root_size = isonum_733 (rootp->size);
+       isomp->im_joliet_level = 0;
+       
+       isomp->im_bmask = logical_block_size - 1;
+       isomp->im_bshift = 0;
+       while ((1 << isomp->im_bshift) < isomp->logical_block_size)
+               isomp->im_bshift++;
+
+       if (ea_len != NULL)
+               *ea_len = isonum_711(rootp->ext_attr_length);
+
+       return 0;
+}
+
+/*
  * Common code for mount and mountroot
  */
 static int
@@ -255,11 +297,9 @@
        int iso_blknum;
        int joliet_level;
        struct iso_volume_descriptor *vdp;
-       struct iso_primary_descriptor *pri;
        struct iso_supplementary_descriptor *sup;
-       struct iso_directory_record *rootp;
-       int logical_block_size;
        int sess = 0;
+       int ext_attr_length;
        
        if (!ronly)
                return EROFS;
@@ -338,63 +378,18 @@
                }
        }
 
-       /* Check the Joliet Extension support */
-       joliet_level = 0;
-       if ((argp->flags & ISOFSMNT_NOJOLIET) == 0 && supbp != NULL) {
-               sup = (struct iso_supplementary_descriptor *)supbp->b_data;
-
-               if ((isonum_711(sup->flags) & 1) == 0) {
-                       if (memcmp(sup->escape, "%/@", 3) == 0)
-                               joliet_level = 1;
-                       if (memcmp(sup->escape, "%/C", 3) == 0)
-                               joliet_level = 2;
-                       if (memcmp(sup->escape, "%/E", 3) == 0)
-                               joliet_level = 3;
-               }
-               if (joliet_level != 0) {
-                       if (pribp != NULL)
-                               brelse(pribp);
-                       pribp = supbp;
-                       supbp = NULL;
-               }
-       }
-
-       if (supbp != NULL) {
-               brelse(supbp);
-               supbp = NULL;
-       }
-
        if (pribp == NULL) {
                error = EINVAL;
                goto out;
        }
 
-       pri = (struct iso_primary_descriptor *)pribp->b_data;
-       
-       logical_block_size = isonum_723 (pri->logical_block_size);
-       
-       if (logical_block_size < DEV_BSIZE || logical_block_size > MAXBSIZE
-           || (logical_block_size & (logical_block_size - 1)) != 0) {
+       isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
+       memset((caddr_t)isomp, 0, sizeof *isomp);
+       if (iso_makemp(isomp, pribp, &ext_attr_length) == -1) {
                error = EINVAL;
                goto out;
        }
-       
-       rootp = (struct iso_directory_record *)pri->root_directory_record;
-       
-       isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
-       memset((caddr_t)isomp, 0, sizeof *isomp);
-       isomp->logical_block_size = logical_block_size;
-       isomp->volume_space_size = isonum_733 (pri->volume_space_size);
-       memcpy(isomp->root, rootp, sizeof(isomp->root));
-       isomp->root_extent = isonum_733 (rootp->extent);
-       isomp->root_size = isonum_733 (rootp->size);
-       isomp->im_joliet_level = joliet_level;
-       
-       isomp->im_bmask = logical_block_size - 1;
-       isomp->im_bshift = 0;
-       while ((1 << isomp->im_bshift) < isomp->logical_block_size)
-               isomp->im_bshift++;
-       
+
        pribp->b_flags |= B_AGE;
        brelse(pribp);
        pribp = NULL;
@@ -412,8 +407,10 @@
        
        /* Check the Rock Ridge Extention support */
        if (!(argp->flags & ISOFSMNT_NORRIP)) {
+               struct iso_directory_record *rootp;
+
                if ((error = bread(isomp->im_devvp,
-                                  (isomp->root_extent + isonum_711(rootp->ext_attr_length)) <<
+                                  (isomp->root_extent + ext_attr_length) <<
                                   (isomp->im_bshift - DEV_BSHIFT),
                                   isomp->logical_block_size, NOCRED,
                                   &bp)) != 0)
@@ -448,6 +445,35 @@
            isomp->iso_ftype = ISO_FTYPE_RRIP;
            break;
        }
+
+       /* Check the Joliet Extension support */
+       if ((argp->flags & ISOFSMNT_NORRIP) != 0 &&
+           (argp->flags & ISOFSMNT_NOJOLIET) == 0 &&
+           supbp != NULL) {
+               joliet_level = 0;
+               sup = (struct iso_supplementary_descriptor *)supbp->b_data;
+
+               if ((isonum_711(sup->flags) & 1) == 0) {
+                       if (memcmp(sup->escape, "%/@", 3) == 0)
+                               joliet_level = 1;
+                       if (memcmp(sup->escape, "%/C", 3) == 0)
+                               joliet_level = 2;
+                       if (memcmp(sup->escape, "%/E", 3) == 0)
+                               joliet_level = 3;
+               }
+               if (joliet_level != 0) {
+                       if (iso_makemp(isomp, supbp, NULL) == -1) {
+                               error = EINVAL;
+                               goto out;
+                       }
+                       isomp->im_joliet_level = joliet_level;
+               }
+       }
+
+       if (supbp != NULL) {
+               brelse(supbp);
+               supbp = NULL;
+       }
        
        return 0;
 out:



Home | Main Index | Thread Index | Old Index