--- old/usr/src/uts/common/fs/udfs/udf_vfsops.c Wed May 7 11:21:43 2008 +++ new/usr/src/uts/common/fs/udfs/udf_vfsops.c Wed May 7 11:21:43 2008 @@ -19,11 +19,11 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "@(#)udf_vfsops.c 1.48 07/10/25 SMI" +#pragma ident "@(#)udf_vfsops.c 1.49 08/05/07 SMI" #include #include @@ -91,22 +91,22 @@ extern kmutex_t ud_sync_busy; static int32_t ud_mountfs(struct vfs *, - enum whymountroot, dev_t, char *, struct cred *, int32_t); + enum whymountroot, dev_t, char *, struct cred *, int32_t); static struct udf_vfs *ud_validate_and_fill_superblock(dev_t, - int32_t, uint32_t); + int32_t, uint32_t); void ud_destroy_fsp(struct udf_vfs *); void ud_convert_to_superblock(struct udf_vfs *, - struct log_vol_int_desc *); + struct log_vol_int_desc *); void ud_update_superblock(struct vfs *); int32_t ud_get_last_block(dev_t, daddr_t *); static int32_t ud_val_get_vat(struct udf_vfs *, - dev_t, daddr_t, struct ud_map *); + dev_t, daddr_t, struct ud_map *); int32_t ud_read_sparing_tbls(struct udf_vfs *, - dev_t, struct ud_map *, struct pmap_typ2 *); + dev_t, struct ud_map *, struct pmap_typ2 *); uint32_t ud_get_lbsize(dev_t, uint32_t *); static int32_t udf_mount(struct vfs *, - struct vnode *, struct mounta *, struct cred *); + struct vnode *, struct mounta *, struct cred *); static int32_t udf_unmount(struct vfs *, int, struct cred *); static int32_t udf_root(struct vfs *, struct vnode **); static int32_t udf_statvfs(struct vfs *, struct statvfs64 *); @@ -183,7 +183,8 @@ struct mounta *uap, struct cred *cr) { dev_t dev; - struct vnode *bvp; + struct vnode *lvp = NULL; + struct vnode *svp = NULL; struct pathname dpn; int32_t error; enum whymountroot why; @@ -202,7 +203,7 @@ mutex_enter(&mvp->v_lock); if ((uap->flags & MS_REMOUNT) == 0 && (uap->flags & MS_OVERLAY) == 0 && - (mvp->v_count != 1 || (mvp->v_flag & VROOT))) { + (mvp->v_count != 1 || (mvp->v_flag & VROOT))) { mutex_exit(&mvp->v_lock); return (EBUSY); } @@ -213,18 +214,30 @@ } /* - * Resolve path name of special file being mounted. + * Resolve path name of the file being mounted. */ if (error = lookupname(uap->spec, UIO_USERSPACE, FOLLOW, NULLVPP, - &bvp)) { + &svp)) { pn_free(&dpn); return (error); } - if (bvp->v_type != VBLK) { - error = ENOTBLK; + + error = vfs_get_lofi(vfsp, &lvp); + + if (error > 0) { + if (error == ENOENT) + error = ENODEV; goto out; + } else if (error == 0) { + dev = lvp->v_rdev; + } else { + dev = svp->v_rdev; + + if (svp->v_type != VBLK) { + error = ENOTBLK; + goto out; + } } - dev = bvp->v_rdev; /* * Ensure that this device isn't already mounted, @@ -282,19 +295,24 @@ oflag = FREAD | FWRITE; aflag = VREAD | VWRITE; } - if ((error = VOP_ACCESS(bvp, aflag, 0, cr, NULL)) != 0 || - (error = secpolicy_spec_open(cr, bvp, oflag)) != 0) { + + if (lvp == NULL && + (error = secpolicy_spec_open(cr, svp, oflag)) != 0) goto out; - } + if ((error = VOP_ACCESS(svp, aflag, 0, cr, NULL)) != 0) + goto out; + /* * Mount the filesystem. */ error = ud_mountfs(vfsp, why, dev, dpn.pn_path, cr, 0); out: - VN_RELE(bvp); + if (svp != NULL) + VN_RELE(svp); + if (lvp != NULL) + VN_RELE(lvp); pn_free(&dpn); - return (error); } @@ -436,15 +454,13 @@ * 38(over head each dent) + MAXNAMLEN / 2 + inode_size(==block size) */ sp->f_ffree = sp->f_favail = - (sp->f_bavail * sp->f_bsize) / (146 + sp->f_bsize); + (sp->f_bavail * sp->f_bsize) / (146 + sp->f_bsize); /* * The total number of inodes is * the sum of files + directories + free inodes */ - sp->f_files = sp->f_ffree + - udf_vfsp->udf_nfiles + - udf_vfsp->udf_ndirs; + sp->f_files = sp->f_ffree + udf_vfsp->udf_nfiles + udf_vfsp->udf_ndirs; (void) cmpldev(&d32, vfsp->vfs_dev); sp->f_fsid = d32; (void) strcpy(sp->f_basetype, vfssw[vfsp->vfs_fstype].vsw_name); @@ -495,7 +511,7 @@ udfid = (struct udf_fid *)fidp; if ((error = ud_iget(vfsp, udfid->udfid_prn, - udfid->udfid_icb_lbn, &ip, NULL, CRED())) != 0) { + udfid->udfid_icb_lbn, &ip, NULL, CRED())) != 0) { *vpp = NULL; return (error); } @@ -502,7 +518,7 @@ rw_enter(&ip->i_contents, RW_READER); if ((udfid->udfid_uinq_lo != (ip->i_uniqid & 0xffffffff)) || - (udfid->udfid_prn != ip->i_icb_prn)) { + (udfid->udfid_prn != ip->i_icb_prn)) { rw_exit(&ip->i_contents); VN_RELE(ITOV(ip)); *vpp = NULL; @@ -555,7 +571,7 @@ (void) dnlc_purge_vfsp(vfsp, 0); vp = common_specvp(vp); (void) VOP_PUTPAGE(vp, (offset_t)0, - (uint32_t)0, B_INVAL, CRED(), NULL); + (uint32_t)0, B_INVAL, CRED(), NULL); binval(vfsp->vfs_dev); ovflags = vfsp->vfs_flag; @@ -566,7 +582,7 @@ ud_update(0); vp = ((struct udf_vfs *)vfsp->vfs_data)->udf_devvp; (void) VOP_CLOSE(vp, FREAD|FWRITE, 1, - (offset_t)0, CRED(), NULL); + (offset_t)0, CRED(), NULL); return (0); } @@ -589,7 +605,7 @@ if (why == ROOT_INIT) { vfs_add((struct vnode *)0, vfsp, - (vfsp->vfs_flag & VFS_RDONLY) ? MS_RDONLY : 0); + (vfsp->vfs_flag & VFS_RDONLY) ? MS_RDONLY : 0); } vfs_unlock(vfsp); return (0); @@ -678,7 +694,7 @@ if (udf_vfsp->udf_flags & UDF_FL_RDONLY) { (void) dnlc_purge_vfsp(vfsp, 0); (void) VOP_PUTPAGE(devvp, (offset_t)0, (uint_t)0, - B_INVAL, CRED(), NULL); + B_INVAL, CRED(), NULL); (void) ud_iflush(vfsp); bflush(dev); binval(dev); @@ -689,7 +705,7 @@ * disallow mount of any highier version */ if ((udf_vfsp->udf_miread > UDF_150) || - (udf_vfsp->udf_miwrite > UDF_150)) { + (udf_vfsp->udf_miwrite > UDF_150)) { error = EINVAL; goto remountout; } @@ -715,8 +731,8 @@ * mount in rw mode */ tpt = ud_bread(vfsp->vfs_dev, - udf_vfsp->udf_iseq_loc << udf_vfsp->udf_l2d_shift, - udf_vfsp->udf_iseq_len); + udf_vfsp->udf_iseq_loc << udf_vfsp->udf_l2d_shift, + udf_vfsp->udf_iseq_len); if (tpt->b_flags & B_ERROR) { error = EIO; goto remountout; @@ -735,7 +751,7 @@ lvid = (struct log_vol_int_desc *)ttag; if (SWAP_32(lvid->lvid_int_type) != - LOG_VOL_CLOSE_INT) { + LOG_VOL_CLOSE_INT) { error = EINVAL; goto remountout; } @@ -744,7 +760,7 @@ * Copy new data to old data */ bcopy(udf_vfsp->udf_iseq->b_un.b_addr, - tpt->b_un.b_addr, udf_vfsp->udf_iseq_len); + tpt->b_un.b_addr, udf_vfsp->udf_iseq_len); break; } } @@ -846,7 +862,7 @@ * disallow mount of any highier version */ if ((udf_vfsp->udf_miread > UDF_150) || - (udf_vfsp->udf_miwrite > UDF_150)) { + (udf_vfsp->udf_miwrite > UDF_150)) { error = EINVAL; goto out; } @@ -904,7 +920,7 @@ _NOTE(COMPETING_THREADS_NOW); #endif if (error = ud_iget(vfsp, udf_vfsp->udf_ricb_prn, - udf_vfsp->udf_ricb_loc, &rip, NULL, cr)) { + udf_vfsp->udf_ricb_loc, &rip, NULL, cr)) { mutex_destroy(&udf_vfsp->udf_lock); goto out; } @@ -937,7 +953,7 @@ ud_destroy_fsp(udf_vfsp); if (needclose) { (void) VOP_CLOSE(devvp, (vfsp->vfs_flag & VFS_RDONLY) ? - FREAD : FREAD|FWRITE, 1, (offset_t)0, cr, NULL); + FREAD : FREAD|FWRITE, 1, (offset_t)0, cr, NULL); bflush(dev); binval(dev); } @@ -982,8 +998,8 @@ */ secbp = ud_bread(dev, avd_loc << shift, ANCHOR_VOL_DESC_LEN); if ((error = geterror(secbp)) != 0) { - cmn_err(CE_NOTE, - "udfs : Could not read Anchor Volume Desc %x", error); + cmn_err(CE_NOTE, "udfs : Could not read Anchor Volume Desc %x", + error); brelse(secbp); return (NULL); } @@ -994,7 +1010,7 @@ return (NULL); } udf_vfsp = (struct udf_vfs *) - kmem_zalloc(sizeof (struct udf_vfs), KM_SLEEP); + kmem_zalloc(sizeof (struct udf_vfs), KM_SLEEP); udf_vfsp->udf_mvds_loc = SWAP_32(avdp->avd_main_vdse.ext_loc); udf_vfsp->udf_mvds_len = SWAP_32(avdp->avd_main_vdse.ext_len); udf_vfsp->udf_rvds_loc = SWAP_32(avdp->avd_res_vdse.ext_loc); @@ -1008,15 +1024,15 @@ */ vds_loc = udf_vfsp->udf_mvds_loc; secbp = ud_bread(dev, vds_loc << shift, - udf_vfsp->udf_mvds_len); + udf_vfsp->udf_mvds_len); if ((error = geterror(secbp)) != 0) { brelse(secbp); - cmn_err(CE_NOTE, - "udfs : Could not read Main Volume Desc %x", error); + cmn_err(CE_NOTE, "udfs : Could not read Main Volume Desc %x", + error); vds_loc = udf_vfsp->udf_rvds_loc; secbp = ud_bread(dev, vds_loc << shift, - udf_vfsp->udf_rvds_len); + udf_vfsp->udf_rvds_len); if ((error = geterror(secbp)) != 0) { brelse(secbp); cmn_err(CE_NOTE, @@ -1046,7 +1062,7 @@ 1, desc_len) == 0) { if (udf_vfsp->udf_pvd == NULL) { udf_vfsp->udf_pvd = - (struct pri_vol_desc *)ttag; + (struct pri_vol_desc *)ttag; } else { struct pri_vol_desc *opvd, *npvd; @@ -1054,15 +1070,15 @@ npvd = (struct pri_vol_desc *)ttag; if ((strncmp(opvd->pvd_vsi, - npvd->pvd_vsi, 128) == 0) && - (strncmp(opvd->pvd_vol_id, - npvd->pvd_vol_id, 32) == 0) && - (strncmp((caddr_t)&opvd->pvd_desc_cs, - (caddr_t)&npvd->pvd_desc_cs, - sizeof (charspec_t)) == 0)) { + npvd->pvd_vsi, 128) == 0) && + (strncmp(opvd->pvd_vol_id, + npvd->pvd_vol_id, 32) == 0) && + (strncmp((caddr_t)&opvd->pvd_desc_cs, + (caddr_t)&npvd->pvd_desc_cs, + sizeof (charspec_t)) == 0)) { if (SWAP_32(opvd->pvd_vdsn) < - SWAP_32(npvd->pvd_vdsn)) { + SWAP_32(npvd->pvd_vdsn)) { udf_vfsp->udf_pvd = npvd; } } else { @@ -1076,7 +1092,7 @@ lvd = (struct log_vol_desc *)ttag; if (strncmp(lvd->lvd_dom_id.reg_id, - UDF_DOMAIN_NAME, 23) != 0) { + UDF_DOMAIN_NAME, 23) != 0) { printf("Domain ID in lvd is not valid\n"); goto out; } @@ -1088,12 +1104,12 @@ olvd = udf_vfsp->udf_lvd; if ((strncmp((caddr_t)&olvd->lvd_desc_cs, - (caddr_t)&lvd->lvd_desc_cs, - sizeof (charspec_t)) == 0) && - (strncmp(olvd->lvd_lvid, - lvd->lvd_lvid, 128) == 0)) { + (caddr_t)&lvd->lvd_desc_cs, + sizeof (charspec_t)) == 0) && + (strncmp(olvd->lvd_lvid, + lvd->lvd_lvid, 128) == 0)) { if (SWAP_32(olvd->lvd_vdsn) < - SWAP_32(lvd->lvd_vdsn)) { + SWAP_32(lvd->lvd_vdsn)) { udf_vfsp->udf_lvd = lvd; } } else { @@ -1111,35 +1127,37 @@ pdesc = (struct part_desc *)ttag; pold = udf_vfsp->udf_parts; for (i = 0; i < udf_vfsp->udf_npart; i++) { - if (pold->udp_number == - SWAP_16(pdesc->pd_pnum)) { - if (SWAP_32(pdesc->pd_vdsn) > - pold->udp_seqno) { - pold->udp_seqno = - SWAP_32(pdesc->pd_vdsn); - pold->udp_access = - SWAP_32(pdesc->pd_acc_type); - pold->udp_start = - SWAP_32(pdesc->pd_part_start); - pold->udp_length = - SWAP_32(pdesc->pd_part_length); - } - goto loop_end; + if (pold->udp_number != + SWAP_16(pdesc->pd_pnum)) { + pold++; + continue; } - pold ++; + + if (SWAP_32(pdesc->pd_vdsn) > + pold->udp_seqno) { + pold->udp_seqno = + SWAP_32(pdesc->pd_vdsn); + pold->udp_access = + SWAP_32(pdesc->pd_acc_type); + pold->udp_start = + SWAP_32(pdesc->pd_part_start); + pold->udp_length = + SWAP_32(pdesc->pd_part_length); + } + goto loop_end; } pold = udf_vfsp->udf_parts; udf_vfsp->udf_npart++; pnew = kmem_zalloc(udf_vfsp->udf_npart * - sizeof (struct ud_part), KM_SLEEP); + sizeof (struct ud_part), KM_SLEEP); udf_vfsp->udf_parts = pnew; if (pold) { bcopy(pold, pnew, - sizeof (struct ud_part) * - (udf_vfsp->udf_npart - 1)); + sizeof (struct ud_part) * + (udf_vfsp->udf_npart - 1)); kmem_free(pold, - sizeof (struct ud_part) * - (udf_vfsp->udf_npart - 1)); + sizeof (struct ud_part) * + (udf_vfsp->udf_npart - 1)); } part = pnew + (udf_vfsp->udf_npart - 1); part->udp_number = SWAP_16(pdesc->pd_pnum); @@ -1157,23 +1175,23 @@ if (hdr->phdr_ust.sad_ext_len) { part->udp_flags = UDP_SPACETBLS; part->udp_unall_loc = - SWAP_32(hdr->phdr_ust.sad_ext_loc); + SWAP_32(hdr->phdr_ust.sad_ext_loc); part->udp_unall_len = - SWAP_32(hdr->phdr_ust.sad_ext_len); + SWAP_32(hdr->phdr_ust.sad_ext_len); part->udp_freed_loc = - SWAP_32(hdr->phdr_fst.sad_ext_loc); + SWAP_32(hdr->phdr_fst.sad_ext_loc); part->udp_freed_len = - SWAP_32(hdr->phdr_fst.sad_ext_len); + SWAP_32(hdr->phdr_fst.sad_ext_len); } else { part->udp_flags = UDP_BITMAPS; part->udp_unall_loc = - SWAP_32(hdr->phdr_usb.sad_ext_loc); + SWAP_32(hdr->phdr_usb.sad_ext_loc); part->udp_unall_len = - SWAP_32(hdr->phdr_usb.sad_ext_len); + SWAP_32(hdr->phdr_usb.sad_ext_len); part->udp_freed_loc = - SWAP_32(hdr->phdr_fsb.sad_ext_loc); + SWAP_32(hdr->phdr_fsb.sad_ext_loc); part->udp_freed_len = - SWAP_32(hdr->phdr_fsb.sad_ext_len); + SWAP_32(hdr->phdr_fsb.sad_ext_len); } } else if (ud_verify_tag_and_desc(ttag, UD_TERM_DESC, vds_loc + (index >> shift), @@ -1185,8 +1203,8 @@ ; } if ((udf_vfsp->udf_pvd == NULL) || - (udf_vfsp->udf_lvd == NULL) || - (udf_vfsp->udf_parts == NULL)) { + (udf_vfsp->udf_lvd == NULL) || + (udf_vfsp->udf_parts == NULL)) { goto out; } @@ -1201,7 +1219,7 @@ * Process Logical Volume Descriptor */ udf_vfsp->udf_lbsize = - SWAP_32(udf_vfsp->udf_lvd->lvd_log_bsize); + SWAP_32(udf_vfsp->udf_lvd->lvd_log_bsize); udf_vfsp->udf_lbmask = udf_vfsp->udf_lbsize - 1; udf_vfsp->udf_l2d_shift = shift; udf_vfsp->udf_l2b_shift = shift + DEV_BSHIFT; @@ -1211,7 +1229,7 @@ * proper domain. */ if (strcmp(udf_vfsp->udf_lvd->lvd_dom_id.reg_id, - UDF_DOMAIN_NAME) != 0) { + UDF_DOMAIN_NAME) != 0) { goto out; } @@ -1224,16 +1242,16 @@ } udf_vfsp->udf_iseq_loc = - SWAP_32(udf_vfsp->udf_lvd->lvd_int_seq_ext.ext_loc); + SWAP_32(udf_vfsp->udf_lvd->lvd_int_seq_ext.ext_loc); udf_vfsp->udf_iseq_len = - SWAP_32(udf_vfsp->udf_lvd->lvd_int_seq_ext.ext_len); + SWAP_32(udf_vfsp->udf_lvd->lvd_int_seq_ext.ext_len); udf_vfsp->udf_fsd_prn = - SWAP_16(udf_vfsp->udf_lvd->lvd_lvcu.lad_ext_prn); + SWAP_16(udf_vfsp->udf_lvd->lvd_lvcu.lad_ext_prn); udf_vfsp->udf_fsd_loc = - SWAP_32(udf_vfsp->udf_lvd->lvd_lvcu.lad_ext_loc); + SWAP_32(udf_vfsp->udf_lvd->lvd_lvcu.lad_ext_loc); udf_vfsp->udf_fsd_len = - SWAP_32(udf_vfsp->udf_lvd->lvd_lvcu.lad_ext_len); + SWAP_32(udf_vfsp->udf_lvd->lvd_lvcu.lad_ext_len); /* @@ -1242,13 +1260,13 @@ udf_vfsp->udf_mtype = udf_vfsp->udf_parts[0].udp_access; for (index = 0; index < udf_vfsp->udf_npart; index ++) { if (udf_vfsp->udf_parts[index].udp_access < - udf_vfsp->udf_mtype) { + udf_vfsp->udf_mtype) { udf_vfsp->udf_mtype = - udf_vfsp->udf_parts[index].udp_access; + udf_vfsp->udf_parts[index].udp_access; } } if ((udf_vfsp->udf_mtype < UDF_MT_RO) || - (udf_vfsp->udf_mtype > UDF_MT_OW)) { + (udf_vfsp->udf_mtype > UDF_MT_OW)) { udf_vfsp->udf_mtype = UDF_MT_RO; } @@ -1258,19 +1276,19 @@ for (index = 0; index < count; index++) { if ((hdr->maph_type == MAP_TYPE1) && - (hdr->maph_length == MAP_TYPE1_LEN)) { + (hdr->maph_length == MAP_TYPE1_LEN)) { typ1 = (struct pmap_typ1 *)hdr; map = udf_vfsp->udf_maps; udf_vfsp->udf_maps = - kmem_zalloc(sizeof (struct ud_map) * - (udf_vfsp->udf_nmaps + 1), - KM_SLEEP); + kmem_zalloc(sizeof (struct ud_map) * + (udf_vfsp->udf_nmaps + 1), KM_SLEEP); if (map != NULL) { bcopy(map, udf_vfsp->udf_maps, - sizeof (struct ud_map) * udf_vfsp->udf_nmaps); - kmem_free(map, - sizeof (struct ud_map) * udf_vfsp->udf_nmaps); + sizeof (struct ud_map) * + udf_vfsp->udf_nmaps); + kmem_free(map, sizeof (struct ud_map) * + udf_vfsp->udf_nmaps); } map = udf_vfsp->udf_maps + udf_vfsp->udf_nmaps; map->udm_flags = UDM_MAP_NORM; @@ -1278,11 +1296,11 @@ map->udm_pn = SWAP_16(typ1->map1_pn); udf_vfsp->udf_nmaps ++; } else if ((hdr->maph_type == MAP_TYPE2) && - (hdr->maph_length == MAP_TYPE2_LEN)) { + (hdr->maph_length == MAP_TYPE2_LEN)) { typ2 = (struct pmap_typ2 *)hdr; if (strncmp(typ2->map2_pti.reg_id, - UDF_VIRT_PART, 23) == 0) { + UDF_VIRT_PART, 23) == 0) { /* * Add this to the normal * partition table so that @@ -1290,16 +1308,15 @@ */ map = udf_vfsp->udf_maps; udf_vfsp->udf_maps = - kmem_zalloc(sizeof (struct ud_map) * - (udf_vfsp->udf_nmaps + 1), - KM_SLEEP); + kmem_zalloc(sizeof (struct ud_map) * + (udf_vfsp->udf_nmaps + 1), KM_SLEEP); if (map != NULL) { bcopy(map, udf_vfsp->udf_maps, - sizeof (struct ud_map) * - udf_vfsp->udf_nmaps); + sizeof (struct ud_map) * + udf_vfsp->udf_nmaps); kmem_free(map, - sizeof (struct ud_map) * - udf_vfsp->udf_nmaps); + sizeof (struct ud_map) * + udf_vfsp->udf_nmaps); } map = udf_vfsp->udf_maps + udf_vfsp->udf_nmaps; map->udm_flags = UDM_MAP_VPM; @@ -1310,34 +1327,34 @@ goto out; } if (error = ud_val_get_vat(udf_vfsp, dev, - lblkno, map)) { + lblkno, map)) { goto out; } } else if (strncmp(typ2->map2_pti.reg_id, - UDF_SPAR_PART, 23) == 0) { + UDF_SPAR_PART, 23) == 0) { if (SWAP_16(typ2->map2_pl) != 32) { printf( - "Packet Length is not valid %x\n", - SWAP_16(typ2->map2_pl)); + "Packet Length is not valid %x\n", + SWAP_16(typ2->map2_pl)); goto out; } if ((typ2->map2_nst < 1) || - (typ2->map2_nst > 4)) { + (typ2->map2_nst > 4)) { goto out; } map = udf_vfsp->udf_maps; udf_vfsp->udf_maps = - kmem_zalloc(sizeof (struct ud_map) * - (udf_vfsp->udf_nmaps + 1), - KM_SLEEP); + kmem_zalloc(sizeof (struct ud_map) * + (udf_vfsp->udf_nmaps + 1), + KM_SLEEP); if (map != NULL) { bcopy(map, udf_vfsp->udf_maps, - sizeof (struct ud_map) * - udf_vfsp->udf_nmaps); + sizeof (struct ud_map) * + udf_vfsp->udf_nmaps); kmem_free(map, - sizeof (struct ud_map) * - udf_vfsp->udf_nmaps); + sizeof (struct ud_map) * + udf_vfsp->udf_nmaps); } map = udf_vfsp->udf_maps + udf_vfsp->udf_nmaps; map->udm_flags = UDM_MAP_SPM; @@ -1347,7 +1364,7 @@ udf_vfsp->udf_nmaps ++; if (error = ud_read_sparing_tbls(udf_vfsp, - dev, map, typ2)) { + dev, map, typ2)) { goto out; } } else { @@ -1373,11 +1390,11 @@ * and process it */ secbp = ud_bread(dev, udf_vfsp->udf_iseq_loc << shift, - udf_vfsp->udf_iseq_len); + udf_vfsp->udf_iseq_len); if ((error = geterror(secbp)) != 0) { cmn_err(CE_NOTE, "udfs : Could not read Logical Volume Integrity Sequence %x", - error); + error); brelse(secbp); goto out; } @@ -1424,8 +1441,8 @@ } if ((blkno = ud_xlate_to_daddr(udf_vfsp, - udf_vfsp->udf_fsd_prn, udf_vfsp->udf_fsd_loc, - 1, &dummy)) == 0) { + udf_vfsp->udf_fsd_prn, udf_vfsp->udf_fsd_loc, + 1, &dummy)) == 0) { goto out; } secbp = ud_bread(dev, blkno << shift, udf_vfsp->udf_fsd_len); @@ -1449,8 +1466,8 @@ secbp->b_flags = B_AGE | B_STALE; brelse(secbp); udf_vfsp->udf_root_blkno = ud_xlate_to_daddr(udf_vfsp, - udf_vfsp->udf_ricb_prn, udf_vfsp->udf_ricb_loc, - 1, &dummy); + udf_vfsp->udf_ricb_prn, udf_vfsp->udf_ricb_loc, + 1, &dummy); return (udf_vfsp); out: @@ -1603,7 +1620,7 @@ int32_t rval, error; if ((error = cdev_ioctl(dev, DKIOCGVTOC, (intptr_t)&vtoc, - FKIOCTL|FREAD|FNATIVE, CRED(), &rval)) != 0) { + FKIOCTL|FREAD|FNATIVE, CRED(), &rval)) != 0) { cmn_err(CE_NOTE, "Could not get the vtoc information"); return (error); } @@ -1612,7 +1629,7 @@ return (EINVAL); } if ((error = cdev_ioctl(dev, DKIOCINFO, (intptr_t)&dki_info, - FKIOCTL|FREAD|FNATIVE, CRED(), &rval)) != 0) { + FKIOCTL|FREAD|FNATIVE, CRED(), &rval)) != 0) { cmn_err(CE_NOTE, "Could not get the slice information"); return (error); } @@ -1656,8 +1673,8 @@ udm->udm_vat_icb = end_loc - ud_sub_blks[i]; secbp = ud_bread(dev, - udm->udm_vat_icb << udf_vfsp->udf_l2d_shift, - udf_vfsp->udf_lbsize); + udm->udm_vat_icb << udf_vfsp->udf_l2d_shift, + udf_vfsp->udf_lbsize); ASSERT(secbp->b_un.b_addr); fe = (struct file_entry *)secbp->b_un.b_addr; @@ -1683,10 +1700,10 @@ udm->udm_nent = 1; } else if (ad_type == ICB_FLAG_SHORT_AD) { udm->udm_nent = - SWAP_32(fe->fe_len_adesc) / sizeof (struct short_ad); + SWAP_32(fe->fe_len_adesc) / sizeof (struct short_ad); } else if (ad_type == ICB_FLAG_LONG_AD) { udm->udm_nent = - SWAP_32(fe->fe_len_adesc) / sizeof (struct long_ad); + SWAP_32(fe->fe_len_adesc) / sizeof (struct long_ad); } else { err = EINVAL; goto end; @@ -1701,22 +1718,22 @@ if (ad_type == ICB_FLAG_ONE_AD) { udm->udm_count[0] = (SWAP_64(fe->fe_info_len) - 36) / - sizeof (uint32_t); + sizeof (uint32_t); udm->udm_bp[0] = secbp; udm->udm_addr[0] = (uint32_t *) - &fe->fe_spec[SWAP_32(fe->fe_len_ear)]; + &fe->fe_spec[SWAP_32(fe->fe_len_ear)]; return (0); } for (i = 0; i < udm->udm_nent; i++) { if (ad_type == ICB_FLAG_SHORT_AD) { sad = (struct short_ad *) - (fe->fe_spec + SWAP_32(fe->fe_len_ear)); + (fe->fe_spec + SWAP_32(fe->fe_len_ear)); sad += i; count = SWAP_32(sad->sad_ext_len); blk = SWAP_32(sad->sad_ext_loc); } else { lad = (struct long_ad *) - (fe->fe_spec + SWAP_32(fe->fe_len_ear)); + (fe->fe_spec + SWAP_32(fe->fe_len_ear)); lad += i; count = SWAP_32(lad->lad_ext_len); blk = SWAP_32(lad->lad_ext_loc); @@ -1744,9 +1761,9 @@ count = (count + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1); udm->udm_bp[i] = ud_bread(dev, - blk << udf_vfsp->udf_l2d_shift, count); + blk << udf_vfsp->udf_l2d_shift, count); if ((udm->udm_bp[i]->b_error != 0) || - (udm->udm_bp[i]->b_resid)) { + (udm->udm_bp[i]->b_resid)) { err = EINVAL; break; } @@ -1782,7 +1799,7 @@ map->udm_loc[index] = SWAP_32(typ2->map2_st[index]); bp = ud_bread(dev, - map->udm_loc[index] << udf_vfsp->udf_l2d_shift, sz); + map->udm_loc[index] << udf_vfsp->udf_l2d_shift, sz); if ((bp->b_error != 0) || (bp->b_resid)) { brelse(bp); continue; @@ -1840,7 +1857,7 @@ } if (cdev_ioctl(dev, CDROMREADOFFSET, (intptr_t)&session_offset, - FKIOCTL|FREAD|FNATIVE, CRED(), &rval) != 0) { + FKIOCTL|FREAD|FNATIVE, CRED(), &rval) != 0) { session_offset = 0; } @@ -1847,16 +1864,16 @@ for (index = 0; index < end_index; index++) { for (bsize = DEV_BSIZE, shift = 0; - bsize <= MAXBSIZE; bsize <<= 1, shift++) { + bsize <= MAXBSIZE; bsize <<= 1, shift++) { if (index == 0) { avd_loc = 256; if (bsize <= 2048) { avd_loc += - session_offset * 2048 / bsize; + session_offset * 2048 / bsize; } else { avd_loc += - session_offset / (bsize / 2048); + session_offset / (bsize / 2048); } } else if (index == 1) { avd_loc = last_block - (1 << shift); @@ -1865,7 +1882,7 @@ } bp = ud_bread(dev, avd_loc << shift, - ANCHOR_VOL_DESC_LEN); + ANCHOR_VOL_DESC_LEN); if (geterror(bp) != 0) { brelse(bp); continue;