commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[1782] 2008-08-06 Bean <address@hidden>


From: Bean
Subject: [1782] 2008-08-06 Bean <address@hidden>
Date: Wed, 06 Aug 2008 04:05:14 +0000

Revision: 1782
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1782
Author:   bean
Date:     2008-08-06 04:05:12 +0000 (Wed, 06 Aug 2008)

Log Message:
-----------
2008-08-06  Bean  <address@hidden>

        * 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.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/fs/i386/pc/pxe.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2008-08-06 00:20:04 UTC (rev 1781)
+++ trunk/grub2/ChangeLog       2008-08-06 04:05:12 UTC (rev 1782)
@@ -1,3 +1,15 @@
+2008-08-06  Bean  <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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.
 

Modified: trunk/grub2/fs/i386/pc/pxe.c
===================================================================
--- trunk/grub2/fs/i386/pc/pxe.c        2008-08-06 00:20:04 UTC (rev 1781)
+++ trunk/grub2/fs/i386/pc/pxe.c        2008-08-06 04:05:12 UTC (rev 1782)
@@ -39,6 +39,8 @@
 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 @@
       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,7 +167,7 @@
       return grub_errno;
     }
 
-  file->data = bufio;
+  grub_memcpy (file, bufio, sizeof (struct grub_file));
 
   return GRUB_ERR_NONE;
 }
@@ -176,25 +175,6 @@
 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;
   grub_uint32_t pn, r;
@@ -206,7 +186,7 @@
     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 @@
       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 @@
 }
 
 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 @@
     .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)
 {






reply via email to

[Prev in Thread] Current Thread [Next in Thread]