mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 06:12:46 +00:00
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:
parent
6d0b13c1ba
commit
481184b805
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75298
@ -262,11 +262,12 @@ buf_read_file(f, buf_p, size_p)
|
|||||||
size_t *size_p;
|
size_t *size_p;
|
||||||
{
|
{
|
||||||
struct file *fp = (struct file *)f->f_fsdata;
|
struct file *fp = (struct file *)f->f_fsdata;
|
||||||
daddr_t blkno;
|
daddr_t blkno, blkoff;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
size_t read;
|
size_t read;
|
||||||
|
|
||||||
blkno = fp->f_off / ISO_DEFAULT_BLOCK_SIZE + fp->f_bno;
|
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 (blkno != fp->f_buf_blkno) {
|
||||||
if (fp->f_buf == (char *)0)
|
if (fp->f_buf == (char *)0)
|
||||||
@ -283,8 +284,8 @@ buf_read_file(f, buf_p, size_p)
|
|||||||
fp->f_buf_blkno = blkno;
|
fp->f_buf_blkno = blkno;
|
||||||
}
|
}
|
||||||
|
|
||||||
*buf_p = fp->f_buf + fp->f_off;
|
*buf_p = fp->f_buf + blkoff;
|
||||||
*size_p = ISO_DEFAULT_BLOCK_SIZE - fp->f_off;
|
*size_p = ISO_DEFAULT_BLOCK_SIZE - blkoff;
|
||||||
|
|
||||||
if (*size_p > fp->f_size - fp->f_off)
|
if (*size_p > fp->f_size - fp->f_off)
|
||||||
*size_p = fp->f_size - fp->f_off;
|
*size_p = fp->f_size - fp->f_off;
|
||||||
|
Loading…
Reference in New Issue
Block a user