merge mainline into crypto

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-23 20:34:26 +01:00
commit a2e77ce455
50 changed files with 931 additions and 788 deletions

View file

@ -1,3 +1,92 @@
2009-12-23 Felix Zielcke <fzielcke@z-51.de>
* commands/i386/pc/drivemap.c: Remove all trailing whitespace.
* commands/lspci.c: Likewise.
* commands/probe.c: Likewise.
* commands/xnu_uuid.c: Likewise.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* fs/i386/pc/pxe.c: Likewise.
* gettext/gettext.c: Likewise.
* include/grub/efi/graphics_output.h: Likewise.
* include/grub/i386/pc/memory.h: Likewise.
* kern/env.c: Likewise.
* kern/i386/qemu/startup.S: Likewise.
* lib/i386/pc/biosnum.c: Likewise.
* lib/i386/relocator.c: Likewise.
* lib/i386/relocator_asm.S: Likewise.
* lib/relocator.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/multiboot.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/xnu.c: Likewise.
* loader/xnu.c: Likewise.
* normal/main.c: Likewise.
* normal/menu_text.c: Likewise.
* util/getroot.c: Likewise.
* util/grub-mkconfig_lib.in: Likewise.
* util/grub.d/00_header.in: Likewise.
* util/i386/pc/grub-mkimage.c: Likewise.
* util/mkisofs/eltorito.c: Likewise.
* util/mkisofs/exclude.h: Likewise.
* util/mkisofs/hash.c: Likewise.
* util/mkisofs/iso9660.h: Likewise.
* util/mkisofs/joliet.c: Likewise.
* util/mkisofs/mkisofs.c: Likewise.
* util/mkisofs/mkisofs.h: Likewise.
* util/mkisofs/multi.c: Likewise.
* util/mkisofs/name.c: Likewise.
* util/mkisofs/rock.c: Likewise.
* util/mkisofs/tree.c: Likewise.
* util/mkisofs/write.c: Likewise.
* video/efi_gop.c: Likewise.
2009-12-23 Vladimir Serbinenko <phcoder@gmail.com>
* video/efi_gop.c (grub_video_gop_get_bitmask): Fix off-by-one in mask
size counting.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in (pkglib_DATA): Set to @pkglib_DATA@.
* genmk.rb (class SCRIPT): Modify the target file instead of source.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/memrw.c (grub_cmd_write): Support for mask parameter.
(GRUB_MOD_INIT(memrw)): Update help line.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/memrw.c (cmd_read_byte, cmd_read_word, cmd_read_dword):
Use grub_extcmd_t. All users updated.
(options): New variable.
(grub_cmd_read): Restructure for readability. Support "-v" option.
(grub_cmd_write): Restructure for readability.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* genmk.rb (class SCRIPT): Prepend #{src} path with $(srcdir).
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* genmk.rb (class SCRIPT): Use sed to substitute @pkglib_DATA@
with the actual contents of the correspondending make variable.
* util/grub-mkrescue.in (pkglib_DATA): New variable.
(process_input_dir): Copy all $pkglib_DATA files instead of explicitly
specifying `*.lst' and `efiemu??.o'
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/30_os-prober.in (osx_entry): Add round brackets
after function name.
Noticed by Rene Engelhard <rene@debian.org>.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com> 2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/lspci.c (grub_pci_classes): Add "USB Controller". * commands/lspci.c (grub_pci_classes): Add "USB Controller".
@ -654,7 +743,7 @@
grub_gettext_msg_list. grub_gettext_msg_list.
(grub_gettext_gettranslation_from_position): Return const char * (grub_gettext_gettranslation_from_position): Return const char *
and not char *. and not char *.
(grub_gettext_translate): Add the translated strings into a list, (grub_gettext_translate): Add the translated strings into a list,
returns from the list if existing there. returns from the list if existing there.
(grub_gettext_init_ext): Add \n at the end of grub_dprintf string. (grub_gettext_init_ext): Add \n at the end of grub_dprintf string.
(grub_gettext_delete_list): Delete the list. (grub_gettext_delete_list): Delete the list.
@ -695,7 +784,7 @@
(run_menu): Replaces grub_printf by print_spaces and dynamic terminal (run_menu): Replaces grub_printf by print_spaces and dynamic terminal
width. width.
(get_entry_number): Gettextize and uses dynamic terminal width. (get_entry_number): Gettextize and uses dynamic terminal width.
(notify_booting, notify_fallback, notify_execution_failure): (notify_booting, notify_fallback, notify_execution_failure):
Gettextize. Gettextize.
* normal/menu_entry.c (store_completion): Cleanup the gettextized * normal/menu_entry.c (store_completion): Cleanup the gettextized
string. string.
@ -966,7 +1055,7 @@
* include/grub/i18n.h: ... to here * include/grub/i18n.h: ... to here
* include/grub/i18n.h: ... to here. * include/grub/i18n.h: ... to here.
* kern/misc.c: Include <grub/i18n.h> * kern/misc.c: Include <grub/i18n.h>
(grub_gettext_dummy): Move above user. (grub_gettext_dummy): Move above user.
2009-11-24 Felix Zielcke <fzielcke@z-51.de> 2009-11-24 Felix Zielcke <fzielcke@z-51.de>

View file

@ -370,7 +370,7 @@ grub_get_root_biosnumber_drivemap (void)
return grub_strtoul (biosnum, 0, 0); return grub_strtoul (biosnum, 0, 0);
dev = grub_device_open (0); dev = grub_device_open (0);
if (dev && dev->disk && dev->disk->dev if (dev && dev->disk && dev->disk->dev
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID) && dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
{ {
drivemap_node_t *curnode = map_head; drivemap_node_t *curnode = map_head;

View file

@ -163,10 +163,10 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
space = grub_pci_read (addr); space = grub_pci_read (addr);
reg++; reg++;
if (space == 0) if (space == 0)
continue; continue;
switch (space & GRUB_PCI_ADDR_SPACE_MASK) switch (space & GRUB_PCI_ADDR_SPACE_MASK)
{ {
case GRUB_PCI_ADDR_SPACE_IO: case GRUB_PCI_ADDR_SPACE_IO:
@ -175,7 +175,7 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
(space & GRUB_PCI_ADDR_IO_MASK)); (space & GRUB_PCI_ADDR_IO_MASK));
break; break;
case GRUB_PCI_ADDR_SPACE_MEMORY: case GRUB_PCI_ADDR_SPACE_MEMORY:
if ((space & GRUB_PCI_ADDR_MEM_TYPE_MASK) if ((space & GRUB_PCI_ADDR_MEM_TYPE_MASK)
== GRUB_PCI_ADDR_MEM_TYPE_64) == GRUB_PCI_ADDR_MEM_TYPE_64)
{ {
addr = grub_pci_make_address (dev, reg); addr = grub_pci_make_address (dev, reg);
@ -186,11 +186,11 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
(space & GRUB_PCI_ADDR_MEM_MASK), (space & GRUB_PCI_ADDR_MEM_MASK),
space & GRUB_PCI_ADDR_MEM_PREFETCH space & GRUB_PCI_ADDR_MEM_PREFETCH
? "prefetchable" : "non-prefetchable"); ? "prefetchable" : "non-prefetchable");
} }
else else
grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n", grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n",
(reg - 1) - 4, (unsigned long long) (reg - 1) - 4, (unsigned long long)
(space & GRUB_PCI_ADDR_MEM_MASK), (space & GRUB_PCI_ADDR_MEM_MASK),
space & GRUB_PCI_ADDR_MEM_PREFETCH space & GRUB_PCI_ADDR_MEM_PREFETCH
? "prefetchable" : "non-prefetchable"); ? "prefetchable" : "non-prefetchable");

View file

@ -19,29 +19,53 @@
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/command.h> #include <grub/extcmd.h>
#include <grub/env.h>
static grub_command_t cmd_read_byte, cmd_read_word, cmd_read_dword; static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword; static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
static const struct grub_arg_option options[] =
{
{0, 'v', 0, "Save read value into variable VARNAME.",
"VARNAME", ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
static grub_err_t static grub_err_t
grub_cmd_read (grub_command_t cmd, int argc, char **argv) grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
{ {
grub_target_addr_t addr; grub_target_addr_t addr;
grub_uint32_t value; grub_uint32_t value = 0;
char buf[sizeof ("XXXXXXXX")];
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments"); return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0); addr = grub_strtoul (argv[0], 0, 0);
if (cmd->name[5] == 'd') switch (cmd->cmd->name[sizeof ("read_") - 1])
value = *((grub_uint32_t *) addr); {
else if (cmd->name[5] == 'w') case 'd':
value = *((grub_uint16_t *) addr); value = *((volatile grub_uint32_t *) addr);
else break;
value = *((grub_uint8_t *) addr);
grub_printf ("0x%x\n", value); case 'w':
value = *((volatile grub_uint16_t *) addr);
break;
case 'b':
value = *((volatile grub_uint8_t *) addr);
break;
}
if (cmd->state[0].set)
{
grub_sprintf (buf, "%x", value);
grub_env_set (cmd->state[0].arg, buf);
}
else
grub_printf ("0x%x\n", value);
return 0; return 0;
} }
@ -51,18 +75,42 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
{ {
grub_target_addr_t addr; grub_target_addr_t addr;
grub_uint32_t value; grub_uint32_t value;
grub_uint32_t mask = 0xffffffff;
if (argc != 2) if (argc != 2 && argc != 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments"); return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0); addr = grub_strtoul (argv[0], 0, 0);
value = grub_strtoul (argv[1], 0, 0); value = grub_strtoul (argv[1], 0, 0);
if (cmd->name[6] == 'd') if (argc == 3)
*((grub_uint32_t *) addr) = value; mask = grub_strtoul (argv[2], 0, 0);
else if (cmd->name[6] == 'w') value &= mask;
*((grub_uint16_t *) addr) = (grub_uint16_t) value; switch (cmd->name[sizeof ("write_") - 1])
else {
*((grub_uint8_t *) addr) = (grub_uint8_t) value; case 'd':
if (mask != 0xffffffff)
*((volatile grub_uint32_t *) addr)
= (*((volatile grub_uint32_t *) addr) & ~mask) | value;
else
*((volatile grub_uint32_t *) addr) = value;
break;
case 'w':
if ((mask & 0xffff) != 0xffff)
*((volatile grub_uint16_t *) addr)
= (*((volatile grub_uint16_t *) addr) & ~mask) | value;
else
*((volatile grub_uint16_t *) addr) = value;
break;
case 'b':
if ((mask & 0xff) != 0xff)
*((volatile grub_uint8_t *) addr)
= (*((volatile grub_uint8_t *) addr) & ~mask) | value;
else
*((volatile grub_uint8_t *) addr) = value;
break;
}
return 0; return 0;
} }
@ -70,30 +118,30 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
GRUB_MOD_INIT(memrw) GRUB_MOD_INIT(memrw)
{ {
cmd_read_byte = cmd_read_byte =
grub_register_command ("read_byte", grub_cmd_read, grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_byte ADDR", "Read byte from ADDR."); "read_byte ADDR", "Read byte from ADDR.", options);
cmd_read_word = cmd_read_word =
grub_register_command ("read_word", grub_cmd_read, grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_word ADDR", "Read word from ADDR."); "read_word ADDR", "Read word from ADDR.", options);
cmd_read_dword = cmd_read_dword =
grub_register_command ("read_dword", grub_cmd_read, grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_dword ADDR", "Read dword from ADDR."); "read_dword ADDR", "Read dword from ADDR.", options);
cmd_write_byte = cmd_write_byte =
grub_register_command ("write_byte", grub_cmd_write, grub_register_command ("write_byte", grub_cmd_write,
"write_byte ADDR VALUE", "Write byte VALUE to ADDR."); "write_byte ADDR VALUE [MASK]", "Write byte VALUE to ADDR.");
cmd_write_word = cmd_write_word =
grub_register_command ("write_word", grub_cmd_write, grub_register_command ("write_word", grub_cmd_write,
"write_word ADDR VALUE", "Write word VALUE to ADDR."); "write_word ADDR VALUE [MASK]", "Write word VALUE to ADDR.");
cmd_write_dword = cmd_write_dword =
grub_register_command ("write_dword", grub_cmd_write, grub_register_command ("write_dword", grub_cmd_write,
"write_dword ADDR VALUE", "Write dword VALUE to ADDR."); "write_dword ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
} }
GRUB_MOD_FINI(memrw) GRUB_MOD_FINI(memrw)
{ {
grub_unregister_command (cmd_read_byte); grub_unregister_extcmd (cmd_read_byte);
grub_unregister_command (cmd_read_word); grub_unregister_extcmd (cmd_read_word);
grub_unregister_command (cmd_read_dword); grub_unregister_extcmd (cmd_read_dword);
grub_unregister_command (cmd_write_byte); grub_unregister_command (cmd_write_byte);
grub_unregister_command (cmd_write_word); grub_unregister_command (cmd_write_word);
grub_unregister_command (cmd_write_dword); grub_unregister_command (cmd_write_dword);

View file

@ -31,7 +31,7 @@
#include <grub/env.h> #include <grub/env.h>
#include <grub/extcmd.h> #include <grub/extcmd.h>
static const struct grub_arg_option options[] = static const struct grub_arg_option options[] =
{ {
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, {"set", 's', GRUB_ARG_OPTION_OPTIONAL,
"Set a variable to return value.", "VAR", ARG_TYPE_STRING}, "Set a variable to return value.", "VAR", ARG_TYPE_STRING},

View file

@ -1,4 +1,4 @@
/* xnu_uuid.c - transform 64-bit serial number /* xnu_uuid.c - transform 64-bit serial number
to 128-bit uuid suitable for xnu. */ to 128-bit uuid suitable for xnu. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
@ -33,10 +33,10 @@
#include <grub/command.h> #include <grub/command.h>
#include <grub/crypto.h> #include <grub/crypto.h>
/* This prefix is used by xnu and boot-132 to hash /* This prefix is used by xnu and boot-132 to hash
together with volume serial. */ together with volume serial. */
static grub_uint8_t hash_prefix[16] static grub_uint8_t hash_prefix[16]
= {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6, = {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC}; 0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC};
static grub_err_t static grub_err_t

View file

@ -109,7 +109,7 @@ pkglib_MODULES = linux.mod multiboot.mod \
lsmmap.mod mmap.mod lsmmap.mod mmap.mod
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -67,7 +67,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -60,7 +60,7 @@ pkglib_MODULES = halt.mod reboot.mod suspend.mod \
date.mod datehook.mod lsmmap.mod mmap.mod date.mod datehook.mod lsmmap.mod mmap.mod
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -128,7 +128,7 @@ pkglib_MODULES = biosdisk.mod chain.mod \
efiemu.mod mmap.mod acpi.mod drivemap.mod efiemu.mod mmap.mod acpi.mod drivemap.mod
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -66,7 +66,7 @@ pkglib_MODULES = halt.mod \
lsmmap.mod lsmmap.mod
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -103,7 +103,7 @@ pkglib_MODULES = halt.mod \
lsmmap.mod lsmmap.mod
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -67,7 +67,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod. # For boot.mod.
pkglib_MODULES += boot.mod pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS) boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS) boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -110,7 +110,7 @@ static grub_err_t
grub_pxefs_dir (grub_device_t device __attribute__ ((unused)), grub_pxefs_dir (grub_device_t device __attribute__ ((unused)),
const char *path __attribute__ ((unused)), const char *path __attribute__ ((unused)),
int (*hook) (const char *filename, int (*hook) (const char *filename,
const struct grub_dirhook_info *info) const struct grub_dirhook_info *info)
__attribute__ ((unused))) __attribute__ ((unused)))
{ {
return GRUB_ERR_NONE; return GRUB_ERR_NONE;

View file

@ -364,6 +364,7 @@ class Script
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status #{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
./config.status --file=#{name}:#{src} ./config.status --file=#{name}:#{src}
sed -i -e 's,@pkglib_DATA@,$(pkglib_DATA),g' $@
chmod +x $@ chmod +x $@
" "

View file

@ -29,8 +29,8 @@
#include <grub/gzio.h> #include <grub/gzio.h>
#include <grub/i18n.h> #include <grub/i18n.h>
/* /*
.mo file information from: .mo file information from:
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html . http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
*/ */

View file

@ -24,7 +24,7 @@
#define GRUB_EFI_GOP_GUID \ #define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }} { 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
typedef enum typedef enum
{ {
GRUB_EFI_GOT_RGBA8, GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8, GRUB_EFI_GOT_BGRA8,

View file

@ -85,7 +85,7 @@
struct grub_machine_bios_data_area struct grub_machine_bios_data_area
{ {
grub_uint8_t unused1[0x17]; grub_uint8_t unused1[0x17];
grub_uint8_t keyboard_flag_lower; /* 0x17 */ grub_uint8_t keyboard_flag_lower; /* 0x17 */
grub_uint8_t unused2[0xf0 - 0x18]; grub_uint8_t unused2[0xf0 - 0x18];
}; };

View file

@ -174,12 +174,12 @@ grub_env_export (const char *name)
if (! var) if (! var)
{ {
grub_err_t err; grub_err_t err;
err = grub_env_set (name, ""); err = grub_env_set (name, "");
if (err) if (err)
return err; return err;
var = grub_env_find (name); var = grub_env_find (name);
} }
var->type = GRUB_ENV_VAR_GLOBAL; var->type = GRUB_ENV_VAR_GLOBAL;
return GRUB_ERR_NONE; return GRUB_ERR_NONE;

View file

@ -81,7 +81,7 @@ codestart:
movl $END_SYMBOL, %ecx movl $END_SYMBOL, %ecx
subl %edi, %ecx subl %edi, %ecx
#endif #endif
/* clean out */ /* clean out */
xorl %eax, %eax xorl %eax, %eax
cld cld

View file

@ -33,7 +33,7 @@ grub_get_root_biosnumber_default (void)
return grub_strtoul (biosnum, 0, 0); return grub_strtoul (biosnum, 0, 0);
dev = grub_device_open (0); dev = grub_device_open (0);
if (dev && dev->disk && dev->disk->dev if (dev && dev->disk && dev->disk->dev
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID) && dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
ret = (int) dev->disk->id; ret = (int) dev->disk->id;

View file

@ -85,14 +85,14 @@ write_call_relocator_fw (void *ptr, void *src, grub_uint32_t dest,
grub_relocator32_forward_dest = dest; grub_relocator32_forward_dest = dest;
grub_relocator32_forward_src = PTR_TO_UINT64 (src); grub_relocator32_forward_src = PTR_TO_UINT64 (src);
grub_relocator32_forward_size = size; grub_relocator32_forward_size = size;
grub_relocator32_forward_eax = state.eax; grub_relocator32_forward_eax = state.eax;
grub_relocator32_forward_ebx = state.ebx; grub_relocator32_forward_ebx = state.ebx;
grub_relocator32_forward_ecx = state.ecx; grub_relocator32_forward_ecx = state.ecx;
grub_relocator32_forward_edx = state.edx; grub_relocator32_forward_edx = state.edx;
grub_relocator32_forward_eip = state.eip; grub_relocator32_forward_eip = state.eip;
grub_relocator32_forward_esp = state.esp; grub_relocator32_forward_esp = state.esp;
grub_memmove (ptr, grub_memmove (ptr,
&grub_relocator32_forward_start, &grub_relocator32_forward_start,
RELOCATOR_SIZEOF (forward)); RELOCATOR_SIZEOF (forward));

View file

@ -32,8 +32,8 @@
#else #else
#define RAX %eax #define RAX %eax
#define RCX %ecx #define RCX %ecx
#define RDI %edi #define RDI %edi
#define RSI %esi #define RSI %esi
#endif #endif
/* The code segment of the protected mode. */ /* The code segment of the protected mode. */
@ -41,7 +41,7 @@
/* The data segment of the protected mode. */ /* The data segment of the protected mode. */
#define DATA_SEGMENT 0x18 #define DATA_SEGMENT 0x18
.p2align 4 /* force 16-byte alignment */ .p2align 4 /* force 16-byte alignment */
RELOCATOR_VARIABLE(start) RELOCATOR_VARIABLE(start)
@ -92,7 +92,7 @@ RELOCATOR_VARIABLE(size)
#endif #endif
mov RDI, RAX mov RDI, RAX
#ifdef BACKWARD #ifdef BACKWARD
add RCX, RSI add RCX, RSI
add RCX, RDI add RCX, RDI
@ -104,7 +104,7 @@ RELOCATOR_VARIABLE(size)
add $0x3, RCX add $0x3, RCX
shr $2, RCX shr $2, RCX
#ifdef BACKWARD #ifdef BACKWARD
/* Backward movsl is implicitly off-by-four. compensate that. */ /* Backward movsl is implicitly off-by-four. compensate that. */
sub $4, RSI sub $4, RSI
@ -213,7 +213,7 @@ RELOCATOR_VARIABLE (eip)
LOCAL(gdt): LOCAL(gdt):
/* NULL. */ /* NULL. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Reserved. */ /* Reserved. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -234,7 +234,7 @@ LOCAL(gdt_addr):
/* Filled by the code. */ /* Filled by the code. */
.long 0 .long 0
#endif #endif
.p2align 4 .p2align 4
LOCAL(jump_vector): LOCAL(jump_vector):
/* Jump location. Is filled by the code */ /* Jump location. Is filled by the code */

View file

@ -79,7 +79,7 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
/* Very unlikely condition: Relocator may risk overwrite itself. /* Very unlikely condition: Relocator may risk overwrite itself.
Just move it a bit up. */ Just move it a bit up. */
if ((grub_addr_t) dest < (grub_addr_t) relocator if ((grub_addr_t) dest < (grub_addr_t) relocator
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN) + (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
&& (grub_addr_t) dest + (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN) && (grub_addr_t) dest + (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
> (grub_addr_t) relocator) > (grub_addr_t) relocator)
{ {
@ -105,7 +105,7 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
"Backward relocator: code %p, source: %p, " "Backward relocator: code %p, source: %p, "
"destination: 0x%x, size: 0x%lx\n", "destination: 0x%x, size: 0x%lx\n",
(char *) relocator - overhead, (char *) relocator - overhead,
(char *) relocator - overhead, (char *) relocator - overhead,
(unsigned) dest - overhead, (unsigned) dest - overhead,
(unsigned long) size + overhead); (unsigned long) size + overhead);

View file

@ -140,7 +140,7 @@ grub_bsd_get_device (grub_uint32_t * biosdev,
grub_uint32_t * slice, grub_uint32_t * part) grub_uint32_t * slice, grub_uint32_t * part)
{ {
char *p; char *p;
grub_device_t dev; grub_device_t dev;
#ifdef GRUB_MACHINE_PCBIOS #ifdef GRUB_MACHINE_PCBIOS
*biosdev = grub_get_root_biosnumber () & 0xff; *biosdev = grub_get_root_biosnumber () & 0xff;

View file

@ -201,7 +201,7 @@ grub_multiboot_get_bootdev (grub_uint32_t *bootdev)
if (dev) if (dev)
grub_device_close (dev); grub_device_close (dev);
*bootdev = ((biosdev & 0xff) << 24) | ((slice & 0xff) << 16) *bootdev = ((biosdev & 0xff) << 24) | ((slice & 0xff) << 16)
| ((part & 0xff) << 8) | 0xff; | ((part & 0xff) << 8) | 0xff;
return (biosdev != ~0UL); return (biosdev != ~0UL);
#else #else

View file

@ -102,7 +102,7 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
if (dev) if (dev)
grub_device_close (dev); grub_device_close (dev);
/* Ignore errors. Perhaps it's not fatal. */ /* Ignore errors. Perhaps it's not fatal. */
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;

View file

@ -832,7 +832,7 @@ grub_xnu_boot_resume (void)
state.eax = grub_xnu_arg1; state.eax = grub_xnu_arg1;
return grub_relocator32_boot (grub_xnu_heap_start, grub_xnu_heap_will_be_at, return grub_relocator32_boot (grub_xnu_heap_start, grub_xnu_heap_will_be_at,
state); state);
} }
/* Boot xnu. */ /* Boot xnu. */

View file

@ -67,7 +67,7 @@ grub_xnu_heap_malloc (int size)
advanced mm is ready. */ advanced mm is ready. */
grub_xnu_heap_start grub_xnu_heap_start
= XNU_RELOCATOR (realloc) (grub_xnu_heap_start, = XNU_RELOCATOR (realloc) (grub_xnu_heap_start,
newblknum newblknum
* GRUB_XNU_HEAP_ALLOC_BLOCK); * GRUB_XNU_HEAP_ALLOC_BLOCK);
if (!grub_xnu_heap_start) if (!grub_xnu_heap_start)
return NULL; return NULL;
@ -1326,20 +1326,20 @@ grub_xnu_fill_devicetree (void)
nextdot = curdot + grub_strlen (curdot) + 1; nextdot = curdot + grub_strlen (curdot) + 1;
name = grub_realloc (name, nextdot - curdot + 1); name = grub_realloc (name, nextdot - curdot + 1);
if (!name) if (!name)
return 1; return 1;
unescape (name, curdot, nextdot, &len); unescape (name, curdot, nextdot, &len);
name[len] = 0; name[len] = 0;
curvalue = grub_xnu_create_value (curkey, name); curvalue = grub_xnu_create_value (curkey, name);
grub_free (name); grub_free (name);
data = grub_malloc (grub_strlen (var->value) + 1); data = grub_malloc (grub_strlen (var->value) + 1);
if (!data) if (!data)
return 1; return 1;
unescape (data, var->value, var->value + grub_strlen (var->value), unescape (data, var->value, var->value + grub_strlen (var->value),
&len); &len);
curvalue->datasize = len; curvalue->datasize = len;

View file

@ -391,17 +391,17 @@ grub_normal_init_page (void)
char *msg_formatted = grub_malloc (grub_strlen(msg) + char *msg_formatted = grub_malloc (grub_strlen(msg) +
grub_strlen(PACKAGE_VERSION)); grub_strlen(PACKAGE_VERSION));
grub_cls (); grub_cls ();
grub_sprintf (msg_formatted, msg, PACKAGE_VERSION); grub_sprintf (msg_formatted, msg, PACKAGE_VERSION);
grub_uint32_t *unicode_msg; grub_uint32_t *unicode_msg;
grub_uint32_t *last_position; grub_uint32_t *last_position;
msg_len = grub_utf8_to_ucs4_alloc (msg_formatted, msg_len = grub_utf8_to_ucs4_alloc (msg_formatted,
&unicode_msg, &last_position); &unicode_msg, &last_position);
if (msg_len < 0) if (msg_len < 0)
{ {
return; return;
@ -529,7 +529,7 @@ grub_normal_reader_init (void)
const char *msg_esc = _("ESC at any time exits."); const char *msg_esc = _("ESC at any time exits.");
char *msg_formatted = grub_malloc (sizeof (char) * (grub_strlen (msg) + char *msg_formatted = grub_malloc (sizeof (char) * (grub_strlen (msg) +
grub_strlen(msg_esc) + 1)); grub_strlen(msg_esc) + 1));
grub_sprintf (msg_formatted, msg, reader_nested ? msg_esc : ""); grub_sprintf (msg_formatted, msg, reader_nested ? msg_esc : "");
@ -537,7 +537,7 @@ grub_normal_reader_init (void)
grub_puts ("\n"); grub_puts ("\n");
grub_free (msg_formatted); grub_free (msg_formatted);
return 0; return 0;
} }

View file

@ -71,7 +71,7 @@ grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
grub_ssize_t msg_len = grub_strlen (msg); grub_ssize_t msg_len = grub_strlen (msg);
*unicode_msg = grub_malloc (grub_strlen (msg) * sizeof (grub_uint32_t)); *unicode_msg = grub_malloc (grub_strlen (msg) * sizeof (grub_uint32_t));
if (!*unicode_msg) if (!*unicode_msg)
{ {
grub_printf ("utf8_to_ucs4 ERROR1: %s", msg); grub_printf ("utf8_to_ucs4 ERROR1: %s", msg);
@ -133,7 +133,7 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right)
{ {
if (! first_loop) if (! first_loop)
grub_putchar ('\n'); grub_putchar ('\n');
next_new_line = (grub_uint32_t *) last_position; next_new_line = (grub_uint32_t *) last_position;
while (grub_getstringwidth (current_position, next_new_line) > line_len while (grub_getstringwidth (current_position, next_new_line) > line_len
@ -402,7 +402,7 @@ print_timeout (int timeout, int offset)
grub_sprintf (msg_translated, msg, timeout); grub_sprintf (msg_translated, msg, timeout);
grub_print_message_indented (msg_translated, 3, 0); grub_print_message_indented (msg_translated, 3, 0);
int posx; int posx;
posx = grub_getxy() >> 8; posx = grub_getxy() >> 8;
print_spaces (GRUB_TERM_WIDTH - posx - 1); print_spaces (GRUB_TERM_WIDTH - posx - 1);

View file

@ -483,7 +483,7 @@ grub_util_is_dmraid (const char *os_dev)
return 1; return 1;
else if (! strncmp (os_dev, "/dev/mapper/sil_", 16)) else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
return 1; return 1;
return 0; return 0;
} }

View file

@ -100,7 +100,7 @@ prepare_grub_to_access_device ()
# Abstraction modules aren't auto-loaded. # Abstraction modules aren't auto-loaded.
abstraction="`${grub_probe} --device ${device} --target=abstraction`" abstraction="`${grub_probe} --device ${device} --target=abstraction`"
for module in ${abstraction} ; do for module in ${abstraction} ; do
echo "insmod ${module}" echo "insmod ${module}"
done done

View file

@ -28,6 +28,7 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@ PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@ target_cpu=@target_cpu@
native_platform=@platform@ native_platform=@platform@
pkglib_DATA="@pkglib_DATA@"
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
@ -93,12 +94,16 @@ process_input_dir ()
input_dir="$1" input_dir="$1"
platform="$2" platform="$2"
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform} mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ for file in ${input_dir}/*.mod; do
${input_dir}/*.lst; do
if test -f "$file"; then if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi fi
done done
for file in ${pkglib_DATA}; do
if test -f "${input_dir}/${file}"; then
cp -f "${input_dir}/${file}" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
mkdir -p ${iso9660_dir}/boot/grub/locale mkdir -p ${iso9660_dir}/boot/grub/locale
for file in ${input_dir}/po/*.mo; do for file in ${input_dir}/po/*.mo; do

View file

@ -107,12 +107,12 @@ if [ "x${LANG}" != "xC" ] ; then
cat << EOF cat << EOF
set locale_dir=${locale_dir} set locale_dir=${locale_dir}
set lang=${grub_lang} set lang=${grub_lang}
insmod gettext insmod gettext
EOF EOF
fi fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose= verbose=
else else
verbose=" --verbose" verbose=" --verbose"

View file

@ -37,7 +37,7 @@ if [ -z "${OSPROBED}" ] ; then
exit 0 exit 0
fi fi
osx_entry { osx_entry() {
cat << EOF cat << EOF
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" { menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
EOF EOF

View file

@ -204,19 +204,19 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
if (num > 0xffff) if (num > 0xffff)
grub_util_error (_("the core image is too big")); grub_util_error (_("the core image is too big"));
boot_path = grub_util_get_path (dir, "diskboot.img"); boot_path = grub_util_get_path (dir, "diskboot.img");
boot_size = grub_util_get_image_size (boot_path); boot_size = grub_util_get_image_size (boot_path);
if (boot_size != GRUB_DISK_SECTOR_SIZE) if (boot_size != GRUB_DISK_SECTOR_SIZE)
grub_util_error (_("diskboot.img size must be %u bytes"), GRUB_DISK_SECTOR_SIZE); grub_util_error (_("diskboot.img size must be %u bytes"), GRUB_DISK_SECTOR_SIZE);
boot_img = grub_util_read_image (boot_path); boot_img = grub_util_read_image (boot_path);
/* i386 is a little endian architecture. */ /* i386 is a little endian architecture. */
*((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE *((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE
- GRUB_BOOT_MACHINE_LIST_SIZE + 8)) - GRUB_BOOT_MACHINE_LIST_SIZE + 8))
= grub_cpu_to_le16 (num); = grub_cpu_to_le16 (num);
grub_util_write_image (boot_img, boot_size, out); grub_util_write_image (boot_img, boot_size, out);
free (boot_img); free (boot_img);
free (boot_path); free (boot_path);

View file

@ -1,6 +1,6 @@
/* /*
* Program eltorito.c - Handle El Torito specific extensions to iso9660. * Program eltorito.c - Handle El Torito specific extensions to iso9660.
* *
Written by Michael Fulbright <msf@redhat.com> (1996). Written by Michael Fulbright <msf@redhat.com> (1996).
@ -53,7 +53,7 @@ static struct eltorito_boot_descriptor gboot_desc;
static int tvd_write __PR((FILE * outfile)); static int tvd_write __PR((FILE * outfile));
/* /*
* Check for presence of boot catalog. If it does not exist then make it * Check for presence of boot catalog. If it does not exist then make it
*/ */
void FDECL1(init_boot_catalog, const char *, path) void FDECL1(init_boot_catalog, const char *, path)
{ {
@ -61,37 +61,37 @@ void FDECL1(init_boot_catalog, const char *, path)
char * bootpath; /* filename of boot catalog */ char * bootpath; /* filename of boot catalog */
char * buf; char * buf;
struct stat statbuf; struct stat statbuf;
bootpath = (char *) e_malloc(strlen(boot_catalog)+strlen(path)+2); bootpath = (char *) e_malloc(strlen(boot_catalog)+strlen(path)+2);
strcpy(bootpath, path); strcpy(bootpath, path);
if (bootpath[strlen(bootpath)-1] != '/') if (bootpath[strlen(bootpath)-1] != '/')
{ {
strcat(bootpath,"/"); strcat(bootpath,"/");
} }
strcat(bootpath, boot_catalog); strcat(bootpath, boot_catalog);
/* /*
* check for the file existing * check for the file existing
*/ */
#ifdef DEBUG_TORITO #ifdef DEBUG_TORITO
fprintf(stderr,"Looking for boot catalog file %s\n",bootpath); fprintf(stderr,"Looking for boot catalog file %s\n",bootpath);
#endif #endif
if (!stat_filter(bootpath, &statbuf)) if (!stat_filter(bootpath, &statbuf))
{ {
/* /*
* make sure its big enough to hold what we want * make sure its big enough to hold what we want
*/ */
if (statbuf.st_size == 2048) if (statbuf.st_size == 2048)
{ {
/* /*
* printf("Boot catalog exists, so we do nothing\n"); * printf("Boot catalog exists, so we do nothing\n");
*/ */
free(bootpath); free(bootpath);
return; return;
} }
else else
{ {
fprintf (stderr, _("A boot catalog exists and appears corrupted.\n")); fprintf (stderr, _("A boot catalog exists and appears corrupted.\n"));
fprintf (stderr, _("Please check the following file: %s.\n"), bootpath); fprintf (stderr, _("Please check the following file: %s.\n"), bootpath);
@ -100,15 +100,15 @@ void FDECL1(init_boot_catalog, const char *, path)
exit (1); exit (1);
} }
} }
/* /*
* file does not exist, so we create it * file does not exist, so we create it
* make it one CD sector long * make it one CD sector long
*/ */
bcat = fopen (bootpath, "wb"); bcat = fopen (bootpath, "wb");
if (bcat == NULL) if (bcat == NULL)
error (1, errno, _("Error creating boot catalog (%s)"), bootpath); error (1, errno, _("Error creating boot catalog (%s)"), bootpath);
buf = (char *) e_malloc( 2048 ); buf = (char *) e_malloc( 2048 );
if (fwrite (buf, 1, 2048, bcat) != 2048) if (fwrite (buf, 1, 2048, bcat) != 2048)
error (1, errno, _("Error writing to boot catalog (%s)"), bootpath); error (1, errno, _("Error writing to boot catalog (%s)"), bootpath);
@ -127,65 +127,65 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
struct directory_entry * de2; struct directory_entry * de2;
unsigned int i; unsigned int i;
int nsectors; int nsectors;
memset(boot_desc, 0, sizeof(*boot_desc)); memset(boot_desc, 0, sizeof(*boot_desc));
boot_desc->id[0] = 0; boot_desc->id[0] = 0;
memcpy(boot_desc->id2, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID)); memcpy(boot_desc->id2, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
boot_desc->version[0] = 1; boot_desc->version[0] = 1;
memcpy(boot_desc->system_id, EL_TORITO_ID, sizeof(EL_TORITO_ID)); memcpy(boot_desc->system_id, EL_TORITO_ID, sizeof(EL_TORITO_ID));
/* /*
* search from root of iso fs to find boot catalog * search from root of iso fs to find boot catalog
*/ */
de2 = search_tree_file(root, boot_catalog); de2 = search_tree_file(root, boot_catalog);
if (!de2) if (!de2)
{ {
fprintf (stderr, _("Boot catalog cannot be found!\n")); fprintf (stderr, _("Boot catalog cannot be found!\n"));
exit (1); exit (1);
} }
set_731(boot_desc->bootcat_ptr, set_731(boot_desc->bootcat_ptr,
(unsigned int) get_733(de2->isorec.extent)); (unsigned int) get_733(de2->isorec.extent));
/* /*
* now adjust boot catalog * now adjust boot catalog
* lets find boot image first * lets find boot image first
*/ */
de=search_tree_file(root, boot_image); de=search_tree_file(root, boot_image);
if (!de) if (!de)
{ {
fprintf (stderr, _("Boot image cannot be found!\n")); fprintf (stderr, _("Boot image cannot be found!\n"));
exit (1); exit (1);
} }
/* /*
* we have the boot image, so write boot catalog information * we have the boot image, so write boot catalog information
* Next we write out the primary descriptor for the disc * Next we write out the primary descriptor for the disc
*/ */
memset(&valid_desc, 0, sizeof(valid_desc)); memset(&valid_desc, 0, sizeof(valid_desc));
valid_desc.headerid[0] = 1; valid_desc.headerid[0] = 1;
valid_desc.arch[0] = EL_TORITO_ARCH_x86; valid_desc.arch[0] = EL_TORITO_ARCH_x86;
/* /*
* we'll shove start of publisher id into id field, may get truncated * we'll shove start of publisher id into id field, may get truncated
* but who really reads this stuff! * but who really reads this stuff!
*/ */
if (publisher) if (publisher)
memcpy_max(valid_desc.id, publisher, MIN(23, strlen(publisher))); memcpy_max(valid_desc.id, publisher, MIN(23, strlen(publisher)));
valid_desc.key1[0] = 0x55; valid_desc.key1[0] = 0x55;
valid_desc.key2[0] = 0xAA; valid_desc.key2[0] = 0xAA;
/* /*
* compute the checksum * compute the checksum
*/ */
checksum=0; checksum=0;
checksum_ptr = (unsigned char *) &valid_desc; checksum_ptr = (unsigned char *) &valid_desc;
for (i=0; i<sizeof(valid_desc); i+=2) for (i=0; i<sizeof(valid_desc); i+=2)
{ {
/* /*
* skip adding in ckecksum word, since we dont have it yet! * skip adding in ckecksum word, since we dont have it yet!
*/ */
if (i == 28) if (i == 28)
{ {
@ -194,82 +194,82 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
checksum += (unsigned int)checksum_ptr[i]; checksum += (unsigned int)checksum_ptr[i];
checksum += ((unsigned int)checksum_ptr[i+1])*256; checksum += ((unsigned int)checksum_ptr[i+1])*256;
} }
/* /*
* now find out the real checksum * now find out the real checksum
*/ */
checksum = -checksum; checksum = -checksum;
set_721(valid_desc.cksum, (unsigned int) checksum); set_721(valid_desc.cksum, (unsigned int) checksum);
/* /*
* now make the initial/default entry for boot catalog * now make the initial/default entry for boot catalog
*/ */
memset(&default_desc, 0, sizeof(default_desc)); memset(&default_desc, 0, sizeof(default_desc));
default_desc.boot_id[0] = EL_TORITO_BOOTABLE; default_desc.boot_id[0] = EL_TORITO_BOOTABLE;
/* /*
* use default BIOS loadpnt * use default BIOS loadpnt
*/ */
set_721(default_desc.loadseg, 0); set_721(default_desc.loadseg, 0);
default_desc.arch[0] = EL_TORITO_ARCH_x86; default_desc.arch[0] = EL_TORITO_ARCH_x86;
/* /*
* figure out size of boot image in sectors, for now hard code to * figure out size of boot image in sectors, for now hard code to
* assume 512 bytes/sector on a bootable floppy * assume 512 bytes/sector on a bootable floppy
*/ */
nsectors = ((de->size + 511) & ~(511))/512; nsectors = ((de->size + 511) & ~(511))/512;
fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors); fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
fprintf (stderr, " -> "); fprintf (stderr, " -> ");
if (! use_eltorito_emul_floppy) if (! use_eltorito_emul_floppy)
{ {
default_desc.boot_media[0] = EL_TORITO_MEDIA_NOEMUL; default_desc.boot_media[0] = EL_TORITO_MEDIA_NOEMUL;
fprintf (stderr, _("No emulation\n")); fprintf (stderr, _("No emulation\n"));
} }
else if (nsectors == 2880 ) else if (nsectors == 2880 )
/* /*
* choose size of emulated floppy based on boot image size * choose size of emulated floppy based on boot image size
*/ */
{ {
default_desc.boot_media[0] = EL_TORITO_MEDIA_144FLOP; default_desc.boot_media[0] = EL_TORITO_MEDIA_144FLOP;
fprintf (stderr, _("Emulating a 1.44 meg floppy\n")); fprintf (stderr, _("Emulating a 1.44 meg floppy\n"));
} }
else if (nsectors == 5760 ) else if (nsectors == 5760 )
{ {
default_desc.boot_media[0] = EL_TORITO_MEDIA_288FLOP; default_desc.boot_media[0] = EL_TORITO_MEDIA_288FLOP;
fprintf (stderr, _("Emulating a 2.88 meg floppy\n")); fprintf (stderr, _("Emulating a 2.88 meg floppy\n"));
} }
else if (nsectors == 2400 ) else if (nsectors == 2400 )
{ {
default_desc.boot_media[0] = EL_TORITO_MEDIA_12FLOP; default_desc.boot_media[0] = EL_TORITO_MEDIA_12FLOP;
fprintf (stderr, _("Emulating a 1.2 meg floppy\n")); fprintf (stderr, _("Emulating a 1.2 meg floppy\n"));
} }
else else
{ {
fprintf (stderr, _("\nError - boot image is not the an allowable size.\n")); fprintf (stderr, _("\nError - boot image is not the an allowable size.\n"));
exit (1); exit (1);
} }
/* /*
* FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!! * FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!!
*/ */
nsectors = 1; nsectors = 1;
set_721(default_desc.nsect, (unsigned int) nsectors ); set_721(default_desc.nsect, (unsigned int) nsectors );
#ifdef DEBUG_TORITO #ifdef DEBUG_TORITO
fprintf(stderr,"Extent of boot images is %d\n",get_733(de->isorec.extent)); fprintf(stderr,"Extent of boot images is %d\n",get_733(de->isorec.extent));
#endif #endif
set_731(default_desc.bootoff, set_731(default_desc.bootoff,
(unsigned int) get_733(de->isorec.extent)); (unsigned int) get_733(de->isorec.extent));
/* /*
* now write it to disk * now write it to disk
*/ */
bootcat = fopen (de2->whole_name, "r+b"); bootcat = fopen (de2->whole_name, "r+b");
if (bootcat == NULL) if (bootcat == NULL)
error (1, errno, _("Error opening boot catalog for update")); error (1, errno, _("Error opening boot catalog for update"));
/* /*
* write out * write out
*/ */
if (fwrite (&valid_desc, 1, 32, bootcat) != 32) if (fwrite (&valid_desc, 1, 32, bootcat) != 32)
error (1, errno, _("Error writing to boot catalog")); error (1, errno, _("Error writing to boot catalog"));
@ -332,7 +332,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
static int FDECL1(tvd_write, FILE *, outfile) static int FDECL1(tvd_write, FILE *, outfile)
{ {
/* /*
* Next we write out the boot volume descriptor for the disc * Next we write out the boot volume descriptor for the disc
*/ */
get_torito_desc(&gboot_desc); get_torito_desc(&gboot_desc);
xfwrite(&gboot_desc, 1, 2048, outfile); xfwrite(&gboot_desc, 1, 2048, outfile);

View file

@ -1,6 +1,6 @@
/* /*
* 9-Dec-93 R.-D. Marzusch, marzusch@odiehh.hanse.de: * 9-Dec-93 R.-D. Marzusch, marzusch@odiehh.hanse.de:
* added 'exclude' option (-x) to specify pathnames NOT to be included in * added 'exclude' option (-x) to specify pathnames NOT to be included in
* CD image. * CD image.
* *
* $Id: exclude.h,v 1.2 1999/03/02 03:41:25 eric Exp $ * $Id: exclude.h,v 1.2 1999/03/02 03:41:25 eric Exp $

View file

@ -33,7 +33,7 @@ void FDECL1(add_hash, struct directory_entry *, spnt){
struct file_hash * s_hash; struct file_hash * s_hash;
unsigned int hash_number; unsigned int hash_number;
if(spnt->size == 0 || spnt->starting_block == 0) if(spnt->size == 0 || spnt->starting_block == 0)
if(spnt->size != 0 || spnt->starting_block != 0) { if(spnt->size != 0 || spnt->starting_block != 0) {
fprintf(stderr,"Non zero-length file assigned zero extent.\n"); fprintf(stderr,"Non zero-length file assigned zero extent.\n");
exit(1); exit(1);
@ -116,10 +116,10 @@ static unsigned int FDECL1(name_hash, const char *, name)
{ {
unsigned int hash = 0; unsigned int hash = 0;
const char * p; const char * p;
p = name; p = name;
while (*p) while (*p)
{ {
/* /*
* Don't hash the iso9660 version number. This way * Don't hash the iso9660 version number. This way
@ -155,7 +155,7 @@ struct directory_entry * FDECL1(find_file_hash, char *, name)
struct name_hash * nh; struct name_hash * nh;
char * p1; char * p1;
char * p2; char * p2;
for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next) for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
{ {
p1 = name; p1 = name;
@ -220,6 +220,6 @@ void flush_file_hash(){
nh = nh1; nh = nh1;
} }
name_hash_table[i] = NULL; name_hash_table[i] = NULL;
} }
} }

View file

@ -138,7 +138,7 @@ struct eltorito_boot_info
char pvd_addr[ISODCL (1, 4)]; char pvd_addr[ISODCL (1, 4)];
/* Boot file address. */ /* Boot file address. */
char file_addr[ISODCL (5, 8)]; char file_addr[ISODCL (5, 8)];
/* Boot file length. */ /* Boot file length. */
char file_length[ISODCL (9, 12)]; char file_length[ISODCL (9, 12)];
/* Boot file checksum. */ /* Boot file checksum. */
char file_checksum[ISODCL (13, 16)]; char file_checksum[ISODCL (13, 16)];

View file

@ -87,13 +87,13 @@ static int DECL(joliet_sort_directory, (struct directory_entry ** sort_dir));
static void DECL(assign_joliet_directory_addresses, (struct directory * node)); static void DECL(assign_joliet_directory_addresses, (struct directory * node));
static int jroot_gen __PR((void)); static int jroot_gen __PR((void));
/* /*
* Function: convert_to_unicode * Function: convert_to_unicode
* *
* Purpose: Perform a 1/2 assed unicode conversion on a text * Purpose: Perform a 1/2 assed unicode conversion on a text
* string. * string.
* *
* Notes: * Notes:
*/ */
static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char *, source ) static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char *, source )
{ {
@ -127,9 +127,9 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
* JS integrated from: Achim_Kaiser@t-online.de * JS integrated from: Achim_Kaiser@t-online.de
* *
* Let all valid unicode characters pass through (assuming ISO-8859-1). * Let all valid unicode characters pass through (assuming ISO-8859-1).
* Others are set to '_' . * Others are set to '_' .
*/ */
if( tmpbuf[j] != 0 && if( tmpbuf[j] != 0 &&
(tmpbuf[j] <= 0x1f || (tmpbuf[j] >= 0x7F && tmpbuf[j] <= 0xA0)) ) (tmpbuf[j] <= 0x1f || (tmpbuf[j] >= 0x7F && tmpbuf[j] <= 0xA0)) )
{ {
buffer[i+1] = '_'; buffer[i+1] = '_';
@ -163,7 +163,7 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
} }
} }
/* /*
* Function: joliet_strlen * Function: joliet_strlen
* *
* Purpose: Return length in bytes of string after conversion to unicode. * Purpose: Return length in bytes of string after conversion to unicode.
@ -178,7 +178,7 @@ static int FDECL1(joliet_strlen, const char *, string)
rtn = strlen(string) << 1; rtn = strlen(string) << 1;
/* /*
* We do clamp the maximum length of a Joliet string to be the * We do clamp the maximum length of a Joliet string to be the
* maximum path size. This helps to ensure that we don't completely * maximum path size. This helps to ensure that we don't completely
* bolix things up with very long paths. The Joliet specs say * bolix things up with very long paths. The Joliet specs say
@ -191,7 +191,7 @@ static int FDECL1(joliet_strlen, const char *, string)
return rtn; return rtn;
} }
/* /*
* Function: get_joliet_vol_desc * Function: get_joliet_vol_desc
* *
* Purpose: generate a Joliet compatible volume desc. * Purpose: generate a Joliet compatible volume desc.
@ -212,7 +212,7 @@ static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, jvol_de
* "expands" 8 bit character codes to 16 bits and does nothing * "expands" 8 bit character codes to 16 bits and does nothing
* special with the Unicode characters, therefore shouldn't mkisofs * special with the Unicode characters, therefore shouldn't mkisofs
* really be stating that it's using UCS-2 Level 1, not Level 3 for * really be stating that it's using UCS-2 Level 1, not Level 3 for
* the Joliet directory tree. * the Joliet directory tree.
*/ */
strcpy(jvol_desc->escape_sequences, "%/@"); strcpy(jvol_desc->escape_sequences, "%/@");
@ -228,7 +228,7 @@ static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, jvol_de
/* /*
* Set this one up. * Set this one up.
*/ */
memcpy(jvol_desc->root_directory_record, &jroot_record, memcpy(jvol_desc->root_directory_record, &jroot_record,
sizeof(struct iso_directory_record)); sizeof(struct iso_directory_record));
/* /*
@ -256,7 +256,7 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
struct directory * dpnt; struct directory * dpnt;
dpnt = node; dpnt = node;
while (dpnt) while (dpnt)
{ {
if( (dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0 ) if( (dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0 )
@ -275,7 +275,7 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
} }
/* skip if hidden - but not for the rr_moved dir */ /* skip if hidden - but not for the rr_moved dir */
if(dpnt->subdir && (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir)) if(dpnt->subdir && (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir))
{ {
assign_joliet_directory_addresses(dpnt->subdir); assign_joliet_directory_addresses(dpnt->subdir);
} }
@ -283,13 +283,13 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
} }
} }
static static
void FDECL1(build_jpathlist, struct directory *, node) void FDECL1(build_jpathlist, struct directory *, node)
{ {
struct directory * dpnt; struct directory * dpnt;
dpnt = node; dpnt = node;
while (dpnt) while (dpnt)
{ {
@ -302,7 +302,7 @@ void FDECL1(build_jpathlist, struct directory *, node)
} }
} /* build_jpathlist(... */ } /* build_jpathlist(... */
static int FDECL2(joliet_compare_paths, void const *, r, void const *, l) static int FDECL2(joliet_compare_paths, void const *, r, void const *, l)
{ {
struct directory const *ll = *(struct directory * const *)l; struct directory const *ll = *(struct directory * const *)l;
struct directory const *rr = *(struct directory * const *)r; struct directory const *rr = *(struct directory * const *)r;
@ -325,13 +325,13 @@ static int FDECL2(joliet_compare_paths, void const *, r, void const *, l)
return -1; return -1;
} }
if (rparent > lparent) if (rparent > lparent)
{ {
return 1; return 1;
} }
return strcmp(rr->self->name, ll->self->name); return strcmp(rr->self->name, ll->self->name);
} /* compare_paths(... */ } /* compare_paths(... */
static int generate_joliet_path_tables() static int generate_joliet_path_tables()
@ -346,7 +346,7 @@ static int generate_joliet_path_tables()
int tablesize; int tablesize;
/* /*
* First allocate memory for the tables and initialize the memory * First allocate memory for the tables and initialize the memory
*/ */
tablesize = jpath_blocks << 11; tablesize = jpath_blocks << 11;
jpath_table_m = (char *) e_malloc(tablesize); jpath_table_m = (char *) e_malloc(tablesize);
@ -361,10 +361,10 @@ static int generate_joliet_path_tables()
exit (1); exit (1);
} }
/* /*
* Now start filling in the path tables. Start with root directory * Now start filling in the path tables. Start with root directory
*/ */
jpath_table_index = 0; jpath_table_index = 0;
jpathlist = (struct directory **) e_malloc(sizeof(struct directory *) jpathlist = (struct directory **) e_malloc(sizeof(struct directory *)
* next_jpath_index); * next_jpath_index);
memset(jpathlist, 0, sizeof(struct directory *) * next_jpath_index); memset(jpathlist, 0, sizeof(struct directory *) * next_jpath_index);
build_jpathlist(root); build_jpathlist(root);
@ -373,10 +373,10 @@ static int generate_joliet_path_tables()
{ {
fix = 0; fix = 0;
#ifdef __STDC__ #ifdef __STDC__
qsort(&jpathlist[1], next_jpath_index-1, sizeof(struct directory *), qsort(&jpathlist[1], next_jpath_index-1, sizeof(struct directory *),
(int (*)(const void *, const void *))joliet_compare_paths); (int (*)(const void *, const void *))joliet_compare_paths);
#else #else
qsort(&jpathlist[1], next_jpath_index-1, sizeof(struct directory *), qsort(&jpathlist[1], next_jpath_index-1, sizeof(struct directory *),
joliet_compare_paths); joliet_compare_paths);
#endif #endif
@ -399,20 +399,20 @@ static int generate_joliet_path_tables()
exit (1); exit (1);
} }
npnt = dpnt->de_name; npnt = dpnt->de_name;
npnt1 = strrchr(npnt, PATH_SEPARATOR); npnt1 = strrchr(npnt, PATH_SEPARATOR);
if(npnt1) if(npnt1)
{ {
npnt = npnt1 + 1; npnt = npnt1 + 1;
} }
de = dpnt->self; de = dpnt->self;
if(!de) if(!de)
{ {
fprintf (stderr, _("Fatal goof - directory has amnesia\n")); fprintf (stderr, _("Fatal goof - directory has amnesia\n"));
exit (1); exit (1);
} }
namelen = joliet_strlen(de->name); namelen = joliet_strlen(de->name);
if( dpnt == root ) if( dpnt == root )
@ -426,28 +426,28 @@ static int generate_joliet_path_tables()
jpath_table_m[jpath_table_index] = namelen; jpath_table_m[jpath_table_index] = namelen;
} }
jpath_table_index += 2; jpath_table_index += 2;
set_731(jpath_table_l + jpath_table_index, dpnt->jextent); set_731(jpath_table_l + jpath_table_index, dpnt->jextent);
set_732(jpath_table_m + jpath_table_index, dpnt->jextent); set_732(jpath_table_m + jpath_table_index, dpnt->jextent);
jpath_table_index += 4; jpath_table_index += 4;
if( dpnt->parent != reloc_dir ) if( dpnt->parent != reloc_dir )
{ {
set_721(jpath_table_l + jpath_table_index, set_721(jpath_table_l + jpath_table_index,
dpnt->parent->jpath_index); dpnt->parent->jpath_index);
set_722(jpath_table_m + jpath_table_index, set_722(jpath_table_m + jpath_table_index,
dpnt->parent->jpath_index); dpnt->parent->jpath_index);
} }
else else
{ {
set_721(jpath_table_l + jpath_table_index, set_721(jpath_table_l + jpath_table_index,
dpnt->self->parent_rec->filedir->jpath_index); dpnt->self->parent_rec->filedir->jpath_index);
set_722(jpath_table_m + jpath_table_index, set_722(jpath_table_m + jpath_table_index,
dpnt->self->parent_rec->filedir->jpath_index); dpnt->self->parent_rec->filedir->jpath_index);
} }
jpath_table_index += 2; jpath_table_index += 2;
/* /*
* The root directory is still represented in non-unicode fashion. * The root directory is still represented in non-unicode fashion.
*/ */
@ -459,19 +459,19 @@ static int generate_joliet_path_tables()
} }
else else
{ {
convert_to_unicode((uint8_t *)jpath_table_l + jpath_table_index, convert_to_unicode((uint8_t *)jpath_table_l + jpath_table_index,
namelen, de->name); namelen, de->name);
convert_to_unicode((uint8_t *)jpath_table_m + jpath_table_index, convert_to_unicode((uint8_t *)jpath_table_m + jpath_table_index,
namelen, de->name); namelen, de->name);
jpath_table_index += namelen; jpath_table_index += namelen;
} }
if(jpath_table_index & 1) if(jpath_table_index & 1)
{ {
jpath_table_index++; /* For odd lengths we pad */ jpath_table_index++; /* For odd lengths we pad */
} }
} }
free(jpathlist); free(jpathlist);
if(jpath_table_index != jpath_table_size) if(jpath_table_index != jpath_table_size)
{ {
@ -493,20 +493,20 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
unsigned int total_size; unsigned int total_size;
int cvt_len; int cvt_len;
struct directory * finddir; struct directory * finddir;
total_size = (dpnt->jsize + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1); total_size = (dpnt->jsize + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1);
directory_buffer = (char *) e_malloc(total_size); directory_buffer = (char *) e_malloc(total_size);
memset(directory_buffer, 0, total_size); memset(directory_buffer, 0, total_size);
dir_index = 0; dir_index = 0;
s_entry = dpnt->jcontents; s_entry = dpnt->jcontents;
while(s_entry) while(s_entry)
{ {
if(s_entry->de_flags & INHIBIT_JOLIET_ENTRY) { if(s_entry->de_flags & INHIBIT_JOLIET_ENTRY) {
s_entry = s_entry->jnext; s_entry = s_entry->jnext;
continue; continue;
} }
/* /*
* If this entry was a directory that was relocated, we have a bit * If this entry was a directory that was relocated, we have a bit
* of trouble here. We need to dig out the real thing and put it * of trouble here. We need to dig out the real thing and put it
@ -535,43 +535,43 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
{ {
s_entry1 = s_entry; s_entry1 = s_entry;
} }
/* /*
* We do not allow directory entries to cross sector boundaries. * We do not allow directory entries to cross sector boundaries.
* Simply pad, and then start the next entry at the next sector * Simply pad, and then start the next entry at the next sector
*/ */
new_reclen = s_entry1->jreclen; new_reclen = s_entry1->jreclen;
if( (dir_index & (SECTOR_SIZE - 1)) + new_reclen >= SECTOR_SIZE ) if( (dir_index & (SECTOR_SIZE - 1)) + new_reclen >= SECTOR_SIZE )
{ {
dir_index = (dir_index + (SECTOR_SIZE - 1)) & dir_index = (dir_index + (SECTOR_SIZE - 1)) &
~(SECTOR_SIZE - 1); ~(SECTOR_SIZE - 1);
} }
memcpy(&jrec, &s_entry1->isorec, sizeof(struct iso_directory_record) - memcpy(&jrec, &s_entry1->isorec, sizeof(struct iso_directory_record) -
sizeof(s_entry1->isorec.name)); sizeof(s_entry1->isorec.name));
cvt_len = joliet_strlen(s_entry1->name); cvt_len = joliet_strlen(s_entry1->name);
/* /*
* Fix the record length - this was the non-Joliet version we * Fix the record length - this was the non-Joliet version we
* were seeing. * were seeing.
*/ */
jrec.name_len[0] = cvt_len; jrec.name_len[0] = cvt_len;
jrec.length[0] = s_entry1->jreclen; jrec.length[0] = s_entry1->jreclen;
/* /*
* If this is a directory, fix the correct size and extent * If this is a directory, fix the correct size and extent
* number. * number.
*/ */
if( (jrec.flags[0] & 2) != 0 ) if( (jrec.flags[0] & 2) != 0 )
{ {
if(strcmp(s_entry1->name,".") == 0) if(strcmp(s_entry1->name,".") == 0)
{ {
jrec.name_len[0] = 1; jrec.name_len[0] = 1;
set_733((char *) jrec.extent, dpnt->jextent); set_733((char *) jrec.extent, dpnt->jextent);
set_733((char *) jrec.size, ROUND_UP(dpnt->jsize)); set_733((char *) jrec.size, ROUND_UP(dpnt->jsize));
} }
else if(strcmp(s_entry1->name,"..") == 0) else if(strcmp(s_entry1->name,"..") == 0)
{ {
jrec.name_len[0] = 1; jrec.name_len[0] = 1;
if( dpnt->parent == reloc_dir ) if( dpnt->parent == reloc_dir )
@ -600,7 +600,7 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
{ {
if(finddir->self == s_entry1) break; if(finddir->self == s_entry1) break;
finddir = finddir->next; finddir = finddir->next;
if(!finddir) if(!finddir)
{ {
fprintf (stderr, _("Fatal goof - unable to find directory location\n")); fprintf (stderr, _("Fatal goof - unable to find directory location\n"));
exit (1); exit (1);
@ -610,25 +610,25 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
set_733((char *) jrec.size, ROUND_UP(finddir->jsize)); set_733((char *) jrec.size, ROUND_UP(finddir->jsize));
} }
} }
memcpy(directory_buffer + dir_index, &jrec, memcpy(directory_buffer + dir_index, &jrec,
sizeof(struct iso_directory_record) - sizeof(struct iso_directory_record) -
sizeof(s_entry1->isorec.name)); sizeof(s_entry1->isorec.name));
dir_index += sizeof(struct iso_directory_record) - dir_index += sizeof(struct iso_directory_record) -
sizeof (s_entry1->isorec.name); sizeof (s_entry1->isorec.name);
/* /*
* Finally dump the Unicode version of the filename. * Finally dump the Unicode version of the filename.
* Note - . and .. are the same as with non-Joliet discs. * Note - . and .. are the same as with non-Joliet discs.
*/ */
if( (jrec.flags[0] & 2) != 0 if( (jrec.flags[0] & 2) != 0
&& strcmp(s_entry1->name, ".") == 0 ) && strcmp(s_entry1->name, ".") == 0 )
{ {
directory_buffer[dir_index++] = 0; directory_buffer[dir_index++] = 0;
} }
else if( (jrec.flags[0] & 2) != 0 else if( (jrec.flags[0] & 2) != 0
&& strcmp(s_entry1->name, "..") == 0 ) && strcmp(s_entry1->name, "..") == 0 )
{ {
directory_buffer[dir_index++] = 1; directory_buffer[dir_index++] = 1;
@ -640,7 +640,7 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
s_entry1->name); s_entry1->name);
dir_index += cvt_len; dir_index += cvt_len;
} }
if(dir_index & 1) if(dir_index & 1)
{ {
directory_buffer[dir_index++] = 0; directory_buffer[dir_index++] = 0;
@ -648,13 +648,13 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
s_entry = s_entry->jnext; s_entry = s_entry->jnext;
} }
if(dpnt->jsize != dir_index) if(dpnt->jsize != dir_index)
{ {
fprintf (stderr, _("Unexpected joliet directory length %d %d %s\n"), fprintf (stderr, _("Unexpected joliet directory length %d %d %s\n"),
dpnt->jsize, dir_index, dpnt->de_name); dpnt->jsize, dir_index, dpnt->de_name);
} }
xfwrite(directory_buffer, 1, total_size, outfile); xfwrite(directory_buffer, 1, total_size, outfile);
last_extent_written += total_size >> 11; last_extent_written += total_size >> 11;
free(directory_buffer); free(directory_buffer);
@ -678,7 +678,7 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
{ {
continue; continue;
} }
/* /*
* First update the path table sizes for directories. * First update the path table sizes for directories.
* *
@ -690,15 +690,15 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
*/ */
if(s_entry->isorec.flags[0] == 2) if(s_entry->isorec.flags[0] == 2)
{ {
if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..")) if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
{ {
jpath_table_size += joliet_strlen(s_entry->name) + sizeof(struct iso_path_table) - 1; jpath_table_size += joliet_strlen(s_entry->name) + sizeof(struct iso_path_table) - 1;
if (jpath_table_size & 1) if (jpath_table_size & 1)
{ {
jpath_table_size++; jpath_table_size++;
} }
} }
else else
{ {
if (this_dir == root && strlen(s_entry->name) == 1) if (this_dir == root && strlen(s_entry->name) == 1)
{ {
@ -708,11 +708,11 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
} }
} }
if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..")) if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
{ {
s_entry->jreclen = sizeof(struct iso_directory_record) s_entry->jreclen = sizeof(struct iso_directory_record)
- sizeof(s_entry->isorec.name) - sizeof(s_entry->isorec.name)
+ joliet_strlen(s_entry->name) + joliet_strlen(s_entry->name)
+ 1; + 1;
} }
else else
@ -737,9 +737,9 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
this_dir->jcontents = this_dir->contents; this_dir->jcontents = this_dir->contents;
status = joliet_sort_directory(&this_dir->jcontents); status = joliet_sort_directory(&this_dir->jcontents);
/* /*
* Now go through the directory and figure out how large this one will be. * Now go through the directory and figure out how large this one will be.
* Do not split a directory entry across a sector boundary * Do not split a directory entry across a sector boundary
*/ */
s_entry = this_dir->jcontents; s_entry = this_dir->jcontents;
/* /*
@ -756,10 +756,10 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
} }
jreclen = s_entry->jreclen; jreclen = s_entry->jreclen;
if ((this_dir->jsize & (SECTOR_SIZE - 1)) + jreclen >= SECTOR_SIZE) if ((this_dir->jsize & (SECTOR_SIZE - 1)) + jreclen >= SECTOR_SIZE)
{ {
this_dir->jsize = (this_dir->jsize + (SECTOR_SIZE - 1)) & this_dir->jsize = (this_dir->jsize + (SECTOR_SIZE - 1)) &
~(SECTOR_SIZE - 1); ~(SECTOR_SIZE - 1);
} }
this_dir->jsize += jreclen; this_dir->jsize += jreclen;
@ -771,11 +771,11 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
* Similar to the iso9660 case, except here we perform a full sort based upon the * Similar to the iso9660 case, except here we perform a full sort based upon the
* regular name of the file, not the 8.3 version. * regular name of the file, not the 8.3 version.
*/ */
static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll) static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
{ {
char * rpnt, *lpnt; char * rpnt, *lpnt;
struct directory_entry ** r, **l; struct directory_entry ** r, **l;
r = (struct directory_entry **) rr; r = (struct directory_entry **) rr;
l = (struct directory_entry **) ll; l = (struct directory_entry **) ll;
rpnt = (*r)->name; rpnt = (*r)->name;
@ -788,7 +788,7 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
{ {
sort_goof++; sort_goof++;
} }
/* /*
* Put the '.' and '..' entries on the head of the sorted list. * Put the '.' and '..' entries on the head of the sorted list.
* For normal ASCII, this always happens to be the case, but out of * For normal ASCII, this always happens to be the case, but out of
@ -800,13 +800,13 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
if( strcmp(rpnt, "..") == 0 ) return -1; if( strcmp(rpnt, "..") == 0 ) return -1;
if( strcmp(lpnt, "..") == 0 ) return 1; if( strcmp(lpnt, "..") == 0 ) return 1;
while(*rpnt && *lpnt) while(*rpnt && *lpnt)
{ {
if(*rpnt == ';' && *lpnt != ';') return -1; if(*rpnt == ';' && *lpnt != ';') return -1;
if(*rpnt != ';' && *lpnt == ';') return 1; if(*rpnt != ';' && *lpnt == ';') return 1;
if(*rpnt == ';' && *lpnt == ';') return 0; if(*rpnt == ';' && *lpnt == ';') return 0;
/* /*
* Extensions are not special here. Don't treat the dot as something that * Extensions are not special here. Don't treat the dot as something that
* must be bumped to the start of the list. * must be bumped to the start of the list.
@ -815,7 +815,7 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
if(*rpnt == '.' && *lpnt != '.') return -1; if(*rpnt == '.' && *lpnt != '.') return -1;
if(*rpnt != '.' && *lpnt == '.') return 1; if(*rpnt != '.' && *lpnt == '.') return 1;
#endif #endif
if(*rpnt < *lpnt) return -1; if(*rpnt < *lpnt) return -1;
if(*rpnt > *lpnt) return 1; if(*rpnt > *lpnt) return 1;
rpnt++; lpnt++; rpnt++; lpnt++;
@ -826,7 +826,7 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
} }
/* /*
* Function: sort_directory * Function: sort_directory
* *
* Purpose: Sort the directory in the appropriate ISO9660 * Purpose: Sort the directory in the appropriate ISO9660
@ -840,7 +840,7 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
int i; int i;
struct directory_entry * s_entry; struct directory_entry * s_entry;
struct directory_entry ** sortlist; struct directory_entry ** sortlist;
s_entry = *sort_dir; s_entry = *sort_dir;
while(s_entry) while(s_entry)
{ {
@ -851,9 +851,9 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
} }
/* /*
* OK, now we know how many there are. Build a vector for sorting. * OK, now we know how many there are. Build a vector for sorting.
*/ */
sortlist = (struct directory_entry **) sortlist = (struct directory_entry **)
e_malloc(sizeof(struct directory_entry *) * dcount); e_malloc(sizeof(struct directory_entry *) * dcount);
dcount = 0; dcount = 0;
@ -867,18 +867,18 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
} }
s_entry = s_entry->next; s_entry = s_entry->next;
} }
sort_goof = 0; sort_goof = 0;
#ifdef __STDC__ #ifdef __STDC__
qsort(sortlist, dcount, sizeof(struct directory_entry *), qsort(sortlist, dcount, sizeof(struct directory_entry *),
(int (*)(const void *, const void *))joliet_compare_dirs); (int (*)(const void *, const void *))joliet_compare_dirs);
#else #else
qsort(sortlist, dcount, sizeof(struct directory_entry *), qsort(sortlist, dcount, sizeof(struct directory_entry *),
joliet_compare_dirs); joliet_compare_dirs);
#endif #endif
/* /*
* Now reassemble the linked list in the proper sorted order * Now reassemble the linked list in the proper sorted order
*/ */
for(i=0; i<dcount-1; i++) for(i=0; i<dcount-1; i++)
{ {
@ -887,7 +887,7 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
sortlist[dcount-1]->jnext = NULL; sortlist[dcount-1]->jnext = NULL;
*sort_dir = sortlist[0]; *sort_dir = sortlist[0];
free(sortlist); free(sortlist);
return sort_goof; return sort_goof;
} }
@ -934,7 +934,7 @@ static void FDECL2(generate_joliet_directories, struct directory *, node, FILE*,
} }
} }
/* skip if hidden - but not for the rr_moved dir */ /* skip if hidden - but not for the rr_moved dir */
if(dpnt->subdir && (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir)) if(dpnt->subdir && (!(dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) || dpnt == reloc_dir))
generate_joliet_directories(dpnt->subdir, outfile); generate_joliet_directories(dpnt->subdir, outfile);
dpnt = dpnt->next; dpnt = dpnt->next;
} }
@ -947,7 +947,7 @@ static void FDECL2(generate_joliet_directories, struct directory *, node, FILE*,
static int FDECL1(jpathtab_write, FILE *, outfile) static int FDECL1(jpathtab_write, FILE *, outfile)
{ {
/* /*
* Next we write the path tables * Next we write the path tables
*/ */
xfwrite(jpath_table_l, 1, jpath_blocks << 11, outfile); xfwrite(jpath_table_l, 1, jpath_blocks << 11, outfile);
xfwrite(jpath_table_m, 1, jpath_blocks << 11, outfile); xfwrite(jpath_table_m, 1, jpath_blocks << 11, outfile);
@ -995,7 +995,7 @@ static int FDECL1(jvd_write, FILE *, outfile)
struct iso_primary_descriptor jvol_desc; struct iso_primary_descriptor jvol_desc;
/* /*
* Next we write out the boot volume descriptor for the disc * Next we write out the boot volume descriptor for the disc
*/ */
jvol_desc = vol_desc; jvol_desc = vol_desc;
get_joliet_vol_desc(&jvol_desc); get_joliet_vol_desc(&jvol_desc);
@ -1013,7 +1013,7 @@ static int FDECL1(jpathtab_size, int, starting_extent)
jpath_table[1] = 0; jpath_table[1] = 0;
jpath_table[2] = jpath_table[0] + jpath_blocks; jpath_table[2] = jpath_table[0] + jpath_blocks;
jpath_table[3] = 0; jpath_table[3] = 0;
last_extent += 2*jpath_blocks; last_extent += 2*jpath_blocks;
return 0; return 0;
} }

View file

@ -564,8 +564,8 @@ void usage(){
} }
/* /*
* Fill in date in the iso9660 format * Fill in date in the iso9660 format
* *
* The standards state that the timezone offset is in multiples of 15 * The standards state that the timezone offset is in multiples of 15
* minutes, and is what you add to GMT to get the localtime. The U.S. * minutes, and is what you add to GMT to get the localtime. The U.S.
@ -583,9 +583,9 @@ int FDECL2(iso9660_date,char *, result, time_t, crtime){
result[4] = local->tm_min; result[4] = local->tm_min;
result[5] = local->tm_sec; result[5] = local->tm_sec;
/* /*
* Must recalculate proper timezone offset each time, * Must recalculate proper timezone offset each time,
* as some files use daylight savings time and some don't... * as some files use daylight savings time and some don't...
*/ */
result[6] = local->tm_yday; /* save yday 'cause gmtime zaps it */ result[6] = local->tm_yday; /* save yday 'cause gmtime zaps it */
local = gmtime(&crtime); local = gmtime(&crtime);
@ -593,11 +593,11 @@ int FDECL2(iso9660_date,char *, result, time_t, crtime){
local->tm_yday -= result[6]; local->tm_yday -= result[6];
local->tm_hour -= result[3]; local->tm_hour -= result[3];
local->tm_min -= result[4]; local->tm_min -= result[4];
if (local->tm_year < 0) if (local->tm_year < 0)
{ {
local->tm_yday = -1; local->tm_yday = -1;
} }
else else
{ {
if (local->tm_year > 0) local->tm_yday = 1; if (local->tm_year > 0) local->tm_yday = 1;
} }
@ -972,7 +972,7 @@ parse_input_files:
{ {
int resource; int resource;
struct rlimit rlp; struct rlimit rlp;
if (getrlimit(RLIMIT_DATA,&rlp) == -1) if (getrlimit(RLIMIT_DATA,&rlp) == -1)
perror (_("Warning: getrlimit")); perror (_("Warning: getrlimit"));
else { else {
rlp.rlim_cur=33554432; rlp.rlim_cur=33554432;
@ -1092,7 +1092,7 @@ parse_input_files:
merge_image); merge_image);
} }
memcpy(&de.isorec.extent, mrootp->extent, 8); memcpy(&de.isorec.extent, mrootp->extent, 8);
} }
/* /*
@ -1175,8 +1175,8 @@ parse_input_files:
break; break;
} }
*pnt = '\0'; *pnt = '\0';
graft_dir = find_or_create_directory(graft_dir, graft_dir = find_or_create_directory(graft_dir,
graft_point, graft_point,
NULL, TRUE); NULL, TRUE);
*pnt = PATH_SEPARATOR; *pnt = PATH_SEPARATOR;
xpnt = pnt + 1; xpnt = pnt + 1;
@ -1262,12 +1262,12 @@ parse_input_files:
if (goof) if (goof)
error (1, 0, _("Joliet tree sort failed.\n")); error (1, 0, _("Joliet tree sort failed.\n"));
/* /*
* Fix a couple of things in the root directory so that everything * Fix a couple of things in the root directory so that everything
* is self consistent. * is self consistent.
*/ */
root->self = root->contents; /* Fix this up so that the path root->self = root->contents; /* Fix this up so that the path
tables get done right */ tables get done right */
/* /*
@ -1344,8 +1344,8 @@ parse_input_files:
outputlist_insert(&dirtree_clean); outputlist_insert(&dirtree_clean);
if(extension_record) if(extension_record)
{ {
outputlist_insert(&extension_desc); outputlist_insert(&extension_desc);
} }
@ -1356,7 +1356,7 @@ parse_input_files:
* will always be a primary and an end volume descriptor. * will always be a primary and an end volume descriptor.
*/ */
last_extent = session_start; last_extent = session_start;
/* /*
* Calculate the size of all of the components of the disc, and assign * Calculate the size of all of the components of the disc, and assign
* extent numbers. * extent numbers.
@ -1402,7 +1402,7 @@ parse_input_files:
if( verbose > 0 ) if( verbose > 0 )
{ {
#ifdef HAVE_SBRK #ifdef HAVE_SBRK
fprintf (stderr, _("Max brk space used %x\n"), fprintf (stderr, _("Max brk space used %x\n"),
(unsigned int)(((unsigned long)sbrk(0)) - mem_start)); (unsigned int)(((unsigned long)sbrk(0)) - mem_start));
#endif #endif
fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9); fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);

View file

@ -190,7 +190,7 @@ struct file_hash{
unsigned int starting_block; unsigned int starting_block;
unsigned int size; unsigned int size;
}; };
/* /*
* This structure is used to control the output of fragments to the cdrom * This structure is used to control the output of fragments to the cdrom
@ -243,7 +243,7 @@ extern struct output_fragment jdirtree_desc;
extern struct output_fragment extension_desc; extern struct output_fragment extension_desc;
extern struct output_fragment files_desc; extern struct output_fragment files_desc;
/* /*
* This structure describes one complete directory. It has pointers * This structure describes one complete directory. It has pointers
* to other directories in the overall tree so that it is clear where * to other directories in the overall tree so that it is clear where
* this directory lives in the tree, and it also must contain pointers * this directory lives in the tree, and it also must contain pointers
@ -326,14 +326,14 @@ extern struct directory *
struct directory_entry * self, int)); struct directory_entry * self, int));
extern void DECL (finish_cl_pl_entries, (void)); extern void DECL (finish_cl_pl_entries, (void));
extern int DECL(scan_directory_tree,(struct directory * this_dir, extern int DECL(scan_directory_tree,(struct directory * this_dir,
char * path, char * path,
struct directory_entry * self)); struct directory_entry * self));
extern int DECL(insert_file_entry,(struct directory *, char *, extern int DECL(insert_file_entry,(struct directory *, char *,
char *)); char *));
extern void DECL(generate_iso9660_directories,(struct directory *, FILE*)); extern void DECL(generate_iso9660_directories,(struct directory *, FILE*));
extern void DECL(dump_tree,(struct directory * node)); extern void DECL(dump_tree,(struct directory * node));
extern struct directory_entry * DECL(search_tree_file, (struct extern struct directory_entry * DECL(search_tree_file, (struct
directory * node,char * filename)); directory * node,char * filename));
extern void DECL(update_nlink_field,(struct directory * node)); extern void DECL(update_nlink_field,(struct directory * node));
extern void DECL (init_fstatbuf, (void)); extern void DECL (init_fstatbuf, (void));
@ -374,17 +374,17 @@ extern char *effective_date;
extern FILE * in_image; extern FILE * in_image;
extern struct iso_directory_record * extern struct iso_directory_record *
DECL(merge_isofs,(char * path)); DECL(merge_isofs,(char * path));
extern int DECL(free_mdinfo, (struct directory_entry **, int len)); extern int DECL(free_mdinfo, (struct directory_entry **, int len));
extern struct directory_entry ** extern struct directory_entry **
DECL(read_merging_directory,(struct iso_directory_record *, int*)); DECL(read_merging_directory,(struct iso_directory_record *, int*));
extern void extern void
DECL(merge_remaining_entries, (struct directory *, DECL(merge_remaining_entries, (struct directory *,
struct directory_entry **, int)); struct directory_entry **, int));
extern int extern int
DECL(merge_previous_session, (struct directory *, DECL(merge_previous_session, (struct directory *,
struct iso_directory_record *)); struct iso_directory_record *));
extern int DECL(get_session_start, (int *)); extern int DECL(get_session_start, (int *));
@ -401,7 +401,7 @@ struct dirent * DECL(readdir_add_files, (char **, char *, DIR *));
/* */ /* */
extern int DECL(iso9660_file_length,(const char* name, extern int DECL(iso9660_file_length,(const char* name,
struct directory_entry * sresult, int flag)); struct directory_entry * sresult, int flag));
extern int DECL(iso9660_date,(char *, time_t)); extern int DECL(iso9660_date,(char *, time_t));
extern void DECL(add_hash,(struct directory_entry *)); extern void DECL(add_hash,(struct directory_entry *));
@ -413,7 +413,7 @@ extern int DECL(delete_file_hash,(struct directory_entry *));
extern struct directory_entry * DECL(find_file_hash,(char *)); extern struct directory_entry * DECL(find_file_hash,(char *));
extern void DECL(add_file_hash,(struct directory_entry *)); extern void DECL(add_file_hash,(struct directory_entry *));
extern int DECL(generate_rock_ridge_attributes,(char *, char *, extern int DECL(generate_rock_ridge_attributes,(char *, char *,
struct directory_entry *, struct directory_entry *,
struct stat *, struct stat *, struct stat *, struct stat *,
int deep_flag)); int deep_flag));
extern char * DECL(generate_rr_extension_record,(char * id, char * descriptor, extern char * DECL(generate_rr_extension_record,(char * id, char * descriptor,

View file

@ -1,5 +1,5 @@
/* /*
* File multi.c - scan existing iso9660 image and merge into * File multi.c - scan existing iso9660 image and merge into
* iso9660 filesystem. Used for multisession support. * iso9660 filesystem. Used for multisession support.
* *
* Written by Eric Youngdale (1996). * Written by Eric Youngdale (1996).
@ -166,7 +166,7 @@ readsecs(startsecno, buffer, sectorcount)
/* /*
* Parse the RR attributes so we can find the file name. * Parse the RR attributes so we can find the file name.
*/ */
static int static int
FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt) FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
{ {
int cont_extent, cont_offset, cont_size; int cont_extent, cont_offset, cont_size;
@ -219,10 +219,10 @@ FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
} /* parse_rr */ } /* parse_rr */
static int static int
FDECL4(check_rr_dates, struct directory_entry *, dpnt, FDECL4(check_rr_dates, struct directory_entry *, dpnt,
struct directory_entry *, current, struct directory_entry *, current,
struct stat *, statbuf, struct stat *, statbuf,
struct stat *,lstatbuf) struct stat *,lstatbuf)
{ {
int cont_extent, cont_offset, cont_size; int cont_extent, cont_offset, cont_size;
@ -233,8 +233,8 @@ FDECL4(check_rr_dates, struct directory_entry *, dpnt,
int same_file_type; int same_file_type;
mode_t mode; mode_t mode;
char time_buf[7]; char time_buf[7];
cont_extent = cont_offset = cont_size = 0; cont_extent = cont_offset = cont_size = 0;
same_file = 1; same_file = 1;
same_file_type = 1; same_file_type = 1;
@ -270,14 +270,14 @@ FDECL4(check_rr_dates, struct directory_entry *, dpnt,
if( pnt[4] & TF_CREATE ) if( pnt[4] & TF_CREATE )
{ {
iso9660_date((char *) time_buf, lstatbuf->st_ctime); iso9660_date((char *) time_buf, lstatbuf->st_ctime);
if(memcmp(time_buf, pnt+offset, 7) == 0) if(memcmp(time_buf, pnt+offset, 7) == 0)
same_file = 0; same_file = 0;
offset += 7; offset += 7;
} }
if( pnt[4] & TF_MODIFY ) if( pnt[4] & TF_MODIFY )
{ {
iso9660_date((char *) time_buf, lstatbuf->st_mtime); iso9660_date((char *) time_buf, lstatbuf->st_mtime);
if(memcmp(time_buf, pnt+offset, 7) == 0) if(memcmp(time_buf, pnt+offset, 7) == 0)
same_file = 0; same_file = 0;
offset += 7; offset += 7;
} }
@ -350,7 +350,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
while(i < len ) while(i < len )
{ {
idr = (struct iso_directory_record *) &dirbuff[i]; idr = (struct iso_directory_record *) &dirbuff[i];
if(idr->length[0] == 0) if(idr->length[0] == 0)
{ {
i = (i + SECTOR_SIZE - 1) & ~(SECTOR_SIZE - 1); i = (i + SECTOR_SIZE - 1) & ~(SECTOR_SIZE - 1);
continue; continue;
@ -378,7 +378,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
while(i < len ) while(i < len )
{ {
idr = (struct iso_directory_record *) &dirbuff[i]; idr = (struct iso_directory_record *) &dirbuff[i];
if(idr->length[0] == 0) if(idr->length[0] == 0)
{ {
i = (i + SECTOR_SIZE - 1) & ~(SECTOR_SIZE - 1); i = (i + SECTOR_SIZE - 1) & ~(SECTOR_SIZE - 1);
continue; continue;
@ -413,16 +413,16 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
*/ */
rlen = idr->length[0] & 0xff; rlen = idr->length[0] & 0xff;
cpnt = (unsigned char *) idr; cpnt = (unsigned char *) idr;
rlen -= sizeof(struct iso_directory_record); rlen -= sizeof(struct iso_directory_record);
cpnt += sizeof(struct iso_directory_record); cpnt += sizeof(struct iso_directory_record);
rlen += sizeof(idr->name); rlen += sizeof(idr->name);
cpnt -= sizeof(idr->name); cpnt -= sizeof(idr->name);
rlen -= idr->name_len[0]; rlen -= idr->name_len[0];
cpnt += idr->name_len[0]; cpnt += idr->name_len[0];
if((idr->name_len[0] & 1) == 0){ if((idr->name_len[0] & 1) == 0){
cpnt++; cpnt++;
rlen--; rlen--;
@ -444,7 +444,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
memset(cpnt, 0, sizeof((*pnt)->isorec.name) - idr->name_len[0]); memset(cpnt, 0, sizeof((*pnt)->isorec.name) - idr->name_len[0]);
parse_rr((*pnt)->rr_attributes, rlen, *pnt); parse_rr((*pnt)->rr_attributes, rlen, *pnt);
if( ((*pnt)->isorec.name_len[0] == 1) if( ((*pnt)->isorec.name_len[0] == 1)
&& ( ((*pnt)->isorec.name[0] == 0) && ( ((*pnt)->isorec.name[0] == 0)
|| ((*pnt)->isorec.name[0] == 1)) ) || ((*pnt)->isorec.name[0] == 1)) )
@ -485,7 +485,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
tt_extent = isonum_733((unsigned char *)idr->extent); tt_extent = isonum_733((unsigned char *)idr->extent);
tt_size = isonum_733((unsigned char *)idr->size); tt_size = isonum_733((unsigned char *)idr->size);
} }
pnt++; pnt++;
i += idr->length[0]; i += idr->length[0];
} }
@ -515,7 +515,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
{ {
rlen = isonum_711((*pnt)->isorec.name_len); rlen = isonum_711((*pnt)->isorec.name_len);
if( strncmp((char *) cpnt + 2, (*pnt)->isorec.name, if( strncmp((char *) cpnt + 2, (*pnt)->isorec.name,
rlen) == 0 rlen) == 0
&& cpnt[2+rlen] == ' ') && cpnt[2+rlen] == ' ')
{ {
(*pnt)->table = e_malloc(strlen((char*)cpnt) - 33); (*pnt)->table = e_malloc(strlen((char*)cpnt) - 33);
@ -534,7 +534,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
cpnt = cpnt1 + 1; cpnt = cpnt1 + 1;
cpnt1 = cpnt; cpnt1 = cpnt;
} }
free(tt_buf); free(tt_buf);
} }
else if( !seen_rockridge && !warning_given ) else if( !seen_rockridge && !warning_given )
@ -553,14 +553,14 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
{ {
free(dirbuff); free(dirbuff);
} }
return rtn; return rtn;
} /* read_merging_directory */ } /* read_merging_directory */
/* /*
* Free any associated data related to the structures. * Free any associated data related to the structures.
*/ */
int int
FDECL2(free_mdinfo, struct directory_entry ** , ptr, int, len ) FDECL2(free_mdinfo, struct directory_entry ** , ptr, int, len )
{ {
int i; int i;
@ -792,7 +792,7 @@ struct iso_directory_record * FDECL1(merge_isofs, char *, path)
/* /*
* Get the location and size of the root directory. * Get the location and size of the root directory.
*/ */
rootp = (struct iso_directory_record *) rootp = (struct iso_directory_record *)
malloc(sizeof(struct iso_directory_record)); malloc(sizeof(struct iso_directory_record));
memcpy(rootp, pri->root_directory_record, sizeof(*rootp)); memcpy(rootp, pri->root_directory_record, sizeof(*rootp));
@ -820,7 +820,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
{ {
continue; continue;
} }
if( pnt[i]->name != NULL && pnt[i]->whole_name == NULL) if( pnt[i]->name != NULL && pnt[i]->whole_name == NULL)
{ {
/* /*
@ -868,7 +868,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
this_dir->contents = pnt[i]; this_dir->contents = pnt[i];
pnt[i] = NULL; pnt[i] = NULL;
} }
/* /*
* If we don't have an entry for the translation table, then * If we don't have an entry for the translation table, then
@ -945,7 +945,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
* location. FIXME(eric). * location. FIXME(eric).
*/ */
static int static int
FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt, FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt,
struct directory *, parent) struct directory *, parent)
{ {
struct directory_entry **contents = NULL; struct directory_entry **contents = NULL;
@ -997,7 +997,7 @@ FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt,
/* /*
* We can always reuse the TRANS.TBL in this particular case. * We can always reuse the TRANS.TBL in this particular case.
*/ */
contents[i]->de_flags |= SAFE_TO_REUSE_TABLE_ENTRY; contents[i]->de_flags |= SAFE_TO_REUSE_TABLE_ENTRY;
if( ((contents[i]->isorec.flags[0] & 2) != 0) if( ((contents[i]->isorec.flags[0] & 2) != 0)
&& (i >= 2) ) && (i >= 2) )
@ -1059,7 +1059,7 @@ FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt,
char * cdwrite_data = NULL; char * cdwrite_data = NULL;
int int
FDECL1(get_session_start, int *, file_addr) FDECL1(get_session_start, int *, file_addr)
{ {
char * pnt; char * pnt;
@ -1171,14 +1171,14 @@ FDECL2(merge_previous_session,struct directory *, this_dir,
{ {
int dflag; int dflag;
if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..")) if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
{ {
struct directory * child; struct directory * child;
child = find_or_create_directory(this_dir, child = find_or_create_directory(this_dir,
s_entry->whole_name, s_entry->whole_name,
s_entry, 1); s_entry, 1);
dflag = merge_previous_session(child, dflag = merge_previous_session(child,
&odpnt->isorec); &odpnt->isorec);
/* If unable to scan directory, mark this as a non-directory */ /* If unable to scan directory, mark this as a non-directory */
if(!dflag) if(!dflag)
@ -1188,14 +1188,14 @@ FDECL2(merge_previous_session,struct directory *, this_dir,
} }
} }
} }
/* /*
* Whatever is left over, are things which are no longer in the tree * Whatever is left over, are things which are no longer in the tree
* on disk. We need to also merge these into the tree. * on disk. We need to also merge these into the tree.
*/ */
merge_remaining_entries(this_dir, orig_contents, n_orig); merge_remaining_entries(this_dir, orig_contents, n_orig);
free_mdinfo(orig_contents, n_orig); free_mdinfo(orig_contents, n_orig);
return 1; return 1;
} }

View file

@ -27,7 +27,7 @@
#include <ctype.h> #include <ctype.h>
extern int allow_leading_dots; extern int allow_leading_dots;
/* /*
* Function: iso9660_file_length * Function: iso9660_file_length
* *
@ -43,8 +43,8 @@ extern int allow_leading_dots;
* would also be nice to have. * would also be nice to have.
*/ */
int FDECL3(iso9660_file_length, int FDECL3(iso9660_file_length,
const char*, name, const char*, name,
struct directory_entry *, sresult, struct directory_entry *, sresult,
int, dirflag) int, dirflag)
{ {
char * c; char * c;
@ -69,7 +69,7 @@ int FDECL3(iso9660_file_length,
*/ */
if(strcmp(name,".") == 0) if(strcmp(name,".") == 0)
{ {
if(result) if(result)
{ {
*result = 0; *result = 0;
} }
@ -82,7 +82,7 @@ int FDECL3(iso9660_file_length,
*/ */
if(strcmp(name,"..") == 0) if(strcmp(name,"..") == 0)
{ {
if(result) if(result)
{ {
*result++ = 1; *result++ = 1;
*result++ = 0; *result++ = 0;
@ -115,7 +115,7 @@ int FDECL3(iso9660_file_length,
while(*pnt) while(*pnt)
{ {
#ifdef VMS #ifdef VMS
if( strcmp(pnt,".DIR;1") == 0 ) if( strcmp(pnt,".DIR;1") == 0 )
{ {
break; break;
} }
@ -126,11 +126,11 @@ int FDECL3(iso9660_file_length,
* generated by some editors. Lower the priority of * generated by some editors. Lower the priority of
* the file. * the file.
*/ */
if(*pnt == '#') if(*pnt == '#')
{ {
priority = 1; priority = 1;
pnt++; pnt++;
continue; continue;
} }
/* /*
@ -138,11 +138,11 @@ int FDECL3(iso9660_file_length,
* generated by some editors. Lower the priority of * generated by some editors. Lower the priority of
* the file. * the file.
*/ */
if(*pnt == '~') if(*pnt == '~')
{ {
priority = 1; priority = 1;
tildes++; tildes++;
pnt++; pnt++;
continue; continue;
} }
@ -170,9 +170,9 @@ int FDECL3(iso9660_file_length,
* If we have a name with multiple '.' characters, we ignore everything * If we have a name with multiple '.' characters, we ignore everything
* after we have gotten the extension. * after we have gotten the extension.
*/ */
if(ignore) if(ignore)
{ {
pnt++; pnt++;
continue; continue;
} }
@ -181,7 +181,7 @@ int FDECL3(iso9660_file_length,
*/ */
if(seen_semic) if(seen_semic)
{ {
if(*pnt >= '0' && *pnt <= '9') if(*pnt >= '0' && *pnt <= '9')
{ {
*result++ = *pnt; *result++ = *pnt;
} }
@ -197,19 +197,19 @@ int FDECL3(iso9660_file_length,
* option. We still only allow one '.' character in the * option. We still only allow one '.' character in the
* name, however. * name, however.
*/ */
if(full_iso9660_filenames) if(full_iso9660_filenames)
{ {
/* Here we allow a more relaxed syntax. */ /* Here we allow a more relaxed syntax. */
if(*pnt == '.') if(*pnt == '.')
{ {
if (seen_dot) if (seen_dot)
{ {
ignore++; ignore++;
continue; continue;
} }
seen_dot++; seen_dot++;
} }
if(current_length < 30) if(current_length < 30)
{ {
if( !isascii (*pnt)) if( !isascii (*pnt))
{ {
@ -222,21 +222,21 @@ int FDECL3(iso9660_file_length,
} }
} }
else else
{ {
/* /*
* Dos style filenames. We really restrict the * Dos style filenames. We really restrict the
* names here. * names here.
*/ */
/* It would be nice to have .tar.gz transform to .tgz, /* It would be nice to have .tar.gz transform to .tgz,
* .ps.gz to .psz, ... * .ps.gz to .psz, ...
*/ */
if(*pnt == '.') if(*pnt == '.')
{ {
if (!chars_before_dot && !allow_leading_dots) if (!chars_before_dot && !allow_leading_dots)
{ {
/* DOS can't read files with dot first */ /* DOS can't read files with dot first */
chars_before_dot++; chars_before_dot++;
if (result) if (result)
{ {
*result++ = '_'; /* Substitute underscore */ *result++ = '_'; /* Substitute underscore */
} }
@ -247,36 +247,36 @@ int FDECL3(iso9660_file_length,
* If this isn't the dot that we use for the extension, * If this isn't the dot that we use for the extension,
* then change the character into a '_' instead. * then change the character into a '_' instead.
*/ */
if(chars_before_dot < 8) if(chars_before_dot < 8)
{ {
chars_before_dot++; chars_before_dot++;
if(result) if(result)
{ {
*result++ = '_'; *result++ = '_';
} }
} }
} }
else else
{ {
if (seen_dot) if (seen_dot)
{ {
ignore++; continue; ignore++; continue;
} }
if(result) if(result)
{ {
*result++ = '.'; *result++ = '.';
} }
seen_dot++; seen_dot++;
} }
} }
else else
{ {
if( (seen_dot && (chars_after_dot < 3) && ++chars_after_dot) if( (seen_dot && (chars_after_dot < 3) && ++chars_after_dot)
|| (!seen_dot && (chars_before_dot < 8) && ++chars_before_dot) ) || (!seen_dot && (chars_before_dot < 8) && ++chars_before_dot) )
{ {
if(result) if(result)
{ {
switch (*pnt) switch (*pnt)
{ {
default: default:
if( !isascii (*pnt) ) if( !isascii (*pnt) )
@ -289,7 +289,7 @@ int FDECL3(iso9660_file_length,
} }
break; break;
/* /*
* Descriptions of DOS's 'Parse Filename' * Descriptions of DOS's 'Parse Filename'
* (function 29H) describes V1 and V2.0+ * (function 29H) describes V1 and V2.0+
* separator and terminator characters. * separator and terminator characters.
@ -329,7 +329,7 @@ int FDECL3(iso9660_file_length,
current_length++; current_length++;
pnt++; pnt++;
} /* while (*pnt) */ } /* while (*pnt) */
/* /*
* OK, that wraps up the scan of the name. Now tidy up a few other * OK, that wraps up the scan of the name. Now tidy up a few other
* things. * things.
@ -345,11 +345,11 @@ int FDECL3(iso9660_file_length,
{ {
int prio1 = 0; int prio1 = 0;
pnt = name; pnt = name;
while (*pnt && *pnt != '~') while (*pnt && *pnt != '~')
{ {
pnt++; pnt++;
} }
if (*pnt) if (*pnt)
{ {
pnt++; pnt++;
} }
@ -360,7 +360,7 @@ int FDECL3(iso9660_file_length,
} }
priority = prio1; priority = prio1;
} }
/* /*
* If this is not a directory, force a '.' in case we haven't * If this is not a directory, force a '.' in case we haven't
* seen one, and add a version number if we haven't seen one * seen one, and add a version number if we haven't seen one
@ -368,12 +368,12 @@ int FDECL3(iso9660_file_length,
*/ */
if (!dirflag) if (!dirflag)
{ {
if (!seen_dot && !omit_period) if (!seen_dot && !omit_period)
{ {
if (result) *result++ = '.'; if (result) *result++ = '.';
extra++; extra++;
} }
if(!omit_version_number && !seen_semic) if(!omit_version_number && !seen_semic)
{ {
if(result) if(result)
{ {
@ -383,8 +383,8 @@ int FDECL3(iso9660_file_length,
extra += 2; extra += 2;
} }
} }
if(result) if(result)
{ {
*result++ = 0; *result++ = 0;
} }

View file

@ -87,7 +87,7 @@
a CE entry for the continuation record */ a CE entry for the continuation record */
#define MAYBE_ADD_CE_ENTRY(BYTES) \ #define MAYBE_ADD_CE_ENTRY(BYTES) \
((unsigned) ((BYTES) + CE_SIZE + currlen + ipnt) > (unsigned) (recstart + reclimit) ? 1 : 0) ((unsigned) ((BYTES) + CE_SIZE + currlen + ipnt) > (unsigned) (recstart + reclimit) ? 1 : 0)
/* /*
* Buffer to build RR attributes * Buffer to build RR attributes
@ -210,13 +210,13 @@ int deep_opt;
}; };
/* /*
* Add the posix modes * Add the posix modes
*/ */
if(MAYBE_ADD_CE_ENTRY(PX_SIZE)) add_CE_entry(); if(MAYBE_ADD_CE_ENTRY(PX_SIZE)) add_CE_entry();
Rock[ipnt++] ='P'; Rock[ipnt++] ='P';
Rock[ipnt++] ='X'; Rock[ipnt++] ='X';
Rock[ipnt++] = PX_SIZE; Rock[ipnt++] = PX_SIZE;
Rock[ipnt++] = SU_VERSION; Rock[ipnt++] = SU_VERSION;
flagval |= (1<<0); flagval |= (1<<0);
set_733((char*)Rock + ipnt, lstatbuf->st_mode); set_733((char*)Rock + ipnt, lstatbuf->st_mode);
ipnt += 8; ipnt += 8;
@ -236,7 +236,7 @@ int deep_opt;
Rock[ipnt++] ='P'; Rock[ipnt++] ='P';
Rock[ipnt++] ='N'; Rock[ipnt++] ='N';
Rock[ipnt++] = PN_SIZE; Rock[ipnt++] = PN_SIZE;
Rock[ipnt++] = SU_VERSION; Rock[ipnt++] = SU_VERSION;
flagval |= (1<<1); flagval |= (1<<1);
#if defined(MAJOR_IN_SYSMACROS) || defined(MAJOR_IN_MKDEV) #if defined(MAJOR_IN_SYSMACROS) || defined(MAJOR_IN_MKDEV)
set_733((char*)Rock + ipnt, major(lstatbuf->st_rdev )); set_733((char*)Rock + ipnt, major(lstatbuf->st_rdev ));
@ -286,25 +286,25 @@ int deep_opt;
cpnt = &symlink_buff[0]; cpnt = &symlink_buff[0];
flagval |= (1<<2); flagval |= (1<<2);
if (! split_SL_field) if (! split_SL_field)
{ {
int sl_bytes = 0; int sl_bytes = 0;
for (cpnt1 = cpnt; *cpnt1 != '\0'; cpnt1++) for (cpnt1 = cpnt; *cpnt1 != '\0'; cpnt1++)
{ {
if (*cpnt1 == '/') if (*cpnt1 == '/')
{ {
sl_bytes += 4; sl_bytes += 4;
} }
else else
{ {
sl_bytes += 1; sl_bytes += 1;
} }
} }
if (sl_bytes > 250) if (sl_bytes > 250)
{ {
/* /*
* the symbolic link won't fit into one SL System Use Field * the symbolic link won't fit into one SL System Use Field
* print an error message and continue with splited one * print an error message and continue with splited one
*/ */
fprintf(stderr, _("symbolic link ``%s'' to long for one SL System Use Field, splitting"), cpnt); fprintf(stderr, _("symbolic link ``%s'' to long for one SL System Use Field, splitting"), cpnt);
} }
@ -317,7 +317,7 @@ int deep_opt;
Rock[ipnt++] ='L'; Rock[ipnt++] ='L';
lenpos = ipnt; lenpos = ipnt;
Rock[ipnt++] = SL_SIZE; Rock[ipnt++] = SL_SIZE;
Rock[ipnt++] = SU_VERSION; Rock[ipnt++] = SU_VERSION;
Rock[ipnt++] = 0; /* Flags */ Rock[ipnt++] = 0; /* Flags */
lenval = 5; lenval = 5;
while(*cpnt){ while(*cpnt){
@ -326,7 +326,7 @@ int deep_opt;
nchar--; nchar--;
*cpnt1 = 0; *cpnt1 = 0;
}; };
/* We treat certain components in a special way. */ /* We treat certain components in a special way. */
if(cpnt[0] == '.' && cpnt[1] == '.' && cpnt[2] == 0){ if(cpnt[0] == '.' && cpnt[1] == '.' && cpnt[2] == 0){
if(MAYBE_ADD_CE_ENTRY(2)) add_CE_entry(); if(MAYBE_ADD_CE_ENTRY(2)) add_CE_entry();
@ -349,7 +349,7 @@ int deep_opt;
/* If we do not have enough room for a component, start /* If we do not have enough room for a component, start
a new continuations segment now */ a new continuations segment now */
if(split_SL_component ? MAYBE_ADD_CE_ENTRY(6) : if(split_SL_component ? MAYBE_ADD_CE_ENTRY(6) :
MAYBE_ADD_CE_ENTRY(6 + strlen ((char *) cpnt))) MAYBE_ADD_CE_ENTRY(6 + strlen ((char *) cpnt)))
{ {
add_CE_entry(); add_CE_entry();
if(cpnt1) if(cpnt1)
@ -397,7 +397,7 @@ int deep_opt;
if(nchar) Rock[lenpos + 2] = SL_CONTINUE; /* We need another SL entry */ if(nchar) Rock[lenpos + 2] = SL_CONTINUE; /* We need another SL entry */
} /* while nchar */ } /* while nchar */
} /* Is a symbolic link */ } /* Is a symbolic link */
/* /*
* Add in the Rock Ridge TF time field * Add in the Rock Ridge TF time field
*/ */
if(MAYBE_ADD_CE_ENTRY(TF_SIZE)) add_CE_entry(); if(MAYBE_ADD_CE_ENTRY(TF_SIZE)) add_CE_entry();
@ -422,7 +422,7 @@ int deep_opt;
iso9660_date((char *) &Rock[ipnt], lstatbuf->st_ctime); iso9660_date((char *) &Rock[ipnt], lstatbuf->st_ctime);
ipnt += 7; ipnt += 7;
/* /*
* Add in the Rock Ridge RE time field * Add in the Rock Ridge RE time field
*/ */
if(deep_opt & NEED_RE){ if(deep_opt & NEED_RE){
@ -433,7 +433,7 @@ int deep_opt;
Rock[ipnt++] = SU_VERSION; Rock[ipnt++] = SU_VERSION;
flagval |= (1<<6); flagval |= (1<<6);
}; };
/* /*
* Add in the Rock Ridge PL record, if required. * Add in the Rock Ridge PL record, if required.
*/ */
if(deep_opt & NEED_PL){ if(deep_opt & NEED_PL){
@ -447,7 +447,7 @@ int deep_opt;
flagval |= (1<<5); flagval |= (1<<5);
}; };
/* /*
* Add in the Rock Ridge CL field, if required. * Add in the Rock Ridge CL field, if required.
*/ */
if(deep_opt & NEED_CL){ if(deep_opt & NEED_CL){
@ -464,7 +464,7 @@ int deep_opt;
#ifndef VMS #ifndef VMS
/* If transparent compression was requested, fill in the correct /* If transparent compression was requested, fill in the correct
field for this file */ field for this file */
if(transparent_compression && if(transparent_compression &&
S_ISREG(lstatbuf->st_mode) && S_ISREG(lstatbuf->st_mode) &&
strlen(name) > 3 && strlen(name) > 3 &&
strcmp(name + strlen(name) - 3,".gZ") == 0){ strcmp(name + strlen(name) - 3,".gZ") == 0){
@ -498,8 +498,8 @@ int deep_opt;
else { else {
int blocksize; int blocksize;
blocksize = (header[3] << 8) | header[2]; blocksize = (header[3] << 8) | header[2];
file_size = ((unsigned int)header[7] << 24) | file_size = ((unsigned int)header[7] << 24) |
((unsigned int)header[6] << 16) | ((unsigned int)header[6] << 16) |
((unsigned int)header[5] << 8) | header[4]; ((unsigned int)header[5] << 8) | header[4];
#if 0 #if 0
fprintf(stderr,"Blocksize = %d %d\n", blocksize, file_size); fprintf(stderr,"Blocksize = %d %d\n", blocksize, file_size);
@ -534,7 +534,7 @@ int deep_opt;
}; };
} }
#endif #endif
/* /*
* Add in the Rock Ridge CE field, if required. We use this for the * Add in the Rock Ridge CE field, if required. We use this for the
* extension record that is stored in the root directory. * extension record that is stored in the root directory.
*/ */

File diff suppressed because it is too large Load diff

View file

@ -40,7 +40,7 @@
#include "mkisofs.h" #include "mkisofs.h"
#include "iso9660.h" #include "iso9660.h"
#include "msdos_partition.h" #include "msdos_partition.h"
#ifdef __SVR4 #ifdef __SVR4
extern char * strdup(const char *); extern char * strdup(const char *);
#endif #endif
@ -161,7 +161,7 @@ void FDECL4(xfwrite, void *, buffer, uint64_t, count, uint64_t, size, FILE *, fi
error (1, errno, _("Cannot open '%s'"), nbuf); error (1, errno, _("Cannot open '%s'"), nbuf);
} }
while(count) while(count)
{ {
size_t got = fwrite (buffer, size, count, file); size_t got = fwrite (buffer, size, count, file);
@ -196,7 +196,7 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
struct directory * dpnt; struct directory * dpnt;
dpnt = node; dpnt = node;
while (dpnt) while (dpnt)
{ {
/* skip if it's hidden */ /* skip if it's hidden */
@ -214,13 +214,13 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
{ {
dpnt->extent = last_extent; dpnt->extent = last_extent;
dir_size = (dpnt->size + (SECTOR_SIZE - 1)) >> 11; dir_size = (dpnt->size + (SECTOR_SIZE - 1)) >> 11;
last_extent += dir_size; last_extent += dir_size;
/* /*
* Leave room for the CE entries for this directory. Keep them * Leave room for the CE entries for this directory. Keep them
* close to the reference directory so that access will be * close to the reference directory so that access will be
* quick. * quick.
*/ */
if(dpnt->ce_bytes) if(dpnt->ce_bytes)
{ {
@ -228,7 +228,7 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
} }
} }
if(dpnt->subdir) if(dpnt->subdir)
{ {
assign_directory_addresses(dpnt->subdir); assign_directory_addresses(dpnt->subdir);
} }
@ -238,7 +238,7 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
return 0; return 0;
} }
static void FDECL3(write_one_file, char *, filename, static void FDECL3(write_one_file, char *, filename,
uint64_t, size, FILE *, outfile) uint64_t, size, FILE *, outfile)
{ {
char buffer[SECTOR_SIZE * NSECT]; char buffer[SECTOR_SIZE * NSECT];
@ -247,7 +247,7 @@ static void FDECL3(write_one_file, char *, filename,
size_t use; size_t use;
if ((infile = fopen(filename, "rb")) == NULL) if ((infile = fopen(filename, "rb")) == NULL)
error (1, errno, _("cannot open %s\n"), filename); error (1, errno, _("cannot open %s\n"), filename);
remain = size; remain = size;
@ -256,12 +256,12 @@ static void FDECL3(write_one_file, char *, filename,
use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT*SECTOR_SIZE : remain); use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT*SECTOR_SIZE : remain);
use = ROUND_UP(use); /* Round up to nearest sector boundary */ use = ROUND_UP(use); /* Round up to nearest sector boundary */
memset(buffer, 0, use); memset(buffer, 0, use);
if (fread(buffer, 1, use, infile) == 0) if (fread(buffer, 1, use, infile) == 0)
error (1, errno, _("cannot read %llu bytes from %s"), use, filename); error (1, errno, _("cannot read %llu bytes from %s"), use, filename);
xfwrite(buffer, 1, use, outfile); xfwrite(buffer, 1, use, outfile);
last_extent_written += use/SECTOR_SIZE; last_extent_written += use/SECTOR_SIZE;
#if 0 #if 0
if((last_extent_written % 1000) < use/SECTOR_SIZE) if((last_extent_written % 1000) < use/SECTOR_SIZE)
{ {
fprintf(stderr,"%d..", last_extent_written); fprintf(stderr,"%d..", last_extent_written);
} }
@ -271,7 +271,7 @@ static void FDECL3(write_one_file, char *, filename,
time_t now; time_t now;
time_t the_end; time_t the_end;
double frac; double frac;
time(&now); time(&now);
frac = last_extent_written / (double)last_extent; frac = last_extent_written / (double)last_extent;
the_end = begun + (now - begun) / frac; the_end = begun + (now - begun) / frac;
@ -290,13 +290,13 @@ static void FDECL1(write_files, FILE *, outfile)
dwpnt = dw_head; dwpnt = dw_head;
while(dwpnt) while(dwpnt)
{ {
if(dwpnt->table) if(dwpnt->table)
{ {
write_one_file (dwpnt->table, dwpnt->size, outfile); write_one_file (dwpnt->table, dwpnt->size, outfile);
table_size += dwpnt->size; table_size += dwpnt->size;
free (dwpnt->table); free (dwpnt->table);
} }
else else
{ {
#ifdef VMS #ifdef VMS
@ -327,11 +327,11 @@ static void dump_filelist()
} }
#endif #endif
static int FDECL2(compare_dirs, const void *, rr, const void *, ll) static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
{ {
char * rpnt, *lpnt; char * rpnt, *lpnt;
struct directory_entry ** r, **l; struct directory_entry ** r, **l;
r = (struct directory_entry **) rr; r = (struct directory_entry **) rr;
l = (struct directory_entry **) ll; l = (struct directory_entry **) ll;
rpnt = (*r)->isorec.name; rpnt = (*r)->isorec.name;
@ -344,7 +344,7 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
{ {
sort_goof++; sort_goof++;
} }
/* /*
* Put the '.' and '..' entries on the head of the sorted list. * Put the '.' and '..' entries on the head of the sorted list.
* For normal ASCII, this always happens to be the case, but out of * For normal ASCII, this always happens to be the case, but out of
@ -376,16 +376,16 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
if((*l)->isorec.name_len[0] == 1 && *lpnt == 1) return 1; if((*l)->isorec.name_len[0] == 1 && *lpnt == 1) return 1;
#endif #endif
while(*rpnt && *lpnt) while(*rpnt && *lpnt)
{ {
if(*rpnt == ';' && *lpnt != ';') return -1; if(*rpnt == ';' && *lpnt != ';') return -1;
if(*rpnt != ';' && *lpnt == ';') return 1; if(*rpnt != ';' && *lpnt == ';') return 1;
if(*rpnt == ';' && *lpnt == ';') return 0; if(*rpnt == ';' && *lpnt == ';') return 0;
if(*rpnt == '.' && *lpnt != '.') return -1; if(*rpnt == '.' && *lpnt != '.') return -1;
if(*rpnt != '.' && *lpnt == '.') return 1; if(*rpnt != '.' && *lpnt == '.') return 1;
if((unsigned char)*rpnt < (unsigned char)*lpnt) return -1; if((unsigned char)*rpnt < (unsigned char)*lpnt) return -1;
if((unsigned char)*rpnt > (unsigned char)*lpnt) return 1; if((unsigned char)*rpnt > (unsigned char)*lpnt) return 1;
rpnt++; lpnt++; rpnt++; lpnt++;
@ -395,7 +395,7 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
return 0; return 0;
} }
/* /*
* Function: sort_directory * Function: sort_directory
* *
* Purpose: Sort the directory in the appropriate ISO9660 * Purpose: Sort the directory in the appropriate ISO9660
@ -411,7 +411,7 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
int i, len; int i, len;
struct directory_entry * s_entry; struct directory_entry * s_entry;
struct directory_entry ** sortlist; struct directory_entry ** sortlist;
/* need to keep a count of how many entries are hidden */ /* need to keep a count of how many entries are hidden */
s_entry = *sort_dir; s_entry = *sort_dir;
while(s_entry) while(s_entry)
@ -428,9 +428,9 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
} }
/* /*
* OK, now we know how many there are. Build a vector for sorting. * OK, now we know how many there are. Build a vector for sorting.
*/ */
sortlist = (struct directory_entry **) sortlist = (struct directory_entry **)
e_malloc(sizeof(struct directory_entry *) * dcount); e_malloc(sizeof(struct directory_entry *) * dcount);
j = dcount - 1; j = dcount - 1;
@ -452,29 +452,29 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
s_entry->isorec.name[len] = 0; s_entry->isorec.name[len] = 0;
s_entry = s_entry->next; s_entry = s_entry->next;
} }
/* /*
* Each directory is required to contain at least . and .. * Each directory is required to contain at least . and ..
*/ */
if( dcount < 2 ) if( dcount < 2 )
{ {
sort_goof = 1; sort_goof = 1;
} }
else else
{ {
/* only sort the non-hidden entries */ /* only sort the non-hidden entries */
sort_goof = 0; sort_goof = 0;
#ifdef __STDC__ #ifdef __STDC__
qsort(sortlist, dcount, sizeof(struct directory_entry *), qsort(sortlist, dcount, sizeof(struct directory_entry *),
(int (*)(const void *, const void *))compare_dirs); (int (*)(const void *, const void *))compare_dirs);
#else #else
qsort(sortlist, dcount, sizeof(struct directory_entry *), qsort(sortlist, dcount, sizeof(struct directory_entry *),
compare_dirs); compare_dirs);
#endif #endif
/* /*
* Now reassemble the linked list in the proper sorted order * Now reassemble the linked list in the proper sorted order
* We still need the hidden entries, as they may be used in the * We still need the hidden entries, as they may be used in the
* Joliet tree. * Joliet tree.
*/ */
@ -482,7 +482,7 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
{ {
sortlist[i]->next = sortlist[i+1]; sortlist[i]->next = sortlist[i+1];
} }
sortlist[dcount+xcount-1]->next = NULL; sortlist[dcount+xcount-1]->next = NULL;
*sort_dir = sortlist[0]; *sort_dir = sortlist[0];
} }
@ -494,7 +494,7 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
static int root_gen() static int root_gen()
{ {
init_fstatbuf(); init_fstatbuf();
root_record.length[0] = 1 + sizeof(struct iso_directory_record) root_record.length[0] = 1 + sizeof(struct iso_directory_record)
- sizeof(root_record.name); - sizeof(root_record.name);
root_record.ext_attr_length[0] = 0; root_record.ext_attr_length[0] = 0;
@ -533,16 +533,16 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
{ {
continue; continue;
} }
/* /*
* This saves some space if there are symlinks present * This saves some space if there are symlinks present
*/ */
s_hash = find_hash(s_entry->dev, s_entry->inode); s_hash = find_hash(s_entry->dev, s_entry->inode);
if(s_hash) if(s_hash)
{ {
if(verbose > 2) if(verbose > 2)
{ {
fprintf (stderr, _("Cache hit for %s%s%s\n"), s_entry->filedir->de_name, fprintf (stderr, _("Cache hit for %s%s%s\n"), s_entry->filedir->de_name,
SPATH_SEPARATOR, s_entry->name); SPATH_SEPARATOR, s_entry->name);
} }
set_733((char *) s_entry->isorec.extent, s_hash->starting_block); set_733((char *) s_entry->isorec.extent, s_hash->starting_block);
@ -551,12 +551,12 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
} }
/* /*
* If this is for a directory that is not a . or a .. entry, * If this is for a directory that is not a . or a .. entry,
* then look up the information for the entry. We have already * then look up the information for the entry. We have already
* assigned extents for directories, so we just need to * assigned extents for directories, so we just need to
* fill in the blanks here. * fill in the blanks here.
*/ */
if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..") && if (strcmp(s_entry->name,".") && strcmp(s_entry->name,"..") &&
s_entry->isorec.flags[0] == 2) s_entry->isorec.flags[0] == 2)
{ {
finddir = dpnt->subdir; finddir = dpnt->subdir;
@ -564,7 +564,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
{ {
if(finddir->self == s_entry) break; if(finddir->self == s_entry) break;
finddir = finddir->next; finddir = finddir->next;
if (!finddir) if (!finddir)
error (1, 0, _("Fatal goof\n")); error (1, 0, _("Fatal goof\n"));
} }
set_733((char *) s_entry->isorec.extent, finddir->extent); set_733((char *) s_entry->isorec.extent, finddir->extent);
@ -581,45 +581,45 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
* If this is . or .., then look up the relevant info from the * If this is . or .., then look up the relevant info from the
* tables. * tables.
*/ */
if(strcmp(s_entry->name,".") == 0) if(strcmp(s_entry->name,".") == 0)
{ {
set_733((char *) s_entry->isorec.extent, dpnt->extent); set_733((char *) s_entry->isorec.extent, dpnt->extent);
/* /*
* Set these so that the hash table has the * Set these so that the hash table has the
* correct information * correct information
*/ */
s_entry->starting_block = dpnt->extent; s_entry->starting_block = dpnt->extent;
s_entry->size = ROUND_UP(dpnt->size); s_entry->size = ROUND_UP(dpnt->size);
add_hash(s_entry); add_hash(s_entry);
s_entry->starting_block = dpnt->extent; s_entry->starting_block = dpnt->extent;
set_733((char *) s_entry->isorec.size, ROUND_UP(dpnt->size)); set_733((char *) s_entry->isorec.size, ROUND_UP(dpnt->size));
continue; continue;
} }
if(strcmp(s_entry->name,"..") == 0) if(strcmp(s_entry->name,"..") == 0)
{ {
if(dpnt == root) if(dpnt == root)
{ {
total_dir_size += root->size; total_dir_size += root->size;
} }
set_733((char *) s_entry->isorec.extent, dpnt->parent->extent); set_733((char *) s_entry->isorec.extent, dpnt->parent->extent);
/* /*
* Set these so that the hash table has the * Set these so that the hash table has the
* correct information * correct information
*/ */
s_entry->starting_block = dpnt->parent->extent; s_entry->starting_block = dpnt->parent->extent;
s_entry->size = ROUND_UP(dpnt->parent->size); s_entry->size = ROUND_UP(dpnt->parent->size);
add_hash(s_entry); add_hash(s_entry);
s_entry->starting_block = dpnt->parent->extent; s_entry->starting_block = dpnt->parent->extent;
set_733((char *) s_entry->isorec.size, ROUND_UP(dpnt->parent->size)); set_733((char *) s_entry->isorec.size, ROUND_UP(dpnt->parent->size));
continue; continue;
} }
/* /*
* Some ordinary non-directory file. Just schedule the * Some ordinary non-directory file. Just schedule the
* file to be written. This is all quite * file to be written. This is all quite
* straightforward, just make a list and assign extents * straightforward, just make a list and assign extents
@ -627,28 +627,28 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
* directories, we should be ready write out these * directories, we should be ready write out these
* files * files
*/ */
if(s_entry->size) if(s_entry->size)
{ {
dwpnt = (struct deferred_write *) dwpnt = (struct deferred_write *)
e_malloc(sizeof(struct deferred_write)); e_malloc(sizeof(struct deferred_write));
if(dw_tail) if(dw_tail)
{ {
dw_tail->next = dwpnt; dw_tail->next = dwpnt;
dw_tail = dwpnt; dw_tail = dwpnt;
} }
else else
{ {
dw_head = dwpnt; dw_head = dwpnt;
dw_tail = dwpnt; dw_tail = dwpnt;
} }
if(s_entry->inode == TABLE_INODE) if(s_entry->inode == TABLE_INODE)
{ {
dwpnt->table = s_entry->table; dwpnt->table = s_entry->table;
dwpnt->name = NULL; dwpnt->name = NULL;
sprintf(whole_path,"%s%sTRANS.TBL", sprintf(whole_path,"%s%sTRANS.TBL",
s_entry->filedir->whole_name, SPATH_SEPARATOR); s_entry->filedir->whole_name, SPATH_SEPARATOR);
} }
else else
{ {
dwpnt->table = NULL; dwpnt->table = NULL;
strcpy(whole_path, s_entry->whole_name); strcpy(whole_path, s_entry->whole_name);
@ -672,15 +672,15 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
fprintf (stderr, "Warning: large file %s\n", whole_path); fprintf (stderr, "Warning: large file %s\n", whole_path);
fprintf (stderr, "Starting block is %d\n", s_entry->starting_block); fprintf (stderr, "Starting block is %d\n", s_entry->starting_block);
fprintf (stderr, "Reported file size is %d extents\n", s_entry->size); fprintf (stderr, "Reported file size is %d extents\n", s_entry->size);
} }
#endif #endif
#ifdef NOT_NEEDED /* Never use this code if you like to create a DVD */ #ifdef NOT_NEEDED /* Never use this code if you like to create a DVD */
if(last_extent > (800000000 >> 11)) if(last_extent > (800000000 >> 11))
{ {
/* /*
* More than 800Mb? Punt * More than 800Mb? Punt
*/ */
fprintf(stderr,"Extent overflow processing file %s\n", whole_path); fprintf(stderr,"Extent overflow processing file %s\n", whole_path);
fprintf(stderr,"Starting block is %d\n", s_entry->starting_block); fprintf(stderr,"Starting block is %d\n", s_entry->starting_block);
@ -699,7 +699,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
*/ */
set_733((char *) s_entry->isorec.extent, last_extent); set_733((char *) s_entry->isorec.extent, last_extent);
} }
if(dpnt->subdir) if(dpnt->subdir)
{ {
assign_file_addresses(dpnt->subdir); assign_file_addresses(dpnt->subdir);
} }
@ -711,13 +711,13 @@ static void FDECL1(free_one_directory, struct directory *, dpnt)
{ {
struct directory_entry * s_entry; struct directory_entry * s_entry;
struct directory_entry * s_entry_d; struct directory_entry * s_entry_d;
s_entry = dpnt->contents; s_entry = dpnt->contents;
while(s_entry) while(s_entry)
{ {
s_entry_d = s_entry; s_entry_d = s_entry;
s_entry = s_entry->next; s_entry = s_entry->next;
if( s_entry_d->name != NULL ) if( s_entry_d->name != NULL )
{ {
free (s_entry_d->name); free (s_entry_d->name);
@ -753,31 +753,31 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
struct directory_entry * s_entry; struct directory_entry * s_entry;
struct directory_entry * s_entry_d; struct directory_entry * s_entry_d;
unsigned int total_size; unsigned int total_size;
total_size = (dpnt->size + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1); total_size = (dpnt->size + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1);
directory_buffer = (char *) e_malloc(total_size); directory_buffer = (char *) e_malloc(total_size);
memset(directory_buffer, 0, total_size); memset(directory_buffer, 0, total_size);
dir_index = 0; dir_index = 0;
ce_size = (dpnt->ce_bytes + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1); ce_size = (dpnt->ce_bytes + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1);
ce_buffer = NULL; ce_buffer = NULL;
if(ce_size) if(ce_size)
{ {
ce_buffer = (char *) e_malloc(ce_size); ce_buffer = (char *) e_malloc(ce_size);
memset(ce_buffer, 0, ce_size); memset(ce_buffer, 0, ce_size);
ce_index = 0; ce_index = 0;
/* /*
* Absolute byte address of CE entries for this directory * Absolute byte address of CE entries for this directory
*/ */
ce_address = last_extent_written + (total_size >> 11); ce_address = last_extent_written + (total_size >> 11);
ce_address = ce_address << 11; ce_address = ce_address << 11;
} }
s_entry = dpnt->contents; s_entry = dpnt->contents;
while(s_entry) while(s_entry)
{ {
/* skip if it's hidden */ /* skip if it's hidden */
if(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) { if(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
@ -785,25 +785,25 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
continue; continue;
} }
/* /*
* We do not allow directory entries to cross sector boundaries. * We do not allow directory entries to cross sector boundaries.
* Simply pad, and then start the next entry at the next sector * Simply pad, and then start the next entry at the next sector
*/ */
new_reclen = s_entry->isorec.length[0]; new_reclen = s_entry->isorec.length[0];
if( (dir_index & (SECTOR_SIZE - 1)) + new_reclen >= SECTOR_SIZE ) if( (dir_index & (SECTOR_SIZE - 1)) + new_reclen >= SECTOR_SIZE )
{ {
dir_index = (dir_index + (SECTOR_SIZE - 1)) & dir_index = (dir_index + (SECTOR_SIZE - 1)) &
~(SECTOR_SIZE - 1); ~(SECTOR_SIZE - 1);
} }
memcpy(directory_buffer + dir_index, &s_entry->isorec, memcpy(directory_buffer + dir_index, &s_entry->isorec,
sizeof(struct iso_directory_record) - sizeof(struct iso_directory_record) -
sizeof(s_entry->isorec.name) + s_entry->isorec.name_len[0]); sizeof(s_entry->isorec.name) + s_entry->isorec.name_len[0]);
dir_index += sizeof(struct iso_directory_record) - dir_index += sizeof(struct iso_directory_record) -
sizeof (s_entry->isorec.name)+ s_entry->isorec.name_len[0]; sizeof (s_entry->isorec.name)+ s_entry->isorec.name_len[0];
/* /*
* Add the Rock Ridge attributes, if present * Add the Rock Ridge attributes, if present
*/ */
if(s_entry->rr_attr_size) if(s_entry->rr_attr_size)
{ {
@ -812,20 +812,20 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
directory_buffer[dir_index++] = 0; directory_buffer[dir_index++] = 0;
} }
/* /*
* If the RR attributes were too long, then write the * If the RR attributes were too long, then write the
* CE records, as required. * CE records, as required.
*/ */
if(s_entry->rr_attr_size != s_entry->total_rr_attr_size) if(s_entry->rr_attr_size != s_entry->total_rr_attr_size)
{ {
unsigned char * pnt; unsigned char * pnt;
int len, nbytes; int len, nbytes;
/* /*
* Go through the entire record and fix up the CE entries * Go through the entire record and fix up the CE entries
* so that the extent and offset are correct * so that the extent and offset are correct
*/ */
pnt = s_entry->rr_attributes; pnt = s_entry->rr_attributes;
len = s_entry->total_rr_attr_size; len = s_entry->total_rr_attr_size;
while(len > 3) while(len > 3)
@ -837,30 +837,30 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
ce_index, ce_address); ce_index, ce_address);
} }
#endif #endif
if(pnt[0] == 'C' && pnt[1] == 'E') if(pnt[0] == 'C' && pnt[1] == 'E')
{ {
nbytes = get_733( (char *) pnt+20); nbytes = get_733( (char *) pnt+20);
if((ce_index & (SECTOR_SIZE - 1)) + nbytes >= if((ce_index & (SECTOR_SIZE - 1)) + nbytes >=
SECTOR_SIZE) SECTOR_SIZE)
{ {
ce_index = ROUND_UP(ce_index); ce_index = ROUND_UP(ce_index);
} }
set_733( (char *) pnt+4, set_733( (char *) pnt+4,
(ce_address + ce_index) >> 11); (ce_address + ce_index) >> 11);
set_733( (char *) pnt+12, set_733( (char *) pnt+12,
(ce_address + ce_index) & (SECTOR_SIZE - 1)); (ce_address + ce_index) & (SECTOR_SIZE - 1));
/* /*
* Now store the block in the ce buffer * Now store the block in the ce buffer
*/ */
memcpy(ce_buffer + ce_index, memcpy(ce_buffer + ce_index,
pnt + pnt[2], nbytes); pnt + pnt[2], nbytes);
ce_index += nbytes; ce_index += nbytes;
if(ce_index & 1) if(ce_index & 1)
{ {
ce_index++; ce_index++;
} }
@ -868,11 +868,11 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
len -= pnt[2]; len -= pnt[2];
pnt += pnt[2]; pnt += pnt[2];
} }
} }
rockridge_size += s_entry->total_rr_attr_size; rockridge_size += s_entry->total_rr_attr_size;
memcpy(directory_buffer + dir_index, s_entry->rr_attributes, memcpy(directory_buffer + dir_index, s_entry->rr_attributes,
s_entry->rr_attr_size); s_entry->rr_attr_size);
dir_index += s_entry->rr_attr_size; dir_index += s_entry->rr_attr_size;
} }
@ -880,14 +880,14 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
{ {
directory_buffer[dir_index++] = 0; directory_buffer[dir_index++] = 0;
} }
s_entry_d = s_entry; s_entry_d = s_entry;
s_entry = s_entry->next; s_entry = s_entry->next;
/* /*
* Joliet doesn't use the Rock Ridge attributes, so we free it here. * Joliet doesn't use the Rock Ridge attributes, so we free it here.
*/ */
if (s_entry_d->rr_attributes) if (s_entry_d->rr_attributes)
{ {
free(s_entry_d->rr_attributes); free(s_entry_d->rr_attributes);
s_entry_d->rr_attributes = NULL; s_entry_d->rr_attributes = NULL;
@ -915,16 +915,16 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
last_extent_written += ce_size >> 11; last_extent_written += ce_size >> 11;
free(ce_buffer); free(ce_buffer);
} }
} /* generate_one_directory(... */ } /* generate_one_directory(... */
static static
void FDECL1(build_pathlist, struct directory *, node) void FDECL1(build_pathlist, struct directory *, node)
{ {
struct directory * dpnt; struct directory * dpnt;
dpnt = node; dpnt = node;
while (dpnt) while (dpnt)
{ {
/* skip if it's hidden */ /* skip if it's hidden */
@ -936,7 +936,7 @@ void FDECL1(build_pathlist, struct directory *, node)
} }
} /* build_pathlist(... */ } /* build_pathlist(... */
static int FDECL2(compare_paths, void const *, r, void const *, l) static int FDECL2(compare_paths, void const *, r, void const *, l)
{ {
struct directory const *ll = *(struct directory * const *)l; struct directory const *ll = *(struct directory * const *)l;
struct directory const *rr = *(struct directory * const *)r; struct directory const *rr = *(struct directory * const *)r;
@ -946,13 +946,13 @@ static int FDECL2(compare_paths, void const *, r, void const *, l)
return -1; return -1;
} }
if (rr->parent->path_index > ll->parent->path_index) if (rr->parent->path_index > ll->parent->path_index)
{ {
return 1; return 1;
} }
return strcmp(rr->self->isorec.name, ll->self->isorec.name); return strcmp(rr->self->isorec.name, ll->self->isorec.name);
} /* compare_paths(... */ } /* compare_paths(... */
static int generate_path_tables() static int generate_path_tables()
@ -968,7 +968,7 @@ static int generate_path_tables()
int tablesize; int tablesize;
/* /*
* First allocate memory for the tables and initialize the memory * First allocate memory for the tables and initialize the memory
*/ */
tablesize = path_blocks << 11; tablesize = path_blocks << 11;
path_table_m = (char *) e_malloc(tablesize); path_table_m = (char *) e_malloc(tablesize);
@ -977,7 +977,7 @@ static int generate_path_tables()
memset(path_table_m, 0, tablesize); memset(path_table_m, 0, tablesize);
/* /*
* Now start filling in the path tables. Start with root directory * Now start filling in the path tables. Start with root directory
*/ */
if( next_path_index > 0xffff ) if( next_path_index > 0xffff )
{ {
@ -986,7 +986,7 @@ static int generate_path_tables()
} }
path_table_index = 0; path_table_index = 0;
pathlist = (struct directory **) e_malloc(sizeof(struct directory *) pathlist = (struct directory **) e_malloc(sizeof(struct directory *)
* next_path_index); * next_path_index);
memset(pathlist, 0, sizeof(struct directory *) * next_path_index); memset(pathlist, 0, sizeof(struct directory *) * next_path_index);
build_pathlist(root); build_pathlist(root);
@ -995,10 +995,10 @@ static int generate_path_tables()
{ {
fix = 0; fix = 0;
#ifdef __STDC__ #ifdef __STDC__
qsort(&pathlist[1], next_path_index-1, sizeof(struct directory *), qsort(&pathlist[1], next_path_index-1, sizeof(struct directory *),
(int (*)(const void *, const void *))compare_paths); (int (*)(const void *, const void *))compare_paths);
#else #else
qsort(&pathlist[1], next_path_index-1, sizeof(struct directory *), qsort(&pathlist[1], next_path_index-1, sizeof(struct directory *),
compare_paths); compare_paths);
#endif #endif
@ -1020,55 +1020,55 @@ static int generate_path_tables()
error (1, 0, _("Entry %d not in path tables\n"), j); error (1, 0, _("Entry %d not in path tables\n"), j);
} }
npnt = dpnt->de_name; npnt = dpnt->de_name;
/* /*
* So the root comes out OK * So the root comes out OK
*/ */
if( (*npnt == 0) || (dpnt == root) ) if( (*npnt == 0) || (dpnt == root) )
{ {
npnt = "."; npnt = ".";
} }
npnt1 = strrchr(npnt, PATH_SEPARATOR); npnt1 = strrchr(npnt, PATH_SEPARATOR);
if(npnt1) if(npnt1)
{ {
npnt = npnt1 + 1; npnt = npnt1 + 1;
} }
de = dpnt->self; de = dpnt->self;
if(!de) if(!de)
{ {
error (1, 0, _("Fatal goof\n")); error (1, 0, _("Fatal goof\n"));
} }
namelen = de->isorec.name_len[0]; namelen = de->isorec.name_len[0];
path_table_l[path_table_index] = namelen; path_table_l[path_table_index] = namelen;
path_table_m[path_table_index] = namelen; path_table_m[path_table_index] = namelen;
path_table_index += 2; path_table_index += 2;
set_731(path_table_l + path_table_index, dpnt->extent); set_731(path_table_l + path_table_index, dpnt->extent);
set_732(path_table_m + path_table_index, dpnt->extent); set_732(path_table_m + path_table_index, dpnt->extent);
path_table_index += 4; path_table_index += 4;
set_721(path_table_l + path_table_index, set_721(path_table_l + path_table_index,
dpnt->parent->path_index); dpnt->parent->path_index);
set_722(path_table_m + path_table_index, set_722(path_table_m + path_table_index,
dpnt->parent->path_index); dpnt->parent->path_index);
path_table_index += 2; path_table_index += 2;
for(i =0; i<namelen; i++) for(i =0; i<namelen; i++)
{ {
path_table_l[path_table_index] = de->isorec.name[i]; path_table_l[path_table_index] = de->isorec.name[i];
path_table_m[path_table_index] = de->isorec.name[i]; path_table_m[path_table_index] = de->isorec.name[i];
path_table_index++; path_table_index++;
} }
if(path_table_index & 1) if(path_table_index & 1)
{ {
path_table_index++; /* For odd lengths we pad */ path_table_index++; /* For odd lengths we pad */
} }
} }
free(pathlist); free(pathlist);
if(path_table_index != path_table_size) if(path_table_index != path_table_size)
{ {
@ -1111,7 +1111,7 @@ static int FDECL1(file_write, FILE *, outfile)
/* /*
* OK, all done with that crap. Now write out the directories. * OK, all done with that crap. Now write out the directories.
* This is where the fur starts to fly, because we need to keep track of * This is where the fur starts to fly, because we need to keep track of
* each file as we find it and keep track of where we put it. * each file as we find it and keep track of where we put it.
*/ */
should_write = last_extent - session_start; should_write = last_extent - session_start;
@ -1127,16 +1127,16 @@ static int FDECL1(file_write, FILE *, outfile)
#ifdef DBG_ISO #ifdef DBG_ISO
fprintf(stderr,"Total directory extents being written = %llu\n", last_extent); fprintf(stderr,"Total directory extents being written = %llu\n", last_extent);
#endif #endif
fprintf (stderr, _("Total extents scheduled to be written = %llu\n"), fprintf (stderr, _("Total extents scheduled to be written = %llu\n"),
last_extent - session_start); last_extent - session_start);
} }
/* /*
* Now write all of the files that we need. * Now write all of the files that we need.
*/ */
write_files(outfile); write_files(outfile);
/* /*
* The rest is just fluff. * The rest is just fluff.
*/ */
@ -1148,8 +1148,8 @@ static int FDECL1(file_write, FILE *, outfile)
fprintf (stderr, _("Total extents actually written = %llu\n"), fprintf (stderr, _("Total extents actually written = %llu\n"),
last_extent_written - session_start); last_extent_written - session_start);
/* /*
* Hard links throw us off here * Hard links throw us off here
*/ */
assert (last_extent > session_start); assert (last_extent > session_start);
if(should_write + session_start != last_extent) if(should_write + session_start != last_extent)
@ -1195,7 +1195,7 @@ static int FDECL1(pvd_write, FILE *, outfile)
/* /*
* This will break in the year 2000, I supose, but there is no good way * This will break in the year 2000, I supose, but there is no good way
* to get the top two digits of the year. * to get the top two digits of the year.
*/ */
sprintf(iso_time, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d00", 1900 + local.tm_year, sprintf(iso_time, "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d00", 1900 + local.tm_year,
local.tm_mon+1, local.tm_mday, local.tm_mon+1, local.tm_mday,
@ -1207,28 +1207,28 @@ static int FDECL1(pvd_write, FILE *, outfile)
iso_time[16] = (local.tm_min + 60*(local.tm_hour + 24*local.tm_yday)) / 15; iso_time[16] = (local.tm_min + 60*(local.tm_hour + 24*local.tm_yday)) / 15;
/* /*
* Next we write out the primary descriptor for the disc * Next we write out the primary descriptor for the disc
*/ */
memset(&vol_desc, 0, sizeof(vol_desc)); memset(&vol_desc, 0, sizeof(vol_desc));
vol_desc.type[0] = ISO_VD_PRIMARY; vol_desc.type[0] = ISO_VD_PRIMARY;
memcpy(vol_desc.id, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID)); memcpy(vol_desc.id, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
vol_desc.version[0] = 1; vol_desc.version[0] = 1;
memset(vol_desc.system_id, ' ', sizeof(vol_desc.system_id)); memset(vol_desc.system_id, ' ', sizeof(vol_desc.system_id));
memcpy_max(vol_desc.system_id, system_id, strlen(system_id)); memcpy_max(vol_desc.system_id, system_id, strlen(system_id));
memset(vol_desc.volume_id, ' ', sizeof(vol_desc.volume_id)); memset(vol_desc.volume_id, ' ', sizeof(vol_desc.volume_id));
memcpy_max(vol_desc.volume_id, volume_id, strlen(volume_id)); memcpy_max(vol_desc.volume_id, volume_id, strlen(volume_id));
should_write = last_extent - session_start; should_write = last_extent - session_start;
set_733((char *) vol_desc.volume_space_size, should_write); set_733((char *) vol_desc.volume_space_size, should_write);
set_723(vol_desc.volume_set_size, volume_set_size); set_723(vol_desc.volume_set_size, volume_set_size);
set_723(vol_desc.volume_sequence_number, volume_sequence_number); set_723(vol_desc.volume_sequence_number, volume_sequence_number);
set_723(vol_desc.logical_block_size, 2048); set_723(vol_desc.logical_block_size, 2048);
/* /*
* The path tables are used by DOS based machines to cache directory * The path tables are used by DOS based machines to cache directory
* locations * locations
*/ */
set_733((char *) vol_desc.path_table_size, path_table_size); set_733((char *) vol_desc.path_table_size, path_table_size);
@ -1238,9 +1238,9 @@ static int FDECL1(pvd_write, FILE *, outfile)
set_732(vol_desc.opt_type_m_path_table, path_table[3]); set_732(vol_desc.opt_type_m_path_table, path_table[3]);
/* /*
* Now we copy the actual root directory record * Now we copy the actual root directory record
*/ */
memcpy(vol_desc.root_directory_record, &root_record, memcpy(vol_desc.root_directory_record, &root_record,
sizeof(struct iso_directory_record) + 1); sizeof(struct iso_directory_record) + 1);
/* /*
@ -1260,15 +1260,15 @@ static int FDECL1(pvd_write, FILE *, outfile)
if(appid) memcpy_max(vol_desc.application_id, appid, strlen(appid)); if(appid) memcpy_max(vol_desc.application_id, appid, strlen(appid));
FILL_SPACE(copyright_file_id); FILL_SPACE(copyright_file_id);
if(copyright) memcpy_max(vol_desc.copyright_file_id, copyright, if(copyright) memcpy_max(vol_desc.copyright_file_id, copyright,
strlen(copyright)); strlen(copyright));
FILL_SPACE(abstract_file_id); FILL_SPACE(abstract_file_id);
if(abstract) memcpy_max(vol_desc.abstract_file_id, abstract, if(abstract) memcpy_max(vol_desc.abstract_file_id, abstract,
strlen(abstract)); strlen(abstract));
FILL_SPACE(bibliographic_file_id); FILL_SPACE(bibliographic_file_id);
if(biblio) memcpy_max(vol_desc.bibliographic_file_id, biblio, if(biblio) memcpy_max(vol_desc.bibliographic_file_id, biblio,
strlen(biblio)); strlen(biblio));
FILL_SPACE(creation_date); FILL_SPACE(creation_date);
@ -1284,7 +1284,7 @@ static int FDECL1(pvd_write, FILE *, outfile)
memcpy(vol_desc.effective_date, effective_date ? effective_date : iso_time, 17); memcpy(vol_desc.effective_date, effective_date ? effective_date : iso_time, 17);
/* /*
* if not a bootable cd do it the old way * if not a bootable cd do it the old way
*/ */
xfwrite(&vol_desc, 1, 2048, outfile); xfwrite(&vol_desc, 1, 2048, outfile);
last_extent_written++; last_extent_written++;
@ -1299,7 +1299,7 @@ static int FDECL1(evd_write, FILE *, outfile)
struct iso_primary_descriptor evol_desc; struct iso_primary_descriptor evol_desc;
/* /*
* Now write the end volume descriptor. Much simpler than the other one * Now write the end volume descriptor. Much simpler than the other one
*/ */
memset(&evol_desc, 0, sizeof(evol_desc)); memset(&evol_desc, 0, sizeof(evol_desc));
evol_desc.type[0] = ISO_VD_END; evol_desc.type[0] = ISO_VD_END;
@ -1316,7 +1316,7 @@ static int FDECL1(evd_write, FILE *, outfile)
static int FDECL1(pathtab_write, FILE *, outfile) static int FDECL1(pathtab_write, FILE *, outfile)
{ {
/* /*
* Next we write the path tables * Next we write the path tables
*/ */
xfwrite(path_table_l, 1, path_blocks << 11, outfile); xfwrite(path_table_l, 1, path_blocks << 11, outfile);
xfwrite(path_table_m, 1, path_blocks << 11, outfile); xfwrite(path_table_m, 1, path_blocks << 11, outfile);

View file

@ -93,7 +93,7 @@ grub_video_gop_get_bpp (struct grub_efi_gop_mode_info *in)
total_mask = in->pixel_bitmask.r | in->pixel_bitmask.g total_mask = in->pixel_bitmask.r | in->pixel_bitmask.g
| in->pixel_bitmask.b | in->pixel_bitmask.a; | in->pixel_bitmask.b | in->pixel_bitmask.a;
for (i = 31; i >= 0; i--) for (i = 31; i >= 0; i--)
if (total_mask & (1 << i)) if (total_mask & (1 << i))
return i + 1; return i + 1;
@ -123,7 +123,7 @@ grub_video_gop_get_bitmask (grub_uint32_t mask, unsigned int *mask_size,
if (!(mask & (1 << i))) if (!(mask & (1 << i)))
break; break;
*field_pos = i + 1; *field_pos = i + 1;
*mask_size = last_p - *field_pos; *mask_size = last_p - *field_pos + 1;
} }
static grub_err_t static grub_err_t
@ -212,7 +212,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
found = 1; found = 1;
} }
} }
if (!found) if (!found)
{ {
unsigned mode; unsigned mode;
@ -221,7 +221,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
{ {
grub_efi_uintn_t size; grub_efi_uintn_t size;
grub_efi_status_t status; grub_efi_status_t status;
status = efi_call_4 (gop->query_mode, gop, mode, &size, &info); status = efi_call_4 (gop->query_mode, gop, mode, &size, &info);
if (status) if (status)
{ {
@ -255,7 +255,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
* ((unsigned long long) bpp)) * ((unsigned long long) bpp))
{ {
best_volume = ((unsigned long long) info->width) best_volume = ((unsigned long long) info->width)
* ((unsigned long long) info->height) * ((unsigned long long) info->height)
* ((unsigned long long) bpp); * ((unsigned long long) bpp);
best_mode = mode; best_mode = mode;
} }
@ -293,8 +293,8 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
grub_dprintf ("video", "GOP: initialising FB @ %p %dx%dx%d\n", grub_dprintf ("video", "GOP: initialising FB @ %p %dx%dx%d\n",
framebuffer.ptr, framebuffer.mode_info.width, framebuffer.ptr, framebuffer.mode_info.width,
framebuffer.mode_info.height, framebuffer.mode_info.bpp); framebuffer.mode_info.height, framebuffer.mode_info.bpp);
err = grub_video_fb_create_render_target_from_pointer err = grub_video_fb_create_render_target_from_pointer
(&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr); (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
if (err) if (err)
@ -302,15 +302,15 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
grub_dprintf ("video", "GOP: Couldn't create FB target\n"); grub_dprintf ("video", "GOP: Couldn't create FB target\n");
return err; return err;
} }
err = grub_video_fb_set_active_render_target (framebuffer.render_target); err = grub_video_fb_set_active_render_target (framebuffer.render_target);
if (err) if (err)
{ {
grub_dprintf ("video", "GOP: Couldn't set FB target\n"); grub_dprintf ("video", "GOP: Couldn't set FB target\n");
return err; return err;
} }
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors); grub_video_fbstd_colors);
@ -318,7 +318,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
grub_dprintf ("video", "GOP: Couldn't set palette\n"); grub_dprintf ("video", "GOP: Couldn't set palette\n");
else else
grub_dprintf ("video", "GOP: Success\n"); grub_dprintf ("video", "GOP: Success\n");
return err; return err;
} }