summaryrefslogtreecommitdiffstats
path: root/sys/isofs/cd9660/cd9660_rrip.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
committerdyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
commit10f666af84d48e89e4e2960415c9b616fce4077f (patch)
tree88a944de263165091f0a18abeedbaaccec532407 /sys/isofs/cd9660/cd9660_rrip.c
parent0960d7e91af3428ffba89b42228d82d8afaa0389 (diff)
downloadFreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.zip
FreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.tar.gz
This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
Diffstat (limited to 'sys/isofs/cd9660/cd9660_rrip.c')
-rw-r--r--sys/isofs/cd9660/cd9660_rrip.c76
1 files changed, 40 insertions, 36 deletions
diff --git a/sys/isofs/cd9660/cd9660_rrip.c b/sys/isofs/cd9660/cd9660_rrip.c
index 44d52eb..521094f 100644
--- a/sys/isofs/cd9660/cd9660_rrip.c
+++ b/sys/isofs/cd9660/cd9660_rrip.c
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94
+ * @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94
* $FreeBSD$
*/
@@ -104,10 +104,10 @@ cd9660_rrip_attr(p,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;
}
@@ -352,8 +352,8 @@ cd9660_rrip_tstamp(p,ana)
ISO_RRIP_TSTAMP *p;
ISO_RRIP_ANALYZE *ana;
{
- unsigned char *ptime;
-
+ u_char *ptime;
+
ptime = p->time;
/* Check a format of time stamp (7bytes/17bytes) */
@@ -367,7 +367,7 @@ cd9660_rrip_tstamp(p,ana)
ptime += 7;
} else
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,
ISO_FTYPE_RRIP);
@@ -390,7 +390,7 @@ cd9660_rrip_tstamp(p,ana)
ptime += 17;
} else
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);
ptime += 17;
@@ -423,16 +423,15 @@ cd9660_rrip_device(p,ana)
ISO_RRIP_DEVICE *p;
ISO_RRIP_ANALYZE *ana;
{
- unsigned high, low;
-
- high = isonum_733(p->dev_t_high_l);
- low = isonum_733(p->dev_t_low_l);
-
- if ( high == 0 ) {
- ana->inop->inode.iso_rdev = makedev( major(low), minor(low) );
- } else {
- ana->inop->inode.iso_rdev = makedev( high, minor(low) );
- }
+ u_int high, low;
+
+ 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));
+ else
+ ana->inop->inode.iso_rdev = makedev(high, minor(low));
ana->fields &= ~ISO_SUSP_DEVICE;
return ISO_SUSP_DEVICE;
}
@@ -475,8 +474,6 @@ cd9660_rrip_stop(p,ana)
ISO_SUSP_HEADER *p;
ISO_RRIP_ANALYZE *ana;
{
- /* stop analyzing */
- ana->fields = 0;
return ISO_SUSP_STOP;
}
@@ -545,22 +542,30 @@ cd9660_rrip_loop(isodir,ana,table)
if (!ana->fields)
break;
}
+ if (result&ISO_SUSP_STOP) {
+ result &= ~ISO_SUSP_STOP;
+ break;
+ }
+ /* plausibility check */
+ if (isonum_711(phead->length) < sizeof(*phead))
+ break;
/*
* move to next SUSP
* Hopefully this works with newer versions, too
*/
phead = (ISO_SUSP_HEADER *)((char *)phead + isonum_711(phead->length));
}
-
- if ( ana->fields && ana->iso_ce_len ) {
+
+ if (ana->fields && ana->iso_ce_len) {
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,
- iso_lblktodaddr(ana->imp, ana->iso_ce_blk),
- 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;
- 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;
@@ -569,7 +574,7 @@ cd9660_rrip_loop(isodir,ana,table)
brelse(bp);
/*
* If we don't find the Basic SUSP stuffs, just set default value
- * ( attribute/time stamp )
+ * (attribute/time stamp)
*/
for (ptable = table; ptable->func2; ptable++)
if (!(ptable->result&result))
@@ -579,6 +584,9 @@ cd9660_rrip_loop(isodir,ana,table)
}
/*
+ * Get Attributes.
+ */
+/*
* XXX the casts are bogus but will do for now.
*/
#define BC (rrt_func_t *)
@@ -607,10 +615,8 @@ cd9660_rrip_analyze(isodir,inop,imp)
return cd9660_rrip_loop(isodir,&analyze,rrip_table_analyze);
}
-/*
- * Get Alternate Name from 'AL' record
- * If either no AL record or 0 length,
- * it will be return the translated ISO9660 name,
+/*
+ * Get Alternate Name.
*/
static RRIP_TABLE rrip_table_getname[] = {
{ "NM", BC cd9660_rrip_altname, cd9660_rrip_defname, ISO_SUSP_ALTNAME },
@@ -654,10 +660,8 @@ cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
return cd9660_rrip_loop(isodir,&analyze,tab);
}
-/*
- * Get Symbolic Name from 'SL' record
- *
- * Note: isodir should contains SL record!
+/*
+ * Get Symbolic Link.
*/
static RRIP_TABLE rrip_table_getsymname[] = {
{ "SL", BC cd9660_rrip_slink, 0, ISO_SUSP_SLINK },
@@ -696,7 +700,7 @@ static RRIP_TABLE rrip_table_extref[] = {
/*
* Check for Rock Ridge Extension and return offset of its fields.
- * Note: We require the ER field.
+ * Note: We insist on the ER field.
*/
int
cd9660_rrip_offset(isodir,imp)
OpenPOWER on IntegriCloud