]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Merge mainline into net
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 2 Sep 2010 15:18:21 +0000 (17:18 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 2 Sep 2010 15:18:21 +0000 (17:18 +0200)
1  2 
grub-core/fs/i386/pc/pxe.c

index 20d0e1979e2b4bfec2bb779fcf99fc7cc02d191a,ee8c55416e5a08b47506cafc47b9b3db4c8e7b56..eac3bf770c37e8db4816fee600434af8855823b2
  #define SEGMENT(x)    ((x) >> 4)
  #define OFFSET(x)     ((x) & 0xF)
  #define SEGOFS(x)     ((SEGMENT(x) << 16) + OFFSET(x))
 -#define LINEAR(x)     (void *) (((x >> 16) <<4) + (x & 0xFFFF))
 -
 -struct grub_pxe_disk_data
 -{
 -  grub_uint32_t server_ip;
 -  grub_uint32_t gateway_ip;
 -};
 +#define LINEAR(x)     (void *) (((x >> 16) << 4) + (x & 0xFFFF))
  
- struct grub_pxenv *grub_pxe_pxenv;
+ struct grub_pxe_bangpxe *grub_pxe_pxenv;
  static grub_uint32_t grub_pxe_your_ip;
  static grub_uint32_t grub_pxe_default_server_ip;
  static grub_uint32_t grub_pxe_default_gateway_ip;
@@@ -70,34 -76,64 +71,39 @@@ grub_pxe_scan (void
  
    if ((regs.eax & 0xffff) != 0x564e)
      return NULL;
-   ret = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff));
-   if (grub_memcmp (ret->signature, GRUB_PXE_SIGNATURE, sizeof (ret->signature))
+   pxenv = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff));
+   if (grub_memcmp (pxenv->signature, GRUB_PXE_SIGNATURE,
+                  sizeof (pxenv->signature))
        != 0)
      return NULL;
-   if (ret->version < 0x201)
+   if (pxenv->version < 0x201)
      return NULL;
  
-   pxe = (void *) ((((ret->pxe_ptr & 0xffff0000) >> 16) << 4)
-                 + (ret->pxe_ptr & 0xffff));
-   if (!pxe)
+   bangpxe = (void *) ((((pxenv->pxe_ptr & 0xffff0000) >> 16) << 4)
+                     + (pxenv->pxe_ptr & 0xffff));
+   if (!bangpxe)
      return NULL;
  
-   /* !PXE  */
-   if (*(grub_uint32_t *) pxe !=       0x45585021)
+   if (grub_memcmp (bangpxe->signature, GRUB_PXE_BANGPXE_SIGNATURE,
+                  sizeof (bangpxe->signature)) != 0)
      return NULL;
  
-   pxe_rm_entry = ret->rm_entry;
-   return ret;
+   pxe_rm_entry = bangpxe->rm_entry;
+   return bangpxe;
  }
  
 -static int
 -grub_pxe_iterate (int (*hook) (const char *name))
 -{
 -  if (hook ("pxe"))
 -    return 1;
 -  return 0;
 -}
 -
  static grub_err_t
 -parse_ip (const char *val, grub_uint32_t *ip, const char **rest)
 +grub_pxefs_dir (grub_device_t device  __attribute__ ((unused)),
 +              const char *path  __attribute__ ((unused)),
 +              int (*hook) (const char *filename,
 +                           const struct grub_dirhook_info *info)
 +              __attribute__ ((unused)))
  {
 -  grub_uint32_t newip = 0;
 -  unsigned long t;
 -  int i;
 -  const char *ptr = val;
 -
 -  for (i = 0; i < 4; i++)
 -    {
 -      t = grub_strtoul (ptr, (char **) &ptr, 0);
 -      if (grub_errno)
 -      return grub_errno;
 -      if (t & ~0xff)
 -      return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
 -      newip >>= 8;
 -      newip |= (t << 24);
 -      if (i != 3 && *ptr != '.')
 -      return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
 -      ptr++;
 -    }
 -  *ip = newip;
 -  if (rest)
 -    *rest = ptr - 1;
 -  return 0;
 +  return GRUB_ERR_NONE;
  }
  
  static grub_err_t