]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-08-06 Bean <bean123ch@gmail.com>
authorbean <bean@localhost>
Wed, 6 Aug 2008 06:17:14 +0000 (06:17 +0000)
committerbean <bean@localhost>
Wed, 6 Aug 2008 06:17:14 +0000 (06:17 +0000)
* fs/i386/pc/pxe.c (grub_pxe_data): New member block_size.
(grub_pxefs_fs_int): Remove dummy definition.
(grub_pxefs_open): Use data->block_size to store the current block
size setting.
(grub_pxefs_read): Use block size stored in data->block_size. As the
value of grub_pxe_blksize can be changed after the file is opened.

ChangeLog
fs/i386/pc/pxe.c

index e803ca3043d2fd425351568ee00b7ac279d27fe7..4f85589385cd0ac51c110230cc8b85d0acf82ff4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-08-06  Bean  <bean123ch@gmail.com>
+
+       * fs/i386/pc/pxe.c (grub_pxe_data): New member block_size.
+       (grub_pxefs_fs_int): Remove dummy definition.
+       (grub_pxefs_open): Use data->block_size to store the current block
+       size setting.
+       (grub_pxefs_read): Use block size stored in data->block_size. As the
+       value of grub_pxe_blksize can be changed after the file is opened.
+
 2008-08-06  Bean  <bean123ch@gmail.com>
 
        * fs/i386/pc/pxe.c (curr_file): new variable.
index fb69fb385b517bea21ebaff085e738305bb9eaa6..f5f215ff4c944767d793ea57aaf3d0772d35bed0 100644 (file)
@@ -44,6 +44,7 @@ static grub_file_t curr_file = 0;
 struct grub_pxe_data
 {
   grub_uint32_t packet_number;
+  grub_uint32_t block_size;
   char filename[0];
 };
 
@@ -113,8 +114,6 @@ grub_pxefs_dir (grub_device_t device __attribute((unused)),
   return GRUB_ERR_NONE;
 }
 
-static struct grub_fs grub_pxefs_fs_int;
-
 static grub_err_t
 grub_pxefs_open (struct grub_file *file, const char *name)
 {
@@ -146,6 +145,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
     return grub_errno;
 
   data->packet_number = 0;
+  data->block_size = grub_pxe_blksize;
   grub_strcpy (data->filename, name);
 
   file_int = grub_malloc (sizeof (*file_int));
@@ -159,7 +159,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
   grub_memcpy (file_int, file, sizeof (struct grub_file));
   curr_file = file_int;
 
-  bufio = grub_bufio_open (file_int, grub_pxe_blksize);
+  bufio = grub_bufio_open (file_int, data->block_size);
   if (! bufio)
     {
       grub_free (file_int);
@@ -181,7 +181,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
 
   data = file->data;
 
-  pn = grub_divmod64 (file->offset, grub_pxe_blksize, &r);
+  pn = grub_divmod64 (file->offset, data->block_size, &r);
   if (r)
     return grub_error (GRUB_ERR_BAD_FS,
                        "read access must be aligned to packet size");
@@ -196,7 +196,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
       o.gateway_ip = grub_pxe_gateway_ip;
       grub_strcpy (o.filename, data->filename);
       o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
-      o.packet_size = grub_pxe_blksize;
+      o.packet_size = data->block_size;
       grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o);
       if (o.status)
         return grub_error (GRUB_ERR_BAD_FS, "open fails");