* 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 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
grub_gettext_msg_list.
(grub_gettext_gettranslation_from_position): Return const 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.
(grub_gettext_init_ext): Add \n at the end of grub_dprintf string.
(grub_gettext_delete_list): Delete the list.
(run_menu): Replaces grub_printf by print_spaces and 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.
* normal/menu_entry.c (store_completion): Cleanup the gettextized
string.
* include/grub/i18n.h: ... to here
* include/grub/i18n.h: ... to here.
* 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>
return grub_strtoul (biosnum, 0, 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)
{
drivemap_node_t *curnode = map_head;
space = grub_pci_read (addr);
reg++;
-
+
if (space == 0)
continue;
-
+
switch (space & GRUB_PCI_ADDR_SPACE_MASK)
{
case GRUB_PCI_ADDR_SPACE_IO:
(space & GRUB_PCI_ADDR_IO_MASK));
break;
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)
{
addr = grub_pci_make_address (dev, reg);
(space & GRUB_PCI_ADDR_MEM_MASK),
space & GRUB_PCI_ADDR_MEM_PREFETCH
? "prefetchable" : "non-prefetchable");
-
+
}
else
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_PREFETCH
? "prefetchable" : "non-prefetchable");
#include <grub/env.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 a variable to return value.", "VAR", ARG_TYPE_STRING},
-/* xnu_uuid.c - transform 64-bit serial number
+/* xnu_uuid.c - transform 64-bit serial number
to 128-bit uuid suitable for xnu. */
/*
* GRUB -- GRand Unified Bootloader
grub_uint64_t serial;
} __attribute__ ((packed));
-/* 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. */
-static grub_uint8_t hash_prefix[16]
- = {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
+static grub_uint8_t hash_prefix[16]
+ = {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC};
#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
}
// _gcry_burn_stack (80+6*sizeof(void*));
- while( inlen >= 64 )
+ while( inlen >= 64 )
{
transform( hd, inbuf );
hd->count = 0;
lsmmap.mod mmap.mod
# For boot.mod.
-pkglib_MODULES += boot.mod
+pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
-pkglib_MODULES += boot.mod
+pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
date.mod datehook.mod lsmmap.mod mmap.mod
# For boot.mod.
-pkglib_MODULES += boot.mod
+pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
efiemu.mod mmap.mod acpi.mod drivemap.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_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
lsmmap.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_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
lsmmap.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_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
-pkglib_MODULES += boot.mod
+pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
grub_pxefs_dir (grub_device_t device __attribute__ ((unused)),
const char *path __attribute__ ((unused)),
int (*hook) (const char *filename,
- const struct grub_dirhook_info *info)
+ const struct grub_dirhook_info *info)
__attribute__ ((unused)))
{
return GRUB_ERR_NONE;
#include <grub/gzio.h>
#include <grub/i18n.h>
-/*
- .mo file information from:
+/*
+ .mo file information from:
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
*/
#define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
-typedef enum
+typedef enum
{
GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8,
struct grub_machine_bios_data_area
{
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];
};
if (! var)
{
grub_err_t err;
-
+
err = grub_env_set (name, "");
if (err)
return err;
var = grub_env_find (name);
- }
+ }
var->type = GRUB_ENV_VAR_GLOBAL;
return GRUB_ERR_NONE;
movl $END_SYMBOL, %ecx
subl %edi, %ecx
#endif
-
+
/* clean out */
xorl %eax, %eax
cld
return grub_strtoul (biosnum, 0, 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)
ret = (int) dev->disk->id;
grub_relocator32_forward_dest = dest;
grub_relocator32_forward_src = PTR_TO_UINT64 (src);
grub_relocator32_forward_size = size;
-
+
grub_relocator32_forward_eax = state.eax;
grub_relocator32_forward_ebx = state.ebx;
grub_relocator32_forward_ecx = state.ecx;
grub_relocator32_forward_edx = state.edx;
grub_relocator32_forward_eip = state.eip;
grub_relocator32_forward_esp = state.esp;
-
+
grub_memmove (ptr,
&grub_relocator32_forward_start,
RELOCATOR_SIZEOF (forward));
#else
#define RAX %eax
#define RCX %ecx
-#define RDI %edi
-#define RSI %esi
+#define RDI %edi
+#define RSI %esi
#endif
/* The code segment of the protected mode. */
/* The data segment of the protected mode. */
#define DATA_SEGMENT 0x18
-
+
.p2align 4 /* force 16-byte alignment */
RELOCATOR_VARIABLE(start)
#endif
mov RDI, RAX
-
+
#ifdef BACKWARD
add RCX, RSI
add RCX, RDI
add $0x3, RCX
shr $2, RCX
-
+
#ifdef BACKWARD
/* Backward movsl is implicitly off-by-four. compensate that. */
sub $4, RSI
LOCAL(gdt):
/* NULL. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
+
/* Reserved. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Filled by the code. */
.long 0
#endif
-
+
.p2align 4
LOCAL(jump_vector):
/* Jump location. Is filled by the code */
/* Very unlikely condition: Relocator may risk overwrite itself.
Just move it a bit up. */
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) relocator)
{
"Backward relocator: code %p, source: %p, "
"destination: 0x%x, size: 0x%lx\n",
(char *) relocator - overhead,
- (char *) relocator - overhead,
+ (char *) relocator - overhead,
(unsigned) dest - overhead,
(unsigned long) size + overhead);
grub_uint32_t * slice, grub_uint32_t * part)
{
char *p;
- grub_device_t dev;
+ grub_device_t dev;
#ifdef GRUB_MACHINE_PCBIOS
*biosdev = grub_get_root_biosnumber () & 0xff;
if (dev)
grub_device_close (dev);
- *bootdev = ((biosdev & 0xff) << 24) | ((slice & 0xff) << 16)
+ *bootdev = ((biosdev & 0xff) << 24) | ((slice & 0xff) << 16)
| ((part & 0xff) << 8) | 0xff;
return (biosdev != ~0UL);
#else
if (dev)
grub_device_close (dev);
-
+
/* Ignore errors. Perhaps it's not fatal. */
grub_errno = GRUB_ERR_NONE;
state.eax = grub_xnu_arg1;
return grub_relocator32_boot (grub_xnu_heap_start, grub_xnu_heap_will_be_at,
- state);
+ state);
}
/* Boot xnu. */
advanced mm is ready. */
grub_xnu_heap_start
= XNU_RELOCATOR (realloc) (grub_xnu_heap_start,
- newblknum
+ newblknum
* GRUB_XNU_HEAP_ALLOC_BLOCK);
if (!grub_xnu_heap_start)
return NULL;
nextdot = curdot + grub_strlen (curdot) + 1;
name = grub_realloc (name, nextdot - curdot + 1);
-
+
if (!name)
return 1;
-
+
unescape (name, curdot, nextdot, &len);
name[len] = 0;
curvalue = grub_xnu_create_value (curkey, name);
grub_free (name);
-
+
data = grub_malloc (grub_strlen (var->value) + 1);
if (!data)
return 1;
-
+
unescape (data, var->value, var->value + grub_strlen (var->value),
&len);
curvalue->datasize = len;
char *msg_formatted = grub_malloc (grub_strlen(msg) +
grub_strlen(PACKAGE_VERSION));
-
+
grub_cls ();
grub_sprintf (msg_formatted, msg, PACKAGE_VERSION);
grub_uint32_t *unicode_msg;
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);
-
+
if (msg_len < 0)
{
return;
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_sprintf (msg_formatted, msg, reader_nested ? msg_esc : "");
grub_puts ("\n");
grub_free (msg_formatted);
-
+
return 0;
}
grub_ssize_t msg_len = grub_strlen (msg);
*unicode_msg = grub_malloc (grub_strlen (msg) * sizeof (grub_uint32_t));
-
+
if (!*unicode_msg)
{
grub_printf ("utf8_to_ucs4 ERROR1: %s", msg);
{
if (! first_loop)
grub_putchar ('\n');
-
+
next_new_line = (grub_uint32_t *) last_position;
while (grub_getstringwidth (current_position, next_new_line) > line_len
grub_sprintf (msg_translated, msg, timeout);
grub_print_message_indented (msg_translated, 3, 0);
-
+
int posx;
posx = grub_getxy() >> 8;
print_spaces (GRUB_TERM_WIDTH - posx - 1);
return 1;
else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
return 1;
-
+
return 0;
}
# Abstraction modules aren't auto-loaded.
abstraction="`${grub_probe} --device ${device} --target=abstraction`"
- for module in ${abstraction} ; do
+ for module in ${abstraction} ; do
echo "insmod ${module}"
done
cat << EOF
set locale_dir=${locale_dir}
set lang=${grub_lang}
-insmod gettext
+insmod gettext
EOF
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
- if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
+ if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
if (num > 0xffff)
grub_util_error (_("the core image is too big"));
-
+
boot_path = grub_util_get_path (dir, "diskboot.img");
boot_size = grub_util_get_image_size (boot_path);
if (boot_size != 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);
-
+
/* i386 is a little endian architecture. */
*((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE
- GRUB_BOOT_MACHINE_LIST_SIZE + 8))
= grub_cpu_to_le16 (num);
-
+
grub_util_write_image (boot_img, boot_size, out);
free (boot_img);
free (boot_path);
/*
* Program eltorito.c - Handle El Torito specific extensions to iso9660.
- *
+ *
Written by Michael Fulbright <msf@redhat.com> (1996).
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)
{
char * bootpath; /* filename of boot catalog */
char * buf;
struct stat statbuf;
-
+
bootpath = (char *) e_malloc(strlen(boot_catalog)+strlen(path)+2);
strcpy(bootpath, path);
- if (bootpath[strlen(bootpath)-1] != '/')
+ if (bootpath[strlen(bootpath)-1] != '/')
{
strcat(bootpath,"/");
}
-
+
strcat(bootpath, boot_catalog);
-
+
/*
- * check for the file existing
+ * check for the file existing
*/
#ifdef DEBUG_TORITO
fprintf(stderr,"Looking for boot catalog file %s\n",bootpath);
#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);
return;
}
- else
+ else
{
fprintf (stderr, _("A boot catalog exists and appears corrupted.\n"));
fprintf (stderr, _("Please check the following file: %s.\n"), bootpath);
exit (1);
}
}
-
+
/*
- * file does not exist, so we create it
+ * file does not exist, so we create it
* make it one CD sector long
*/
bcat = fopen (bootpath, "wb");
if (bcat == NULL)
error (1, errno, _("Error creating boot catalog (%s)"), bootpath);
-
+
buf = (char *) e_malloc( 2048 );
if (fwrite (buf, 1, 2048, bcat) != 2048)
error (1, errno, _("Error writing to boot catalog (%s)"), bootpath);
struct directory_entry * de2;
unsigned int i;
int nsectors;
-
+
memset(boot_desc, 0, sizeof(*boot_desc));
boot_desc->id[0] = 0;
memcpy(boot_desc->id2, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
boot_desc->version[0] = 1;
-
+
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);
- if (!de2)
+ if (!de2)
{
fprintf (stderr, _("Boot catalog cannot be found!\n"));
exit (1);
}
-
+
set_731(boot_desc->bootcat_ptr,
(unsigned int) get_733(de2->isorec.extent));
-
- /*
+
+ /*
* now adjust boot catalog
- * lets find boot image first
+ * lets find boot image first
*/
de=search_tree_file(root, boot_image);
- if (!de)
+ if (!de)
{
fprintf (stderr, _("Boot image cannot be found!\n"));
exit (1);
- }
-
- /*
+ }
+
+ /*
* 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));
valid_desc.headerid[0] = 1;
valid_desc.arch[0] = EL_TORITO_ARCH_x86;
-
+
/*
* we'll shove start of publisher id into id field, may get truncated
* but who really reads this stuff!
*/
if (publisher)
memcpy_max(valid_desc.id, publisher, MIN(23, strlen(publisher)));
-
+
valid_desc.key1[0] = 0x55;
valid_desc.key2[0] = 0xAA;
-
+
/*
- * compute the checksum
+ * compute the checksum
*/
checksum=0;
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)
{
checksum += (unsigned int)checksum_ptr[i];
checksum += ((unsigned int)checksum_ptr[i+1])*256;
}
-
- /*
- * now find out the real checksum
+
+ /*
+ * now find out the real checksum
*/
checksum = -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));
default_desc.boot_id[0] = EL_TORITO_BOOTABLE;
-
+
/*
* use default BIOS loadpnt
- */
+ */
set_721(default_desc.loadseg, 0);
default_desc.arch[0] = EL_TORITO_ARCH_x86;
-
+
/*
* figure out size of boot image in sectors, for now hard code to
* assume 512 bytes/sector on a bootable floppy
*/
nsectors = ((de->size + 511) & ~(511))/512;
- fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
- fprintf (stderr, " -> ");
+ fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
+ fprintf (stderr, " -> ");
if (! use_eltorito_emul_floppy)
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_NOEMUL;
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;
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;
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;
fprintf (stderr, _("Emulating a 1.2 meg floppy\n"));
}
- else
+ else
{
fprintf (stderr, _("\nError - boot image is not the an allowable size.\n"));
exit (1);
}
-
- /*
- * FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!!
+
+ /*
+ * FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!!
*/
nsectors = 1;
set_721(default_desc.nsect, (unsigned int) nsectors );
#ifdef DEBUG_TORITO
fprintf(stderr,"Extent of boot images is %d\n",get_733(de->isorec.extent));
#endif
- set_731(default_desc.bootoff,
+ set_731(default_desc.bootoff,
(unsigned int) get_733(de->isorec.extent));
-
+
/*
- * now write it to disk
+ * now write it to disk
*/
bootcat = fopen (de2->whole_name, "r+b");
- if (bootcat == NULL)
+ if (bootcat == NULL)
error (1, errno, _("Error opening boot catalog for update"));
- /*
- * write out
+ /*
+ * write out
*/
if (fwrite (&valid_desc, 1, 32, bootcat) != 32)
error (1, errno, _("Error writing to boot catalog"));
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);
xfwrite(&gboot_desc, 1, 2048, outfile);
/*
* 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.
*
* $Id: exclude.h,v 1.2 1999/03/02 03:41:25 eric Exp $
struct file_hash * s_hash;
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) {
fprintf(stderr,"Non zero-length file assigned zero extent.\n");
exit(1);
{
unsigned int hash = 0;
const char * p;
-
+
p = name;
-
- while (*p)
+
+ while (*p)
{
/*
* Don't hash the iso9660 version number. This way
struct name_hash * nh;
char * p1;
char * p2;
-
+
for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
{
p1 = name;
nh = nh1;
}
name_hash_table[i] = NULL;
-
+
}
}
char pvd_addr[ISODCL (1, 4)];
/* Boot file address. */
char file_addr[ISODCL (5, 8)];
- /* Boot file length. */
+ /* Boot file length. */
char file_length[ISODCL (9, 12)];
/* Boot file checksum. */
char file_checksum[ISODCL (13, 16)];
static void DECL(assign_joliet_directory_addresses, (struct directory * node));
static int jroot_gen __PR((void));
-/*
+/*
* Function: convert_to_unicode
*
* Purpose: Perform a 1/2 assed unicode conversion on a text
* string.
*
- * Notes:
+ * Notes:
*/
static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char *, source )
{
* JS integrated from: Achim_Kaiser@t-online.de
*
* Let all valid unicode characters pass through (assuming ISO-8859-1).
- * Others are set to '_' .
- */
- if( tmpbuf[j] != 0 &&
+ * Others are set to '_' .
+ */
+ if( tmpbuf[j] != 0 &&
(tmpbuf[j] <= 0x1f || (tmpbuf[j] >= 0x7F && tmpbuf[j] <= 0xA0)) )
{
buffer[i+1] = '_';
}
}
-/*
+/*
* Function: joliet_strlen
*
* Purpose: Return length in bytes of string after conversion to unicode.
rtn = strlen(string) << 1;
- /*
+ /*
* 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
* bolix things up with very long paths. The Joliet specs say
return rtn;
}
-/*
+/*
* Function: get_joliet_vol_desc
*
* Purpose: generate a Joliet compatible volume desc.
* "expands" 8 bit character codes to 16 bits and does nothing
* special with the Unicode characters, therefore shouldn't mkisofs
* 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, "%/@");
/*
* 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));
/*
struct directory * dpnt;
dpnt = node;
-
+
while (dpnt)
{
if( (dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0 )
}
/* 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);
}
}
}
-static
+static
void FDECL1(build_jpathlist, struct directory *, node)
{
struct directory * dpnt;
-
+
dpnt = node;
-
+
while (dpnt)
{
}
} /* 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 *rr = *(struct directory * const *)r;
return -1;
}
- if (rparent > lparent)
+ if (rparent > lparent)
{
return 1;
}
return strcmp(rr->self->name, ll->self->name);
-
+
} /* compare_paths(... */
static int generate_joliet_path_tables()
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;
jpath_table_m = (char *) e_malloc(tablesize);
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;
- jpathlist = (struct directory **) e_malloc(sizeof(struct directory *)
+ jpathlist = (struct directory **) e_malloc(sizeof(struct directory *)
* next_jpath_index);
memset(jpathlist, 0, sizeof(struct directory *) * next_jpath_index);
build_jpathlist(root);
{
fix = 0;
#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);
#else
- qsort(&jpathlist[1], next_jpath_index-1, sizeof(struct directory *),
+ qsort(&jpathlist[1], next_jpath_index-1, sizeof(struct directory *),
joliet_compare_paths);
#endif
exit (1);
}
npnt = dpnt->de_name;
-
+
npnt1 = strrchr(npnt, PATH_SEPARATOR);
- if(npnt1)
- {
+ if(npnt1)
+ {
npnt = npnt1 + 1;
}
-
+
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);
}
-
+
namelen = joliet_strlen(de->name);
if( dpnt == root )
jpath_table_m[jpath_table_index] = namelen;
}
jpath_table_index += 2;
-
- set_731(jpath_table_l + jpath_table_index, dpnt->jextent);
- set_732(jpath_table_m + 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);
jpath_table_index += 4;
-
+
if( dpnt->parent != reloc_dir )
{
- set_721(jpath_table_l + jpath_table_index,
- dpnt->parent->jpath_index);
- set_722(jpath_table_m + jpath_table_index,
- dpnt->parent->jpath_index);
+ set_721(jpath_table_l + jpath_table_index,
+ dpnt->parent->jpath_index);
+ set_722(jpath_table_m + jpath_table_index,
+ dpnt->parent->jpath_index);
}
else
{
- set_721(jpath_table_l + jpath_table_index,
- dpnt->self->parent_rec->filedir->jpath_index);
- set_722(jpath_table_m + jpath_table_index,
- dpnt->self->parent_rec->filedir->jpath_index);
+ set_721(jpath_table_l + jpath_table_index,
+ dpnt->self->parent_rec->filedir->jpath_index);
+ set_722(jpath_table_m + jpath_table_index,
+ dpnt->self->parent_rec->filedir->jpath_index);
}
jpath_table_index += 2;
-
+
/*
* The root directory is still represented in non-unicode fashion.
*/
}
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);
- 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);
jpath_table_index += namelen;
}
- if(jpath_table_index & 1)
+ if(jpath_table_index & 1)
{
jpath_table_index++; /* For odd lengths we pad */
}
}
-
+
free(jpathlist);
if(jpath_table_index != jpath_table_size)
{
unsigned int total_size;
int cvt_len;
struct directory * finddir;
-
+
total_size = (dpnt->jsize + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1);
directory_buffer = (char *) e_malloc(total_size);
memset(directory_buffer, 0, total_size);
dir_index = 0;
-
+
s_entry = dpnt->jcontents;
- while(s_entry)
+ while(s_entry)
{
if(s_entry->de_flags & INHIBIT_JOLIET_ENTRY) {
s_entry = s_entry->jnext;
continue;
}
-
+
/*
* 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
{
s_entry1 = s_entry;
}
-
- /*
- * We do not allow directory entries to cross sector boundaries.
- * Simply pad, and then start the next entry at the next sector
+
+ /*
+ * We do not allow directory entries to cross sector boundaries.
+ * Simply pad, and then start the next entry at the next sector
*/
new_reclen = s_entry1->jreclen;
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);
}
-
+
memcpy(&jrec, &s_entry1->isorec, sizeof(struct iso_directory_record) -
sizeof(s_entry1->isorec.name));
-
+
cvt_len = joliet_strlen(s_entry1->name);
-
+
/*
* Fix the record length - this was the non-Joliet version we
* were seeing.
*/
jrec.name_len[0] = cvt_len;
jrec.length[0] = s_entry1->jreclen;
-
+
/*
* If this is a directory, fix the correct size and extent
* number.
*/
if( (jrec.flags[0] & 2) != 0 )
{
- if(strcmp(s_entry1->name,".") == 0)
+ if(strcmp(s_entry1->name,".") == 0)
{
jrec.name_len[0] = 1;
set_733((char *) jrec.extent, dpnt->jextent);
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;
if( dpnt->parent == reloc_dir )
{
if(finddir->self == s_entry1) break;
finddir = finddir->next;
- if(!finddir)
+ if(!finddir)
{
fprintf (stderr, _("Fatal goof - unable to find directory location\n"));
exit (1);
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(s_entry1->isorec.name));
-
-
- dir_index += sizeof(struct iso_directory_record) -
+
+
+ dir_index += sizeof(struct iso_directory_record) -
sizeof (s_entry1->isorec.name);
-
+
/*
* Finally dump the Unicode version of the filename.
* 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 )
{
directory_buffer[dir_index++] = 0;
}
- else if( (jrec.flags[0] & 2) != 0
+ else if( (jrec.flags[0] & 2) != 0
&& strcmp(s_entry1->name, "..") == 0 )
{
directory_buffer[dir_index++] = 1;
s_entry1->name);
dir_index += cvt_len;
}
-
+
if(dir_index & 1)
{
directory_buffer[dir_index++] = 0;
s_entry = s_entry->jnext;
}
-
+
if(dpnt->jsize != dir_index)
{
fprintf (stderr, _("Unexpected joliet directory length %d %d %s\n"),
dpnt->jsize, dir_index, dpnt->de_name);
}
-
+
xfwrite(directory_buffer, 1, total_size, outfile);
last_extent_written += total_size >> 11;
free(directory_buffer);
{
continue;
}
-
+
/*
* First update the path table sizes for directories.
*
*/
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;
- if (jpath_table_size & 1)
+ if (jpath_table_size & 1)
{
jpath_table_size++;
}
}
- else
+ else
{
if (this_dir == root && strlen(s_entry->name) == 1)
{
}
}
- 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)
- sizeof(s_entry->isorec.name)
- + joliet_strlen(s_entry->name)
+ + joliet_strlen(s_entry->name)
+ 1;
}
else
this_dir->jcontents = this_dir->contents;
status = joliet_sort_directory(&this_dir->jcontents);
- /*
+ /*
* 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;
/*
}
jreclen = s_entry->jreclen;
-
+
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);
}
this_dir->jsize += jreclen;
* 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.
*/
-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;
struct directory_entry ** r, **l;
-
+
r = (struct directory_entry **) rr;
l = (struct directory_entry **) ll;
rpnt = (*r)->name;
{
sort_goof++;
}
-
+
/*
* Put the '.' and '..' entries on the head of the sorted list.
* For normal ASCII, this always happens to be the case, but out of
if( strcmp(rpnt, "..") == 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 0;
-
+
/*
* Extensions are not special here. Don't treat the dot as something that
* must be bumped to the start of the list.
if(*rpnt == '.' && *lpnt != '.') return -1;
if(*rpnt != '.' && *lpnt == '.') return 1;
#endif
-
+
if(*rpnt < *lpnt) return -1;
if(*rpnt > *lpnt) return 1;
rpnt++; lpnt++;
}
-/*
+/*
* Function: sort_directory
*
* Purpose: Sort the directory in the appropriate ISO9660
int i;
struct directory_entry * s_entry;
struct directory_entry ** sortlist;
-
+
s_entry = *sort_dir;
while(s_entry)
{
}
/*
- * 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);
dcount = 0;
}
s_entry = s_entry->next;
}
-
+
sort_goof = 0;
#ifdef __STDC__
- qsort(sortlist, dcount, sizeof(struct directory_entry *),
+ qsort(sortlist, dcount, sizeof(struct directory_entry *),
(int (*)(const void *, const void *))joliet_compare_dirs);
#else
- qsort(sortlist, dcount, sizeof(struct directory_entry *),
+ qsort(sortlist, dcount, sizeof(struct directory_entry *),
joliet_compare_dirs);
#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++)
{
sortlist[dcount-1]->jnext = NULL;
*sort_dir = sortlist[0];
-
+
free(sortlist);
return sort_goof;
}
}
}
/* 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);
dpnt = dpnt->next;
}
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_m, 1, jpath_blocks << 11, outfile);
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;
get_joliet_vol_desc(&jvol_desc);
jpath_table[1] = 0;
jpath_table[2] = jpath_table[0] + jpath_blocks;
jpath_table[3] = 0;
-
+
last_extent += 2*jpath_blocks;
return 0;
}
}
-/*
- * 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
* minutes, and is what you add to GMT to get the localtime. The U.S.
result[4] = local->tm_min;
result[5] = local->tm_sec;
- /*
+ /*
* 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 */
local = gmtime(&crtime);
local->tm_yday -= result[6];
local->tm_hour -= result[3];
local->tm_min -= result[4];
- if (local->tm_year < 0)
+ if (local->tm_year < 0)
{
local->tm_yday = -1;
}
- else
+ else
{
if (local->tm_year > 0) local->tm_yday = 1;
}
{
int resource;
struct rlimit rlp;
- if (getrlimit(RLIMIT_DATA,&rlp) == -1)
+ if (getrlimit(RLIMIT_DATA,&rlp) == -1)
perror (_("Warning: getrlimit"));
else {
rlp.rlim_cur=33554432;
merge_image);
}
- memcpy(&de.isorec.extent, mrootp->extent, 8);
+ memcpy(&de.isorec.extent, mrootp->extent, 8);
}
/*
break;
}
*pnt = '\0';
- graft_dir = find_or_create_directory(graft_dir,
- graft_point,
+ graft_dir = find_or_create_directory(graft_dir,
+ graft_point,
NULL, TRUE);
*pnt = PATH_SEPARATOR;
xpnt = pnt + 1;
if (goof)
error (1, 0, _("Joliet tree sort failed.\n"));
-
+
/*
* Fix a couple of things in the root directory so that everything
* 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 */
/*
outputlist_insert(&dirtree_clean);
- if(extension_record)
- {
+ if(extension_record)
+ {
outputlist_insert(&extension_desc);
}
* will always be a primary and an end volume descriptor.
*/
last_extent = session_start;
-
+
/*
* Calculate the size of all of the components of the disc, and assign
* extent numbers.
if( verbose > 0 )
{
#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));
#endif
fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);
unsigned int starting_block;
unsigned int size;
};
-
+
/*
* This structure is used to control the output of fragments to the cdrom
extern struct output_fragment extension_desc;
extern struct output_fragment files_desc;
-/*
+/*
* This structure describes one complete directory. It has pointers
* 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
struct directory_entry * self, int));
extern void DECL (finish_cl_pl_entries, (void));
extern int DECL(scan_directory_tree,(struct directory * this_dir,
- char * path,
+ char * path,
struct directory_entry * self));
-extern int DECL(insert_file_entry,(struct directory *, char *,
+extern int DECL(insert_file_entry,(struct directory *, char *,
char *));
extern void DECL(generate_iso9660_directories,(struct directory *, FILE*));
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));
extern void DECL(update_nlink_field,(struct directory * node));
extern void DECL (init_fstatbuf, (void));
extern FILE * in_image;
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 struct directory_entry **
+extern struct directory_entry **
DECL(read_merging_directory,(struct iso_directory_record *, int*));
-extern void
- DECL(merge_remaining_entries, (struct directory *,
+extern void
+ DECL(merge_remaining_entries, (struct directory *,
struct directory_entry **, int));
-extern int
- DECL(merge_previous_session, (struct directory *,
+extern int
+ DECL(merge_previous_session, (struct directory *,
struct iso_directory_record *));
extern int DECL(get_session_start, (int *));
/* */
-extern int DECL(iso9660_file_length,(const char* name,
+extern int DECL(iso9660_file_length,(const char* name,
struct directory_entry * sresult, int flag));
extern int DECL(iso9660_date,(char *, time_t));
extern void DECL(add_hash,(struct directory_entry *));
extern struct directory_entry * DECL(find_file_hash,(char *));
extern void DECL(add_file_hash,(struct directory_entry *));
extern int DECL(generate_rock_ridge_attributes,(char *, char *,
- struct directory_entry *,
+ struct directory_entry *,
struct stat *, struct stat *,
int deep_flag));
extern char * DECL(generate_rr_extension_record,(char * id, char * descriptor,
/*
- * 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.
*
* Written by Eric Youngdale (1996).
/*
* 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)
{
int cont_extent, cont_offset, cont_size;
} /* parse_rr */
-static int
-FDECL4(check_rr_dates, struct directory_entry *, dpnt,
- struct directory_entry *, current,
- struct stat *, statbuf,
+static int
+FDECL4(check_rr_dates, struct directory_entry *, dpnt,
+ struct directory_entry *, current,
+ struct stat *, statbuf,
struct stat *,lstatbuf)
{
int cont_extent, cont_offset, cont_size;
int same_file_type;
mode_t mode;
char time_buf[7];
-
-
+
+
cont_extent = cont_offset = cont_size = 0;
same_file = 1;
same_file_type = 1;
if( pnt[4] & TF_CREATE )
{
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;
offset += 7;
}
if( pnt[4] & TF_MODIFY )
{
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;
offset += 7;
}
while(i < len )
{
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);
continue;
while(i < len )
{
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);
continue;
*/
rlen = idr->length[0] & 0xff;
cpnt = (unsigned char *) idr;
-
+
rlen -= sizeof(struct iso_directory_record);
cpnt += sizeof(struct iso_directory_record);
-
+
rlen += sizeof(idr->name);
cpnt -= sizeof(idr->name);
-
+
rlen -= idr->name_len[0];
cpnt += idr->name_len[0];
-
+
if((idr->name_len[0] & 1) == 0){
cpnt++;
rlen--;
memset(cpnt, 0, sizeof((*pnt)->isorec.name) - idr->name_len[0]);
parse_rr((*pnt)->rr_attributes, rlen, *pnt);
-
+
if( ((*pnt)->isorec.name_len[0] == 1)
&& ( ((*pnt)->isorec.name[0] == 0)
|| ((*pnt)->isorec.name[0] == 1)) )
tt_extent = isonum_733((unsigned char *)idr->extent);
tt_size = isonum_733((unsigned char *)idr->size);
}
-
+
pnt++;
i += idr->length[0];
}
{
rlen = isonum_711((*pnt)->isorec.name_len);
if( strncmp((char *) cpnt + 2, (*pnt)->isorec.name,
- rlen) == 0
+ rlen) == 0
&& cpnt[2+rlen] == ' ')
{
(*pnt)->table = e_malloc(strlen((char*)cpnt) - 33);
cpnt = cpnt1 + 1;
cpnt1 = cpnt;
}
-
+
free(tt_buf);
}
else if( !seen_rockridge && !warning_given )
{
free(dirbuff);
}
-
+
return rtn;
} /* read_merging_directory */
/*
* Free any associated data related to the structures.
*/
-int
+int
FDECL2(free_mdinfo, struct directory_entry ** , ptr, int, len )
{
int i;
/*
* 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));
memcpy(rootp, pri->root_directory_record, sizeof(*rootp));
{
continue;
}
-
+
if( pnt[i]->name != NULL && pnt[i]->whole_name == NULL)
{
/*
this_dir->contents = pnt[i];
pnt[i] = NULL;
}
-
+
/*
* If we don't have an entry for the translation table, then
* location. FIXME(eric).
*/
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_entry **contents = NULL;
/*
* 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)
&& (i >= 2) )
char * cdwrite_data = NULL;
int
-FDECL1(get_session_start, int *, file_addr)
+FDECL1(get_session_start, int *, file_addr)
{
char * pnt;
{
int dflag;
- if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
+ if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
{
struct directory * child;
- child = find_or_create_directory(this_dir,
- s_entry->whole_name,
+ child = find_or_create_directory(this_dir,
+ s_entry->whole_name,
s_entry, 1);
- dflag = merge_previous_session(child,
+ dflag = merge_previous_session(child,
&odpnt->isorec);
/* If unable to scan directory, mark this as a non-directory */
if(!dflag)
}
}
}
-
+
/*
* Whatever is left over, are things which are no longer in the tree
* on disk. We need to also merge these into the tree.
*/
merge_remaining_entries(this_dir, orig_contents, n_orig);
free_mdinfo(orig_contents, n_orig);
-
+
return 1;
}
#include <ctype.h>
extern int allow_leading_dots;
-
+
/*
* Function: iso9660_file_length
*
* would also be nice to have.
*/
int FDECL3(iso9660_file_length,
- const char*, name,
- struct directory_entry *, sresult,
+ const char*, name,
+ struct directory_entry *, sresult,
int, dirflag)
{
char * c;
*/
if(strcmp(name,".") == 0)
{
- if(result)
+ if(result)
{
*result = 0;
}
*/
if(strcmp(name,"..") == 0)
{
- if(result)
+ if(result)
{
*result++ = 1;
*result++ = 0;
while(*pnt)
{
#ifdef VMS
- if( strcmp(pnt,".DIR;1") == 0 )
+ if( strcmp(pnt,".DIR;1") == 0 )
{
break;
}
* generated by some editors. Lower the priority of
* the file.
*/
- if(*pnt == '#')
+ if(*pnt == '#')
{
- priority = 1;
- pnt++;
- continue;
+ priority = 1;
+ pnt++;
+ continue;
}
/*
* generated by some editors. Lower the priority of
* the file.
*/
- if(*pnt == '~')
+ if(*pnt == '~')
{
- priority = 1;
- tildes++;
- pnt++;
+ priority = 1;
+ tildes++;
+ pnt++;
continue;
}
* If we have a name with multiple '.' characters, we ignore everything
* after we have gotten the extension.
*/
- if(ignore)
+ if(ignore)
{
- pnt++;
+ pnt++;
continue;
}
*/
if(seen_semic)
{
- if(*pnt >= '0' && *pnt <= '9')
+ if(*pnt >= '0' && *pnt <= '9')
{
*result++ = *pnt;
}
* option. We still only allow one '.' character in the
* name, however.
*/
- if(full_iso9660_filenames)
+ if(full_iso9660_filenames)
{
/* Here we allow a more relaxed syntax. */
- if(*pnt == '.')
+ if(*pnt == '.')
{
- if (seen_dot)
+ if (seen_dot)
{
- ignore++;
+ ignore++;
continue;
}
seen_dot++;
}
- if(current_length < 30)
+ if(current_length < 30)
{
if( !isascii (*pnt))
{
}
}
else
- {
- /*
+ {
+ /*
* Dos style filenames. We really restrict the
* names here.
*/
/* It would be nice to have .tar.gz transform to .tgz,
* .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 */
chars_before_dot++;
- if (result)
+ if (result)
{
*result++ = '_'; /* Substitute underscore */
}
* If this isn't the dot that we use for the extension,
* then change the character into a '_' instead.
*/
- if(chars_before_dot < 8)
+ if(chars_before_dot < 8)
{
chars_before_dot++;
- if(result)
+ if(result)
{
*result++ = '_';
}
}
}
- else
+ else
{
- if (seen_dot)
+ if (seen_dot)
{
ignore++; continue;
}
- if(result)
+ if(result)
{
*result++ = '.';
}
seen_dot++;
}
}
- else
+ else
{
if( (seen_dot && (chars_after_dot < 3) && ++chars_after_dot)
|| (!seen_dot && (chars_before_dot < 8) && ++chars_before_dot) )
{
- if(result)
+ if(result)
{
- switch (*pnt)
+ switch (*pnt)
{
default:
if( !isascii (*pnt) )
}
break;
- /*
+ /*
* Descriptions of DOS's 'Parse Filename'
* (function 29H) describes V1 and V2.0+
* separator and terminator characters.
current_length++;
pnt++;
} /* while (*pnt) */
-
+
/*
* OK, that wraps up the scan of the name. Now tidy up a few other
* things.
{
int prio1 = 0;
pnt = name;
- while (*pnt && *pnt != '~')
+ while (*pnt && *pnt != '~')
{
pnt++;
}
- if (*pnt)
+ if (*pnt)
{
pnt++;
}
}
priority = prio1;
}
-
+
/*
* 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
*/
if (!dirflag)
{
- if (!seen_dot && !omit_period)
+ if (!seen_dot && !omit_period)
{
- if (result) *result++ = '.';
+ if (result) *result++ = '.';
extra++;
}
- if(!omit_version_number && !seen_semic)
+ if(!omit_version_number && !seen_semic)
{
if(result)
{
extra += 2;
}
}
-
- if(result)
+
+ if(result)
{
*result++ = 0;
}
a CE entry for the continuation record */
#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
};
/*
- * Add the posix modes
+ * Add the posix modes
*/
if(MAYBE_ADD_CE_ENTRY(PX_SIZE)) add_CE_entry();
Rock[ipnt++] ='P';
Rock[ipnt++] ='X';
Rock[ipnt++] = PX_SIZE;
- Rock[ipnt++] = SU_VERSION;
+ Rock[ipnt++] = SU_VERSION;
flagval |= (1<<0);
set_733((char*)Rock + ipnt, lstatbuf->st_mode);
ipnt += 8;
Rock[ipnt++] ='P';
Rock[ipnt++] ='N';
Rock[ipnt++] = PN_SIZE;
- Rock[ipnt++] = SU_VERSION;
+ Rock[ipnt++] = SU_VERSION;
flagval |= (1<<1);
#if defined(MAJOR_IN_SYSMACROS) || defined(MAJOR_IN_MKDEV)
set_733((char*)Rock + ipnt, major(lstatbuf->st_rdev ));
cpnt = &symlink_buff[0];
flagval |= (1<<2);
- if (! split_SL_field)
+ if (! split_SL_field)
{
int sl_bytes = 0;
- for (cpnt1 = cpnt; *cpnt1 != '\0'; cpnt1++)
+ for (cpnt1 = cpnt; *cpnt1 != '\0'; cpnt1++)
{
- if (*cpnt1 == '/')
+ if (*cpnt1 == '/')
{
sl_bytes += 4;
- }
- else
+ }
+ else
{
sl_bytes += 1;
}
}
- if (sl_bytes > 250)
+ if (sl_bytes > 250)
{
- /*
+ /*
* 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);
}
Rock[ipnt++] ='L';
lenpos = ipnt;
Rock[ipnt++] = SL_SIZE;
- Rock[ipnt++] = SU_VERSION;
+ Rock[ipnt++] = SU_VERSION;
Rock[ipnt++] = 0; /* Flags */
lenval = 5;
while(*cpnt){
nchar--;
*cpnt1 = 0;
};
-
+
/* We treat certain components in a special way. */
if(cpnt[0] == '.' && cpnt[1] == '.' && cpnt[2] == 0){
if(MAYBE_ADD_CE_ENTRY(2)) add_CE_entry();
/* If we do not have enough room for a component, start
a new continuations segment now */
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();
if(cpnt1)
if(nchar) Rock[lenpos + 2] = SL_CONTINUE; /* We need another SL entry */
} /* while nchar */
} /* Is a symbolic link */
- /*
+ /*
* Add in the Rock Ridge TF time field
*/
if(MAYBE_ADD_CE_ENTRY(TF_SIZE)) add_CE_entry();
iso9660_date((char *) &Rock[ipnt], lstatbuf->st_ctime);
ipnt += 7;
- /*
+ /*
* Add in the Rock Ridge RE time field
*/
if(deep_opt & NEED_RE){
Rock[ipnt++] = SU_VERSION;
flagval |= (1<<6);
};
- /*
+ /*
* Add in the Rock Ridge PL record, if required.
*/
if(deep_opt & NEED_PL){
flagval |= (1<<5);
};
- /*
+ /*
* Add in the Rock Ridge CL field, if required.
*/
if(deep_opt & NEED_CL){
#ifndef VMS
/* If transparent compression was requested, fill in the correct
field for this file */
- if(transparent_compression &&
+ if(transparent_compression &&
S_ISREG(lstatbuf->st_mode) &&
strlen(name) > 3 &&
strcmp(name + strlen(name) - 3,".gZ") == 0){
else {
int blocksize;
blocksize = (header[3] << 8) | header[2];
- file_size = ((unsigned int)header[7] << 24) |
- ((unsigned int)header[6] << 16) |
+ file_size = ((unsigned int)header[7] << 24) |
+ ((unsigned int)header[6] << 16) |
((unsigned int)header[5] << 8) | header[4];
#if 0
fprintf(stderr,"Blocksize = %d %d\n", blocksize, file_size);
};
}
#endif
- /*
+ /*
* Add in the Rock Ridge CE field, if required. We use this for the
* extension record that is stored in the root directory.
*/
* missing the required '.' entries. Create these now if we need
* them.
*/
- if( (this_dir->dir_flags & (DIR_HAS_DOT | DIR_HAS_DOTDOT)) !=
+ if( (this_dir->dir_flags & (DIR_HAS_DOT | DIR_HAS_DOTDOT)) !=
(DIR_HAS_DOT | DIR_HAS_DOTDOT) )
{
attach_dot_entries(this_dir, &fstatbuf);
s_entry = s_entry->next;
continue;
}
-
+
/*
- * First assume no conflict, and handle this case
+ * First assume no conflict, and handle this case
*/
if(!(s_entry1 = find_file_hash(s_entry->isorec.name)))
{
s_entry = s_entry->next;
continue;
}
-
+
if(s_entry1 == s_entry)
error (1, 0, _("Fatal goof\n"));
-
- /*
+
+ /*
* OK, handle the conflicts. Try substitute names until we come
- * up with a winner
+ * up with a winner
*/
strcpy(rootname, s_entry->isorec.name);
- if(full_iso9660_filenames)
+ if(full_iso9660_filenames)
{
if(strlen(rootname) > 27) rootname[27] = 0;
}
* a ';'.
*/
c = strchr(rootname, '.');
- if (c)
+ if (c)
*c = 0;
else
{
{
for(d3 = 0; d3 < 36; d3++)
{
- sprintf(newname,"%s.%c%c%c%s", rootname,
+ sprintf(newname,"%s.%c%c%c%s", rootname,
(d1 <= 9 ? '0' + d1 : 'A' + d1 - 10),
(d2 <= 9 ? '0' + d2 : 'A' + d2 - 10),
(d3 <= 9 ? '0' + d3 : 'A' + d3 - 10),
- (s_entry->isorec.flags[0] == 2 ||
+ (s_entry->isorec.flags[0] == 2 ||
omit_version_number ? "" : ";1"));
-
+
#ifdef VMS
/* Sigh. VAXCRTL seems to be broken here */
{
int ijk = 0;
- while(newname[ijk])
+ while(newname[ijk])
{
if(newname[ijk] == ' ') newname[ijk] = '0';
ijk++;
}
}
#endif
-
+
if(!find_file_hash(newname)) goto got_valid_name;
}
}
*/
error (1, 0, _("Unable to generate unique name for file %s\n"), s_entry->name);
-got_valid_name:
- /*
+got_valid_name:
+ /*
* OK, now we have a good replacement name. Now decide which one
- * of these two beasts should get the name changed
+ * of these two beasts should get the name changed
*/
- if(s_entry->priority < s_entry1->priority)
+ if(s_entry->priority < s_entry1->priority)
{
if( verbose > 0 )
{
- fprintf (stderr, _("Using %s for %s%s%s (%s)\n"), newname,
- this_dir->whole_name, SPATH_SEPARATOR,
+ fprintf (stderr, _("Using %s for %s%s%s (%s)\n"), newname,
+ this_dir->whole_name, SPATH_SEPARATOR,
s_entry->name, s_entry1->name);
}
s_entry->isorec.name_len[0] = strlen(newname);
new_reclen = sizeof(struct iso_directory_record) -
sizeof(s_entry->isorec.name) +
strlen(newname);
- if(use_RockRidge)
+ if(use_RockRidge)
{
if (new_reclen & 1) new_reclen++; /* Pad to an even byte */
new_reclen += s_entry->rr_attr_size;
s_entry->isorec.length[0] = new_reclen;
strcpy(s_entry->isorec.name, newname);
}
- else
+ else
{
delete_file_hash(s_entry1);
if( verbose > 0 )
{
- fprintf(stderr, _("Using %s for %s%s%s (%s)\n"), newname,
- this_dir->whole_name, SPATH_SEPARATOR,
+ fprintf(stderr, _("Using %s for %s%s%s (%s)\n"), newname,
+ this_dir->whole_name, SPATH_SEPARATOR,
s_entry1->name, s_entry->name);
}
s_entry1->isorec.name_len[0] = strlen(newname);
new_reclen = sizeof(struct iso_directory_record) -
sizeof(s_entry1->isorec.name) +
strlen(newname);
- if(use_RockRidge)
+ if(use_RockRidge)
{
if (new_reclen & 1) new_reclen++; /* Pad to an even byte */
new_reclen += s_entry1->rr_attr_size;
add_file_hash(s_entry);
s_entry = s_entry->next;
}
-
- if(generate_tables
- && !find_file_hash("TRANS.TBL")
+
+ if(generate_tables
+ && !find_file_hash("TRANS.TBL")
&& (reloc_dir != this_dir)
&& (this_dir->extent == 0) )
{
- /*
- * First we need to figure out how big this table is
+ /*
+ * First we need to figure out how big this table is
*/
for (s_entry = this_dir->contents; s_entry; s_entry = s_entry->next)
{
if(strcmp(s_entry->name, ".") == 0 ||
- strcmp(s_entry->name, "..") == 0) continue;
+ strcmp(s_entry->name, "..") == 0) continue;
if(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) continue;
if(s_entry->table) tablesize += 35 + strlen(s_entry->table);
}
if( tablesize > 0 )
{
- table = (struct directory_entry *)
+ table = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
memset(table, 0, sizeof(struct directory_entry));
table->table = NULL;
table->next = this_dir->contents;
this_dir->contents = table;
-
+
table->filedir = root;
table->isorec.flags[0] = 0;
table->priority = 32768;
table->table = (char *) e_malloc(ROUND_UP(tablesize));
memset(table->table, 0, ROUND_UP(tablesize));
iso9660_file_length ("TRANS.TBL", table, 0);
-
+
if(use_RockRidge)
{
fstatbuf.st_mode = 0444 | S_IFREG;
&fstatbuf, &fstatbuf, 0);
}
}
-
+
/*
* We have now chosen the 8.3 names and we should now know the length
* of every entry in the directory.
}
new_reclen = strlen(s_entry->isorec.name);
-
+
/*
* First update the path table sizes for directories.
*/
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,".."))
{
path_table_size += new_reclen + sizeof(struct iso_path_table) - 1;
if (new_reclen & 1) path_table_size++;
}
- else
+ else
{
new_reclen = 1;
if (this_dir == root && strlen(s_entry->name) == 1)
}
if(path_table_size & 1) path_table_size++; /* For odd lengths we pad */
s_entry->isorec.name_len[0] = new_reclen;
-
- new_reclen +=
+
+ new_reclen +=
sizeof(struct iso_directory_record) -
sizeof(s_entry->isorec.name);
-
- if (new_reclen & 1)
+
+ if (new_reclen & 1)
new_reclen++;
-
+
new_reclen += s_entry->rr_attr_size;
-
+
if (new_reclen & 1) new_reclen++;
-
- if(new_reclen > 0xff)
+
+ if(new_reclen > 0xff)
error (1, 0, _("Fatal error - RR overflow for file %s\n"),
s_entry->name);
s_entry->isorec.length[0] = new_reclen;
s_entry->table = NULL;
}
- if(count != tablesize)
+ if(count != tablesize)
error (1, 0, _("Translation table size mismatch %d %d\n"),
count, tablesize);
}
- /*
+ /*
* 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->contents;
this_dir->ce_bytes = 0;
new_reclen = s_entry->isorec.length[0];
if ((this_dir->size & (SECTOR_SIZE - 1)) + new_reclen >= SECTOR_SIZE)
- this_dir->size = (this_dir->size + (SECTOR_SIZE - 1)) &
+ this_dir->size = (this_dir->size + (SECTOR_SIZE - 1)) &
~(SECTOR_SIZE - 1);
this_dir->size += new_reclen;
/* See if continuation entries were used on disc */
- if(use_RockRidge &&
- s_entry->rr_attr_size != s_entry->total_rr_attr_size)
+ if(use_RockRidge &&
+ s_entry->rr_attr_size != s_entry->total_rr_attr_size)
{
unsigned char * pnt;
int len;
int nbytes;
-
+
pnt = s_entry->rr_attributes;
len = s_entry->total_rr_attr_size;
-
+
/*
* We make sure that each continuation entry record is not
* split across sectors, but each file could in theory have more
- * than one CE, so we scan through and figure out what we need.
+ * than one CE, so we scan through and figure out what we need.
*/
while(len > 3)
{
- if(pnt[0] == 'C' && pnt[1] == 'E')
+ if(pnt[0] == 'C' && pnt[1] == 'E')
{
nbytes = get_733((char *) pnt+20);
-
+
if((this_dir->ce_bytes & (SECTOR_SIZE - 1)) + nbytes >=
- SECTOR_SIZE) this_dir->ce_bytes =
+ SECTOR_SIZE) this_dir->ce_bytes =
ROUND_UP(this_dir->ce_bytes);
/* Now store the block in the ce buffer */
this_dir->ce_bytes += nbytes;
/* Create an entry for our internal tree */
time (¤t_time);
- reloc_dir = (struct directory *)
+ reloc_dir = (struct directory *)
e_malloc(sizeof(struct directory));
memset(reloc_dir, 0, sizeof(struct directory));
reloc_dir->parent = root;
reloc_dir->whole_name = strdup("./rr_moved");
reloc_dir->de_name = strdup("rr_moved");
reloc_dir->extent = 0;
-
-
+
+
/* Now create an actual directory entry */
- s_entry = (struct directory_entry *)
+ s_entry = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
memset(s_entry, 0, sizeof(struct directory_entry));
s_entry->next = root->contents;
"rr_moved", s_entry,
&fstatbuf, &fstatbuf, 0);
};
-
+
/* Now create the . and .. entries in rr_moved */
/* Now create an actual directory entry */
attach_dot_entries(reloc_dir, &root_statbuf);
}
-/*
+/*
* Function: attach_dot_entries
*
* Purpose: Create . and .. entries for a new directory.
if( (dirnode->dir_flags & DIR_HAS_DOTDOT) == 0 )
{
- s_entry = (struct directory_entry *)
+ s_entry = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
- memcpy(s_entry, dirnode->self,
+ memcpy(s_entry, dirnode->self,
sizeof(struct directory_entry));
s_entry->name = strdup("..");
s_entry->whole_name = NULL;
}
generate_rock_ridge_attributes("",
"..", s_entry,
- parent_stat,
+ parent_stat,
parent_stat, 0);
}
dirnode->dir_flags |= DIR_HAS_DOTDOT;
if( (dirnode->dir_flags & DIR_HAS_DOT) == 0 )
{
- s_entry = (struct directory_entry *)
+ s_entry = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
- memcpy(s_entry, dirnode->self,
+ memcpy(s_entry, dirnode->self,
sizeof(struct directory_entry));
s_entry->name = strdup(".");
s_entry->whole_name = NULL;
iso9660_file_length (".", s_entry, 1);
iso9660_date(s_entry->isorec.date, fstatbuf.st_mtime);
s_entry->filedir = dirnode;
-
+
dirnode->contents = s_entry;
dirnode->contents->next = orig_contents;
{
fstatbuf.st_mode = 0555 | S_IFDIR;
fstatbuf.st_nlink = 2;
-
+
if( dirnode == root )
{
deep_flag |= NEED_CE | NEED_SP; /* For extension record */
}
-
+
generate_rock_ridge_attributes("",
".", s_entry,
&fstatbuf, &fstatbuf, deep_flag);
}
-
+
dirnode->dir_flags |= DIR_HAS_DOT;
}
{
unsigned char * pnt;
int len;
-
+
pnt = s_entry->rr_attributes;
len = s_entry->total_rr_attr_size;
while(len)
{
- if(pnt[0] == 'P' && pnt[1] == 'X')
+ if(pnt[0] == 'P' && pnt[1] == 'X')
{
set_733((char *) pnt+12, value);
break;
{
unsigned char * pnt;
int len, nlink;
-
+
pnt = s_entry->rr_attributes;
len = s_entry->total_rr_attr_size;
while(len)
{
- if(pnt[0] == 'P' && pnt[1] == 'X')
+ if(pnt[0] == 'P' && pnt[1] == 'X')
{
nlink = get_733((char *) pnt+12);
set_733((char *) pnt+12, nlink+1);
};
}
-/*
+/*
* Function: scan_directory_tree
*
* Purpose: Walk through a directory on the local machine
*/
int
FDECL3(scan_directory_tree,struct directory *, this_dir,
- char *, path,
+ char *, path,
struct directory_entry *, de)
{
DIR * current_dir;
if(current_dir) d_entry = readdir(current_dir);
- if(!current_dir || !d_entry)
+ if(!current_dir || !d_entry)
{
fprintf (stderr, _("Unable to open directory %s\n"), path);
de->isorec.flags[0] &= ~2; /* Mark as not a directory */
*/
if (de->de_flags & INHIBIT_ISO9660_ENTRY)
this_dir->dir_flags |= INHIBIT_ISO9660_ENTRY;
-
+
if (de->de_flags & INHIBIT_JOLIET_ENTRY)
this_dir->dir_flags |= INHIBIT_JOLIET_ENTRY;
-
- /*
- * Now we scan the directory itself, and look at what is inside of it.
+
+ /*
+ * Now we scan the directory itself, and look at what is inside of it.
*/
dflag = 0;
while(1==1){
continue;
}
- if( generate_tables
+ if( generate_tables
&& strcmp(d_entry->d_name, "TRANS.TBL") == 0 )
{
/*
* versions of these files, and we need to ignore any
* originals that we might have found.
*/
- if (verbose > 1)
+ if (verbose > 1)
{
fprintf (stderr, _("Excluded: %s\n"), whole_path);
}
* If we already have a '.' or a '..' entry, then don't
* insert new ones.
*/
- if( strcmp(d_entry->d_name, ".") == 0
+ if( strcmp(d_entry->d_name, ".") == 0
&& this_dir->dir_flags & DIR_HAS_DOT )
{
continue;
}
- if( strcmp(d_entry->d_name, "..") == 0
+ if( strcmp(d_entry->d_name, "..") == 0
&& this_dir->dir_flags & DIR_HAS_DOTDOT )
{
continue;
insert_file_entry(this_dir, whole_path, d_entry->d_name);
}
closedir(current_dir);
-
+
return 1;
}
-/*
+/*
* Function: insert_file_entry
*
* Purpose: Insert one entry into our directory node.
fprintf (stderr, _("Non-existant or inaccessible: %s\n"),whole_path);
return 0;
}
-
+
if(this_dir == root && strcmp(short_name, ".") == 0)
root_statbuf = statbuf; /* Save this for later on */
-
+
/* We do this to make sure that the root entries are consistent */
- if(this_dir == root && strcmp(short_name, "..") == 0)
+ if(this_dir == root && strcmp(short_name, "..") == 0)
{
statbuf = root_statbuf;
lstatbuf = root_statbuf;
if(S_ISLNK(lstatbuf.st_mode))
{
-
+
/* Here we decide how to handle the symbolic links. Here
we handle the general case - if we are not following
links or there is an error, then we must change
something. If RR is in use, it is easy, we let RR
describe the file. If not, then we punt the file. */
-
+
if((status || !follow_links))
{
if(use_RockRidge)
statbuf.st_dev = (dev_t) UNCACHED_DEVICE;
statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG;
} else {
- if(follow_links)
+ if(follow_links)
{
fprintf (stderr,
_("Unable to stat file %s - ignoring and continuing.\n"),
}
}
}
-
+
/* Here we handle a different kind of case. Here we have
a symlink, but we want to follow symlinks. If we run
across a directory loop, then we need to pretend that
is the first time we have seen this, then make this
seem as if there was no symlink there in the first
place */
-
+
if( follow_links
- && S_ISDIR(statbuf.st_mode) )
+ && S_ISDIR(statbuf.st_mode) )
{
if( strcmp(short_name, ".")
&& strcmp(short_name, "..") )
{
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)))
{
- if(!use_RockRidge)
+ if(!use_RockRidge)
{
fprintf (stderr, _("Already cached directory seen (%s)\n"),
whole_path);
statbuf.st_dev = (dev_t) UNCACHED_DEVICE;
statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG;
}
- else
+ else
{
lstatbuf = statbuf;
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
}
}
-
+
/*
* For non-directories, we just copy the stat information over
* so we correctly include this file.
*/
if( follow_links
- && !S_ISDIR(statbuf.st_mode) )
+ && !S_ISDIR(statbuf.st_mode) )
{
lstatbuf = statbuf;
}
}
-
+
/*
* Add directories to the cache so that we don't waste space even
* if we are supposed to be following symlinks.
if( follow_links
&& strcmp(short_name, ".")
&& strcmp(short_name, "..")
- && S_ISDIR(statbuf.st_mode) )
+ && S_ISDIR(statbuf.st_mode) )
{
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
whole_path, strerror (errno));
return 0;
}
-
+
/* Add this so that we can detect directory loops with hard links.
If we are set up to follow symlinks, then we skip this checking. */
- if( !follow_links
- && S_ISDIR(lstatbuf.st_mode)
- && strcmp(short_name, ".")
- && strcmp(short_name, "..") )
+ if( !follow_links
+ && S_ISDIR(lstatbuf.st_mode)
+ && strcmp(short_name, ".")
+ && strcmp(short_name, "..") )
{
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)))
error (1, 0, _("Directory loop - fatal goof (%s %lx %lu).\n"),
(unsigned long) STAT_INODE(statbuf));
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
-
+
if (!S_ISCHR(lstatbuf.st_mode) && !S_ISBLK(lstatbuf.st_mode) &&
!S_ISFIFO(lstatbuf.st_mode) && !S_ISSOCK(lstatbuf.st_mode)
&& !S_ISLNK(lstatbuf.st_mode) && !S_ISREG(lstatbuf.st_mode) &&
whole_path);
return 0;
}
-
+
/* Who knows what trash this is - ignore and continue */
-
- if(status)
+
+ if(status)
{
fprintf (stderr,
_("Unable to stat file %s - ignoring and continuing.\n"),
whole_path);
- return 0;
+ return 0;
}
-
+
/*
* Check to see if we have already seen this directory node.
* If so, then we don't create a new entry for it, but we do want
* to recurse beneath it and add any new files we do find.
*/
- if (S_ISDIR(statbuf.st_mode))
+ if (S_ISDIR(statbuf.st_mode))
{
int dflag;
-
+
for( s_entry = this_dir->contents; s_entry; s_entry = s_entry->next)
{
if( strcmp(s_entry->name, short_name) == 0 )
break;
}
}
- if ( s_entry != NULL
- && strcmp(short_name,".")
- && strcmp(short_name,".."))
+ if ( s_entry != NULL
+ && strcmp(short_name,".")
+ && strcmp(short_name,".."))
{
struct directory * child;
-
+
if ( (s_entry->de_flags & RELOCATED_DIRECTORY) != 0)
{
for( s_entry = reloc_dir->contents; s_entry; s_entry = s_entry->next)
break;
}
}
- child = find_or_create_directory(reloc_dir, whole_path,
+ child = find_or_create_directory(reloc_dir, whole_path,
s_entry, 1);
}
else
{
- child = find_or_create_directory(this_dir, whole_path,
+ child = find_or_create_directory(this_dir, whole_path,
s_entry, 1);
/* If unable to scan directory, mark this as a non-directory */
}
return 0;
}
}
-
- s_entry = (struct directory_entry *)
+
+ s_entry = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
s_entry->next = this_dir->contents;
memset(s_entry->isorec.extent, 0, 8);
this_dir->contents = s_entry;
deep_flag = 0;
s_entry->table = NULL;
-
+
s_entry->name = strdup(short_name);
s_entry->whole_name = strdup (whole_path);
if( strcmp(short_name, ".") == 0)
{
this_dir->dir_flags |= DIR_HAS_DOT;
- }
+ }
if( strcmp(short_name, "..") == 0)
{
this_dir->dir_flags |= DIR_HAS_DOTDOT;
- }
+ }
- if( this_dir->parent
- && this_dir->parent == reloc_dir
+ if( this_dir->parent
+ && this_dir->parent == reloc_dir
&& strcmp(short_name, "..") == 0)
{
s_entry->inode = UNCACHED_INODE;
s_entry->dev = (dev_t) UNCACHED_DEVICE;
deep_flag = NEED_PL;
- }
+ }
else
{
s_entry->inode = STAT_INODE(statbuf);
s_entry->rr_attr_size = 0;
s_entry->total_rr_attr_size = 0;
s_entry->rr_attributes = NULL;
-
+
/* Directories are assigned sizes later on */
- if (!S_ISDIR(statbuf.st_mode))
+ if (!S_ISDIR(statbuf.st_mode))
{
- if (S_ISCHR(lstatbuf.st_mode) || S_ISBLK(lstatbuf.st_mode) ||
+ if (S_ISCHR(lstatbuf.st_mode) || S_ISBLK(lstatbuf.st_mode) ||
S_ISFIFO(lstatbuf.st_mode) || S_ISSOCK(lstatbuf.st_mode)
|| S_ISLNK(lstatbuf.st_mode))
{
- s_entry->size = 0;
- statbuf.st_size = 0;
+ s_entry->size = 0;
+ statbuf.st_size = 0;
}
else
{
- s_entry->size = statbuf.st_size;
+ s_entry->size = statbuf.st_size;
}
- set_733((char *) s_entry->isorec.size, statbuf.st_size);
- }
+ set_733((char *) s_entry->isorec.size, statbuf.st_size);
+ }
else
{
s_entry->isorec.flags[0] = 2;
}
-
- if (strcmp(short_name,".") && strcmp(short_name,"..") &&
+
+ if (strcmp(short_name,".") && strcmp(short_name,"..") &&
S_ISDIR(statbuf.st_mode) && this_dir->depth > RR_relocation_depth)
{
struct directory * child;
if(!reloc_dir) generate_reloc_directory();
-
+
/*
* Replicate the entry for this directory. The old one will stay where it
* is, and it will be neutered so that it no longer looks like a directory.
* The new one will look like a directory, and it will be put in the reloc_dir.
*/
- s_entry1 = (struct directory_entry *)
+ s_entry1 = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
memcpy(s_entry1, s_entry, sizeof(struct directory_entry));
s_entry1->table = NULL;
reloc_dir->contents = s_entry1;
s_entry1->priority = 32768;
s_entry1->parent_rec = this_dir->contents;
-
+
deep_flag = NEED_RE;
-
- if(use_RockRidge)
+
+ if(use_RockRidge)
{
generate_rock_ridge_attributes(whole_path,
short_name, s_entry1,
&statbuf, &lstatbuf, deep_flag);
}
-
+
deep_flag = 0;
-
+
/* We need to set this temporarily so that the parent to this
is correctly determined. */
s_entry1->filedir = reloc_dir;
- child = find_or_create_directory(reloc_dir, whole_path,
+ child = find_or_create_directory(reloc_dir, whole_path,
s_entry1, 0);
scan_directory_tree(child, whole_path, s_entry1);
s_entry1->filedir = this_dir;
-
+
statbuf.st_size = 0;
statbuf.st_mode &= 0777;
set_733((char *) s_entry->isorec.size, 0);
s_entry->de_flags |= RELOCATED_DIRECTORY;
deep_flag = NEED_CL;
}
-
- if(generate_tables
- && strcmp(s_entry->name, ".")
- && strcmp(s_entry->name, ".."))
+
+ if(generate_tables
+ && strcmp(s_entry->name, ".")
+ && strcmp(s_entry->name, ".."))
{
char buffer[2048];
int nchar;
#endif
#ifdef S_IFLNK
case S_IFLNK:
- nchar = readlink(whole_path,
- (char *)symlink_buff,
+ nchar = readlink(whole_path,
+ (char *)symlink_buff,
sizeof(symlink_buff));
symlink_buff[nchar < 0 ? 0 : nchar] = 0;
sprintf(buffer,"L\t%s\t%s\n",
};
s_entry->table = strdup(buffer);
}
-
+
if(S_ISDIR(statbuf.st_mode))
{
int dflag;
- if (strcmp(short_name,".") && strcmp(short_name,".."))
+ if (strcmp(short_name,".") && strcmp(short_name,".."))
{
struct directory * child;
-
- child = find_or_create_directory(this_dir, whole_path,
+
+ child = find_or_create_directory(this_dir, whole_path,
s_entry, 1);
dflag = scan_directory_tree(child, whole_path, s_entry);
-
+
if(!dflag)
{
lstatbuf.st_mode = (lstatbuf.st_mode & ~S_IFMT) | S_IFREG;
}
/* If unable to scan directory, mark this as a non-directory */
}
-
+
if(use_RockRidge && this_dir == root && strcmp(s_entry->name, ".") == 0)
{
deep_flag |= NEED_CE | NEED_SP; /* For extension record */
}
-
+
/* Now figure out how much room this file will take in the
directory */
-
- if(use_RockRidge)
+
+ if(use_RockRidge)
{
generate_rock_ridge_attributes(whole_path,
short_name, s_entry,
&statbuf, &lstatbuf, deep_flag);
-
+
}
-
+
return 1;
}
*/
if( de == NULL )
{
- de = (struct directory_entry *)
+ de = (struct directory_entry *)
e_malloc(sizeof (struct directory_entry));
memset(de, 0, sizeof(struct directory_entry));
de->next = parent->contents;
fstatbuf.st_nlink = 2;
generate_rock_ridge_attributes("",
(char *) pnt, de,
- &fstatbuf,
+ &fstatbuf,
&fstatbuf, 0);
}
iso9660_date(de->isorec.date, fstatbuf.st_mtime);
if(!parent || parent == root)
{
- if (!root)
+ if (!root)
{
root = dpnt; /* First time through for root directory only */
root->depth = 0;
{
root->subdir = dpnt;
}
- else
+ else
{
next_brother = root->subdir;
while(next_brother->next) next_brother = next_brother->next;
}
dpnt->parent = parent;
}
- }
- else
+ }
+ else
{
/* Come through here for normal traversal of tree */
#ifdef DEBUG
fprintf(stderr,"%s(%d) ", path, dpnt->depth);
#endif
- if(parent->depth > RR_relocation_depth)
+ if(parent->depth > RR_relocation_depth)
error (1, 0, _("Directories too deep %s\n"), path);
-
- dpnt->parent = parent;
+
+ dpnt->parent = parent;
dpnt->depth = parent->depth + 1;
-
+
if(!parent->subdir)
{
parent->subdir = dpnt;
}
- else
+ else
{
next_brother = parent->subdir;
while(next_brother->next) next_brother = next_brother->next;
{
break;
}
-
+
if(dpnt->subdir) sort_tree(dpnt->subdir);
dpnt = dpnt->next;
}
int i;
dpnt = node;
-
+
while (dpnt)
{
if (dpnt->dir_flags & INHIBIT_ISO9660_ENTRY) {
/*
* something quick and dirty to locate a file given a path
* recursively walks down path in filename until it finds the
- * directory entry for the desired file
+ * directory entry for the desired file
*/
-struct directory_entry * FDECL2(search_tree_file, struct directory *,
+struct directory_entry * FDECL2(search_tree_file, struct directory *,
node,char *, filename)
{
struct directory_entry * depnt;
char * subdir;
/*
- * strip off next directory name from filename
+ * strip off next directory name from filename
*/
subdir = strdup(filename);
}
/*
- * do we need to find a subdirectory
+ * do we need to find a subdirectory
*/
- if (p1)
+ if (p1)
{
*p1 = '\0';
#ifdef DEBUG_TORITO
- fprintf(stderr,"Looking for subdir called %s\n",p1);
+ fprintf(stderr,"Looking for subdir called %s\n",p1);
#endif
rest = p1+1;
#ifdef DEBUG_TORITO
- fprintf(stderr,"Remainder of path name is now %s\n", rest);
+ fprintf(stderr,"Remainder of path name is now %s\n", rest);
#endif
-
+
dpnt = node->subdir;
while( dpnt )
{
#ifdef DEBUG_TORITO
- fprintf(stderr,"%4d %5d %s\n", dpnt->extent, dpnt->size,
- dpnt->de_name);
+ fprintf(stderr,"%4d %5d %s\n", dpnt->extent, dpnt->size,
+ dpnt->de_name);
#endif
- if (!strcmp(subdir, dpnt->de_name))
+ if (!strcmp(subdir, dpnt->de_name))
{
#ifdef DEBUG_TORITO
- fprintf(stderr,"Calling next level with filename = %s", rest);
+ fprintf(stderr,"Calling next level with filename = %s", rest);
#endif
return(search_tree_file( dpnt, rest ));
}
dpnt = dpnt->next;
}
-
+
/* if we got here means we couldnt find the subdir */
return (NULL);
- }
- else
+ }
+ else
{
- /*
- * look for a normal file now
+ /*
+ * look for a normal file now
*/
depnt = node->contents;
while (depnt)
{
#ifdef DEBUG_TORITO
- fprintf(stderr,"%4d %5d %s\n",depnt->isorec.extent,
- depnt->size, depnt->name);
+ fprintf(stderr,"%4d %5d %s\n",depnt->isorec.extent,
+ depnt->size, depnt->name);
#endif
- if (!strcmp(filename, depnt->name))
+ if (!strcmp(filename, depnt->name))
{
#ifdef DEBUG_TORITO
- fprintf(stderr,"Found our file %s", filename);
+ fprintf(stderr,"Found our file %s", filename);
#endif
return(depnt);
}
depnt = depnt->next;
}
- /*
- * if we got here means we couldnt find the subdir
+ /*
+ * if we got here means we couldnt find the subdir
*/
return (NULL);
}
#include "mkisofs.h"
#include "iso9660.h"
#include "msdos_partition.h"
-
+
#ifdef __SVR4
extern char * strdup(const char *);
#endif
error (1, errno, _("Cannot open '%s'"), nbuf);
}
- while(count)
+ while(count)
{
size_t got = fwrite (buffer, size, count, file);
struct directory * dpnt;
dpnt = node;
-
+
while (dpnt)
{
/* skip if it's hidden */
{
dpnt->extent = last_extent;
dir_size = (dpnt->size + (SECTOR_SIZE - 1)) >> 11;
-
+
last_extent += dir_size;
-
- /*
+
+ /*
* Leave room for the CE entries for this directory. Keep them
- * close to the reference directory so that access will be
- * quick.
+ * close to the reference directory so that access will be
+ * quick.
*/
if(dpnt->ce_bytes)
{
}
}
- if(dpnt->subdir)
+ if(dpnt->subdir)
{
assign_directory_addresses(dpnt->subdir);
}
return 0;
}
-static void FDECL3(write_one_file, char *, filename,
+static void FDECL3(write_one_file, char *, filename,
uint64_t, size, FILE *, outfile)
{
char buffer[SECTOR_SIZE * NSECT];
size_t use;
- if ((infile = fopen(filename, "rb")) == NULL)
+ if ((infile = fopen(filename, "rb")) == NULL)
error (1, errno, _("cannot open %s\n"), filename);
remain = size;
use = (remain > SECTOR_SIZE * NSECT - 1 ? NSECT*SECTOR_SIZE : remain);
use = ROUND_UP(use); /* Round up to nearest sector boundary */
memset(buffer, 0, use);
- if (fread(buffer, 1, use, infile) == 0)
- error (1, errno, _("cannot read %llu bytes from %s"), use, filename);
+ if (fread(buffer, 1, use, infile) == 0)
+ error (1, errno, _("cannot read %llu bytes from %s"), use, filename);
xfwrite(buffer, 1, use, outfile);
last_extent_written += use/SECTOR_SIZE;
#if 0
- if((last_extent_written % 1000) < use/SECTOR_SIZE)
+ if((last_extent_written % 1000) < use/SECTOR_SIZE)
{
fprintf(stderr,"%d..", last_extent_written);
}
time_t now;
time_t the_end;
double frac;
-
+
time(&now);
frac = last_extent_written / (double)last_extent;
the_end = begun + (now - begun) / frac;
dwpnt = dw_head;
while(dwpnt)
{
- if(dwpnt->table)
+ if(dwpnt->table)
{
write_one_file (dwpnt->table, dwpnt->size, outfile);
table_size += dwpnt->size;
free (dwpnt->table);
}
- else
+ else
{
#ifdef VMS
}
#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;
struct directory_entry ** r, **l;
-
+
r = (struct directory_entry **) rr;
l = (struct directory_entry **) ll;
rpnt = (*r)->isorec.name;
{
sort_goof++;
}
-
+
/*
* Put the '.' and '..' entries on the head of the sorted list.
* For normal ASCII, this always happens to be the case, but out of
if((*l)->isorec.name_len[0] == 1 && *lpnt == 1) return 1;
#endif
- while(*rpnt && *lpnt)
+ while(*rpnt && *lpnt)
{
if(*rpnt == ';' && *lpnt != ';') return -1;
if(*rpnt != ';' && *lpnt == ';') return 1;
-
+
if(*rpnt == ';' && *lpnt == ';') return 0;
-
+
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;
rpnt++; lpnt++;
return 0;
}
-/*
+/*
* Function: sort_directory
*
* Purpose: Sort the directory in the appropriate ISO9660
int i, len;
struct directory_entry * s_entry;
struct directory_entry ** sortlist;
-
+
/* need to keep a count of how many entries are hidden */
s_entry = *sort_dir;
while(s_entry)
}
/*
- * 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);
j = dcount - 1;
s_entry->isorec.name[len] = 0;
s_entry = s_entry->next;
}
-
+
/*
* Each directory is required to contain at least . and ..
*/
if( dcount < 2 )
{
sort_goof = 1;
-
+
}
else
{
/* only sort the non-hidden entries */
sort_goof = 0;
#ifdef __STDC__
- qsort(sortlist, dcount, sizeof(struct directory_entry *),
+ qsort(sortlist, dcount, sizeof(struct directory_entry *),
(int (*)(const void *, const void *))compare_dirs);
#else
- qsort(sortlist, dcount, sizeof(struct directory_entry *),
+ qsort(sortlist, dcount, sizeof(struct directory_entry *),
compare_dirs);
#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
* Joliet tree.
*/
{
sortlist[i]->next = sortlist[i+1];
}
-
+
sortlist[dcount+xcount-1]->next = NULL;
*sort_dir = sortlist[0];
}
static int root_gen()
{
init_fstatbuf();
-
+
root_record.length[0] = 1 + sizeof(struct iso_directory_record)
- sizeof(root_record.name);
root_record.ext_attr_length[0] = 0;
{
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);
if(s_hash)
{
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);
}
set_733((char *) s_entry->isorec.extent, s_hash->starting_block);
}
/*
- * 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
* assigned extents for directories, so we just need to
* 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)
{
finddir = dpnt->subdir;
{
if(finddir->self == s_entry) break;
finddir = finddir->next;
- if (!finddir)
+ if (!finddir)
error (1, 0, _("Fatal goof\n"));
}
set_733((char *) s_entry->isorec.extent, finddir->extent);
* If this is . or .., then look up the relevant info from the
* tables.
*/
- if(strcmp(s_entry->name,".") == 0)
+ if(strcmp(s_entry->name,".") == 0)
{
set_733((char *) s_entry->isorec.extent, dpnt->extent);
-
- /*
+
+ /*
* Set these so that the hash table has the
* correct information
*/
s_entry->starting_block = dpnt->extent;
s_entry->size = ROUND_UP(dpnt->size);
-
+
add_hash(s_entry);
s_entry->starting_block = dpnt->extent;
set_733((char *) s_entry->isorec.size, ROUND_UP(dpnt->size));
continue;
}
- if(strcmp(s_entry->name,"..") == 0)
+ if(strcmp(s_entry->name,"..") == 0)
{
if(dpnt == root)
- {
+ {
total_dir_size += root->size;
}
set_733((char *) s_entry->isorec.extent, dpnt->parent->extent);
-
- /*
+
+ /*
* Set these so that the hash table has the
* correct information
*/
s_entry->starting_block = dpnt->parent->extent;
s_entry->size = ROUND_UP(dpnt->parent->size);
-
+
add_hash(s_entry);
s_entry->starting_block = dpnt->parent->extent;
set_733((char *) s_entry->isorec.size, ROUND_UP(dpnt->parent->size));
continue;
}
- /*
+ /*
* Some ordinary non-directory file. Just schedule the
* file to be written. This is all quite
* straightforward, just make a list and assign extents
* directories, we should be ready write out these
* files
*/
- if(s_entry->size)
+ if(s_entry->size)
{
- dwpnt = (struct deferred_write *)
+ dwpnt = (struct deferred_write *)
e_malloc(sizeof(struct deferred_write));
if(dw_tail)
{
dw_tail->next = dwpnt;
dw_tail = dwpnt;
- }
- else
+ }
+ else
{
dw_head = dwpnt;
dw_tail = dwpnt;
}
- if(s_entry->inode == TABLE_INODE)
+ if(s_entry->inode == TABLE_INODE)
{
dwpnt->table = s_entry->table;
dwpnt->name = NULL;
sprintf(whole_path,"%s%sTRANS.TBL",
s_entry->filedir->whole_name, SPATH_SEPARATOR);
- }
- else
+ }
+ else
{
dwpnt->table = NULL;
strcpy(whole_path, s_entry->whole_name);
fprintf (stderr, "Warning: large file %s\n", whole_path);
fprintf (stderr, "Starting block is %d\n", s_entry->starting_block);
fprintf (stderr, "Reported file size is %d extents\n", s_entry->size);
-
+
}
#endif
#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,"Starting block is %d\n", s_entry->starting_block);
*/
set_733((char *) s_entry->isorec.extent, last_extent);
}
- if(dpnt->subdir)
+ if(dpnt->subdir)
{
assign_file_addresses(dpnt->subdir);
}
{
struct directory_entry * s_entry;
struct directory_entry * s_entry_d;
-
+
s_entry = dpnt->contents;
- while(s_entry)
+ while(s_entry)
{
s_entry_d = s_entry;
s_entry = s_entry->next;
-
+
if( s_entry_d->name != NULL )
{
free (s_entry_d->name);
struct directory_entry * s_entry;
struct directory_entry * s_entry_d;
unsigned int total_size;
-
+
total_size = (dpnt->size + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1);
directory_buffer = (char *) e_malloc(total_size);
memset(directory_buffer, 0, total_size);
dir_index = 0;
-
+
ce_size = (dpnt->ce_bytes + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1);
ce_buffer = NULL;
-
- if(ce_size)
+
+ if(ce_size)
{
ce_buffer = (char *) e_malloc(ce_size);
memset(ce_buffer, 0, ce_size);
-
+
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 = ce_address << 11;
}
-
+
s_entry = dpnt->contents;
- while(s_entry)
+ while(s_entry)
{
/* skip if it's hidden */
if(s_entry->de_flags & INHIBIT_ISO9660_ENTRY) {
continue;
}
- /*
- * We do not allow directory entries to cross sector boundaries.
- * Simply pad, and then start the next entry at the next sector
+ /*
+ * We do not allow directory entries to cross sector boundaries.
+ * Simply pad, and then start the next entry at the next sector
*/
new_reclen = s_entry->isorec.length[0];
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);
}
- memcpy(directory_buffer + dir_index, &s_entry->isorec,
+ memcpy(directory_buffer + dir_index, &s_entry->isorec,
sizeof(struct iso_directory_record) -
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];
/*
- * Add the Rock Ridge attributes, if present
+ * Add the Rock Ridge attributes, if present
*/
if(s_entry->rr_attr_size)
{
directory_buffer[dir_index++] = 0;
}
- /*
+ /*
* If the RR attributes were too long, then write the
* 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;
int len, nbytes;
-
- /*
+
+ /*
* 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;
len = s_entry->total_rr_attr_size;
while(len > 3)
ce_index, ce_address);
}
#endif
-
- if(pnt[0] == 'C' && pnt[1] == 'E')
+
+ if(pnt[0] == 'C' && pnt[1] == 'E')
{
nbytes = get_733( (char *) pnt+20);
-
+
if((ce_index & (SECTOR_SIZE - 1)) + nbytes >=
- SECTOR_SIZE)
+ SECTOR_SIZE)
{
ce_index = ROUND_UP(ce_index);
}
-
- set_733( (char *) pnt+4,
+
+ set_733( (char *) pnt+4,
(ce_address + ce_index) >> 11);
- set_733( (char *) pnt+12,
+ set_733( (char *) pnt+12,
(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);
ce_index += nbytes;
- if(ce_index & 1)
+ if(ce_index & 1)
{
ce_index++;
}
len -= pnt[2];
pnt += pnt[2];
}
-
+
}
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);
dir_index += s_entry->rr_attr_size;
}
{
directory_buffer[dir_index++] = 0;
}
-
+
s_entry_d = s_entry;
s_entry = s_entry->next;
-
+
/*
* 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);
s_entry_d->rr_attributes = NULL;
last_extent_written += ce_size >> 11;
free(ce_buffer);
}
-
+
} /* generate_one_directory(... */
-static
+static
void FDECL1(build_pathlist, struct directory *, node)
{
struct directory * dpnt;
-
+
dpnt = node;
-
+
while (dpnt)
{
/* skip if it's hidden */
}
} /* 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 *rr = *(struct directory * const *)r;
return -1;
}
- if (rr->parent->path_index > ll->parent->path_index)
+ if (rr->parent->path_index > ll->parent->path_index)
{
return 1;
}
return strcmp(rr->self->isorec.name, ll->self->isorec.name);
-
+
} /* compare_paths(... */
static int generate_path_tables()
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;
path_table_m = (char *) e_malloc(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 )
{
}
path_table_index = 0;
- pathlist = (struct directory **) e_malloc(sizeof(struct directory *)
+ pathlist = (struct directory **) e_malloc(sizeof(struct directory *)
* next_path_index);
memset(pathlist, 0, sizeof(struct directory *) * next_path_index);
build_pathlist(root);
{
fix = 0;
#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);
#else
- qsort(&pathlist[1], next_path_index-1, sizeof(struct directory *),
+ qsort(&pathlist[1], next_path_index-1, sizeof(struct directory *),
compare_paths);
#endif
error (1, 0, _("Entry %d not in path tables\n"), j);
}
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);
- if(npnt1)
- {
+ if(npnt1)
+ {
npnt = npnt1 + 1;
}
-
+
de = dpnt->self;
- if(!de)
+ if(!de)
{
error (1, 0, _("Fatal goof\n"));
}
-
-
+
+
namelen = de->isorec.name_len[0];
-
+
path_table_l[path_table_index] = namelen;
path_table_m[path_table_index] = namelen;
path_table_index += 2;
-
- set_731(path_table_l + path_table_index, dpnt->extent);
- set_732(path_table_m + 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);
path_table_index += 4;
-
- set_721(path_table_l + path_table_index,
- dpnt->parent->path_index);
- set_722(path_table_m + path_table_index,
- dpnt->parent->path_index);
+
+ set_721(path_table_l + path_table_index,
+ dpnt->parent->path_index);
+ set_722(path_table_m + path_table_index,
+ dpnt->parent->path_index);
path_table_index += 2;
-
+
for(i =0; i<namelen; i++)
{
path_table_l[path_table_index] = de->isorec.name[i];
path_table_m[path_table_index] = de->isorec.name[i];
path_table_index++;
}
- if(path_table_index & 1)
+ if(path_table_index & 1)
{
path_table_index++; /* For odd lengths we pad */
}
}
-
+
free(pathlist);
if(path_table_index != path_table_size)
{
/*
* 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
- * 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;
#ifdef DBG_ISO
fprintf(stderr,"Total directory extents being written = %llu\n", last_extent);
#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);
}
- /*
- * Now write all of the files that we need.
+ /*
+ * Now write all of the files that we need.
*/
write_files(outfile);
-
+
/*
* The rest is just fluff.
*/
fprintf (stderr, _("Total extents actually written = %llu\n"),
last_extent_written - session_start);
- /*
- * Hard links throw us off here
+ /*
+ * Hard links throw us off here
*/
assert (last_extent > session_start);
if(should_write + session_start != last_extent)
/*
* 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,
local.tm_mon+1, local.tm_mday,
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));
vol_desc.type[0] = ISO_VD_PRIMARY;
memcpy(vol_desc.id, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID));
vol_desc.version[0] = 1;
-
+
memset(vol_desc.system_id, ' ', sizeof(vol_desc.system_id));
memcpy_max(vol_desc.system_id, system_id, strlen(system_id));
-
+
memset(vol_desc.volume_id, ' ', sizeof(vol_desc.volume_id));
memcpy_max(vol_desc.volume_id, volume_id, strlen(volume_id));
-
+
should_write = last_extent - session_start;
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_sequence_number, volume_sequence_number);
set_723(vol_desc.logical_block_size, 2048);
-
+
/*
* 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_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);
/*
if(appid) memcpy_max(vol_desc.application_id, appid, strlen(appid));
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));
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));
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));
FILL_SPACE(creation_date);
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);
last_extent_written++;
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));
evol_desc.type[0] = ISO_VD_END;
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_m, 1, path_blocks << 11, outfile);
total_mask = in->pixel_bitmask.r | in->pixel_bitmask.g
| in->pixel_bitmask.b | in->pixel_bitmask.a;
-
+
for (i = 31; i >= 0; i--)
if (total_mask & (1 << i))
return i + 1;
found = 1;
}
}
-
+
if (!found)
{
unsigned mode;
{
grub_efi_uintn_t size;
grub_efi_status_t status;
-
+
status = efi_call_4 (gop->query_mode, gop, mode, &size, &info);
if (status)
{
* ((unsigned long long) bpp))
{
best_volume = ((unsigned long long) info->width)
- * ((unsigned long long) info->height)
+ * ((unsigned long long) info->height)
* ((unsigned long long) bpp);
best_mode = mode;
}
grub_dprintf ("video", "GOP: initialising FB @ %p %dx%dx%d\n",
framebuffer.ptr, framebuffer.mode_info.width,
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);
if (err)
grub_dprintf ("video", "GOP: Couldn't create FB target\n");
return err;
}
-
+
err = grub_video_fb_set_active_render_target (framebuffer.render_target);
-
+
if (err)
{
grub_dprintf ("video", "GOP: Couldn't set FB target\n");
return err;
}
-
+
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors);
grub_dprintf ("video", "GOP: Couldn't set palette\n");
else
grub_dprintf ("video", "GOP: Success\n");
-
+
return err;
}