Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libstand/cd9660.c
Show First 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | while (p + 3 < end) { | ||||
sh = (ISO_SUSP_HEADER *)p; | sh = (ISO_SUSP_HEADER *)p; | ||||
if (bcmp(sh->type, identifier, 2) == 0) | if (bcmp(sh->type, identifier, 2) == 0) | ||||
return (sh); | return (sh); | ||||
if (bcmp(sh->type, SUSP_STOP, 2) == 0) | if (bcmp(sh->type, SUSP_STOP, 2) == 0) | ||||
return (NULL); | return (NULL); | ||||
if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) { | if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) { | ||||
shc = (ISO_RRIP_CONT *)sh; | shc = (ISO_RRIP_CONT *)sh; | ||||
error = f->f_dev->dv_strategy(f->f_devdata, F_READ, | error = f->f_dev->dv_strategy(f->f_devdata, F_READ, | ||||
cdb2devb(isonum_733(shc->location)), | cdb2devb(isonum_733(shc->location)), 0, | ||||
ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read); | ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read); | ||||
/* Bail if it fails. */ | /* Bail if it fails. */ | ||||
if (error != 0 || read != ISO_DEFAULT_BLOCK_SIZE) | if (error != 0 || read != ISO_DEFAULT_BLOCK_SIZE) | ||||
return (NULL); | return (NULL); | ||||
p = susp_buffer + isonum_733(shc->offset); | p = susp_buffer + isonum_733(shc->offset); | ||||
end = p + isonum_733(shc->length); | end = p + isonum_733(shc->length); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | cd9660_open(const char *path, struct open_file *f) | ||||
int rc, first, use_rrip, lenskip; | int rc, first, use_rrip, lenskip; | ||||
/* First find the volume descriptor */ | /* First find the volume descriptor */ | ||||
buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE); | buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE); | ||||
vd = buf; | vd = buf; | ||||
for (bno = 16;; bno++) { | for (bno = 16;; bno++) { | ||||
twiddle(1); | twiddle(1); | ||||
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), | rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), | ||||
ISO_DEFAULT_BLOCK_SIZE, buf, &read); | 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); | ||||
if (rc) | if (rc) | ||||
goto out; | goto out; | ||||
if (read != ISO_DEFAULT_BLOCK_SIZE) { | if (read != ISO_DEFAULT_BLOCK_SIZE) { | ||||
rc = EIO; | rc = EIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
rc = EINVAL; | rc = EINVAL; | ||||
if (bcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0) | if (bcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0) | ||||
Show All 17 Lines | while (*path) { | ||||
off = 0; | off = 0; | ||||
boff = 0; | boff = 0; | ||||
while (off < dsize) { | while (off < dsize) { | ||||
if ((off % ISO_DEFAULT_BLOCK_SIZE) == 0) { | if ((off % ISO_DEFAULT_BLOCK_SIZE) == 0) { | ||||
twiddle(1); | twiddle(1); | ||||
rc = f->f_dev->dv_strategy | rc = f->f_dev->dv_strategy | ||||
(f->f_devdata, F_READ, | (f->f_devdata, F_READ, | ||||
cdb2devb(bno + boff), | cdb2devb(bno + boff), 0, | ||||
ISO_DEFAULT_BLOCK_SIZE, | ISO_DEFAULT_BLOCK_SIZE, | ||||
buf, &read); | buf, &read); | ||||
if (rc) | if (rc) | ||||
goto out; | goto out; | ||||
if (read != ISO_DEFAULT_BLOCK_SIZE) { | if (read != ISO_DEFAULT_BLOCK_SIZE) { | ||||
rc = EIO; | rc = EIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | cd9660_open(const char *path, struct open_file *f) | ||||
} | } | ||||
if (first) { | if (first) { | ||||
fp->f_flags |= F_ROOTDIR; | fp->f_flags |= F_ROOTDIR; | ||||
/* Check for Rock Ridge since we didn't in the loop above. */ | /* Check for Rock Ridge since we didn't in the loop above. */ | ||||
bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); | bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); | ||||
twiddle(1); | twiddle(1); | ||||
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), | rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), | ||||
ISO_DEFAULT_BLOCK_SIZE, buf, &read); | 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); | ||||
if (rc) | if (rc) | ||||
goto out; | goto out; | ||||
if (read != ISO_DEFAULT_BLOCK_SIZE) { | if (read != ISO_DEFAULT_BLOCK_SIZE) { | ||||
rc = EIO; | rc = EIO; | ||||
goto out; | goto out; | ||||
} | } | ||||
dp = (struct iso_directory_record *)buf; | dp = (struct iso_directory_record *)buf; | ||||
use_rrip = rrip_check(f, dp, &lenskip); | use_rrip = rrip_check(f, dp, &lenskip); | ||||
Show All 40 Lines | buf_read_file(struct open_file *f, char **buf_p, size_t *size_p) | ||||
blkoff = fp->f_off % ISO_DEFAULT_BLOCK_SIZE; | blkoff = fp->f_off % ISO_DEFAULT_BLOCK_SIZE; | ||||
if (blkno != fp->f_buf_blkno) { | if (blkno != fp->f_buf_blkno) { | ||||
if (fp->f_buf == (char *)0) | if (fp->f_buf == (char *)0) | ||||
fp->f_buf = malloc(ISO_DEFAULT_BLOCK_SIZE); | fp->f_buf = malloc(ISO_DEFAULT_BLOCK_SIZE); | ||||
twiddle(16); | twiddle(16); | ||||
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, | rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, | ||||
cdb2devb(blkno), ISO_DEFAULT_BLOCK_SIZE, fp->f_buf, &read); | cdb2devb(blkno), 0, ISO_DEFAULT_BLOCK_SIZE, | ||||
fp->f_buf, &read); | |||||
if (rc) | if (rc) | ||||
return (rc); | return (rc); | ||||
if (read != ISO_DEFAULT_BLOCK_SIZE) | if (read != ISO_DEFAULT_BLOCK_SIZE) | ||||
return (EIO); | return (EIO); | ||||
fp->f_buf_blkno = blkno; | fp->f_buf_blkno = blkno; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |