diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2006-07-09 04:23:10 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2006-07-09 04:23:10 +0000 |
commit | 20d3a6465006e13095c3c051d8ac2d07ea5018e1 (patch) | |
tree | b16fbae27688c23b6d0c5d3708cdfe118458e170 | |
parent | a427ee045c2a807dd8857bf8d8458a2dd6e5be9e (diff) |
Be consistent about how we name 'struct umount' instances
-rw-r--r-- | sys/isofs/udf/udf.h | 22 | ||||
-rw-r--r-- | sys/isofs/udf/udf_vfsops.c | 149 | ||||
-rw-r--r-- | sys/isofs/udf/udf_vnops.c | 98 |
3 files changed, 135 insertions, 134 deletions
diff --git a/sys/isofs/udf/udf.h b/sys/isofs/udf/udf.h index 73d0f71c75e..4ffdd003406 100644 --- a/sys/isofs/udf/udf.h +++ b/sys/isofs/udf/udf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udf.h,v 1.8 2006/07/09 04:14:25 pedro Exp $ */ +/* $OpenBSD: udf.h,v 1.9 2006/07/09 04:23:09 pedro Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> @@ -77,7 +77,7 @@ struct umount { struct udf_dirstream { struct unode *node; - struct umount *udfmp; + struct umount *ump; struct buf *bp; uint8_t *data; uint8_t *buf; @@ -99,27 +99,27 @@ struct udf_dirstream { * Can the block layer be forced to use a different block size? */ #define RDSECTOR(devvp, sector, size, bp) \ - bread(devvp, sector << (udfmp->um_bshift - DEV_BSHIFT), size, NOCRED, bp) + bread(devvp, sector << (ump->um_bshift - DEV_BSHIFT), size, NOCRED, bp) static __inline int -udf_readlblks(struct umount *udfmp, int sector, int size, struct buf **bp) +udf_readlblks(struct umount *ump, int sector, int size, struct buf **bp) { - return (RDSECTOR(udfmp->um_devvp, sector, - (size + udfmp->um_bmask) & ~udfmp->um_bmask, bp)); + return (RDSECTOR(ump->um_devvp, sector, + (size + ump->um_bmask) & ~ump->um_bmask, bp)); } static __inline int -udf_readalblks(struct umount *udfmp, int lsector, int size, struct buf **bp) +udf_readalblks(struct umount *ump, int lsector, int size, struct buf **bp) { daddr_t rablock, lblk; int rasize; - lblk = (lsector + udfmp->um_start) << (udfmp->um_bshift - DEV_BSHIFT); - rablock = (lblk + 1) << udfmp->um_bshift; + lblk = (lsector + ump->um_start) << (ump->um_bshift - DEV_BSHIFT); + rablock = (lblk + 1) << ump->um_bshift; rasize = size; - return (breadn(udfmp->um_devvp, lblk, - (size + udfmp->um_bmask) & ~udfmp->um_bmask, + return (breadn(ump->um_devvp, lblk, + (size + ump->um_bmask) & ~ump->um_bmask, &rablock, &rasize, 1, NOCRED, bp)); } diff --git a/sys/isofs/udf/udf_vfsops.c b/sys/isofs/udf/udf_vfsops.c index f0557ae6a70..b69cce5b114 100644 --- a/sys/isofs/udf/udf_vfsops.c +++ b/sys/isofs/udf/udf_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_vfsops.c,v 1.18 2006/07/09 04:14:25 pedro Exp $ */ +/* $OpenBSD: udf_vfsops.c,v 1.19 2006/07/09 04:23:09 pedro Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> @@ -217,7 +217,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) { struct buf *bp = NULL; struct anchor_vdp avdp; - struct umount *udfmp = NULL; + struct umount *ump = NULL; struct part_desc *pd; struct logvol_desc *lvd; struct fileset_desc *fsd; @@ -249,17 +249,18 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) if (error) return (error); - MALLOC(udfmp, struct umount *, sizeof(struct umount), M_UDFMOUNT, + MALLOC(ump, struct umount *, sizeof(struct umount), M_UDFMOUNT, M_WAITOK); - bzero(udfmp, sizeof(struct umount)); + bzero(ump, sizeof(struct umount)); - mp->mnt_data = (qaddr_t)udfmp; + mp->mnt_data = (qaddr_t) ump; mp->mnt_stat.f_fsid.val[0] = devvp->v_rdev; mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_UDF); mp->mnt_flag |= MNT_LOCAL; - udfmp->um_mountp = mp; - udfmp->um_dev = devvp->v_rdev; - udfmp->um_devvp = devvp; + + ump->um_mountp = mp; + ump->um_dev = devvp->v_rdev; + ump->um_devvp = devvp; bsize = 2048; /* Should probe the media for its size. */ @@ -294,12 +295,12 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) } lvd = (struct logvol_desc *)bp->b_data; if (!udf_checktag(&lvd->tag, TAGID_LOGVOL)) { - udfmp->um_bsize = letoh32(lvd->lb_size); - udfmp->um_bmask = udfmp->um_bsize - 1; - udfmp->um_bshift = ffs(udfmp->um_bsize) - 1; + ump->um_bsize = letoh32(lvd->lb_size); + ump->um_bmask = ump->um_bsize - 1; + ump->um_bshift = ffs(ump->um_bsize) - 1; fsd_part = letoh16(lvd->_lvd_use.fsd_loc.loc.part_num); fsd_offset = letoh32(lvd->_lvd_use.fsd_loc.loc.lb_num); - if (udf_find_partmaps(udfmp, lvd)) + if (udf_find_partmaps(ump, lvd)) break; logvol_found = 1; } @@ -307,8 +308,8 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) if (!udf_checktag(&pd->tag, TAGID_PARTITION)) { part_found = 1; part_num = letoh16(pd->part_num); - udfmp->um_len = letoh32(pd->part_len); - udfmp->um_start = letoh32(pd->start_loc); + ump->um_len = letoh32(pd->part_len); + ump->um_start = letoh32(pd->start_loc); } brelse(bp); @@ -328,13 +329,13 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) goto bail; } - mtx_init(&udfmp->um_hashmtx, IPL_NONE); - udfmp->um_hashtbl = hashinit(UDF_HASHTBLSIZE, M_UDFMOUNT, M_WAITOK, - &udfmp->um_hashsz); + mtx_init(&ump->um_hashmtx, IPL_NONE); + ump->um_hashtbl = hashinit(UDF_HASHTBLSIZE, M_UDFMOUNT, M_WAITOK, + &ump->um_hashsz); /* Get the VAT, if needed */ - if (udfmp->um_flags & UDF_MNT_FIND_VAT) { - error = udf_vat_get(udfmp); + if (ump->um_flags & UDF_MNT_FIND_VAT) { + error = udf_vat_get(ump); if (error) goto bail; } @@ -345,15 +346,15 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) * me in the right direction here. */ sector = fsd_offset; - udf_vat_map(udfmp, §or); - if ((error = RDSECTOR(devvp, sector, udfmp->um_bsize, &bp)) != 0) { + udf_vat_map(ump, §or); + if ((error = RDSECTOR(devvp, sector, ump->um_bsize, &bp)) != 0) { printf("Cannot read sector %d of FSD\n", sector); goto bail; } fsd = (struct fileset_desc *)bp->b_data; if (!udf_checktag(&fsd->tag, TAGID_FSD)) { fsd_found = 1; - bcopy(&fsd->rootdir_icb, &udfmp->um_root_icb, + bcopy(&fsd->rootdir_icb, &ump->um_root_icb, sizeof(struct long_ad)); } @@ -369,10 +370,10 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) /* * Find the file entry for the root directory. */ - sector = letoh32(udfmp->um_root_icb.loc.lb_num); - size = letoh32(udfmp->um_root_icb.len); - udf_vat_map(udfmp, §or); - if ((error = udf_readlblks(udfmp, sector, size, &bp)) != 0) { + sector = letoh32(ump->um_root_icb.loc.lb_num); + size = letoh32(ump->um_root_icb.len); + udf_vat_map(ump, §or); + if ((error = udf_readlblks(ump, sector, size, &bp)) != 0) { printf("Cannot read sector %d\n", sector); goto bail; } @@ -391,11 +392,11 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) return (0); bail: - if (udfmp->um_hashtbl != NULL) - free(udfmp->um_hashtbl, M_UDFMOUNT); + if (ump->um_hashtbl != NULL) + free(ump->um_hashtbl, M_UDFMOUNT); - if (udfmp != NULL) { - FREE(udfmp, M_UDFMOUNT); + if (ump != NULL) { + FREE(ump, M_UDFMOUNT); mp->mnt_data = NULL; mp->mnt_flag &= ~MNT_LOCAL; } @@ -409,12 +410,12 @@ bail: int udf_unmount(struct mount *mp, int mntflags, struct proc *p) { - struct umount *udfmp; + struct umount *ump; struct vnode *devvp; int error, flags = 0; - udfmp = VFSTOUDFFS(mp); - devvp = udfmp->um_devvp; + ump = VFSTOUDFFS(mp); + devvp = ump->um_devvp; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; @@ -432,13 +433,13 @@ udf_unmount(struct mount *mp, int mntflags, struct proc *p) devvp->v_specmountpoint = NULL; vrele(devvp); - if (udfmp->um_stbl != NULL) - free(udfmp->um_stbl, M_UDFMOUNT); + if (ump->um_stbl != NULL) + free(ump->um_stbl, M_UDFMOUNT); - if (udfmp->um_hashtbl != NULL) - free(udfmp->um_hashtbl, M_UDFMOUNT); + if (ump->um_hashtbl != NULL) + free(ump->um_hashtbl, M_UDFMOUNT); - FREE(udfmp, M_UDFMOUNT); + FREE(ump, M_UDFMOUNT); mp->mnt_data = (qaddr_t)0; mp->mnt_flag &= ~MNT_LOCAL; @@ -449,14 +450,14 @@ udf_unmount(struct mount *mp, int mntflags, struct proc *p) int udf_root(struct mount *mp, struct vnode **vpp) { - struct umount *udfmp; + struct umount *ump; struct vnode *vp; ino_t id; int error; - udfmp = VFSTOUDFFS(mp); + ump = VFSTOUDFFS(mp); - id = udf_getid(&udfmp->um_root_icb); + id = udf_getid(&ump->um_root_icb); error = udf_vget(mp, id, vpp); if (error) @@ -478,13 +479,13 @@ udf_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg, int udf_statfs(struct mount *mp, struct statfs *sbp, struct proc *p) { - struct umount *udfmp; + struct umount *ump; - udfmp = VFSTOUDFFS(mp); + ump = VFSTOUDFFS(mp); - sbp->f_bsize = udfmp->um_bsize; - sbp->f_iosize = udfmp->um_bsize; - sbp->f_blocks = udfmp->um_len; + sbp->f_bsize = ump->um_bsize; + sbp->f_iosize = ump->um_bsize; + sbp->f_blocks = ump->um_len; sbp->f_bfree = 0; sbp->f_bavail = 0; sbp->f_files = 0; @@ -504,7 +505,7 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) { struct buf *bp; struct vnode *devvp; - struct umount *udfmp; + struct umount *ump; struct proc *p; struct vnode *vp; struct unode *up; @@ -514,10 +515,10 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) p = curproc; bp = NULL; *vpp = NULL; - udfmp = VFSTOUDFFS(mp); + ump = VFSTOUDFFS(mp); /* See if we already have this in the cache */ - if ((error = udf_hashlookup(udfmp, ino, LK_EXCLUSIVE, vpp)) != 0) + if ((error = udf_hashlookup(ump, ino, LK_EXCLUSIVE, vpp)) != 0) return (error); if (*vpp != NULL) return (0); @@ -533,9 +534,9 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) * Copy in the file entry. Per the spec, the size can only be 1 block. */ sector = ino; - devvp = udfmp->um_devvp; - udf_vat_map(udfmp, §or); - if ((error = RDSECTOR(devvp, sector, udfmp->um_bsize, &bp)) != 0) { + devvp = ump->um_devvp; + udf_vat_map(ump, §or); + if ((error = RDSECTOR(devvp, sector, ump->um_bsize, &bp)) != 0) { printf("Cannot read sector %d\n", sector); pool_put(&unode_pool, up); if (bp != NULL) @@ -573,11 +574,11 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) up->u_vnode = vp; up->u_ino = ino; - up->u_devvp = udfmp->um_devvp; - up->u_dev = udfmp->um_dev; - up->u_ump = udfmp; + up->u_devvp = ump->um_devvp; + up->u_dev = ump->um_dev; + up->u_ump = ump; vp->v_data = up; - VREF(udfmp->um_devvp); + VREF(ump->um_devvp); lockinit(&up->u_lock, PINOD, "unode", 0, 0); @@ -677,43 +678,43 @@ udf_checkexp(struct mount *mp, struct mbuf *nam, int *exflagsp, /* Handle a virtual partition map */ int -udf_get_vpartmap(struct umount *udfmp, struct part_map_virt *pmv) +udf_get_vpartmap(struct umount *ump, struct part_map_virt *pmv) { - udfmp->um_flags |= UDF_MNT_FIND_VAT; /* Should do more than this */ + ump->um_flags |= UDF_MNT_FIND_VAT; /* Should do more than this */ return (0); } /* Handle a sparable partition map */ int -udf_get_spartmap(struct umount *udfmp, struct part_map_spare *pms) +udf_get_spartmap(struct umount *ump, struct part_map_spare *pms) { struct buf *bp; int i, error; - udfmp->um_stbl = malloc(letoh32(pms->st_size), M_UDFMOUNT, M_NOWAIT); - if (udfmp->um_stbl == NULL) + ump->um_stbl = malloc(letoh32(pms->st_size), M_UDFMOUNT, M_NOWAIT); + if (ump->um_stbl == NULL) return (ENOMEM); - bzero(udfmp->um_stbl, letoh32(pms->st_size)); + bzero(ump->um_stbl, letoh32(pms->st_size)); /* Calculate the number of sectors per packet */ - udfmp->um_psecs = letoh16(pms->packet_len) / udfmp->um_bsize; + ump->um_psecs = letoh16(pms->packet_len) / ump->um_bsize; - error = udf_readlblks(udfmp, letoh32(pms->st_loc[0]), + error = udf_readlblks(ump, letoh32(pms->st_loc[0]), letoh32(pms->st_size), &bp); if (error) { if (bp != NULL) brelse(bp); - free(udfmp->um_stbl, M_UDFMOUNT); + free(ump->um_stbl, M_UDFMOUNT); return (error); /* Failed to read sparing table */ } - bcopy(bp->b_data, udfmp->um_stbl, letoh32(pms->st_size)); + bcopy(bp->b_data, ump->um_stbl, letoh32(pms->st_size)); brelse(bp); - if (udf_checktag(&udfmp->um_stbl->tag, 0)) { - free(udfmp->um_stbl, M_UDFMOUNT); + if (udf_checktag(&ump->um_stbl->tag, 0)) { + free(ump->um_stbl, M_UDFMOUNT); return (EINVAL); /* Invalid sparing table found */ } @@ -721,9 +722,9 @@ udf_get_spartmap(struct umount *udfmp, struct part_map_spare *pms) * See how many valid entries there are here. The list is * supposed to be sorted, 0xfffffff0 and higher are not valid. */ - for (i = 0; i < letoh16(udfmp->um_stbl->rt_l); i++) { - udfmp->um_stbl_len = i; - if (letoh32(udfmp->um_stbl->entries[i].org) >= 0xfffffff0) + for (i = 0; i < letoh16(ump->um_stbl->rt_l); i++) { + ump->um_stbl_len = i; + if (letoh32(ump->um_stbl->entries[i].org) >= 0xfffffff0) break; } @@ -732,7 +733,7 @@ udf_get_spartmap(struct umount *udfmp, struct part_map_spare *pms) /* Scan the partition maps */ int -udf_find_partmaps(struct umount *udfmp, struct logvol_desc *lvd) +udf_find_partmaps(struct umount *ump, struct logvol_desc *lvd) { struct regid *pmap_id; unsigned char regid_id[UDF_REGID_ID_SIZE + 1]; @@ -762,11 +763,11 @@ udf_find_partmaps(struct umount *udfmp, struct logvol_desc *lvd) if (!bcmp(®id_id[0], "*UDF Virtual Partition", UDF_REGID_ID_SIZE)) - error = udf_get_vpartmap(udfmp, + error = udf_get_vpartmap(ump, (struct part_map_virt *) pmap); else if (!bcmp(®id_id[0], "*UDF Sparable Partition", UDF_REGID_ID_SIZE)) - error = udf_get_spartmap(udfmp, + error = udf_get_spartmap(ump, (struct part_map_spare *) pmap); else return (EINVAL); /* Unsupported partition map */ diff --git a/sys/isofs/udf/udf_vnops.c b/sys/isofs/udf/udf_vnops.c index ad88e91c4fa..ac8aceab9e7 100644 --- a/sys/isofs/udf/udf_vnops.c +++ b/sys/isofs/udf/udf_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_vnops.c,v 1.19 2006/07/09 04:14:25 pedro Exp $ */ +/* $OpenBSD: udf_vnops.c,v 1.20 2006/07/09 04:23:09 pedro Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> @@ -86,7 +86,7 @@ struct vnodeopv_desc udf_vnodeop_opv_desc = /* Look up a unode based on the ino_t passed in and return it's vnode */ int -udf_hashlookup(struct umount *udfmp, ino_t id, int flags, struct vnode **vpp) +udf_hashlookup(struct umount *ump, ino_t id, int flags, struct vnode **vpp) { struct unode *up; struct udf_hash_lh *lh; @@ -96,16 +96,16 @@ udf_hashlookup(struct umount *udfmp, ino_t id, int flags, struct vnode **vpp) *vpp = NULL; loop: - mtx_enter(&udfmp->um_hashmtx); - lh = &udfmp->um_hashtbl[id & udfmp->um_hashsz]; + mtx_enter(&ump->um_hashmtx); + lh = &ump->um_hashtbl[id & ump->um_hashsz]; if (lh == NULL) { - mtx_leave(&udfmp->um_hashmtx); + mtx_leave(&ump->um_hashmtx); return (ENOENT); } LIST_FOREACH(up, lh, u_le) { if (up->u_ino == id) { - mtx_leave(&udfmp->um_hashmtx); + mtx_leave(&ump->um_hashmtx); error = vget(up->u_vnode, flags | LK_INTERLOCK, p); if (error == ENOENT) goto loop; @@ -116,7 +116,7 @@ loop: } } - mtx_leave(&udfmp->um_hashmtx); + mtx_leave(&ump->um_hashmtx); return (0); } @@ -124,19 +124,19 @@ loop: int udf_hashins(struct unode *up) { - struct umount *udfmp; + struct umount *ump; struct udf_hash_lh *lh; struct proc *p = curproc; - udfmp = up->u_ump; + ump = up->u_ump; vn_lock(up->u_vnode, LK_EXCLUSIVE | LK_RETRY, p); - mtx_enter(&udfmp->um_hashmtx); - lh = &udfmp->um_hashtbl[up->u_ino & udfmp->um_hashsz]; + mtx_enter(&ump->um_hashmtx); + lh = &ump->um_hashtbl[up->u_ino & ump->um_hashsz]; if (lh == NULL) LIST_INIT(lh); LIST_INSERT_HEAD(lh, up, u_le); - mtx_leave(&udfmp->um_hashmtx); + mtx_leave(&ump->um_hashmtx); return (0); } @@ -144,17 +144,17 @@ udf_hashins(struct unode *up) int udf_hashrem(struct unode *up) { - struct umount *udfmp; + struct umount *ump; struct udf_hash_lh *lh; - udfmp = up->u_ump; + ump = up->u_ump; - mtx_enter(&udfmp->um_hashmtx); - lh = &udfmp->um_hashtbl[up->u_ino & udfmp->um_hashsz]; + mtx_enter(&ump->um_hashmtx); + lh = &ump->um_hashtbl[up->u_ino & ump->um_hashsz]; if (lh == NULL) panic("hash entry is NULL, up->u_ino = %d", up->u_ino); LIST_REMOVE(up, u_le); - mtx_leave(&udfmp->um_hashmtx); + mtx_leave(&ump->um_hashmtx); return (0); } @@ -467,7 +467,7 @@ udf_read(void *v) * that the kernel/user expects. Return the length of the translated string. */ int -udf_transname(char *cs0string, char *destname, int len, struct umount *udfmp) +udf_transname(char *cs0string, char *destname, int len, struct umount *ump) { unicode_t *transname; int i, unilen = 0, destlen; @@ -512,7 +512,7 @@ udf_transname(char *cs0string, char *destname, int len, struct umount *udfmp) * done here also. */ static int -udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct umount *udfmp) +udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct umount *ump) { char *transname; int error = 0; @@ -520,7 +520,7 @@ udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct umoun /* This is overkill, but not worth creating a new pool */ transname = pool_get(&udf_trans_pool, PR_WAITOK); - cs0len = udf_transname(cs0string, transname, cs0len, udfmp); + cs0len = udf_transname(cs0string, transname, cs0len, ump); /* Easy check. If they aren't the same length, they aren't equal */ if ((cs0len == 0) || (cs0len != cmplen)) @@ -561,7 +561,7 @@ udf_uiodir(struct udf_uiodir *uiodir, int de_size, struct uio *uio, long cookie) } static struct udf_dirstream * -udf_opendir(struct unode *up, int offset, int fsize, struct umount *udfmp) +udf_opendir(struct unode *up, int offset, int fsize, struct umount *ump) { struct udf_dirstream *ds; @@ -570,7 +570,7 @@ udf_opendir(struct unode *up, int offset, int fsize, struct umount *udfmp) ds->node = up; ds->offset = offset; - ds->udfmp = udfmp; + ds->ump = ump; ds->fsize = fsize; return (ds); @@ -622,7 +622,7 @@ udf_getfid(struct udf_dirstream *ds) /* Copy what we have of the fid into a buffer */ frag_size = ds->size - ds->off; - if (frag_size >= ds->udfmp->um_bsize) { + if (frag_size >= ds->ump->um_bsize) { printf("udf: invalid FID fragment\n"); ds->error = EINVAL; return (NULL); @@ -632,8 +632,8 @@ udf_getfid(struct udf_dirstream *ds) * File ID descriptors can only be at most one * logical sector in size. */ - ds->buf = malloc(ds->udfmp->um_bsize, M_UDFFID, M_WAITOK); - bzero(ds->buf, ds->udfmp->um_bsize); + ds->buf = malloc(ds->ump->um_bsize, M_UDFFID, M_WAITOK); + bzero(ds->buf, ds->ump->um_bsize); bcopy(fid, ds->buf, frag_size); /* Reduce all of the casting magic */ @@ -666,7 +666,7 @@ udf_getfid(struct udf_dirstream *ds) * allocation. */ total_fid_size = UDF_FID_SIZE + letoh16(fid->l_iu) + fid->l_fi; - if (total_fid_size > ds->udfmp->um_bsize) { + if (total_fid_size > ds->ump->um_bsize) { printf("udf: invalid FID\n"); ds->error = EIO; return (NULL); @@ -721,7 +721,7 @@ udf_readdir(void *v) struct uio *uio; struct dirent dir; struct unode *up; - struct umount *udfmp; + struct umount *ump; struct fileid_desc *fid; struct udf_uiodir uiodir; struct udf_dirstream *ds; @@ -735,7 +735,7 @@ udf_readdir(void *v) vp = ap->a_vp; uio = ap->a_uio; up = VTOU(vp); - udfmp = up->u_ump; + ump = up->u_ump; uiodir.eofflag = 1; if (ap->a_ncookies != NULL) { @@ -801,7 +801,7 @@ udf_readdir(void *v) error = udf_uiodir(&uiodir, dir.d_reclen, uio, 2); } else { dir.d_namlen = udf_transname(&fid->data[fid->l_iu], - &dir.d_name[0], fid->l_fi, udfmp); + &dir.d_name[0], fid->l_fi, ump); dir.d_fileno = udf_getid(&fid->icb); dir.d_type = (fid->file_char & UDF_FILE_CHAR_DIR) ? DT_DIR : DT_UNKNOWN; @@ -1010,7 +1010,7 @@ udf_lookup(void *v) struct vnode *tdp = NULL; struct vnode **vpp = ap->a_vpp; struct unode *up; - struct umount *udfmp; + struct umount *ump; struct fileid_desc *fid = NULL; struct udf_dirstream *ds; struct proc *p; @@ -1026,7 +1026,7 @@ udf_lookup(void *v) dvp = ap->a_dvp; up = VTOU(dvp); - udfmp = up->u_ump; + ump = up->u_ump; nameiop = ap->a_cnp->cn_nameiop; flags = ap->a_cnp->cn_flags; nameptr = ap->a_cnp->cn_nameptr; @@ -1076,7 +1076,7 @@ udf_lookup(void *v) } lookloop: - ds = udf_opendir(up, offset, fsize, udfmp); + ds = udf_opendir(up, offset, fsize, ump); while ((fid = udf_getfid(ds)) != NULL) { /* Check for a valid FID tag. */ @@ -1097,7 +1097,7 @@ lookloop: } } else { if (!(udf_cmpname(&fid->data[fid->l_iu], - nameptr, fid->l_fi, namelen, udfmp))) { + nameptr, fid->l_fi, namelen, ump))) { id = udf_getid(&fid->icb); break; } @@ -1114,7 +1114,7 @@ lookloop: /* Did we have a match? */ if (id) { - error = udf_vget(udfmp->um_mountp, id, &tdp); + error = udf_vget(ump->um_mountp, id, &tdp); if (!error) { /* * Remember where this entry was if it's the final @@ -1220,14 +1220,14 @@ int udf_readatoffset(struct unode *up, int *size, off_t offset, struct buf **bp, uint8_t **data) { - struct umount *udfmp; + struct umount *ump; struct file_entry *fentry = NULL; struct buf *bp1; uint32_t max_size; daddr_t sector; int error; - udfmp = up->u_ump; + ump = up->u_ump; *bp = NULL; error = udf_bmap_internal(up, offset, §or, &max_size); @@ -1249,14 +1249,14 @@ udf_readatoffset(struct unode *up, int *size, off_t offset, *size = max_size; *size = min(*size, MAXBSIZE); - if ((error = udf_readlblks(udfmp, sector, *size, bp))) { + if ((error = udf_readlblks(ump, sector, *size, bp))) { printf("warning: udf_readlblks returned error %d\n", error); /* note: *bp may be non-NULL */ return (error); } bp1 = *bp; - *data = (uint8_t *)&bp1->b_data[offset % udfmp->um_bsize]; + *data = (uint8_t *)&bp1->b_data[offset % ump->um_bsize]; return (0); } @@ -1268,7 +1268,7 @@ int udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector, uint32_t *max_size) { - struct umount *udfmp; + struct umount *ump; struct file_entry *fentry; void *icb; struct icb_tag *tag; @@ -1277,7 +1277,7 @@ udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector, int ad_offset, ad_num = 0; int i, p_offset; - udfmp = up->u_ump; + ump = up->u_ump; fentry = up->u_fentry; tag = &fentry->icbtag; @@ -1314,7 +1314,7 @@ udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector, ad_num++; } while(offset >= icblen); - lsector = (offset >> udfmp->um_bshift) + + lsector = (offset >> ump->um_bshift) + letoh32(((struct short_ad *)(icb))->pos); *max_size = GETICBLEN(short_ad, icb); @@ -1339,7 +1339,7 @@ udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector, ad_num++; } while(offset >= icblen); - lsector = (offset >> udfmp->um_bshift) + + lsector = (offset >> ump->um_bshift) + letoh32(((struct long_ad *)(icb))->loc.lb_num); *max_size = GETICBLEN(long_ad, icb); @@ -1351,7 +1351,7 @@ udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector, * allocation descriptor field of the file entry. */ *max_size = 0; - *sector = up->u_ino + udfmp->um_start; + *sector = up->u_ino + ump->um_start; return (UDF_INVALID_BMAP); case 2: @@ -1362,19 +1362,19 @@ udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector, return (ENODEV); } - *sector = lsector + udfmp->um_start; + *sector = lsector + ump->um_start; /* * Check the sparing table. Each entry represents the beginning of * a packet. */ - if (udfmp->um_stbl != NULL) { - for (i = 0; i< udfmp->um_stbl_len; i++) { + if (ump->um_stbl != NULL) { + for (i = 0; i< ump->um_stbl_len; i++) { p_offset = - lsector - letoh32(udfmp->um_stbl->entries[i].org); - if ((p_offset < udfmp->um_psecs) && (p_offset >= 0)) { + lsector - letoh32(ump->um_stbl->entries[i].org); + if ((p_offset < ump->um_psecs) && (p_offset >= 0)) { *sector = - letoh32(udfmp->um_stbl->entries[i].map) + + letoh32(ump->um_stbl->entries[i].map) + p_offset; break; } |