mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-28 18:19:23 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d83b08e9c |
No files matched your search
@@ -1,30 +1,3 @@
|
||||
2013-10-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Move grub_disk_write out of kernel into disk.mod.
|
||||
|
||||
2013-10-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/misc.c (grub_vsnprintf_real): Unify int and wchar
|
||||
handling.
|
||||
|
||||
2013-10-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/misc.c (grub_abort): Make static
|
||||
|
||||
2013-10-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/misc.c (grub_vsnprintf_real): Don't attempt to
|
||||
transform invalid unicode codepoints.
|
||||
|
||||
2013-10-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/misc.c (grub_vsnprintf_real): Remove needless explicit
|
||||
\0 checking.
|
||||
|
||||
2013-10-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/lib/legacy_parse.c: Add support for "nd" disk.
|
||||
|
||||
2013-10-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Consolidate cpuid code.
|
||||
@@ -601,6 +574,11 @@
|
||||
currently used so this doesn't really have any effect.
|
||||
Reported by: Douglas Ray <dougray>
|
||||
|
||||
2013-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-mkstandalone.in: Remove needless copying since we already
|
||||
pass the files to tar.
|
||||
|
||||
2013-10-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* autogen.sh: Don't set LC_CTYPE as it doesn't create problem for
|
||||
|
||||
+1
-1
@@ -9,7 +9,6 @@ library = {
|
||||
common = grub-core/kern/command.c;
|
||||
common = grub-core/kern/device.c;
|
||||
common = grub-core/kern/disk.c;
|
||||
common = grub-core/lib/disk.c;
|
||||
common = util/getroot.c;
|
||||
common = grub-core/osdep/unix/getroot.c;
|
||||
common = grub-core/osdep/getroot.c;
|
||||
@@ -147,6 +146,7 @@ library = {
|
||||
common = grub-core/partmap/sunpc.c;
|
||||
common = grub-core/partmap/bsdlabel.c;
|
||||
common = grub-core/partmap/dfly.c;
|
||||
common = grub-core/partmap/dasd.c;
|
||||
common = grub-core/script/function.c;
|
||||
common = grub-core/script/lexer.c;
|
||||
common = grub-core/script/main.c;
|
||||
|
||||
@@ -90,6 +90,7 @@ case "$target_cpu" in
|
||||
i[[3456]]86) target_cpu=i386 ;;
|
||||
amd64) target_cpu=x86_64 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
s390x) target_cpu=s390 ;;
|
||||
mipsel|mips64el)
|
||||
target_cpu=mipsel;
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||
@@ -122,6 +123,7 @@ if test "x$with_platform" = x; then
|
||||
mips-*) platform=arc ;;
|
||||
ia64-*) platform=efi ;;
|
||||
arm-*) platform=uboot ;;
|
||||
s390-* | s390x-*) platform=mainframe ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
esac
|
||||
else
|
||||
@@ -159,6 +161,7 @@ case "$target_cpu"-"$platform" in
|
||||
mipsel-loongson) ;;
|
||||
arm-uboot) ;;
|
||||
arm-efi) ;;
|
||||
s390-mainframe) ;;
|
||||
*-emu) ;;
|
||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||
esac
|
||||
@@ -1331,6 +1334,7 @@ AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target
|
||||
AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
|
||||
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_s390_mainframe], [test x$target_cpu = xs390 -a x$platform = xmainframe])
|
||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
|
||||
AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
|
||||
AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
|
||||
|
||||
@@ -23,7 +23,7 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||
"mips_loongson", "sparc64_ieee1275",
|
||||
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||
"mips_qemu_mips", "arm_uboot", "arm_efi" ]
|
||||
"mips_qemu_mips", "arm_uboot", "arm_efi", "s390_mainframe" ]
|
||||
|
||||
GROUPS = {}
|
||||
|
||||
@@ -37,6 +37,7 @@ GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ]
|
||||
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
||||
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
||||
GROUPS["arm"] = [ "arm_uboot", "arm_efi" ]
|
||||
GROUPS["s390"] = [ "s390_mainframe" ]
|
||||
|
||||
# Groups based on firmware
|
||||
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi" ]
|
||||
|
||||
@@ -78,6 +78,7 @@ kernel = {
|
||||
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
|
||||
mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)';
|
||||
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
s390_mainframe_ldflags = '-Wl,-Ttext,0x8000';
|
||||
|
||||
mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||
mips_loongson_cppflags = '-DUSE_ASCII_FALLBACK';
|
||||
@@ -455,11 +456,6 @@ image = {
|
||||
enable = mips_loongson;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = disk;
|
||||
common = lib/disk.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = trig;
|
||||
common_nodist = trigtables.c;
|
||||
@@ -1742,6 +1738,11 @@ module = {
|
||||
common = partmap/dfly.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = part_dasd;
|
||||
common = partmap/dasd.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = msdospart;
|
||||
common = parttool/msdospart.c;
|
||||
|
||||
+28
-4
@@ -116,11 +116,35 @@ print_files_long (const char *filename, const struct grub_dirhook_info *info,
|
||||
|
||||
if (! info->dir)
|
||||
{
|
||||
if (! ctx->human)
|
||||
grub_printf ("%-12llu", (unsigned long long) info->size);
|
||||
grub_file_t file;
|
||||
char *pathname;
|
||||
|
||||
if (ctx->dirname[grub_strlen (ctx->dirname) - 1] == '/')
|
||||
pathname = grub_xasprintf ("%s%s", ctx->dirname, filename);
|
||||
else
|
||||
grub_printf ("%-12s", grub_get_human_size (info->size,
|
||||
GRUB_HUMAN_SIZE_SHORT));
|
||||
pathname = grub_xasprintf ("%s/%s", ctx->dirname, filename);
|
||||
|
||||
if (!pathname)
|
||||
return 1;
|
||||
|
||||
/* XXX: For ext2fs symlinks are detected as files while they
|
||||
should be reported as directories. */
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (pathname);
|
||||
if (! file)
|
||||
{
|
||||
grub_errno = 0;
|
||||
grub_free (pathname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! ctx->human)
|
||||
grub_printf ("%-12llu", (unsigned long long) file->size);
|
||||
else
|
||||
grub_printf ("%-12s", grub_get_human_size (file->size,
|
||||
GRUB_HUMAN_SIZE_SHORT));
|
||||
grub_file_close (file);
|
||||
grub_free (pathname);
|
||||
}
|
||||
else
|
||||
grub_printf ("%-12s", _("DIR"));
|
||||
|
||||
@@ -631,16 +631,10 @@ grub_cryptodisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
return grub_crypto_gcry_error (gcry_err);
|
||||
}
|
||||
|
||||
/* Since ->write was called so disk.mod is loaded but be paranoid */
|
||||
|
||||
if (grub_disk_write_weak)
|
||||
err = grub_disk_write_weak (dev->source_disk,
|
||||
(sector << (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS))
|
||||
+ dev->offset,
|
||||
0, size << disk->log_sector_size, tmp);
|
||||
else
|
||||
err = grub_error (GRUB_ERR_BUG, "disk.mod not loaded");
|
||||
err = grub_disk_write (dev->source_disk,
|
||||
(sector << (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) + dev->offset,
|
||||
0, size << disk->log_sector_size, tmp);
|
||||
grub_free (tmp);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -565,7 +565,6 @@ grub_affs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = aftime2ctime (&node->di.mtime);
|
||||
info.size = grub_be_to_cpu32 (node->di.size);
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
@@ -155,10 +155,9 @@ grub_archelp_dir (struct grub_archelp_data *data,
|
||||
{
|
||||
grub_int32_t mtime;
|
||||
grub_uint32_t mode;
|
||||
grub_uint64_t size;
|
||||
grub_err_t err;
|
||||
|
||||
if (arcops->find_file (data, &name, &mtime, &mode, &size))
|
||||
if (arcops->find_file (data, &name, &mtime, &mode))
|
||||
goto fail;
|
||||
|
||||
if (mode == GRUB_ARCHELP_ATTR_END)
|
||||
@@ -190,7 +189,6 @@ grub_archelp_dir (struct grub_archelp_data *data,
|
||||
info.mtime = mtime;
|
||||
info.mtimeset = 1;
|
||||
}
|
||||
info.size = size;
|
||||
if (hook (n, &info, hook_data))
|
||||
{
|
||||
grub_free (name);
|
||||
@@ -250,9 +248,8 @@ grub_archelp_open (struct grub_archelp_data *data,
|
||||
{
|
||||
grub_uint32_t mode;
|
||||
int restart;
|
||||
grub_uint64_t size;
|
||||
|
||||
if (arcops->find_file (data, &fn, NULL, &mode, &size))
|
||||
if (arcops->find_file (data, &fn, NULL, &mode))
|
||||
goto fail;
|
||||
|
||||
if (mode == GRUB_ARCHELP_ATTR_END)
|
||||
|
||||
@@ -889,7 +889,6 @@ grub_bfs_dir_iter (const char *name, grub_uint64_t value,
|
||||
info.mtime = grub_bfs_to_cpu64 (ino.mtime) >> 16;
|
||||
#endif
|
||||
info.dir = ((grub_bfs_to_cpu32 (ino.mode) & ATTR_TYPE) == ATTR_DIR);
|
||||
info.size = grub_bfs_to_cpu64 (ino.size);
|
||||
return ctx->hook (name, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1580,7 +1580,6 @@ grub_btrfs_dir (grub_device_t device, const char *path,
|
||||
else
|
||||
{
|
||||
info.mtime = grub_le_to_cpu64 (inode.mtime.sec);
|
||||
info.size = grub_le_to_cpu64 (inode.size);
|
||||
info.mtimeset = 1;
|
||||
}
|
||||
c = cdirel->name[grub_le_to_cpu16 (cdirel->n)];
|
||||
|
||||
+1
-3
@@ -44,8 +44,7 @@ struct grub_archelp_data
|
||||
static grub_err_t
|
||||
grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
||||
grub_int32_t *mtime,
|
||||
grub_uint32_t *mode,
|
||||
grub_uint64_t *size)
|
||||
grub_uint32_t *mode)
|
||||
{
|
||||
grub_size_t offset;
|
||||
for (;;
|
||||
@@ -72,7 +71,6 @@ grub_cbfs_find_file (struct grub_archelp_data *data, char **name,
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
data->size = grub_be_to_cpu32 (hd.len);
|
||||
*size = grub_be_to_cpu32 (hd.len);
|
||||
(void) mtime;
|
||||
offset = grub_be_to_cpu32 (hd.offset);
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ struct grub_archelp_data
|
||||
|
||||
static grub_err_t
|
||||
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||
grub_int32_t *mtime, grub_uint32_t *mode,
|
||||
grub_uint64_t *size)
|
||||
grub_int32_t *mtime, grub_uint32_t *mode)
|
||||
{
|
||||
struct head hd;
|
||||
grub_size_t namesize;
|
||||
@@ -87,7 +86,6 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||
|
||||
data->dofs = data->hofs + ALIGN_CPIO (sizeof (hd) + namesize);
|
||||
data->next_hofs = data->dofs + ALIGN_CPIO (data->size);
|
||||
*size = data->size;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -884,8 +884,6 @@ grub_ext2_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
{
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_le_to_cpu32 (node->inode.mtime);
|
||||
info.size = grub_le_to_cpu32 (node->inode.size);
|
||||
info.size |= ((grub_off_t) grub_le_to_cpu32 (node->inode.size_high)) << 32;
|
||||
}
|
||||
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
|
||||
@@ -938,8 +938,6 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data,
|
||||
#endif
|
||||
data->cur_cluster_num = ~0U;
|
||||
|
||||
info.size = data->file_size;
|
||||
|
||||
if (call_hook)
|
||||
hook (ctxt.filename, &info, hook_data);
|
||||
|
||||
|
||||
@@ -1237,7 +1237,6 @@ grub_hfs_dir_hook (struct grub_hfs_record *rec, void *hook_arg)
|
||||
info.dir = 0;
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_be_to_cpu32 (frec->mtime) - 2082844800;
|
||||
info.size = grub_be_to_cpu32 (frec->size);
|
||||
return ctx->hook (fname, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -917,7 +917,6 @@ grub_hfsplus_dir_iter (const char *filename,
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = node->mtime;
|
||||
info.size = node->size;
|
||||
info.case_insensitive = !! (filetype & GRUB_FSHELP_CASE_INSENSITIVE);
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
|
||||
@@ -861,7 +861,7 @@ grub_iso9660_dir_iter (const char *filename,
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = !!iso9660_to_unixtime2 (&node->dirents[0].mtime, &info.mtime);
|
||||
info.size = get_node_size (node);
|
||||
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,6 @@ grub_jfs_dir (grub_device_t device, const char *path,
|
||||
& GRUB_JFS_FILETYPE_MASK) == GRUB_JFS_FILETYPE_DIR;
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_le_to_cpu32 (inode.mtime.sec);
|
||||
info.size = grub_le_to_cpu64 (inode.size);
|
||||
if (hook (diro->name, &info, hook_data))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -576,7 +576,6 @@ grub_minix_dir (grub_device_t device, const char *path,
|
||||
& GRUB_MINIX_IFDIR) == GRUB_MINIX_IFDIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_minix_to_cpu32 (data->inode.mtime);
|
||||
info.size = GRUB_MINIX_INODE_SIZE (data);
|
||||
|
||||
if (hook (filename, &info, hook_data) ? 1 : 0)
|
||||
break;
|
||||
|
||||
@@ -1066,7 +1066,6 @@ grub_nilfs2_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
{
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_le_to_cpu64 (node->inode.i_mtime);
|
||||
info.size = grub_le_to_cpu64 (node->inode.i_size);
|
||||
}
|
||||
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
|
||||
@@ -981,13 +981,10 @@ grub_ntfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
init_file (node, node->ino);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_divmod64 (node->mtime, 10000000, 0)
|
||||
- 86400ULL * 365 * (1970 - 1601)
|
||||
- 86400ULL * ((1970 - 1601) / 4) + 86400ULL * ((1970 - 1601) / 100);
|
||||
info.mtime = node->size;
|
||||
free_file (node);
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
@@ -1271,7 +1271,6 @@ grub_reiserfs_dir_iter (const char *filename,
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = node->mtime;
|
||||
info.size = node->size;
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
@@ -331,7 +331,6 @@ grub_romfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.size = grub_be_to_cpu32 (node->file.size);
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
@@ -671,7 +671,6 @@ grub_sfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtime = node->mtime + 8 * 365 * 86400 + 86400 * 2;
|
||||
info.mtimeset = 1;
|
||||
info.size = node->size;
|
||||
grub_free (node->cache);
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
|
||||
@@ -656,15 +656,6 @@ grub_squash_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
||||
switch (node->ino.type)
|
||||
{
|
||||
case grub_cpu_to_le16_compile_time (SQUASH_TYPE_LONG_REGULAR):
|
||||
info.size = grub_le_to_cpu64 (node->ino.long_file.size);
|
||||
break;
|
||||
case grub_cpu_to_le16_compile_time (SQUASH_TYPE_REGULAR):
|
||||
info.size = grub_le_to_cpu32 (node->ino.file.size);
|
||||
break;
|
||||
}
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
}
|
||||
|
||||
+1
-3
@@ -72,8 +72,7 @@ struct grub_archelp_data
|
||||
static grub_err_t
|
||||
grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||
grub_int32_t *mtime,
|
||||
grub_uint32_t *mode,
|
||||
grub_uint64_t *size)
|
||||
grub_uint32_t *mode)
|
||||
{
|
||||
struct head hd;
|
||||
int reread = 0, have_longname = 0, have_longlink = 0;
|
||||
@@ -201,7 +200,6 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name,
|
||||
grub_memcpy (data->linkname, hd.linkname, sizeof (hd.linkname));
|
||||
data->linkname[100] = 0;
|
||||
}
|
||||
*size = data->size;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
@@ -1072,7 +1072,6 @@ grub_udf_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
info.mtimeset = !!grub_datetime2unixtime (&datetime, &info.mtime);
|
||||
|
||||
info.mtime -= 60 * tz;
|
||||
info.size = U64 (node->block.fe.file_size);
|
||||
}
|
||||
grub_free (node);
|
||||
return ctx->hook (filename, &info, ctx->hook_data);
|
||||
|
||||
@@ -711,8 +711,6 @@ grub_ufs_dir (grub_device_t device, const char *path,
|
||||
#endif
|
||||
info.mtimeset = 1;
|
||||
|
||||
info.size = grub_ufs_to_cpu64 (inode.size);
|
||||
|
||||
if (hook (filename, &info, hook_data))
|
||||
{
|
||||
grub_free (filename);
|
||||
|
||||
@@ -732,7 +732,6 @@ grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
|
||||
{
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec);
|
||||
info.size = grub_be_to_cpu64 (node->inode.size);
|
||||
}
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
grub_free (node);
|
||||
|
||||
@@ -3999,8 +3999,6 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_MTIME_OFFSET), dn.endian);
|
||||
info.case_insensitive = ctx->data->subvol.case_insensitive;
|
||||
info.size = grub_zfs_to_cpu64 (grub_get_unaligned64 ((char *) sahdrp + hdrsize + SA_SIZE_OFFSET), dn.endian);
|
||||
|
||||
}
|
||||
|
||||
if (dn.dn.dn_bonustype == DMU_OT_ZNODE)
|
||||
@@ -4008,7 +4006,6 @@ iterate_zap (const char *name, grub_uint64_t val, struct grub_zfs_dir_ctx *ctx)
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_mtime[0],
|
||||
dn.endian);
|
||||
info.size = grub_zfs_to_cpu64 (((znode_phys_t *) DN_BONUS (&dn.dn))->zp_size, dn.endian);
|
||||
}
|
||||
info.dir = (dn.dn.dn_type == DMU_OT_DIRECTORY_CONTENTS);
|
||||
grub_dprintf ("zfs", "type=%d, name=%s\n",
|
||||
|
||||
@@ -216,7 +216,7 @@ grub_gdb_trap (int trap_no)
|
||||
grub_backtrace_print_address ((void *) grub_gdb_regs[PC]);
|
||||
grub_printf ("\n");
|
||||
grub_backtrace_pointer ((void *) grub_gdb_regs[EBP]);
|
||||
grub_fatal ("Unhandled exception");
|
||||
grub_abort ();
|
||||
}
|
||||
|
||||
sig_no = grub_gdb_trap2sig (trap_no);
|
||||
|
||||
+180
-7
@@ -31,7 +31,18 @@
|
||||
/* The last time the disk was used. */
|
||||
static grub_uint64_t grub_last_time = 0;
|
||||
|
||||
struct grub_disk_cache grub_disk_cache_table[GRUB_DISK_CACHE_NUM];
|
||||
|
||||
/* Disk cache. */
|
||||
struct grub_disk_cache
|
||||
{
|
||||
enum grub_disk_dev_id dev_id;
|
||||
unsigned long disk_id;
|
||||
grub_disk_addr_t sector;
|
||||
char *data;
|
||||
int lock;
|
||||
};
|
||||
|
||||
static struct grub_disk_cache grub_disk_cache_table[GRUB_DISK_CACHE_NUM];
|
||||
|
||||
void (*grub_disk_firmware_fini) (void);
|
||||
int grub_disk_firmware_is_tainted;
|
||||
@@ -48,12 +59,35 @@ grub_disk_cache_get_performance (unsigned long *hits, unsigned long *misses)
|
||||
}
|
||||
#endif
|
||||
|
||||
grub_err_t (*grub_disk_write_weak) (grub_disk_t disk,
|
||||
grub_disk_addr_t sector,
|
||||
grub_off_t offset,
|
||||
grub_size_t size,
|
||||
const void *buf);
|
||||
#include "disk_common.c"
|
||||
static unsigned
|
||||
grub_disk_cache_get_index (unsigned long dev_id, unsigned long disk_id,
|
||||
grub_disk_addr_t sector)
|
||||
{
|
||||
return ((dev_id * 524287UL + disk_id * 2606459UL
|
||||
+ ((unsigned) (sector >> GRUB_DISK_CACHE_BITS)))
|
||||
% GRUB_DISK_CACHE_NUM);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_disk_cache_invalidate (unsigned long dev_id, unsigned long disk_id,
|
||||
grub_disk_addr_t sector)
|
||||
{
|
||||
unsigned cache_index;
|
||||
struct grub_disk_cache *cache;
|
||||
|
||||
sector &= ~(GRUB_DISK_CACHE_SIZE - 1);
|
||||
cache_index = grub_disk_cache_get_index (dev_id, disk_id, sector);
|
||||
cache = grub_disk_cache_table + cache_index;
|
||||
|
||||
if (cache->dev_id == dev_id && cache->disk_id == disk_id
|
||||
&& cache->sector == sector && cache->data)
|
||||
{
|
||||
cache->lock = 1;
|
||||
grub_free (cache->data);
|
||||
cache->data = 0;
|
||||
cache->lock = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grub_disk_cache_invalidate_all (void)
|
||||
@@ -307,6 +341,53 @@ grub_disk_close (grub_disk_t disk)
|
||||
grub_free (disk);
|
||||
}
|
||||
|
||||
/* This function performs three tasks:
|
||||
- Make sectors disk relative from partition relative.
|
||||
- Normalize offset to be less than the sector size.
|
||||
- Verify that the range is inside the partition. */
|
||||
static grub_err_t
|
||||
grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
||||
grub_off_t *offset, grub_size_t size)
|
||||
{
|
||||
grub_partition_t part;
|
||||
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
|
||||
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
|
||||
|
||||
for (part = disk->partition; part; part = part->parent)
|
||||
{
|
||||
grub_disk_addr_t start;
|
||||
grub_uint64_t len;
|
||||
|
||||
start = part->start;
|
||||
len = part->len;
|
||||
|
||||
if (*sector >= len
|
||||
|| len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of partition"));
|
||||
|
||||
*sector += start;
|
||||
}
|
||||
|
||||
if (disk->total_sectors != GRUB_DISK_SIZE_UNKNOWN
|
||||
&& ((disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) <= *sector
|
||||
|| ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors
|
||||
<< (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) - *sector))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of disk `%s'"), disk->name);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline grub_disk_addr_t
|
||||
transform_sector (grub_disk_t disk, grub_disk_addr_t sector)
|
||||
{
|
||||
return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
}
|
||||
|
||||
/* Small read (less than cache size and not pass across cache unit boundaries).
|
||||
sector is already adjusted and is divisible by cache unit size.
|
||||
*/
|
||||
@@ -532,6 +613,98 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_off_t offset, grub_size_t size, const void *buf)
|
||||
{
|
||||
unsigned real_offset;
|
||||
grub_disk_addr_t aligned_sector;
|
||||
|
||||
grub_dprintf ("disk", "Writing `%s'...\n", disk->name);
|
||||
|
||||
if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE)
|
||||
return -1;
|
||||
|
||||
aligned_sector = (sector & ~((1 << (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) - 1));
|
||||
real_offset = offset + ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS);
|
||||
sector = aligned_sector;
|
||||
|
||||
while (size)
|
||||
{
|
||||
if (real_offset != 0 || (size < (1U << disk->log_sector_size)
|
||||
&& size != 0))
|
||||
{
|
||||
char *tmp_buf;
|
||||
grub_size_t len;
|
||||
grub_partition_t part;
|
||||
|
||||
tmp_buf = grub_malloc (1 << disk->log_sector_size);
|
||||
if (!tmp_buf)
|
||||
return grub_errno;
|
||||
|
||||
part = disk->partition;
|
||||
disk->partition = 0;
|
||||
if (grub_disk_read (disk, sector,
|
||||
0, (1 << disk->log_sector_size), tmp_buf)
|
||||
!= GRUB_ERR_NONE)
|
||||
{
|
||||
disk->partition = part;
|
||||
grub_free (tmp_buf);
|
||||
goto finish;
|
||||
}
|
||||
disk->partition = part;
|
||||
|
||||
len = (1 << disk->log_sector_size) - real_offset;
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
grub_memcpy (tmp_buf + real_offset, buf, len);
|
||||
|
||||
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
|
||||
|
||||
if ((disk->dev->write) (disk, transform_sector (disk, sector),
|
||||
1, tmp_buf) != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_free (tmp_buf);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
grub_free (tmp_buf);
|
||||
|
||||
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
|
||||
buf = (const char *) buf + len;
|
||||
size -= len;
|
||||
real_offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_size_t len;
|
||||
grub_size_t n;
|
||||
|
||||
len = size & ~((1 << disk->log_sector_size) - 1);
|
||||
n = size >> disk->log_sector_size;
|
||||
|
||||
if ((disk->dev->write) (disk, transform_sector (disk, sector),
|
||||
n, buf) != GRUB_ERR_NONE)
|
||||
goto finish;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
|
||||
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
|
||||
}
|
||||
|
||||
buf = (const char *) buf + len;
|
||||
size -= len;
|
||||
}
|
||||
}
|
||||
|
||||
finish:
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_uint64_t
|
||||
grub_disk_get_size (grub_disk_t disk)
|
||||
{
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* This function performs three tasks:
|
||||
- Make sectors disk relative from partition relative.
|
||||
- Normalize offset to be less than the sector size.
|
||||
- Verify that the range is inside the partition. */
|
||||
static grub_err_t
|
||||
grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
|
||||
grub_off_t *offset, grub_size_t size)
|
||||
{
|
||||
grub_partition_t part;
|
||||
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
|
||||
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
|
||||
|
||||
for (part = disk->partition; part; part = part->parent)
|
||||
{
|
||||
grub_disk_addr_t start;
|
||||
grub_uint64_t len;
|
||||
|
||||
start = part->start;
|
||||
len = part->len;
|
||||
|
||||
if (*sector >= len
|
||||
|| len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of partition"));
|
||||
|
||||
*sector += start;
|
||||
}
|
||||
|
||||
if (disk->total_sectors != GRUB_DISK_SIZE_UNKNOWN
|
||||
&& ((disk->total_sectors << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) <= *sector
|
||||
|| ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1)
|
||||
>> GRUB_DISK_SECTOR_BITS) > (disk->total_sectors
|
||||
<< (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) - *sector))
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read or write outside of disk `%s'"), disk->name);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline grub_disk_addr_t
|
||||
transform_sector (grub_disk_t disk, grub_disk_addr_t sector)
|
||||
{
|
||||
return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
grub_disk_cache_get_index (unsigned long dev_id, unsigned long disk_id,
|
||||
grub_disk_addr_t sector)
|
||||
{
|
||||
return ((dev_id * 524287UL + disk_id * 2606459UL
|
||||
+ ((unsigned) (sector >> GRUB_DISK_CACHE_BITS)))
|
||||
% GRUB_DISK_CACHE_NUM);
|
||||
}
|
||||
@@ -511,7 +511,7 @@ grub_efi_mm_init (void)
|
||||
grub_printf ("printing memory map\n");
|
||||
print_memory_map (memory_map, desc_size,
|
||||
NEXT_MEMORY_DESCRIPTOR (memory_map, map_size));
|
||||
grub_fatal ("Debug. ");
|
||||
grub_abort ();
|
||||
#endif
|
||||
|
||||
/* Release the memory maps. */
|
||||
|
||||
@@ -47,6 +47,18 @@ grub_error (grub_err_t n, const char *fmt, ...)
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
grub_fatal (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
grub_vprintf (_(fmt), ap);
|
||||
va_end (ap);
|
||||
|
||||
grub_abort ();
|
||||
}
|
||||
|
||||
void
|
||||
grub_error_push (void)
|
||||
{
|
||||
|
||||
+37
-29
@@ -664,33 +664,34 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
|
||||
if (c != '%')
|
||||
continue;
|
||||
|
||||
if (*fmt =='-')
|
||||
if (*fmt && *fmt =='-')
|
||||
fmt++;
|
||||
|
||||
while (grub_isdigit (*fmt))
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
if (*fmt == '$')
|
||||
if (*fmt && *fmt == '$')
|
||||
fmt++;
|
||||
|
||||
if (*fmt =='-')
|
||||
if (*fmt && *fmt =='-')
|
||||
fmt++;
|
||||
|
||||
while (grub_isdigit (*fmt))
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
if (*fmt =='.')
|
||||
if (*fmt && *fmt =='.')
|
||||
fmt++;
|
||||
|
||||
while (grub_isdigit (*fmt))
|
||||
while (*fmt && grub_isdigit (*fmt))
|
||||
fmt++;
|
||||
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
c = *fmt++;
|
||||
|
||||
{
|
||||
c = *fmt++;
|
||||
if (c == 'l')
|
||||
c = *fmt++;
|
||||
}
|
||||
switch (c)
|
||||
{
|
||||
case 'p':
|
||||
@@ -705,17 +706,16 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
|
||||
}
|
||||
}
|
||||
|
||||
enum { INT, LONG, LONGLONG, POINTER } types[count_args];
|
||||
enum { INT, WCHAR, LONG, LONGLONG, POINTER } types[count_args];
|
||||
union
|
||||
{
|
||||
int i;
|
||||
grub_uint32_t w;
|
||||
long l;
|
||||
long long ll;
|
||||
void *p;
|
||||
} args[count_args];
|
||||
|
||||
COMPILE_TIME_ASSERT (sizeof (int) == sizeof (grub_uint32_t));
|
||||
|
||||
grub_memset (types, 0, sizeof (types));
|
||||
|
||||
fmt = fmt0;
|
||||
@@ -787,16 +787,21 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
|
||||
case 's':
|
||||
types[curn] = POINTER;
|
||||
break;
|
||||
case 'C':
|
||||
case 'c':
|
||||
types[curn] = INT;
|
||||
break;
|
||||
case 'C':
|
||||
types[curn] = WCHAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (n = 0; n < count_args; n++)
|
||||
switch (types[n])
|
||||
{
|
||||
case WCHAR:
|
||||
args[n].w = va_arg (args_in, grub_uint32_t);
|
||||
break;
|
||||
case POINTER:
|
||||
args[n].p = va_arg (args_in, void *);
|
||||
break;
|
||||
@@ -924,7 +929,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
|
||||
|
||||
case 'C':
|
||||
{
|
||||
grub_uint32_t code = args[curn].i;
|
||||
grub_uint32_t code = args[curn].w;
|
||||
int shift;
|
||||
unsigned mask;
|
||||
|
||||
@@ -943,11 +948,21 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a
|
||||
shift = 12;
|
||||
mask = 0xe0;
|
||||
}
|
||||
else if (code <= 0x10ffff)
|
||||
else if (code <= 0x1fffff)
|
||||
{
|
||||
shift = 18;
|
||||
mask = 0xf0;
|
||||
}
|
||||
else if (code <= 0x3ffffff)
|
||||
{
|
||||
shift = 24;
|
||||
mask = 0xf8;
|
||||
}
|
||||
else if (code <= 0x7fffffff)
|
||||
{
|
||||
shift = 30;
|
||||
mask = 0xfc;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = '?';
|
||||
@@ -1063,7 +1078,7 @@ grub_xasprintf (const char *fmt, ...)
|
||||
}
|
||||
|
||||
/* Abort GRUB. This function does not return. */
|
||||
static void __attribute__ ((noreturn))
|
||||
void
|
||||
grub_abort (void)
|
||||
{
|
||||
grub_printf ("\nAborted.");
|
||||
@@ -1079,17 +1094,10 @@ grub_abort (void)
|
||||
grub_exit ();
|
||||
}
|
||||
|
||||
void
|
||||
grub_fatal (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
grub_vprintf (_(fmt), ap);
|
||||
va_end (ap);
|
||||
|
||||
grub_abort ();
|
||||
}
|
||||
#if ! defined (__APPLE__) && !defined (GRUB_UTIL)
|
||||
/* GCC emits references to abort(). */
|
||||
void abort (void) __attribute__ ((alias ("grub_abort")));
|
||||
#endif
|
||||
|
||||
#if NEED_REGISTER_FRAME_INFO && !defined(GRUB_UTIL)
|
||||
void __register_frame_info (void)
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#include "../kern/disk_common.c"
|
||||
|
||||
static void
|
||||
grub_disk_cache_invalidate (unsigned long dev_id, unsigned long disk_id,
|
||||
grub_disk_addr_t sector)
|
||||
{
|
||||
unsigned cache_index;
|
||||
struct grub_disk_cache *cache;
|
||||
|
||||
sector &= ~(GRUB_DISK_CACHE_SIZE - 1);
|
||||
cache_index = grub_disk_cache_get_index (dev_id, disk_id, sector);
|
||||
cache = grub_disk_cache_table + cache_index;
|
||||
|
||||
if (cache->dev_id == dev_id && cache->disk_id == disk_id
|
||||
&& cache->sector == sector && cache->data)
|
||||
{
|
||||
cache->lock = 1;
|
||||
grub_free (cache->data);
|
||||
cache->data = 0;
|
||||
cache->lock = 0;
|
||||
}
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_off_t offset, grub_size_t size, const void *buf)
|
||||
{
|
||||
unsigned real_offset;
|
||||
grub_disk_addr_t aligned_sector;
|
||||
|
||||
grub_dprintf ("disk", "Writing `%s'...\n", disk->name);
|
||||
|
||||
if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE)
|
||||
return -1;
|
||||
|
||||
aligned_sector = (sector & ~((1 << (disk->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS)) - 1));
|
||||
real_offset = offset + ((sector - aligned_sector) << GRUB_DISK_SECTOR_BITS);
|
||||
sector = aligned_sector;
|
||||
|
||||
while (size)
|
||||
{
|
||||
if (real_offset != 0 || (size < (1U << disk->log_sector_size)
|
||||
&& size != 0))
|
||||
{
|
||||
char *tmp_buf;
|
||||
grub_size_t len;
|
||||
grub_partition_t part;
|
||||
|
||||
tmp_buf = grub_malloc (1 << disk->log_sector_size);
|
||||
if (!tmp_buf)
|
||||
return grub_errno;
|
||||
|
||||
part = disk->partition;
|
||||
disk->partition = 0;
|
||||
if (grub_disk_read (disk, sector,
|
||||
0, (1 << disk->log_sector_size), tmp_buf)
|
||||
!= GRUB_ERR_NONE)
|
||||
{
|
||||
disk->partition = part;
|
||||
grub_free (tmp_buf);
|
||||
goto finish;
|
||||
}
|
||||
disk->partition = part;
|
||||
|
||||
len = (1 << disk->log_sector_size) - real_offset;
|
||||
if (len > size)
|
||||
len = size;
|
||||
|
||||
grub_memcpy (tmp_buf + real_offset, buf, len);
|
||||
|
||||
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
|
||||
|
||||
if ((disk->dev->write) (disk, transform_sector (disk, sector),
|
||||
1, tmp_buf) != GRUB_ERR_NONE)
|
||||
{
|
||||
grub_free (tmp_buf);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
grub_free (tmp_buf);
|
||||
|
||||
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
|
||||
buf = (const char *) buf + len;
|
||||
size -= len;
|
||||
real_offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_size_t len;
|
||||
grub_size_t n;
|
||||
|
||||
len = size & ~((1 << disk->log_sector_size) - 1);
|
||||
n = size >> disk->log_sector_size;
|
||||
|
||||
if ((disk->dev->write) (disk, transform_sector (disk, sector),
|
||||
n, buf) != GRUB_ERR_NONE)
|
||||
goto finish;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
|
||||
sector += (1 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
|
||||
}
|
||||
|
||||
buf = (const char *) buf + len;
|
||||
size -= len;
|
||||
}
|
||||
}
|
||||
|
||||
finish:
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(disk)
|
||||
{
|
||||
grub_disk_write_weak = grub_disk_write;
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(disk)
|
||||
{
|
||||
grub_disk_write_weak = NULL;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ static struct legacy_command legacy_commands[] =
|
||||
"Print the blocklist notation of the file FILE."},
|
||||
{"boot", "boot\n", NULL, 0, 0, {}, 0, 0,
|
||||
"Boot the OS/chain-loader which has been loaded."},
|
||||
{"bootp", "net_bootp; net_ls_addr; echo $\"" N_("Default server is ${net_default_server}") "\"; if [ x%s = x--with-configfile ]; then "
|
||||
{"bootp", "net_bootp; net_ls_addr; if [ x%s = x--with-configfile ]; then "
|
||||
"if net_get_dhcp_option configfile_name pxe 150 string; then "
|
||||
"configfile $configfile_name; fi; fi\n", NULL, 0, 1,
|
||||
{TYPE_WITH_CONFIGFILE_OPTION}, FLAG_IGNORE_REST, "[--with-configfile]",
|
||||
@@ -385,29 +385,6 @@ adjust_file (const char *in, grub_size_t len)
|
||||
if (*ptr == '\'' || *ptr == '\\')
|
||||
overhead++;
|
||||
comma = ptr;
|
||||
if (*comma == ')' && comma - in == 3
|
||||
&& in[1] == 'n' && in[2] == 'd')
|
||||
{
|
||||
rest = comma + 1;
|
||||
for (ptr = rest; ptr < in + len && *ptr; ptr++)
|
||||
if (*ptr == '\'' || *ptr == '\\')
|
||||
overhead++;
|
||||
|
||||
ret = grub_malloc (ptr - in + overhead + 15);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
outptr = grub_stpcpy (ret, "(tftp)");;
|
||||
for (ptr = rest; ptr < in + len; ptr++)
|
||||
{
|
||||
if (*ptr == '\'' || *ptr == '\\')
|
||||
*outptr++ = '\\';
|
||||
|
||||
*outptr++ = *ptr;
|
||||
}
|
||||
*outptr = 0;
|
||||
return ret;
|
||||
}
|
||||
if (*comma != ',')
|
||||
return grub_legacy_escape (in, len);
|
||||
part = grub_strtoull (comma + 1, (char **) &rest, 0);
|
||||
@@ -421,7 +398,7 @@ adjust_file (const char *in, grub_size_t len)
|
||||
overhead++;
|
||||
|
||||
/* 35 is enough for any 2 numbers. */
|
||||
ret = grub_malloc (ptr - in + overhead + 35 + 5);
|
||||
ret = grub_malloc (ptr - in + overhead + 35);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ void _gcry_log_bug (const char *fmt, ...)
|
||||
grub_vprintf (fmt, args);
|
||||
va_end (args);
|
||||
grub_refresh ();
|
||||
grub_fatal ("gcrypt bug");
|
||||
grub_abort ();
|
||||
}
|
||||
|
||||
gcry_err_code_t
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/partition.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static struct grub_partition_map grub_dasd_partition_map;
|
||||
|
||||
struct addr
|
||||
{
|
||||
grub_uint16_t cyl;
|
||||
grub_uint16_t head;
|
||||
grub_uint8_t sec;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct anchor
|
||||
{
|
||||
grub_uint8_t unused1[4];
|
||||
grub_uint8_t magic[4];
|
||||
grub_uint8_t unused2[7];
|
||||
struct addr vtoc_addr;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* VOL1 in EBCDIC. */
|
||||
#define ANCHOR_MAGIC "\xe5\xd6\xd3\xf1"
|
||||
|
||||
struct grub_disk_addr_t
|
||||
address_to_block (const struct addr *a)
|
||||
{
|
||||
return a->cyl * + a->head * + a->sec;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
dasd_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
const grub_partition_t partition))
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_partition_t p;
|
||||
struct anchor anchor;
|
||||
|
||||
err = grub_disk_read (disk, 2 * 8, 0, sizeof (anchor), &anchor);
|
||||
if (err)
|
||||
return err;
|
||||
if (grub_memcmp (anchor.magic, ANCHOR_MAGIC, sizeof (ANCHOR_MAGIC) - 1) != 0)
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE,
|
||||
"not a dasd partition table");
|
||||
|
||||
p = (grub_partition_t) grub_zalloc (sizeof (struct grub_partition));
|
||||
if (! p)
|
||||
return grub_errno;
|
||||
p->partmap = &grub_dasd_partition_map;
|
||||
|
||||
p->start = 0x18 << 3;
|
||||
p->len = disk->total_sectors - p->start;
|
||||
p->number = 0;
|
||||
if (hook (disk, p))
|
||||
{
|
||||
grub_free (p);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_free (p);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Partition map type. */
|
||||
static struct grub_partition_map grub_dasd_partition_map =
|
||||
{
|
||||
.name = "dasd",
|
||||
.iterate = dasd_partition_map_iterate,
|
||||
};
|
||||
|
||||
GRUB_MOD_INIT(part_dasd)
|
||||
{
|
||||
grub_partition_map_register (&grub_dasd_partition_map);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(part_dasd)
|
||||
{
|
||||
grub_partition_map_unregister (&grub_dasd_partition_map);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ struct grub_archelp_ops
|
||||
grub_err_t
|
||||
(*find_file) (struct grub_archelp_data *data, char **name,
|
||||
grub_int32_t *mtime,
|
||||
grub_archelp_mode_t *mode,
|
||||
grub_uint64_t *size);
|
||||
grub_archelp_mode_t *mode);
|
||||
|
||||
char *
|
||||
(*get_link_target) (struct grub_archelp_data *data);
|
||||
|
||||
+5
-23
@@ -193,17 +193,11 @@ grub_err_t EXPORT_FUNC(grub_disk_read) (grub_disk_t disk,
|
||||
grub_off_t offset,
|
||||
grub_size_t size,
|
||||
void *buf);
|
||||
grub_err_t grub_disk_write (grub_disk_t disk,
|
||||
grub_disk_addr_t sector,
|
||||
grub_off_t offset,
|
||||
grub_size_t size,
|
||||
const void *buf);
|
||||
extern grub_err_t (*EXPORT_VAR(grub_disk_write_weak)) (grub_disk_t disk,
|
||||
grub_disk_addr_t sector,
|
||||
grub_off_t offset,
|
||||
grub_size_t size,
|
||||
const void *buf);
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
|
||||
grub_disk_addr_t sector,
|
||||
grub_off_t offset,
|
||||
grub_size_t size,
|
||||
const void *buf);
|
||||
|
||||
grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
|
||||
|
||||
@@ -227,18 +221,6 @@ grub_stop_disk_firmware (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Disk cache. */
|
||||
struct grub_disk_cache
|
||||
{
|
||||
enum grub_disk_dev_id dev_id;
|
||||
unsigned long disk_id;
|
||||
grub_disk_addr_t sector;
|
||||
char *data;
|
||||
int lock;
|
||||
};
|
||||
|
||||
extern struct grub_disk_cache EXPORT_VAR(grub_disk_cache_table)[GRUB_DISK_CACHE_NUM];
|
||||
|
||||
#if defined (GRUB_UTIL)
|
||||
void grub_lvm_init (void);
|
||||
void grub_ldm_init (void);
|
||||
|
||||
@@ -39,7 +39,6 @@ struct grub_dirhook_info
|
||||
unsigned mtimeset:1;
|
||||
unsigned case_insensitive:1;
|
||||
grub_int32_t mtime;
|
||||
grub_off_t size;
|
||||
};
|
||||
|
||||
typedef int (*grub_fs_dir_hook_t) (const char *filename,
|
||||
|
||||
@@ -375,6 +375,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
|
||||
__attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;
|
||||
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT;
|
||||
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
||||
grub_uint64_t d,
|
||||
grub_uint64_t *r);
|
||||
|
||||
@@ -116,9 +116,6 @@ fi
|
||||
|
||||
memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
||||
grub_install_files "${source_directory}" "${memdisk_dir}"/boot/grub "${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
|
||||
for file in $source; do
|
||||
cp -f "$file" "${memdisk_dir}"/"$file";
|
||||
done
|
||||
|
||||
memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user