]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2004-05-23 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Sun, 23 May 2004 16:45:45 +0000 (16:45 +0000)
committerokuji <okuji@localhost>
Sun, 23 May 2004 16:45:45 +0000 (16:45 +0000)
* stage2/char_io.c (grub_isspace): Use a switch sentense instead
of an if sentense, because that reduces the size.

* lib/device.c (read_device_map): Change the max number of DRIVE
to 127 from 8. This was too strict.

* stage2/asm.S (stop_floppy): Call pusha and popa outside the
block of real mode code. Reported by Guillem Jover
<guillem@debian.org>.

ChangeLog
grub/Makefile.in
lib/device.c
lib/device.h
stage2/asm.S
stage2/char_io.c
stage2/disk_io.c

index c42bd08a9c6f16dca99fec8e28cfd6ae9644112b..8e05224d196bf4edc33193c3e73f90ccffa4c1cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-05-23  Yoshinori K. Okuji  <okuji@enbug.org>
+
+       * stage2/char_io.c (grub_isspace): Use a switch sentense instead
+       of an if sentense, because that reduces the size.
+
+       * lib/device.c (read_device_map): Change the max number of DRIVE
+       to 127 from 8. This was too strict.
+
+       * stage2/asm.S (stop_floppy): Call pusha and popa outside the
+       block of real mode code. Reported by Guillem Jover
+       <guillem@debian.org>.
+
 2004-05-20  Damian Ivereigh  <damian@cisco.com>
 
        * netboot/main.c: Fixed bootp only code so that options
index 6f611a64277e7fd9b103f6faee608d1c461583f8..ed348746ffd0122485ee152005d0c1f0cfd33eef 100644 (file)
@@ -142,13 +142,14 @@ sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 sbin_PROGRAMS = grub
-@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 
 
 @SERIAL_SPEED_SIMULATION_TRUE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 -DSIMULATE_SLOWNESS_OF_SERIAL=1
+@SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 
 
-AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
-       -DFSYS_UFS2=1 \
-       -DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \
+AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
+       -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
+       -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+       -DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
        $(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \
        -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
 
index b9cc28ad234f590b5b78aaf3b2f8b1496868011f..4a49001ce8beb4d79645aa7a29cd86dbe7b986b4 100644 (file)
@@ -558,7 +558,7 @@ read_device_map (FILE *fp, char **map, const char *map_file)
          show_error (line_number, "Bad device number");
          return 0;
        }
-      else if (drive > 8)
+      else if (drive > 127)
        {
          show_warning (line_number,
                        "Ignoring %cd%d due to a BIOS limitation",
@@ -821,9 +821,20 @@ restore_device_map (char **map)
 }
 
 #ifdef __linux__
-/* Linux-only function, because Linux has a bug that the disk cache for
+/* Linux-only functions, because Linux has a bug that the disk cache for
    a whole disk is not consistent with the one for a partition of the
    disk.  */
+int
+is_disk_device (char **map, int drive)
+{
+  struct stat st;
+  
+  assert (map[drive] != 0);
+  assert (stat (map[drive], &st) == 0);
+  /* For now, disk devices under Linux are all block devices.  */
+  return S_ISBLK (st.st_mode);
+}
+
 int
 write_to_partition (char **map, int drive, int partition,
                    int sector, int size, const char *buf)
index e616e4bdfdade01edec1f175d210807a8807a199..02ffce8e8b3d96658bac91379dba398c61b80a2d 100644 (file)
@@ -1,7 +1,7 @@
 /* device.h - Define macros and declare prototypes for device.c */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999, 2000  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2004  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@ extern int init_device_map (char ***map, const char *map_file,
 extern void restore_device_map (char **map);
 
 #ifdef __linux__
+extern int is_disk_device (char **map, int drive);
 extern int write_to_partition (char **map, int drive, int partition,
                               int offset, int size, const char *buf);
 #endif /* __linux__ */
index 2dd07088e928c719d44c1a41eda78e5635347fe2..b4db6d58cc688c7fac4447e4c548b78f1d1d1e87 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -211,14 +211,14 @@ ENTRY(hard_stop)
  * jumped to with a known state.
  */
 ENTRY(stop_floppy)
+       pusha
        call    EXT_C(prot_to_real)
        .code16
-       pusha
        xorb    %dl, %dl
        int     $0x13
-       popa
        DATA32  call EXT_C(real_to_prot)
        .code32
+       popa
        ret
 
 /*
index 3ff110bbcc9625493e42a9c9b1af0a218f20dfde..d2960238f61485b62ac28991594e3b314645e476 100644 (file)
@@ -912,8 +912,16 @@ grub_tolower (int c)
 int
 grub_isspace (int c)
 {
-  if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
-    return 1;
+  switch (c)
+    {
+    case ' ':
+    case '\t':
+    case '\r':
+    case '\n':
+      return 1;
+    default:
+      break;
+    }
 
   return 0;
 }
index 9b63d243e3a5c48e30f41a3daa600876628ea1f6..b9bc5264376d05078b1993e8c0e42a06d6317907 100644 (file)
@@ -366,7 +366,8 @@ int
 devwrite (int sector, int sector_count, char *buf)
 {
 #if defined(GRUB_UTIL) && defined(__linux__)
-  if (current_partition != 0xFFFFFF)
+  if (current_partition != 0xFFFFFF
+      && is_disk_device (device_map, current_drive))
     {
       /* If the grub shell is running under Linux and the user wants to
         embed a Stage 1.5 into a partition instead of a MBR, use system