1 diff -ur -x .svn ./grub2-1919/fs/affs.c ./grub2/fs/affs.c
2 --- ./grub2-1919/fs/affs.c 2008-11-20 16:40:19.000000000 +0100
3 +++ ./grub2/fs/affs.c 2008-11-20 19:16:38.000000000 +0100
6 #include <grub/types.h>
7 #include <grub/fshelp.h>
9 +#include <grub/partition.h>
12 /* The affs bootblock. */
13 struct grub_affs_bblock
15 rblock = (struct grub_affs_rblock *) rootblock;
17 /* Read the rootblock. */
19 + grub_uint64_t reservedblocks = 2;
20 + grub_uint64_t countblocks;
21 + if (disk->partition)
22 + countblocks = disk->partition->len;
24 + countblocks = disk->total_sectors;
26 + grub_disk_addr_t rblknum = (countblocks - 1 + reservedblocks) / 2;
28 + grub_disk_read (disk, rblknum, 0,
29 + GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
31 grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0,
32 GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
39 data->htsize = grub_be_to_cpu32 (rblock->htsize);
40 data->diropen.data = data;
42 + data->diropen.block = rblknum;
44 data->diropen.block = (disk->total_sectors >> 1);
47 grub_free (rootblock);
52 grub_free (hashtable);
58 diff -ur -x .svn ./grub2-1919/fs/sfs.c ./grub2/fs/sfs.c
59 --- ./grub2-1919/fs/sfs.c 2008-11-20 16:40:19.000000000 +0100
60 +++ ./grub2/fs/sfs.c 2008-11-20 19:21:53.000000000 +0100
65 - for (i = 0; i < grub_be_to_cpu16 (tree->nodes); i++)
66 + grub_uint16_t nodescount = grub_be_to_cpu16(tree->nodes);
67 + for (i = nodescount - 1; i >= 0; i--)
70 #define EXTNODE(tree, index) \
72 + (index) * (tree)->nodesize))
74 /* Follow the tree down to the leaf level. */
75 - if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) >= block)
76 + if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) <= block)
79 - next = grub_be_to_cpu32 (EXTNODE (tree, i - 1)->data);
83 - /* In case the last node is reached just use that one, it is
85 - if (i + 1 == grub_be_to_cpu16 (tree->nodes) && !tree->leaf)
87 next = grub_be_to_cpu32 (EXTNODE (tree, i)->data);
93 grub_free (objc_data);
99 diff -ur -x .svn ./grub2-1919/include/grub/pc_partition.h ./grub2/include/grub/pc_partition.h
100 --- ./grub2-1919/include/grub/pc_partition.h 2008-11-20 16:40:22.000000000 +0100
101 +++ ./grub2/include/grub/pc_partition.h 2008-11-20 18:41:04.000000000 +0100
103 || type == GRUB_PC_PARTITION_TYPE_NETBSD);
107 +grub_pc_partition_is_rdb(int type)
109 + return (type == 0x30 || type == 0x76);
112 #endif /* ! GRUB_PC_PARTITION_HEADER */
113 diff -ur -x .svn ./grub2-1919/loader/i386/pc/multiboot.c ./grub2/loader/i386/pc/multiboot.c
114 --- ./grub2-1919/loader/i386/pc/multiboot.c 2008-11-20 16:40:28.000000000 +0100
115 +++ ./grub2/loader/i386/pc/multiboot.c 2008-11-20 19:48:44.000000000 +0100
117 return grub_error (GRUB_ERR_BAD_OS,
118 "invalid offset in program header");
120 - if (grub_file_read (file, load_this_module_at, phdr(i)->p_filesz)
121 - != (grub_ssize_t) phdr(i)->p_filesz)
122 + if ((phdr(i)->p_filesz > 0) && (grub_file_read (file, load_this_module_at, phdr(i)->p_filesz)
123 + != (grub_ssize_t) phdr(i)->p_filesz))
124 return grub_error (GRUB_ERR_BAD_OS,
125 "couldn't read segment from file");
128 return grub_error (GRUB_ERR_BAD_OS,
129 "invalid offset in program header");
131 - if (grub_file_read (file, (void *) ((grub_uint32_t) phdr(i)->p_paddr),
132 + if ((phdr(i)->p_filesz > 0) && (grub_file_read (file, (void *) ((grub_uint32_t) phdr(i)->p_paddr),
134 - != (grub_ssize_t) phdr(i)->p_filesz)
135 + != (grub_ssize_t) phdr(i)->p_filesz))
136 return grub_error (GRUB_ERR_BAD_OS,
137 "couldn't read segment from file");
139 diff -ur -x .svn ./grub2-1919/partmap/amiga.c ./grub2/partmap/amiga.c
140 --- ./grub2-1919/partmap/amiga.c 2008-11-20 16:40:26.000000000 +0100
141 +++ ./grub2/partmap/amiga.c 2008-11-20 18:44:40.000000000 +0100
144 /* Enforce raw disk access. */
151 /* The RDSK block is one of the first 15 blocks. */
152 for (pos = 0; pos < 15; pos++)
155 GRUB_MOD_INIT(amiga_partition_map)
158 + extern struct grub_partition_map *grub_rdb_partition_map;
159 + grub_rdb_partition_map = &grub_amiga_partition_map;
161 grub_partition_map_register (&grub_amiga_partition_map);
164 diff -ur -x .svn ./grub2-1919/partmap/pc.c ./grub2/partmap/pc.c
165 --- ./grub2-1919/partmap/pc.c 2008-11-20 16:40:26.000000000 +0100
166 +++ ./grub2/partmap/pc.c 2008-11-20 18:54:46.000000000 +0100
168 #include <grub/misc.h>
171 +/* RDB partition tables for AROS */
172 +struct grub_partition_map *grub_rdb_partition_map = NULL;
174 static struct grub_partition_map grub_pc_partition_map;
181 - if (hook (disk, &p))
185 + /* Check if this is a RDB partition table. */
186 + if (grub_rdb_partition_map && grub_pc_partition_is_rdb(e->type))
188 + struct grub_partition p2;
189 + struct grub_disk raw2;
192 + auto int rdb_hook(grub_disk_t disk, const grub_partition_t p);
194 + int rdb_hook(grub_disk_t disk __attribute__((unused)),
195 + const grub_partition_t part)
198 + pcdata.bsd_part = part->index;
200 + p2.start += p.start;
201 + p2.offset += p.offset;
203 + p2.partmap = &grub_pc_partition_map;
205 + grub_dprintf("partition", "RDB part %c start=%ld\n",
206 + (char)('a' + part->index), (long)p2.start);
208 + ok = hook(disk, &p2);
213 + raw2.partition = &p;
215 + grub_rdb_partition_map->iterate(&raw2, rdb_hook);
220 + if (hook (disk, &p))
223 /* Check if this is a BSD partition. */
224 if (grub_pc_partition_is_bsd (e->type))
225 diff -ur -x .svn ./grub2-1919/util/grub-fstest.c ./grub2/util/grub-fstest.c
226 --- ./grub2-1919/util/grub-fstest.c 2008-11-20 16:40:31.000000000 +0100
227 +++ ./grub2/util/grub-fstest.c 2008-11-20 18:10:15.000000000 +0100
234 grub_term_get_current_input (void)
241 grub_term_get_current_output (void)