]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/grub-0.97/grub-0.97-misc.patch
HinzugefĆ¼gt:
[ipfire-2.x.git] / src / patches / grub-0.97 / grub-0.97-misc.patch
1 diff -Nur grub-0.97-ori/lib/device.c grub-0.97-misc/lib/device.c
2 --- grub-0.97-ori/lib/device.c 2005-03-28 02:14:25.000000000 +0300
3 +++ grub-0.97-misc/lib/device.c 2005-08-21 20:22:30.000000000 +0300
4 @@ -831,9 +831,11 @@
5 is_disk_device (char **map, int drive)
6 {
7 struct stat st;
8 + int retval;
9
10 assert (map[drive] != 0);
11 - assert (stat (map[drive], &st) == 0);
12 + retval = stat (map[drive], &st);
13 + assert (retval == 0);
14 /* For now, disk devices under Linux are all block devices. */
15 return S_ISBLK (st.st_mode);
16 }
17 diff -Nur grub-0.97-ori/stage2/boot.c grub-0.97-misc/stage2/boot.c
18 --- grub-0.97-ori/stage2/boot.c 2004-03-30 14:44:08.000000000 +0300
19 +++ grub-0.97-misc/stage2/boot.c 2005-08-21 20:22:30.000000000 +0300
20 @@ -824,8 +824,11 @@
21 moveto = (mbi.mem_upper + 0x400) << 10;
22
23 moveto = (moveto - len) & 0xfffff000;
24 - max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
25 - ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
26 + max_addr = LINUX_INITRD_MAX_ADDRESS;
27 + if (lh->header == LINUX_MAGIC_SIGNATURE &&
28 + lh->version >= 0x0203 &&
29 + lh->initrd_addr_max < max_addr)
30 + max_addr = lh->initrd_addr_max;
31 if (moveto + len >= max_addr)
32 moveto = (max_addr - len) & 0xfffff000;
33
34 diff -Nur grub-0.97-ori/stage2/builtins.c grub-0.97-misc/stage2/builtins.c
35 --- grub-0.97-ori/stage2/builtins.c 2005-02-15 23:58:23.000000000 +0200
36 +++ grub-0.97-misc/stage2/builtins.c 2005-08-21 20:22:30.000000000 +0300
37 @@ -1842,9 +1842,23 @@
38 #ifdef GRUB_UTIL
39 else if (grub_memcmp ("--stage2=", arg, sizeof ("--stage2=") - 1) == 0)
40 {
41 + int fd;
42 stage2_os_file = arg + sizeof ("--stage2=") - 1;
43 arg = skip_to (0, arg);
44 nul_terminate (stage2_os_file);
45 +
46 +#if defined(__linux__) && defined (FSYS_REISERFS)
47 + if ((fd=open(stage2_os_file, O_RDONLY)) >= 0)
48 + {
49 + struct statfs buf;
50 + /* see if the file sits on a reiserfs,
51 + and try do defragment it if so. */
52 + fstatfs(fd, &buf);
53 + if (buf.f_type == REISERFS_SUPER_MAGIC)
54 + ioctl (fd, REISERFS_IOC_UNPACK, 1);
55 + }
56 +#endif /* __linux__ && FSYS_REISERFS */
57 +
58 }
59 #endif /* GRUB_UTIL */
60 else
61 diff -Nur grub-0.97-ori/stage2/filesys.h grub-0.97-misc/stage2/filesys.h
62 --- grub-0.97-ori/stage2/filesys.h 2004-05-14 22:36:43.000000000 +0300
63 +++ grub-0.97-misc/stage2/filesys.h 2005-08-21 20:22:30.000000000 +0300
64 @@ -73,6 +73,16 @@
65 int reiserfs_read (char *buf, int len);
66 int reiserfs_dir (char *dirname);
67 int reiserfs_embed (int *start_sector, int needed_sectors);
68 +#if defined(__linux__) && defined (GRUB_UTIL)
69 +#include <sys/types.h>
70 +#include <sys/stat.h>
71 +#include <sys/ioctl.h>
72 +#include <sys/statfs.h>
73 +#include <fcntl.h>
74 +/* from <linux/reiserfs_fs.h> */
75 +#define REISERFS_SUPER_MAGIC 0x52654973
76 +#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
77 +#endif
78 #else
79 #define FSYS_REISERFS_NUM 0
80 #endif
81 diff -Nur grub-0.97-ori/util/mbchk.c grub-0.97-misc/util/mbchk.c
82 --- grub-0.97-ori/util/mbchk.c 2003-10-19 18:36:45.000000000 +0300
83 +++ grub-0.97-misc/util/mbchk.c 2005-08-21 20:22:30.000000000 +0300
84 @@ -59,7 +59,9 @@
85 int i;
86 char buf[8192];
87
88 - if (fread (buf, 1, 8192, fp) < 0)
89 + fread (buf, 1, 8192, fp);
90 +
91 + if (ferror(fp))
92 {
93 fprintf (stderr, "%s: Read error.\n", filename);
94 return 0;