fix cd9660 to work on files larger than ISO_DEFAULT_BLOCK_SIZE and unbreak

cdboot on alphas (which has been broken since just after 4.0-RELEASE)

submitted by: jlemon
This commit is contained in:
Andrew Gallatin 2001-04-07 23:48:46 +00:00
parent 6d0b13c1ba
commit 481184b805
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75298

View File

@ -262,11 +262,12 @@ buf_read_file(f, buf_p, size_p)
size_t *size_p;
{
struct file *fp = (struct file *)f->f_fsdata;
daddr_t blkno;
daddr_t blkno, blkoff;
int rc = 0;
size_t read;
blkno = fp->f_off / ISO_DEFAULT_BLOCK_SIZE + fp->f_bno;
blkoff = fp->f_off % ISO_DEFAULT_BLOCK_SIZE;
if (blkno != fp->f_buf_blkno) {
if (fp->f_buf == (char *)0)
@ -283,8 +284,8 @@ buf_read_file(f, buf_p, size_p)
fp->f_buf_blkno = blkno;
}
*buf_p = fp->f_buf + fp->f_off;
*size_p = ISO_DEFAULT_BLOCK_SIZE - fp->f_off;
*buf_p = fp->f_buf + blkoff;
*size_p = ISO_DEFAULT_BLOCK_SIZE - blkoff;
if (*size_p > fp->f_size - fp->f_off)
*size_p = fp->f_size - fp->f_off;