2009-11-14 Vladimir Serbinenko <phcoder@gmail.com>

* fs/i386/pc/pxe.c (grub_pxefs_open): Correctly handle PXE choosing
	blocksize different from specified.
	(grub_pxefs_read): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-14 22:08:07 +01:00
parent 2e035eb9ba
commit 6621b0e706
2 changed files with 10 additions and 3 deletions

6
ChangeLog.pxefix Normal file
View file

@ -0,0 +1,6 @@
2009-11-14 Vladimir Serbinenko <phcoder@gmail.com>
* fs/i386/pc/pxe.c (grub_pxefs_open): Correctly handle PXE choosing
blocksize different from specified.
(grub_pxefs_read): Likewise.

View file

@ -150,7 +150,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
if (! data) if (! data)
return grub_errno; return grub_errno;
data->block_size = grub_pxe_blksize; data->block_size = c.c2.packet_size;
grub_strcpy (data->filename, name); grub_strcpy (data->filename, name);
file_int = grub_malloc (sizeof (*file_int)); file_int = grub_malloc (sizeof (*file_int));
@ -205,13 +205,14 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
o.gateway_ip = grub_pxe_gateway_ip; o.gateway_ip = grub_pxe_gateway_ip;
grub_strcpy ((char *)&o.filename[0], data->filename); grub_strcpy ((char *)&o.filename[0], data->filename);
o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT); o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
o.packet_size = data->block_size; o.packet_size = grub_pxe_blksize;
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o); grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o);
if (o.status) if (o.status)
{ {
grub_error (GRUB_ERR_BAD_FS, "open fails"); grub_error (GRUB_ERR_BAD_FS, "open fails");
return -1; return -1;
} }
data->block_size = o.packet_size;
data->packet_number = 0; data->packet_number = 0;
curr_file = file; curr_file = file;
} }
@ -219,7 +220,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
c.buffer = SEGOFS (GRUB_MEMORY_MACHINE_SCRATCH_ADDR); c.buffer = SEGOFS (GRUB_MEMORY_MACHINE_SCRATCH_ADDR);
while (pn >= data->packet_number) while (pn >= data->packet_number)
{ {
c.buffer_size = grub_pxe_blksize; c.buffer_size = data->block_size;
grub_pxe_call (GRUB_PXENV_TFTP_READ, &c); grub_pxe_call (GRUB_PXENV_TFTP_READ, &c);
if (c.status) if (c.status)
{ {