mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-25 08:39:28 +00:00
fix and improve tftp_read.
This commit is contained in:
1 parent
b9ff0c2f81
commit
ab6cc80541
2 files changed
+19
-9
No files matched your search
@@ -1,3 +1,14 @@
|
||||
2000-02-25 OKUJI Yoshinori <okuji@gnu.org>
|
||||
|
||||
* netboot/fsys_tftp.c (tftp_read): Set BUF_READ to zero if
|
||||
FILEPOS is less than SAVED_FILEPOS, before calling buf_fill.
|
||||
Don't discard all of the copied data so that we can move FILEPOS
|
||||
backwards cheaply. Now SAVED_FILEPOS indicates the file position
|
||||
corresponding to the first byte of BUF. If (FILEPOS -
|
||||
SAVED_FILEPOS) is greater than (FSYS_BUFLEN / 2), move the data
|
||||
forwards and add (FSYS_BUFLEN / 2) into SAVED_FILEPOS and
|
||||
subtract the same value from BUF_READ.
|
||||
|
||||
2000-02-24 OKUJI Yoshinori <okuji@gnu.org>
|
||||
|
||||
* stage2/disk_io.c [!STAGE1_5] (print_fsys_type): Mask
|
||||
|
||||
+8
-9
@@ -290,6 +290,7 @@ tftp_read (char *addr, int size)
|
||||
if (filepos < saved_filepos)
|
||||
{
|
||||
/* Uggh.. FILEPOS has been moved backwards. So reopen the file. */
|
||||
buf_read = 0;
|
||||
buf_fill (1);
|
||||
grub_memmove ((char *) &tp, (char *) &saved_tp, saved_len);
|
||||
len = saved_len;
|
||||
@@ -331,18 +332,16 @@ tftp_read (char *addr, int size)
|
||||
size -= amt;
|
||||
addr += amt;
|
||||
filepos += amt;
|
||||
saved_filepos = filepos;
|
||||
ret += amt;
|
||||
|
||||
/* Move the unused data forwards. */
|
||||
grub_memmove (buf, buf + amt, buf_read - amt);
|
||||
buf_read -= amt;
|
||||
}
|
||||
else
|
||||
|
||||
/* If the size of the empty space becomes small, move the unused
|
||||
data forwards. */
|
||||
if (filepos - saved_filepos > FSYS_BUFLEN / 2)
|
||||
{
|
||||
/* Reset the reading offset. */
|
||||
saved_filepos += buf_read;
|
||||
buf_read = 0;
|
||||
grub_memmove (buf, buf + FSYS_BUFLEN / 2, FSYS_BUFLEN / 2);
|
||||
buf_read -= FSYS_BUFLEN / 2;
|
||||
saved_filepos += FSYS_BUFLEN / 2;
|
||||
}
|
||||
|
||||
/* Read the data. */
|
||||
|
||||
Reference in new issue
Block a user