summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2006-07-09 04:14:26 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2006-07-09 04:14:26 +0000
commita427ee045c2a807dd8857bf8d8458a2dd6e5be9e (patch)
tree8386c375045c3c9a662de063396db52799c8adc3
parent755d92e17ea524e2081b42e4668f9b6d7057f2fd (diff)
udf_mnt -> umount and rename fields accordingly
-rw-r--r--sys/isofs/udf/udf.h65
-rw-r--r--sys/isofs/udf/udf_extern.h8
-rw-r--r--sys/isofs/udf/udf_subr.c28
-rw-r--r--sys/isofs/udf/udf_vfsops.c117
-rw-r--r--sys/isofs/udf/udf_vnops.c86
5 files changed, 151 insertions, 153 deletions
diff --git a/sys/isofs/udf/udf.h b/sys/isofs/udf/udf.h
index 83b6582d4be..73d0f71c75e 100644
--- a/sys/isofs/udf/udf.h
+++ b/sys/isofs/udf/udf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: udf.h,v 1.7 2006/07/08 23:11:59 pedro Exp $ */
+/* $OpenBSD: udf.h,v 1.8 2006/07/09 04:14:25 pedro Exp $ */
/*
* Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
@@ -38,7 +38,7 @@ struct unode {
LIST_ENTRY(unode) u_le;
struct vnode *u_vnode;
struct vnode *u_devvp;
- struct udf_mnt *u_ump;
+ struct umount *u_ump;
struct lock u_lock;
dev_t u_dev;
ino_t u_ino;
@@ -52,25 +52,24 @@ struct unode {
#define u_diroff un_u.u_diroff
#define u_vatlen un_u.u_vatlen
-struct udf_mnt {
- int im_flags;
- struct mount *im_mountp;
- struct vnode *im_devvp;
- dev_t im_dev;
- int bsize;
- int bshift;
- int bmask;
- uint32_t part_start;
- uint32_t part_len;
- struct vnode *im_vat;
- struct vnode *root_vp;
- struct long_ad root_icb;
- LIST_HEAD(udf_hash_lh, unode) *hashtbl;
- u_long hashsz;
- struct mutex hash_mtx;
- int p_sectors;
- int s_table_entries;
- struct udf_sparing_table *s_table;
+struct umount {
+ int um_flags;
+ struct mount *um_mountp;
+ struct vnode *um_devvp;
+ dev_t um_dev;
+ int um_bsize;
+ int um_bshift;
+ int um_bmask;
+ uint32_t um_start;
+ uint32_t um_len;
+ struct vnode *um_vat;
+ struct long_ad um_root_icb;
+ LIST_HEAD(udf_hash_lh, unode) *um_hashtbl;
+ u_long um_hashsz;
+ struct mutex um_hashmtx;
+ int um_psecs;
+ int um_stbl_len;
+ struct udf_sparing_table *um_stbl;
};
#define UDF_MNT_FIND_VAT 0x01 /* Indicates a VAT must be found */
@@ -78,7 +77,7 @@ struct udf_mnt {
struct udf_dirstream {
struct unode *node;
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct buf *bp;
uint8_t *data;
uint8_t *buf;
@@ -91,7 +90,7 @@ struct udf_dirstream {
int fid_fragment;
};
-#define VFSTOUDFFS(mp) ((struct udf_mnt *)((mp)->mnt_data))
+#define VFSTOUDFFS(mp) ((struct umount *)((mp)->mnt_data))
#define VTOU(vp) ((struct unode *)((vp)->v_data))
/*
@@ -100,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->bshift - DEV_BSHIFT), size, NOCRED, bp)
+ bread(devvp, sector << (udfmp->um_bshift - DEV_BSHIFT), size, NOCRED, bp)
static __inline int
-udf_readlblks(struct udf_mnt *udfmp, int sector, int size, struct buf **bp)
+udf_readlblks(struct umount *udfmp, int sector, int size, struct buf **bp)
{
- return (RDSECTOR(udfmp->im_devvp, sector,
- (size + udfmp->bmask) & ~udfmp->bmask, bp));
+ return (RDSECTOR(udfmp->um_devvp, sector,
+ (size + udfmp->um_bmask) & ~udfmp->um_bmask, bp));
}
static __inline int
-udf_readalblks(struct udf_mnt *udfmp, int lsector, int size, struct buf **bp)
+udf_readalblks(struct umount *udfmp, int lsector, int size, struct buf **bp)
{
daddr_t rablock, lblk;
int rasize;
- lblk = (lsector + udfmp->part_start) << (udfmp->bshift - DEV_BSHIFT);
- rablock = (lblk + 1) << udfmp->bshift;
+ lblk = (lsector + udfmp->um_start) << (udfmp->um_bshift - DEV_BSHIFT);
+ rablock = (lblk + 1) << udfmp->um_bshift;
rasize = size;
- return (breadn(udfmp->im_devvp, lblk,
- (size + udfmp->bmask) & ~udfmp->bmask,
+ return (breadn(udfmp->um_devvp, lblk,
+ (size + udfmp->um_bmask) & ~udfmp->um_bmask,
&rablock, &rasize, 1, NOCRED, bp));
}
@@ -139,7 +138,7 @@ udf_getid(struct long_ad *icb)
}
int udf_allocv(struct mount *, struct vnode **, struct proc *);
-int udf_hashlookup(struct udf_mnt *, ino_t, int, struct vnode **);
+int udf_hashlookup(struct umount *, ino_t, int, struct vnode **);
int udf_hashins(struct unode *);
int udf_hashrem(struct unode *);
int udf_checktag(struct desc_tag *, uint16_t);
diff --git a/sys/isofs/udf/udf_extern.h b/sys/isofs/udf/udf_extern.h
index e35369519a6..7950d658271 100644
--- a/sys/isofs/udf/udf_extern.h
+++ b/sys/isofs/udf/udf_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: udf_extern.h,v 1.5 2006/07/08 23:11:59 pedro Exp $ */
+/* $OpenBSD: udf_extern.h,v 1.6 2006/07/09 04:14:25 pedro Exp $ */
/*
* Written by Pedro Martelletto <pedro@openbsd.org> in February 2005.
@@ -9,8 +9,8 @@
* udf_subr.c
*/
int udf_rawnametounicode(u_int len, char *, unicode_t *);
-int udf_vat_get(struct udf_mnt *);
-int udf_vat_map(struct udf_mnt *, uint32_t *);
+int udf_vat_get(struct umount *);
+int udf_vat_map(struct umount *, uint32_t *);
/*
* udf_vfsops.c
@@ -50,7 +50,7 @@ int udf_lock(void *v);
int udf_unlock(void *v);
int udf_islocked(void *v);
int udf_print(void *v);
-int udf_transname(char *, char *, int, struct udf_mnt *);
+int udf_transname(char *, char *, int, struct umount *);
int udf_readatoffset(struct unode *, int *, off_t, struct buf **,
uint8_t **);
diff --git a/sys/isofs/udf/udf_subr.c b/sys/isofs/udf/udf_subr.c
index bf3632d2d04..cc58cd9fb51 100644
--- a/sys/isofs/udf/udf_subr.c
+++ b/sys/isofs/udf/udf_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udf_subr.c,v 1.8 2006/07/08 23:29:20 pedro Exp $ */
+/* $OpenBSD: udf_subr.c,v 1.9 2006/07/09 04:14:25 pedro Exp $ */
/*
* Copyright (c) 2006, Miodrag Vallat
@@ -42,7 +42,7 @@
#include <isofs/udf/udf.h>
#include <isofs/udf/udf_extern.h>
-int udf_vat_read(struct udf_mnt *, uint32_t *);
+int udf_vat_read(struct umount *, uint32_t *);
/*
* Convert a CS0 dstring to a 16-bit Unicode string.
@@ -183,22 +183,22 @@ out:
/* Get a vnode for the Virtual Allocation Table (VAT) */
int
-udf_vat_get(struct udf_mnt *ump)
+udf_vat_get(struct umount *ump)
{
struct vnode *vp;
struct unode *up;
int error;
- error = udf_vget(ump->im_mountp, ump->part_len - 3, &vp);
+ error = udf_vget(ump->um_mountp, ump->um_len - 3, &vp);
if (error)
return (error);
up = VTOU(vp);
up->u_vatlen = (letoh64(up->u_fentry->inf_len) - 36) >> 2;
- ump->im_vat = vp;
- ump->im_flags &= ~UDF_MNT_FIND_VAT;
- ump->im_flags |= UDF_MNT_USES_VAT;
+ ump->um_vat = vp;
+ ump->um_flags &= ~UDF_MNT_FIND_VAT;
+ ump->um_flags |= UDF_MNT_USES_VAT;
vput(vp);
@@ -207,16 +207,16 @@ udf_vat_get(struct udf_mnt *ump)
/* Look up a sector in the VAT */
int
-udf_vat_map(struct udf_mnt *ump, uint32_t *sector)
+udf_vat_map(struct umount *ump, uint32_t *sector)
{
/* If there's no VAT, then it's easy */
- if (!(ump->im_flags & UDF_MNT_USES_VAT)) {
- *sector += ump->part_start;
+ if (!(ump->um_flags & UDF_MNT_USES_VAT)) {
+ *sector += ump->um_start;
return (0);
}
/* Sanity check the given sector */
- if (*sector >= VTOU(ump->im_vat)->u_vatlen)
+ if (*sector >= VTOU(ump->um_vat)->u_vatlen)
return (EINVAL);
return (udf_vat_read(ump, sector));
@@ -224,14 +224,14 @@ udf_vat_map(struct udf_mnt *ump, uint32_t *sector)
/* Read from the VAT */
int
-udf_vat_read(struct udf_mnt *ump, uint32_t *sector)
+udf_vat_read(struct umount *ump, uint32_t *sector)
{
struct unode *up;
struct buf *bp;
uint8_t *data;
int error, size;
- up = VTOU(ump->im_vat);
+ up = VTOU(ump->um_vat);
size = 4;
/*
@@ -255,7 +255,7 @@ udf_vat_read(struct udf_mnt *ump, uint32_t *sector)
}
/* Map the sector */
- *sector = letoh32(*(uint32_t *)data) + ump->part_start;
+ *sector = letoh32(*(uint32_t *)data) + ump->um_start;
brelse(bp);
diff --git a/sys/isofs/udf/udf_vfsops.c b/sys/isofs/udf/udf_vfsops.c
index 99401b0fc80..f0557ae6a70 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.17 2006/07/08 23:29:20 pedro Exp $ */
+/* $OpenBSD: udf_vfsops.c,v 1.18 2006/07/09 04:14:25 pedro Exp $ */
/*
* Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
@@ -76,9 +76,9 @@ struct pool udf_trans_pool;
struct pool unode_pool;
struct pool udf_ds_pool;
-int udf_find_partmaps(struct udf_mnt *, struct logvol_desc *);
-int udf_get_vpartmap(struct udf_mnt *, struct part_map_virt *);
-int udf_get_spartmap(struct udf_mnt *, struct part_map_spare *);
+int udf_find_partmaps(struct umount *, struct logvol_desc *);
+int udf_get_vpartmap(struct umount *, struct part_map_virt *);
+int udf_get_spartmap(struct umount *, struct part_map_spare *);
const struct vfsops udf_vfsops = {
.vfs_fhtovp = udf_fhtovp,
@@ -217,7 +217,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
{
struct buf *bp = NULL;
struct anchor_vdp avdp;
- struct udf_mnt *udfmp = NULL;
+ struct umount *udfmp = NULL;
struct part_desc *pd;
struct logvol_desc *lvd;
struct fileset_desc *fsd;
@@ -249,17 +249,17 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
if (error)
return (error);
- MALLOC(udfmp, struct udf_mnt *, sizeof(struct udf_mnt), M_UDFMOUNT,
+ MALLOC(udfmp, struct umount *, sizeof(struct umount), M_UDFMOUNT,
M_WAITOK);
- bzero(udfmp, sizeof(struct udf_mnt));
+ bzero(udfmp, sizeof(struct umount));
mp->mnt_data = (qaddr_t)udfmp;
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->im_mountp = mp;
- udfmp->im_dev = devvp->v_rdev;
- udfmp->im_devvp = devvp;
+ udfmp->um_mountp = mp;
+ udfmp->um_dev = devvp->v_rdev;
+ udfmp->um_devvp = devvp;
bsize = 2048; /* Should probe the media for its size. */
@@ -294,9 +294,9 @@ 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->bsize = letoh32(lvd->lb_size);
- udfmp->bmask = udfmp->bsize - 1;
- udfmp->bshift = ffs(udfmp->bsize) - 1;
+ udfmp->um_bsize = letoh32(lvd->lb_size);
+ udfmp->um_bmask = udfmp->um_bsize - 1;
+ udfmp->um_bshift = ffs(udfmp->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))
@@ -307,8 +307,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->part_len = letoh32(pd->part_len);
- udfmp->part_start = letoh32(pd->start_loc);
+ udfmp->um_len = letoh32(pd->part_len);
+ udfmp->um_start = letoh32(pd->start_loc);
}
brelse(bp);
@@ -328,12 +328,12 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
goto bail;
}
- mtx_init(&udfmp->hash_mtx, IPL_NONE);
- udfmp->hashtbl = hashinit(UDF_HASHTBLSIZE, M_UDFMOUNT, M_WAITOK,
- &udfmp->hashsz);
+ mtx_init(&udfmp->um_hashmtx, IPL_NONE);
+ udfmp->um_hashtbl = hashinit(UDF_HASHTBLSIZE, M_UDFMOUNT, M_WAITOK,
+ &udfmp->um_hashsz);
/* Get the VAT, if needed */
- if (udfmp->im_flags & UDF_MNT_FIND_VAT) {
+ if (udfmp->um_flags & UDF_MNT_FIND_VAT) {
error = udf_vat_get(udfmp);
if (error)
goto bail;
@@ -346,14 +346,14 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
*/
sector = fsd_offset;
udf_vat_map(udfmp, &sector);
- if ((error = RDSECTOR(devvp, sector, udfmp->bsize, &bp)) != 0) {
+ if ((error = RDSECTOR(devvp, sector, udfmp->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->root_icb,
+ bcopy(&fsd->rootdir_icb, &udfmp->um_root_icb,
sizeof(struct long_ad));
}
@@ -369,8 +369,8 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
/*
* Find the file entry for the root directory.
*/
- sector = letoh32(udfmp->root_icb.loc.lb_num);
- size = letoh32(udfmp->root_icb.len);
+ sector = letoh32(udfmp->um_root_icb.loc.lb_num);
+ size = letoh32(udfmp->um_root_icb.len);
udf_vat_map(udfmp, &sector);
if ((error = udf_readlblks(udfmp, sector, size, &bp)) != 0) {
printf("Cannot read sector %d\n", sector);
@@ -391,8 +391,8 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p)
return (0);
bail:
- if (udfmp->hashtbl != NULL)
- free(udfmp->hashtbl, M_UDFMOUNT);
+ if (udfmp->um_hashtbl != NULL)
+ free(udfmp->um_hashtbl, M_UDFMOUNT);
if (udfmp != NULL) {
FREE(udfmp, M_UDFMOUNT);
@@ -409,12 +409,12 @@ bail:
int
udf_unmount(struct mount *mp, int mntflags, struct proc *p)
{
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct vnode *devvp;
int error, flags = 0;
udfmp = VFSTOUDFFS(mp);
- devvp = udfmp->im_devvp;
+ devvp = udfmp->um_devvp;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
@@ -432,11 +432,11 @@ udf_unmount(struct mount *mp, int mntflags, struct proc *p)
devvp->v_specmountpoint = NULL;
vrele(devvp);
- if (udfmp->s_table != NULL)
- free(udfmp->s_table, M_UDFMOUNT);
+ if (udfmp->um_stbl != NULL)
+ free(udfmp->um_stbl, M_UDFMOUNT);
- if (udfmp->hashtbl != NULL)
- free(udfmp->hashtbl, M_UDFMOUNT);
+ if (udfmp->um_hashtbl != NULL)
+ free(udfmp->um_hashtbl, M_UDFMOUNT);
FREE(udfmp, M_UDFMOUNT);
@@ -449,14 +449,14 @@ udf_unmount(struct mount *mp, int mntflags, struct proc *p)
int
udf_root(struct mount *mp, struct vnode **vpp)
{
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct vnode *vp;
ino_t id;
int error;
udfmp = VFSTOUDFFS(mp);
- id = udf_getid(&udfmp->root_icb);
+ id = udf_getid(&udfmp->um_root_icb);
error = udf_vget(mp, id, vpp);
if (error)
@@ -464,7 +464,6 @@ udf_root(struct mount *mp, struct vnode **vpp)
vp = *vpp;
vp->v_flag |= VROOT;
- udfmp->root_vp = vp;
return (0);
}
@@ -479,13 +478,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 udf_mnt *udfmp;
+ struct umount *udfmp;
udfmp = VFSTOUDFFS(mp);
- sbp->f_bsize = udfmp->bsize;
- sbp->f_iosize = udfmp->bsize;
- sbp->f_blocks = udfmp->part_len;
+ sbp->f_bsize = udfmp->um_bsize;
+ sbp->f_iosize = udfmp->um_bsize;
+ sbp->f_blocks = udfmp->um_len;
sbp->f_bfree = 0;
sbp->f_bavail = 0;
sbp->f_files = 0;
@@ -505,7 +504,7 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
{
struct buf *bp;
struct vnode *devvp;
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct proc *p;
struct vnode *vp;
struct unode *up;
@@ -534,9 +533,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->im_devvp;
+ devvp = udfmp->um_devvp;
udf_vat_map(udfmp, &sector);
- if ((error = RDSECTOR(devvp, sector, udfmp->bsize, &bp)) != 0) {
+ if ((error = RDSECTOR(devvp, sector, udfmp->um_bsize, &bp)) != 0) {
printf("Cannot read sector %d\n", sector);
pool_put(&unode_pool, up);
if (bp != NULL)
@@ -574,11 +573,11 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
up->u_vnode = vp;
up->u_ino = ino;
- up->u_devvp = udfmp->im_devvp;
- up->u_dev = udfmp->im_dev;
+ up->u_devvp = udfmp->um_devvp;
+ up->u_dev = udfmp->um_dev;
up->u_ump = udfmp;
vp->v_data = up;
- VREF(udfmp->im_devvp);
+ VREF(udfmp->um_devvp);
lockinit(&up->u_lock, PINOD, "unode", 0, 0);
@@ -678,27 +677,27 @@ udf_checkexp(struct mount *mp, struct mbuf *nam, int *exflagsp,
/* Handle a virtual partition map */
int
-udf_get_vpartmap(struct udf_mnt *udfmp, struct part_map_virt *pmv)
+udf_get_vpartmap(struct umount *udfmp, struct part_map_virt *pmv)
{
- udfmp->im_flags |= UDF_MNT_FIND_VAT; /* Should do more than this */
+ udfmp->um_flags |= UDF_MNT_FIND_VAT; /* Should do more than this */
return (0);
}
/* Handle a sparable partition map */
int
-udf_get_spartmap(struct udf_mnt *udfmp, struct part_map_spare *pms)
+udf_get_spartmap(struct umount *udfmp, struct part_map_spare *pms)
{
struct buf *bp;
int i, error;
- udfmp->s_table = malloc(letoh32(pms->st_size), M_UDFMOUNT, M_NOWAIT);
- if (udfmp->s_table == NULL)
+ udfmp->um_stbl = malloc(letoh32(pms->st_size), M_UDFMOUNT, M_NOWAIT);
+ if (udfmp->um_stbl == NULL)
return (ENOMEM);
- bzero(udfmp->s_table, letoh32(pms->st_size));
+ bzero(udfmp->um_stbl, letoh32(pms->st_size));
/* Calculate the number of sectors per packet */
- udfmp->p_sectors = letoh16(pms->packet_len) / udfmp->bsize;
+ udfmp->um_psecs = letoh16(pms->packet_len) / udfmp->um_bsize;
error = udf_readlblks(udfmp, letoh32(pms->st_loc[0]),
letoh32(pms->st_size), &bp);
@@ -706,15 +705,15 @@ udf_get_spartmap(struct udf_mnt *udfmp, struct part_map_spare *pms)
if (error) {
if (bp != NULL)
brelse(bp);
- free(udfmp->s_table, M_UDFMOUNT);
+ free(udfmp->um_stbl, M_UDFMOUNT);
return (error); /* Failed to read sparing table */
}
- bcopy(bp->b_data, udfmp->s_table, letoh32(pms->st_size));
+ bcopy(bp->b_data, udfmp->um_stbl, letoh32(pms->st_size));
brelse(bp);
- if (udf_checktag(&udfmp->s_table->tag, 0)) {
- free(udfmp->s_table, M_UDFMOUNT);
+ if (udf_checktag(&udfmp->um_stbl->tag, 0)) {
+ free(udfmp->um_stbl, M_UDFMOUNT);
return (EINVAL); /* Invalid sparing table found */
}
@@ -722,9 +721,9 @@ udf_get_spartmap(struct udf_mnt *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->s_table->rt_l); i++) {
- udfmp->s_table_entries = i;
- if (letoh32(udfmp->s_table->entries[i].org) >= 0xfffffff0)
+ 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)
break;
}
@@ -733,7 +732,7 @@ udf_get_spartmap(struct udf_mnt *udfmp, struct part_map_spare *pms)
/* Scan the partition maps */
int
-udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
+udf_find_partmaps(struct umount *udfmp, struct logvol_desc *lvd)
{
struct regid *pmap_id;
unsigned char regid_id[UDF_REGID_ID_SIZE + 1];
diff --git a/sys/isofs/udf/udf_vnops.c b/sys/isofs/udf/udf_vnops.c
index fe70d535b53..ad88e91c4fa 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.18 2006/07/08 23:29:20 pedro Exp $ */
+/* $OpenBSD: udf_vnops.c,v 1.19 2006/07/09 04:14:25 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 udf_mnt *udfmp, ino_t id, int flags, struct vnode **vpp)
+udf_hashlookup(struct umount *udfmp, ino_t id, int flags, struct vnode **vpp)
{
struct unode *up;
struct udf_hash_lh *lh;
@@ -96,16 +96,16 @@ udf_hashlookup(struct udf_mnt *udfmp, ino_t id, int flags, struct vnode **vpp)
*vpp = NULL;
loop:
- mtx_enter(&udfmp->hash_mtx);
- lh = &udfmp->hashtbl[id & udfmp->hashsz];
+ mtx_enter(&udfmp->um_hashmtx);
+ lh = &udfmp->um_hashtbl[id & udfmp->um_hashsz];
if (lh == NULL) {
- mtx_leave(&udfmp->hash_mtx);
+ mtx_leave(&udfmp->um_hashmtx);
return (ENOENT);
}
LIST_FOREACH(up, lh, u_le) {
if (up->u_ino == id) {
- mtx_leave(&udfmp->hash_mtx);
+ mtx_leave(&udfmp->um_hashmtx);
error = vget(up->u_vnode, flags | LK_INTERLOCK, p);
if (error == ENOENT)
goto loop;
@@ -116,7 +116,7 @@ loop:
}
}
- mtx_leave(&udfmp->hash_mtx);
+ mtx_leave(&udfmp->um_hashmtx);
return (0);
}
@@ -124,19 +124,19 @@ loop:
int
udf_hashins(struct unode *up)
{
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct udf_hash_lh *lh;
struct proc *p = curproc;
udfmp = up->u_ump;
vn_lock(up->u_vnode, LK_EXCLUSIVE | LK_RETRY, p);
- mtx_enter(&udfmp->hash_mtx);
- lh = &udfmp->hashtbl[up->u_ino & udfmp->hashsz];
+ mtx_enter(&udfmp->um_hashmtx);
+ lh = &udfmp->um_hashtbl[up->u_ino & udfmp->um_hashsz];
if (lh == NULL)
LIST_INIT(lh);
LIST_INSERT_HEAD(lh, up, u_le);
- mtx_leave(&udfmp->hash_mtx);
+ mtx_leave(&udfmp->um_hashmtx);
return (0);
}
@@ -144,17 +144,17 @@ udf_hashins(struct unode *up)
int
udf_hashrem(struct unode *up)
{
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct udf_hash_lh *lh;
udfmp = up->u_ump;
- mtx_enter(&udfmp->hash_mtx);
- lh = &udfmp->hashtbl[up->u_ino & udfmp->hashsz];
+ mtx_enter(&udfmp->um_hashmtx);
+ lh = &udfmp->um_hashtbl[up->u_ino & udfmp->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->hash_mtx);
+ mtx_leave(&udfmp->um_hashmtx);
return (0);
}
@@ -354,16 +354,16 @@ udf_getattr(void *v)
*/
if (fentry->logblks_rec != 0) {
vap->va_size =
- letoh64(fentry->logblks_rec) * up->u_ump->bsize;
+ letoh64(fentry->logblks_rec) * up->u_ump->um_bsize;
} else {
- vap->va_size = up->u_ump->bsize;
+ vap->va_size = up->u_ump->um_bsize;
}
} else {
vap->va_size = letoh64(fentry->inf_len);
}
vap->va_flags = 0;
vap->va_gen = 1;
- vap->va_blocksize = up->u_ump->bsize;
+ vap->va_blocksize = up->u_ump->um_bsize;
vap->va_bytes = letoh64(fentry->inf_len);
vap->va_type = vp->v_type;
vap->va_filerev = 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 udf_mnt *udfmp)
+udf_transname(char *cs0string, char *destname, int len, struct umount *udfmp)
{
unicode_t *transname;
int i, unilen = 0, destlen;
@@ -512,7 +512,7 @@ udf_transname(char *cs0string, char *destname, int len, struct udf_mnt *udfmp)
* done here also.
*/
static int
-udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct udf_mnt *udfmp)
+udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen, struct umount *udfmp)
{
char *transname;
int error = 0;
@@ -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 udf_mnt *udfmp)
+udf_opendir(struct unode *up, int offset, int fsize, struct umount *udfmp)
{
struct udf_dirstream *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->bsize) {
+ if (frag_size >= ds->udfmp->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->bsize, M_UDFFID, M_WAITOK);
- bzero(ds->buf, ds->udfmp->bsize);
+ ds->buf = malloc(ds->udfmp->um_bsize, M_UDFFID, M_WAITOK);
+ bzero(ds->buf, ds->udfmp->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->bsize) {
+ if (total_fid_size > ds->udfmp->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 udf_mnt *udfmp;
+ struct umount *udfmp;
struct fileid_desc *fid;
struct udf_uiodir uiodir;
struct udf_dirstream *ds;
@@ -868,7 +868,7 @@ udf_strategy(void *v)
* Files that are embedded in the fentry don't translate well
* to a block number. Reject.
*/
- if (udf_bmap_internal(up, bp->b_lblkno * up->u_ump->bsize,
+ if (udf_bmap_internal(up, bp->b_lblkno * up->u_ump->um_bsize,
&bp->b_lblkno, &maxsize)) {
clrbuf(bp);
bp->b_blkno = -1;
@@ -980,13 +980,13 @@ udf_bmap(void *v)
if (ap->a_bnp == NULL)
return (0);
- error = udf_bmap_internal(up, ap->a_bn * up->u_ump->bsize,
+ error = udf_bmap_internal(up, ap->a_bn * up->u_ump->um_bsize,
&lsector, &max_size);
if (error)
return (error);
/* Translate logical to physical sector number */
- *ap->a_bnp = lsector << (up->u_ump->bshift - DEV_BSHIFT);
+ *ap->a_bnp = lsector << (up->u_ump->um_bshift - DEV_BSHIFT);
/* Punt on read-ahead for now */
if (ap->a_runp)
@@ -1010,7 +1010,7 @@ udf_lookup(void *v)
struct vnode *tdp = NULL;
struct vnode **vpp = ap->a_vpp;
struct unode *up;
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct fileid_desc *fid = NULL;
struct udf_dirstream *ds;
struct proc *p;
@@ -1114,7 +1114,7 @@ lookloop:
/* Did we have a match? */
if (id) {
- error = udf_vget(udfmp->im_mountp, id, &tdp);
+ error = udf_vget(udfmp->um_mountp, id, &tdp);
if (!error) {
/*
* Remember where this entry was if it's the final
@@ -1220,7 +1220,7 @@ int
udf_readatoffset(struct unode *up, int *size, off_t offset,
struct buf **bp, uint8_t **data)
{
- struct udf_mnt *udfmp;
+ struct umount *udfmp;
struct file_entry *fentry = NULL;
struct buf *bp1;
uint32_t max_size;
@@ -1256,7 +1256,7 @@ udf_readatoffset(struct unode *up, int *size, off_t offset,
}
bp1 = *bp;
- *data = (uint8_t *)&bp1->b_data[offset % udfmp->bsize];
+ *data = (uint8_t *)&bp1->b_data[offset % udfmp->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 udf_mnt *udfmp;
+ struct umount *udfmp;
struct file_entry *fentry;
void *icb;
struct icb_tag *tag;
@@ -1314,7 +1314,7 @@ udf_bmap_internal(struct unode *up, off_t offset, daddr_t *sector,
ad_num++;
} while(offset >= icblen);
- lsector = (offset >> udfmp->bshift) +
+ lsector = (offset >> udfmp->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->bshift) +
+ lsector = (offset >> udfmp->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->part_start;
+ *sector = up->u_ino + udfmp->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->part_start;
+ *sector = lsector + udfmp->um_start;
/*
* Check the sparing table. Each entry represents the beginning of
* a packet.
*/
- if (udfmp->s_table != NULL) {
- for (i = 0; i< udfmp->s_table_entries; i++) {
+ if (udfmp->um_stbl != NULL) {
+ for (i = 0; i< udfmp->um_stbl_len; i++) {
p_offset =
- lsector - letoh32(udfmp->s_table->entries[i].org);
- if ((p_offset < udfmp->p_sectors) && (p_offset >= 0)) {
+ lsector - letoh32(udfmp->um_stbl->entries[i].org);
+ if ((p_offset < udfmp->um_psecs) && (p_offset >= 0)) {
*sector =
- letoh32(udfmp->s_table->entries[i].map) +
+ letoh32(udfmp->um_stbl->entries[i].map) +
p_offset;
break;
}