2008-08-06 Bean <bean123ch@gmail.com>
* fs/i386/pc/pxe.c (curr_file): new variable. (grub_pxefs_open): Simply the handling of pxe file system. Don't require the dummy internal file system anymore. (grub_pxefs_read): Removed. (grub_pxefs_close): Likewise. (grub_pxefs_fs_int): Likewise. (grub_pxefs_read_int): Renamed to grub_pxefs_read. Reinitialize tftp connection when we switch file. (grub_pxefs_close_int): Renamed to grub_pxefs_close.
This commit is contained in:
parent
a55d42e0e0
commit
9f0234cb9a
2 changed files with 22 additions and 36 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2008-08-06 Bean <bean123ch@gmail.com>
|
||||
|
||||
* fs/i386/pc/pxe.c (curr_file): new variable.
|
||||
(grub_pxefs_open): Simply the handling of pxe file system. Don't
|
||||
require the dummy internal file system anymore.
|
||||
(grub_pxefs_read): Removed.
|
||||
(grub_pxefs_close): Likewise.
|
||||
(grub_pxefs_fs_int): Likewise.
|
||||
(grub_pxefs_read_int): Renamed to grub_pxefs_read. Reinitialize tftp
|
||||
connection when we switch file.
|
||||
(grub_pxefs_close_int): Renamed to grub_pxefs_close.
|
||||
|
||||
2008-08-06 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* conf/i386-coreboot.rmk (pkglib_MODULES): Add `reboot.mod' and
|
||||
|
@ -63,7 +75,7 @@
|
|||
|
||||
* commands/i386/pc/pxecmd.c: New file.
|
||||
|
||||
* disk/i386/pc/pxe.c: Likewise.
|
||||
* fs/i386/pc/pxe.c: Likewise.
|
||||
|
||||
* include/grub/i386/pc/pxe.h: Likewise.
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ grub_uint32_t grub_pxe_server_ip;
|
|||
grub_uint32_t grub_pxe_gateway_ip;
|
||||
int grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
|
||||
|
||||
static grub_file_t curr_file = 0;
|
||||
|
||||
struct grub_pxe_data
|
||||
{
|
||||
grub_uint32_t packet_number;
|
||||
|
@ -153,12 +155,9 @@ grub_pxefs_open (struct grub_file *file, const char *name)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
file_int->data = data;
|
||||
file_int->offset = 0;
|
||||
file_int->device = 0;
|
||||
file_int->size = file->size;
|
||||
file_int->read_hook = 0;
|
||||
file_int->fs = &grub_pxefs_fs_int;
|
||||
file->data = data;
|
||||
grub_memcpy (file_int, file, sizeof (struct grub_file));
|
||||
curr_file = file_int;
|
||||
|
||||
bufio = grub_bufio_open (file_int, grub_pxe_blksize);
|
||||
if (! bufio)
|
||||
|
@ -168,32 +167,13 @@ grub_pxefs_open (struct grub_file *file, const char *name)
|
|||
return grub_errno;
|
||||
}
|
||||
|
||||
file->data = bufio;
|
||||
grub_memcpy (file, bufio, sizeof (struct grub_file));
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
{
|
||||
grub_file_t bufio;
|
||||
|
||||
bufio = file->data;
|
||||
bufio->offset = file->offset;
|
||||
|
||||
return bufio->fs->read (bufio, buf, len);
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_pxefs_close (grub_file_t file)
|
||||
{
|
||||
grub_file_close ((grub_file_t) file->data);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_pxefs_read_int (grub_file_t file, char *buf, grub_size_t len)
|
||||
{
|
||||
struct grub_pxenv_tftp_read c;
|
||||
struct grub_pxe_data *data;
|
||||
|
@ -206,7 +186,7 @@ grub_pxefs_read_int (grub_file_t file, char *buf, grub_size_t len)
|
|||
return grub_error (GRUB_ERR_BAD_FS,
|
||||
"read access must be aligned to packet size");
|
||||
|
||||
if (data->packet_number > pn)
|
||||
if ((curr_file != file) || (data->packet_number > pn))
|
||||
{
|
||||
struct grub_pxenv_tftp_open o;
|
||||
|
||||
|
@ -221,6 +201,7 @@ grub_pxefs_read_int (grub_file_t file, char *buf, grub_size_t len)
|
|||
if (o.status)
|
||||
return grub_error (GRUB_ERR_BAD_FS, "open fails");
|
||||
data->packet_number = 0;
|
||||
curr_file = file;
|
||||
}
|
||||
|
||||
c.buffer = SEGOFS (GRUB_MEMORY_MACHINE_SCRATCH_ADDR);
|
||||
|
@ -242,7 +223,7 @@ grub_pxefs_read_int (grub_file_t file, char *buf, grub_size_t len)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_pxefs_close_int (grub_file_t file)
|
||||
grub_pxefs_close (grub_file_t file)
|
||||
{
|
||||
struct grub_pxenv_tftp_close c;
|
||||
|
||||
|
@ -271,13 +252,6 @@ static struct grub_fs grub_pxefs_fs =
|
|||
.next = 0
|
||||
};
|
||||
|
||||
static struct grub_fs grub_pxefs_fs_int =
|
||||
{
|
||||
.name = "pxefs",
|
||||
.read = grub_pxefs_read_int,
|
||||
.close = grub_pxefs_close_int,
|
||||
};
|
||||
|
||||
static void
|
||||
grub_pxe_detect (void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue