Merge from trunk
This commit is contained in:
commit
d94000ed13
210 changed files with 4949 additions and 2557 deletions
|
@ -483,12 +483,12 @@ grub_util_is_dmraid (const char *os_dev)
|
|||
return 1;
|
||||
else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
grub_util_get_dev_abstraction (const char *os_dev UNUSED)
|
||||
grub_util_get_dev_abstraction (const char *os_dev __attribute__((unused)))
|
||||
{
|
||||
#ifdef __linux__
|
||||
/* Check for LVM. */
|
||||
|
|
|
@ -29,6 +29,7 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
|||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
host_os=@host_os@
|
||||
font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ prepare_grub_to_access_device ()
|
|||
|
||||
# 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
|
||||
|
||||
|
|
|
@ -236,19 +236,19 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
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);
|
||||
|
||||
|
||||
*((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE
|
||||
- GRUB_BOOT_MACHINE_LIST_SIZE + 8))
|
||||
= grub_host_to_target16 (num);
|
||||
|
||||
|
||||
grub_util_write_image (boot_img, boot_size, out);
|
||||
free (boot_img);
|
||||
free (boot_path);
|
||||
|
@ -357,13 +357,13 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
ehdr->e_shentsize = grub_host_to_target16 (0);
|
||||
ehdr->e_shnum = grub_host_to_target16 (0);
|
||||
ehdr->e_shstrndx = grub_host_to_target16 (0);
|
||||
|
||||
|
||||
ehdr->e_ehsize = grub_host_to_target16 (sizeof (*ehdr));
|
||||
|
||||
|
||||
phdr->p_type = grub_host_to_target32 (PT_LOAD);
|
||||
phdr->p_offset = grub_host_to_target32 (sizeof (*ehdr) + sizeof (*phdr));
|
||||
phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X);
|
||||
|
||||
|
||||
target_addr = ALIGN_UP (GRUB_KERNEL_MACHINE_LINK_ADDR
|
||||
+ kernel_size + total_module_size, 32);
|
||||
ehdr->e_entry = grub_host_to_target32 (target_addr);
|
||||
|
|
|
@ -27,6 +27,7 @@ static struct option options[] =
|
|||
{
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
@ -28,6 +28,7 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
|||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
native_platform=@platform@
|
||||
pkglib_DATA="@pkglib_DATA@"
|
||||
|
||||
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
|
||||
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
|
||||
|
@ -93,13 +94,16 @@ process_input_dir ()
|
|||
input_dir="$1"
|
||||
platform="$2"
|
||||
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
|
||||
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
|
||||
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
|
||||
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
|
||||
for file in ${input_dir}/*.mod; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
|
||||
fi
|
||||
done
|
||||
for file in ${pkglib_DATA}; do
|
||||
if test -f "${input_dir}/${file}"; then
|
||||
cp -f "${input_dir}/${file}" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p ${iso9660_dir}/boot/grub/locale
|
||||
for file in ${input_dir}/po/*.mo; do
|
||||
|
@ -128,7 +132,7 @@ fi
|
|||
|
||||
# build coreboot core.img
|
||||
if test -e "${coreboot_dir}" ; then
|
||||
echo "Generates coreboot"
|
||||
echo "Enabling coreboot support ..."
|
||||
memdisk_img=`mktemp`
|
||||
memdisk_dir=`mktemp -d`
|
||||
mkdir -p ${memdisk_dir}/boot/grub
|
||||
|
@ -155,14 +159,17 @@ EOF
|
|||
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
|
||||
fi
|
||||
|
||||
# build eltorito core.img
|
||||
# build BIOS core.img
|
||||
if test -e "${pc_dir}" ; then
|
||||
echo "Generates eltorito"
|
||||
echo "Enabling BIOS support ..."
|
||||
core_img=`mktemp`
|
||||
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
|
||||
memdisk tar search iso9660 configfile sh \
|
||||
biosdisk
|
||||
iso9660 biosdisk
|
||||
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
|
||||
|
||||
embed_img=`mktemp`
|
||||
cat ${pc_dir}/boot.img ${core_img} > ${embed_img}
|
||||
|
||||
rm -f ${core_img}
|
||||
|
||||
modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
|
||||
|
@ -172,11 +179,14 @@ if test -e "${pc_dir}" ; then
|
|||
echo "source /boot/grub/grub.cfg") \
|
||||
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
|
||||
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table \
|
||||
--embedded-boot ${embed_img}"
|
||||
fi
|
||||
|
||||
# build iso image
|
||||
grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source}
|
||||
grub-mkisofs ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source}
|
||||
rm -rf ${iso9660_dir}
|
||||
|
||||
rm -f ${embed_img}
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -123,7 +123,7 @@ probe (const char *path, char *device_name)
|
|||
device_name = grub_guess_root_device (path);
|
||||
|
||||
if (! device_name)
|
||||
grub_util_error ("cannot find a device for %s.\n", path);
|
||||
grub_util_error ("cannot find a device for %s (is /dev mounted?).\n", path);
|
||||
|
||||
if (print == PRINT_DEVICE)
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ probe (const char *path, char *device_name)
|
|||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||
file = grub_file_open (grub_path);
|
||||
if (! file)
|
||||
grub_util_error ("can not open %s via GRUB facilities", grub_path);
|
||||
grub_util_error ("cannot open %s via GRUB facilities", grub_path);
|
||||
filebuf_via_grub = xmalloc (file->size);
|
||||
grub_file_read (file, filebuf_via_grub, file->size);
|
||||
|
||||
|
|
|
@ -107,12 +107,12 @@ if [ "x${LANG}" != "xC" ] ; then
|
|||
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"
|
||||
|
|
|
@ -37,6 +37,56 @@ if [ -z "${OSPROBED}" ] ; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
osx_entry() {
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
|
||||
EOF
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
do_resume=0
|
||||
if [ /var/vm/sleepimage -nt10 / ]; then
|
||||
if xnu_resume /var/vm/sleepimage; then
|
||||
do_resume=1
|
||||
fi
|
||||
fi
|
||||
if [ \$do_resume == 0 ]; then
|
||||
xnu_uuid ${OSXUUID} uuid
|
||||
if [ -f /Extra/DSDT.aml ]; then
|
||||
acpi -e /Extra/DSDT.aml
|
||||
fi
|
||||
$1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
|
||||
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
|
||||
xnu_mkext /System/Library/Extensions.mkext
|
||||
else
|
||||
xnu_kextdir /System/Library/Extensions
|
||||
fi
|
||||
if [ -f /Extra/Extensions.mkext ]; then
|
||||
xnu_mkext /Extra/Extensions.mkext
|
||||
fi
|
||||
if [ -d /Extra/Extensions ]; then
|
||||
xnu_kextdir /Extra/Extensions
|
||||
fi
|
||||
if [ -f /Extra/devprop.bin ]; then
|
||||
xnu_devprop_load /Extra/devprop.bin
|
||||
fi
|
||||
if [ -f /Extra/splash.jpg ]; then
|
||||
insmod jpeg
|
||||
xnu_splash /Extra/splash.jpg
|
||||
fi
|
||||
if [ -f /Extra/splash.png ]; then
|
||||
insmod png
|
||||
xnu_splash /Extra/splash.png
|
||||
fi
|
||||
if [ -f /Extra/splash.tga ]; then
|
||||
insmod tga
|
||||
xnu_splash /Extra/splash.tga
|
||||
fi
|
||||
fi
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
for OS in ${OSPROBED} ; do
|
||||
DEVICE="`echo ${OS} | cut -d ':' -f 1`"
|
||||
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
|
||||
|
@ -115,53 +165,8 @@ EOF
|
|||
;;
|
||||
macosx)
|
||||
OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" {
|
||||
EOF
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
do_resume=0
|
||||
if [ /var/vm/sleepimage -nt10 / ]; then
|
||||
if xnu_resume /var/vm/sleepimage; then
|
||||
do_resume=1
|
||||
fi
|
||||
fi
|
||||
if [ \$do_resume == 0 ]; then
|
||||
xnu_uuid ${OSXUUID} uuid
|
||||
if [ -f /Extra/DSDT.aml ]; then
|
||||
acpi -e /Extra/DSDT.aml
|
||||
fi
|
||||
xnu_kernel /mach_kernel boot-uuid=\${uuid} rd=*uuid
|
||||
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
|
||||
xnu_mkext /System/Library/Extensions.mkext
|
||||
else
|
||||
xnu_kextdir /System/Library/Extensions
|
||||
fi
|
||||
if [ -f /Extra/Extensions.mkext ]; then
|
||||
xnu_mkext /Extra/Extensions.mkext
|
||||
fi
|
||||
if [ -d /Extra/Extensions ]; then
|
||||
xnu_kextdir /Extra/Extensions
|
||||
fi
|
||||
if [ -f /Extra/devtree.txt ]; then
|
||||
xnu_devtree /Extra/devtree.txt
|
||||
fi
|
||||
if [ -f /Extra/splash.jpg ]; then
|
||||
insmod jpeg
|
||||
xnu_splash /Extra/splash.jpg
|
||||
fi
|
||||
if [ -f /Extra/splash.png ]; then
|
||||
insmod png
|
||||
xnu_splash /Extra/splash.png
|
||||
fi
|
||||
if [ -f /Extra/splash.tga ]; then
|
||||
insmod tga
|
||||
xnu_splash /Extra/splash.tga
|
||||
fi
|
||||
fi
|
||||
}
|
||||
EOF
|
||||
osx_entry xnu_kernel 32
|
||||
osx_entry xnu_kernel64 64
|
||||
;;
|
||||
hurd)
|
||||
cat << EOF
|
||||
|
|
|
@ -348,7 +348,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Make the buffer cache consistent with the physical disk. */
|
||||
/* Flush the buffer cache to the physical disk.
|
||||
XXX: This also empties the buffer cache. */
|
||||
ioctl (fd, BLKFLSBUF, 0);
|
||||
|
||||
if (is_partition)
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
hexify()
|
||||
{
|
||||
echo -n "$@" | od -A n -t x1 - | sed -e 's/ //g' | tr '\n' '\0'
|
||||
}
|
||||
if [ x$1 == x ]; then
|
||||
echo "Filename required".
|
||||
fi
|
||||
|
||||
echo "`hexify efi`{ `hexify device-properties`:"
|
||||
ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;'
|
||||
echo ";}"
|
||||
ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;' | xxd -r -p > $1
|
||||
|
|
|
@ -29,6 +29,7 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
|||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
host_os=@host_os@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
|
|
|
@ -356,8 +356,12 @@ setup (const char *dir,
|
|||
goto unable_to_embed;
|
||||
}
|
||||
|
||||
grub_partition_iterate (dest_dev->disk, (strcmp (dest_partmap, "part_msdos") ?
|
||||
find_usable_region_gpt : find_usable_region_msdos));
|
||||
if (strcmp (dest_partmap, "part_msdos") == 0)
|
||||
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);
|
||||
else if (strcmp (dest_partmap, "part_gpt") == 0)
|
||||
grub_partition_iterate (dest_dev->disk, find_usable_region_gpt);
|
||||
else
|
||||
grub_util_error (_("No DOS-style partitions found"));
|
||||
|
||||
if (embed_region.end == embed_region.start)
|
||||
{
|
||||
|
|
|
@ -35,8 +35,10 @@ escape_of_path (const char *orig_path)
|
|||
}
|
||||
|
||||
void
|
||||
grub_util_emit_devicemap_entry (FILE *fp, char *name, int is_floppy UNUSED,
|
||||
int *num_fd UNUSED, int *num_hd UNUSED)
|
||||
grub_util_emit_devicemap_entry (FILE *fp, char *name,
|
||||
int is_floppy __attribute__((unused)),
|
||||
int *num_fd __attribute__((unused)),
|
||||
int *num_hd __attribute__((unused)))
|
||||
{
|
||||
const char *orig_path = grub_util_devname_to_ofpath (name);
|
||||
char *ofpath = escape_of_path (orig_path);
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#ifdef OFPATH_STANDALONE
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define xmalloc malloc
|
||||
void
|
||||
grub_util_error (const char *fmt, ...)
|
||||
|
@ -199,8 +198,10 @@ get_basename(char *p)
|
|||
|
||||
static void
|
||||
of_path_of_vdisk(char *of_path,
|
||||
const char *devname UNUSED, const char *device,
|
||||
const char *devnode UNUSED, const char *devicenode)
|
||||
const char *devname __attribute__((unused)),
|
||||
const char *device,
|
||||
const char *devnode __attribute__((unused)),
|
||||
const char *devicenode)
|
||||
{
|
||||
char *sysfs_path, *p;
|
||||
int devno, junk;
|
||||
|
@ -217,8 +218,9 @@ of_path_of_vdisk(char *of_path,
|
|||
|
||||
static void
|
||||
of_path_of_ide(char *of_path,
|
||||
const char *devname UNUSED, const char *device,
|
||||
const char *devnode UNUSED, const char *devicenode)
|
||||
const char *devname __attribute__((unused)), const char *device,
|
||||
const char *devnode __attribute__((unused)),
|
||||
const char *devicenode)
|
||||
{
|
||||
char *sysfs_path, *p;
|
||||
int chan, devno;
|
||||
|
@ -299,8 +301,9 @@ check_sas (char *sysfs_path, int *tgt)
|
|||
|
||||
static void
|
||||
of_path_of_scsi(char *of_path,
|
||||
const char *devname UNUSED, const char *device,
|
||||
const char *devnode UNUSED, const char *devicenode)
|
||||
const char *devname __attribute__((unused)), const char *device,
|
||||
const char *devnode __attribute__((unused)),
|
||||
const char *devicenode)
|
||||
{
|
||||
const char *p, *digit_string, *disk_name;
|
||||
int host, bus, tgt, lun;
|
||||
|
|
|
@ -504,7 +504,7 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
free (p);
|
||||
|
||||
if (stat (buf, &st) < 0)
|
||||
grub_util_error ("can not stat %s: %s", buf, strerror (errno));
|
||||
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
|
||||
|
||||
buf2 = strdup (buf);
|
||||
num = st.st_dev;
|
||||
|
@ -523,7 +523,7 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
*++p = 0;
|
||||
|
||||
if (stat (buf, &st) < 0)
|
||||
grub_util_error ("can not stat %s: %s", buf, strerror (errno));
|
||||
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
|
||||
|
||||
/* buf is another filesystem; we found it. */
|
||||
if (st.st_dev != num)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Program eltorito.c - Handle El Torito specific extensions to iso9660.
|
||||
*
|
||||
*
|
||||
|
||||
Written by Michael Fulbright <msf@redhat.com> (1996).
|
||||
|
||||
|
@ -53,7 +53,7 @@ static struct eltorito_boot_descriptor gboot_desc;
|
|||
static int tvd_write __PR((FILE * outfile));
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
@ -61,37 +61,37 @@ 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);
|
||||
|
@ -100,15 +100,15 @@ void FDECL1(init_boot_catalog, const char *, path)
|
|||
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);
|
||||
|
@ -127,65 +127,65 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
|
|||
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)
|
||||
{
|
||||
|
@ -194,82 +194,82 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
|
|||
checksum += (unsigned int)checksum_ptr[i];
|
||||
checksum += ((unsigned int)checksum_ptr[i+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"));
|
||||
|
@ -332,7 +332,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
|
|||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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 $
|
||||
|
|
|
@ -33,7 +33,7 @@ void FDECL1(add_hash, struct directory_entry *, spnt){
|
|||
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);
|
||||
|
@ -116,10 +116,10 @@ static unsigned int FDECL1(name_hash, const char *, name)
|
|||
{
|
||||
unsigned int hash = 0;
|
||||
const char * p;
|
||||
|
||||
|
||||
p = name;
|
||||
|
||||
while (*p)
|
||||
|
||||
while (*p)
|
||||
{
|
||||
/*
|
||||
* Don't hash the iso9660 version number. This way
|
||||
|
@ -155,7 +155,7 @@ struct directory_entry * FDECL1(find_file_hash, char *, name)
|
|||
struct name_hash * nh;
|
||||
char * p1;
|
||||
char * p2;
|
||||
|
||||
|
||||
for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
|
||||
{
|
||||
p1 = name;
|
||||
|
@ -220,6 +220,6 @@ void flush_file_hash(){
|
|||
nh = nh1;
|
||||
}
|
||||
name_hash_table[i] = NULL;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ struct eltorito_boot_info
|
|||
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)];
|
||||
|
|
|
@ -87,13 +87,13 @@ static int DECL(joliet_sort_directory, (struct directory_entry ** sort_dir));
|
|||
static void DECL(assign_joliet_directory_addresses, (struct directory * node));
|
||||
static 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 )
|
||||
{
|
||||
|
@ -127,9 +127,9 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
|
|||
* 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] = '_';
|
||||
|
@ -163,7 +163,7 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Function: joliet_strlen
|
||||
*
|
||||
* Purpose: Return length in bytes of string after conversion to unicode.
|
||||
|
@ -178,7 +178,7 @@ static int FDECL1(joliet_strlen, const char *, string)
|
|||
|
||||
rtn = strlen(string) << 1;
|
||||
|
||||
/*
|
||||
/*
|
||||
* 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
|
||||
|
@ -191,7 +191,7 @@ static int FDECL1(joliet_strlen, const char *, string)
|
|||
return rtn;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Function: get_joliet_vol_desc
|
||||
*
|
||||
* Purpose: generate a Joliet compatible volume desc.
|
||||
|
@ -212,7 +212,7 @@ static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, jvol_de
|
|||
* "expands" 8 bit character codes to 16 bits and does nothing
|
||||
* 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, "%/@");
|
||||
|
||||
|
@ -228,7 +228,7 @@ static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, jvol_de
|
|||
/*
|
||||
* 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));
|
||||
|
||||
/*
|
||||
|
@ -256,7 +256,7 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
|
|||
struct directory * dpnt;
|
||||
|
||||
dpnt = node;
|
||||
|
||||
|
||||
while (dpnt)
|
||||
{
|
||||
if( (dpnt->dir_flags & INHIBIT_JOLIET_ENTRY) == 0 )
|
||||
|
@ -275,7 +275,7 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
|
|||
}
|
||||
|
||||
/* skip if hidden - but not for the rr_moved dir */
|
||||
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);
|
||||
}
|
||||
|
@ -283,13 +283,13 @@ static void FDECL1(assign_joliet_directory_addresses, struct directory *, node)
|
|||
}
|
||||
}
|
||||
|
||||
static
|
||||
static
|
||||
void FDECL1(build_jpathlist, struct directory *, node)
|
||||
{
|
||||
struct directory * dpnt;
|
||||
|
||||
|
||||
dpnt = node;
|
||||
|
||||
|
||||
while (dpnt)
|
||||
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ void FDECL1(build_jpathlist, struct directory *, node)
|
|||
}
|
||||
} /* 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;
|
||||
|
@ -325,13 +325,13 @@ static int FDECL2(joliet_compare_paths, void const *, r, void const *, l)
|
|||
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()
|
||||
|
@ -346,7 +346,7 @@ 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);
|
||||
|
@ -361,10 +361,10 @@ static int generate_joliet_path_tables()
|
|||
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);
|
||||
|
@ -373,10 +373,10 @@ static int generate_joliet_path_tables()
|
|||
{
|
||||
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
|
||||
|
||||
|
@ -399,20 +399,20 @@ static int generate_joliet_path_tables()
|
|||
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 )
|
||||
|
@ -426,28 +426,28 @@ static int generate_joliet_path_tables()
|
|||
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.
|
||||
*/
|
||||
|
@ -459,19 +459,19 @@ static int generate_joliet_path_tables()
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -493,20 +493,20 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
|
|||
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
|
||||
|
@ -535,43 +535,43 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
|
|||
{
|
||||
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 )
|
||||
|
@ -600,7 +600,7 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
|
|||
{
|
||||
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);
|
||||
|
@ -610,25 +610,25 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
|
|||
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;
|
||||
|
@ -640,7 +640,7 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
|
|||
s_entry1->name);
|
||||
dir_index += cvt_len;
|
||||
}
|
||||
|
||||
|
||||
if(dir_index & 1)
|
||||
{
|
||||
directory_buffer[dir_index++] = 0;
|
||||
|
@ -648,13 +648,13 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
|
|||
|
||||
s_entry = s_entry->jnext;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -678,7 +678,7 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* First update the path table sizes for directories.
|
||||
*
|
||||
|
@ -690,15 +690,15 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
|
|||
*/
|
||||
if(s_entry->isorec.flags[0] == 2)
|
||||
{
|
||||
if (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)
|
||||
{
|
||||
|
@ -708,11 +708,11 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
|
|||
}
|
||||
}
|
||||
|
||||
if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
|
||||
if (strcmp(s_entry->name,".") && strcmp(s_entry->name,".."))
|
||||
{
|
||||
s_entry->jreclen = sizeof(struct iso_directory_record)
|
||||
- sizeof(s_entry->isorec.name)
|
||||
+ joliet_strlen(s_entry->name)
|
||||
+ joliet_strlen(s_entry->name)
|
||||
+ 1;
|
||||
}
|
||||
else
|
||||
|
@ -737,9 +737,9 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
|
|||
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;
|
||||
/*
|
||||
|
@ -756,10 +756,10 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -771,11 +771,11 @@ static int FDECL1(joliet_sort_n_finish, struct directory *, this_dir)
|
|||
* Similar to the iso9660 case, except here we perform a full sort based upon the
|
||||
* 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;
|
||||
|
@ -788,7 +788,7 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
|
|||
{
|
||||
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
|
||||
|
@ -800,13 +800,13 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
|
|||
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.
|
||||
|
@ -815,7 +815,7 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
|
|||
if(*rpnt == '.' && *lpnt != '.') return -1;
|
||||
if(*rpnt != '.' && *lpnt == '.') return 1;
|
||||
#endif
|
||||
|
||||
|
||||
if(*rpnt < *lpnt) return -1;
|
||||
if(*rpnt > *lpnt) return 1;
|
||||
rpnt++; lpnt++;
|
||||
|
@ -826,7 +826,7 @@ static int FDECL2(joliet_compare_dirs, const void *, rr, const void *, ll)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Function: sort_directory
|
||||
*
|
||||
* Purpose: Sort the directory in the appropriate ISO9660
|
||||
|
@ -840,7 +840,7 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
|
|||
int i;
|
||||
struct directory_entry * s_entry;
|
||||
struct directory_entry ** sortlist;
|
||||
|
||||
|
||||
s_entry = *sort_dir;
|
||||
while(s_entry)
|
||||
{
|
||||
|
@ -851,9 +851,9 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
|
|||
}
|
||||
|
||||
/*
|
||||
* OK, now we know how many there are. Build a vector for sorting.
|
||||
* OK, now we know how many there are. Build a vector for sorting.
|
||||
*/
|
||||
sortlist = (struct directory_entry **)
|
||||
sortlist = (struct directory_entry **)
|
||||
e_malloc(sizeof(struct directory_entry *) * dcount);
|
||||
|
||||
dcount = 0;
|
||||
|
@ -867,18 +867,18 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
|
|||
}
|
||||
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++)
|
||||
{
|
||||
|
@ -887,7 +887,7 @@ static int FDECL1(joliet_sort_directory, struct directory_entry **, sort_dir)
|
|||
|
||||
sortlist[dcount-1]->jnext = NULL;
|
||||
*sort_dir = sortlist[0];
|
||||
|
||||
|
||||
free(sortlist);
|
||||
return sort_goof;
|
||||
}
|
||||
|
@ -934,7 +934,7 @@ static void FDECL2(generate_joliet_directories, struct directory *, node, FILE*,
|
|||
}
|
||||
}
|
||||
/* skip if hidden - but not for the rr_moved dir */
|
||||
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;
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ static void FDECL2(generate_joliet_directories, struct directory *, node, FILE*,
|
|||
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);
|
||||
|
@ -995,7 +995,7 @@ static int FDECL1(jvd_write, FILE *, 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);
|
||||
|
@ -1013,7 +1013,7 @@ static int FDECL1(jpathtab_size, int, starting_extent)
|
|||
jpath_table[1] = 0;
|
||||
jpath_table[2] = jpath_table[0] + jpath_blocks;
|
||||
jpath_table[3] = 0;
|
||||
|
||||
|
||||
last_extent += 2*jpath_blocks;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ int extension_record_size = 0;
|
|||
/* These variables are associated with command line options */
|
||||
int use_eltorito = 0;
|
||||
int use_eltorito_emul_floppy = 0;
|
||||
int use_embedded_boot = 0;
|
||||
int use_protective_msdos_label = 0;
|
||||
int use_boot_info_table = 0;
|
||||
int use_RockRidge = 0;
|
||||
int use_Joliet = 0;
|
||||
|
@ -100,17 +102,18 @@ int rationalize = 0;
|
|||
int generate_tables = 0;
|
||||
int print_size = 0;
|
||||
int split_output = 0;
|
||||
char * preparer = PREPARER_DEFAULT;
|
||||
char * publisher = PUBLISHER_DEFAULT;
|
||||
char * appid = APPID_DEFAULT;
|
||||
char * copyright = COPYRIGHT_DEFAULT;
|
||||
char * biblio = BIBLIO_DEFAULT;
|
||||
char * abstract = ABSTRACT_DEFAULT;
|
||||
char * volset_id = VOLSET_ID_DEFAULT;
|
||||
char * volume_id = VOLUME_ID_DEFAULT;
|
||||
char * system_id = SYSTEM_ID_DEFAULT;
|
||||
char * boot_catalog = BOOT_CATALOG_DEFAULT;
|
||||
char * boot_image = BOOT_IMAGE_DEFAULT;
|
||||
char *preparer = PREPARER_DEFAULT;
|
||||
char *publisher = PUBLISHER_DEFAULT;
|
||||
char *appid = APPID_DEFAULT;
|
||||
char *copyright = COPYRIGHT_DEFAULT;
|
||||
char *biblio = BIBLIO_DEFAULT;
|
||||
char *abstract = ABSTRACT_DEFAULT;
|
||||
char *volset_id = VOLSET_ID_DEFAULT;
|
||||
char *volume_id = VOLUME_ID_DEFAULT;
|
||||
char *system_id = SYSTEM_ID_DEFAULT;
|
||||
char *boot_catalog = BOOT_CATALOG_DEFAULT;
|
||||
char *boot_image = BOOT_IMAGE_DEFAULT;
|
||||
char *boot_image_embed = NULL;
|
||||
int volume_set_size = 1;
|
||||
int volume_sequence_number = 1;
|
||||
|
||||
|
@ -197,6 +200,8 @@ struct ld_option
|
|||
|
||||
#define OPTION_VERSION 173
|
||||
|
||||
#define OPTION_PROTECTIVE_MSDOS_LABEL 174
|
||||
|
||||
static const struct ld_option ld_options[] =
|
||||
{
|
||||
{ {"all-files", no_argument, NULL, 'a'},
|
||||
|
@ -209,6 +214,10 @@ static const struct ld_option ld_options[] =
|
|||
'\0', N_("FILE"), N_("Set Bibliographic filename"), ONE_DASH },
|
||||
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
|
||||
'\0', N_("FILE"), N_("Set Copyright filename"), ONE_DASH },
|
||||
{ {"embedded-boot", required_argument, NULL, 'G'},
|
||||
'G', N_("FILE"), N_("Set embedded boot image name"), TWO_DASHES },
|
||||
{ {"protective-msdos-label", no_argument, NULL, OPTION_PROTECTIVE_MSDOS_LABEL },
|
||||
'\0', NULL, N_("Patch a protective DOS-style label in the image"), TWO_DASHES },
|
||||
{ {"eltorito-boot", required_argument, NULL, 'b'},
|
||||
'b', N_("FILE"), N_("Set El Torito boot image name"), ONE_DASH },
|
||||
{ {"eltorito-catalog", required_argument, NULL, 'c'},
|
||||
|
@ -555,8 +564,8 @@ void usage(){
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fill in date in the iso9660 format
|
||||
/*
|
||||
* Fill in date in the iso9660 format
|
||||
*
|
||||
* The standards state that the timezone offset is in multiples of 15
|
||||
* minutes, and is what you add to GMT to get the localtime. The U.S.
|
||||
|
@ -574,9 +583,9 @@ int FDECL2(iso9660_date,char *, result, time_t, crtime){
|
|||
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);
|
||||
|
@ -584,11 +593,11 @@ int FDECL2(iso9660_date,char *, result, time_t, 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;
|
||||
}
|
||||
|
@ -719,10 +728,16 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
use_eltorito++;
|
||||
boot_image = optarg; /* pathname of the boot image on cd */
|
||||
if (boot_image == NULL)
|
||||
{
|
||||
fprintf (stderr, _("Required boot image pathname missing\n"));
|
||||
exit (1);
|
||||
}
|
||||
error (1, 0, _("Required boot image pathname missing"));
|
||||
break;
|
||||
case 'G':
|
||||
use_embedded_boot = 1;
|
||||
boot_image_embed = optarg; /* pathname of the boot image on host filesystem */
|
||||
if (boot_image_embed == NULL)
|
||||
error (1, 0, _("Required boot image pathname missing"));
|
||||
break;
|
||||
case OPTION_PROTECTIVE_MSDOS_LABEL:
|
||||
use_protective_msdos_label = 1;
|
||||
break;
|
||||
case 'c':
|
||||
use_eltorito++;
|
||||
|
@ -957,7 +972,7 @@ parse_input_files:
|
|||
{
|
||||
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;
|
||||
|
@ -1077,7 +1092,7 @@ parse_input_files:
|
|||
merge_image);
|
||||
}
|
||||
|
||||
memcpy(&de.isorec.extent, mrootp->extent, 8);
|
||||
memcpy(&de.isorec.extent, mrootp->extent, 8);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1160,8 +1175,8 @@ parse_input_files:
|
|||
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;
|
||||
|
@ -1247,12 +1262,12 @@ parse_input_files:
|
|||
|
||||
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 */
|
||||
|
||||
/*
|
||||
|
@ -1329,8 +1344,8 @@ parse_input_files:
|
|||
|
||||
outputlist_insert(&dirtree_clean);
|
||||
|
||||
if(extension_record)
|
||||
{
|
||||
if(extension_record)
|
||||
{
|
||||
outputlist_insert(&extension_desc);
|
||||
}
|
||||
|
||||
|
@ -1341,7 +1356,7 @@ parse_input_files:
|
|||
* 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.
|
||||
|
@ -1387,7 +1402,7 @@ parse_input_files:
|
|||
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);
|
||||
|
|
|
@ -190,7 +190,7 @@ struct file_hash{
|
|||
unsigned int starting_block;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This structure is used to control the output of fragments to the cdrom
|
||||
|
@ -243,7 +243,7 @@ extern struct output_fragment jdirtree_desc;
|
|||
extern struct output_fragment extension_desc;
|
||||
extern struct output_fragment 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
|
||||
|
@ -296,6 +296,8 @@ extern struct iso_directory_record root_record;
|
|||
extern struct iso_directory_record jroot_record;
|
||||
|
||||
extern int use_eltorito;
|
||||
extern int use_embedded_boot;
|
||||
extern int use_protective_msdos_label;
|
||||
extern int use_eltorito_emul_floppy;
|
||||
extern int use_boot_info_table;
|
||||
extern int use_RockRidge;
|
||||
|
@ -324,14 +326,14 @@ extern struct directory *
|
|||
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));
|
||||
|
@ -372,17 +374,17 @@ extern char *effective_date;
|
|||
|
||||
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 *));
|
||||
|
@ -399,7 +401,7 @@ struct dirent * DECL(readdir_add_files, (char **, char *, DIR *));
|
|||
|
||||
/* */
|
||||
|
||||
extern int DECL(iso9660_file_length,(const char* name,
|
||||
extern int DECL(iso9660_file_length,(const char* name,
|
||||
struct directory_entry * sresult, int flag));
|
||||
extern int DECL(iso9660_date,(char *, time_t));
|
||||
extern void DECL(add_hash,(struct directory_entry *));
|
||||
|
@ -411,7 +413,7 @@ extern int DECL(delete_file_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,
|
||||
|
@ -438,20 +440,21 @@ extern char * extension_record;
|
|||
extern int extension_record_extent;
|
||||
extern int n_data_extents;
|
||||
|
||||
/* These are a few goodies that can be specified on the command line, and are
|
||||
/* These are a few goodies that can be specified on the command line, and are
|
||||
filled into the root record */
|
||||
|
||||
extern char * preparer;
|
||||
extern char * publisher;
|
||||
extern char * copyright;
|
||||
extern char * biblio;
|
||||
extern char * abstract;
|
||||
extern char * appid;
|
||||
extern char * volset_id;
|
||||
extern char * system_id;
|
||||
extern char * volume_id;
|
||||
extern char * boot_catalog;
|
||||
extern char * boot_image;
|
||||
extern char *preparer;
|
||||
extern char *publisher;
|
||||
extern char *copyright;
|
||||
extern char *biblio;
|
||||
extern char *abstract;
|
||||
extern char *appid;
|
||||
extern char *volset_id;
|
||||
extern char *system_id;
|
||||
extern char *volume_id;
|
||||
extern char *boot_catalog;
|
||||
extern char *boot_image;
|
||||
extern char *boot_image_embed;
|
||||
extern int volume_set_size;
|
||||
extern int volume_sequence_number;
|
||||
|
||||
|
|
75
util/mkisofs/msdos_partition.h
Normal file
75
util/mkisofs/msdos_partition.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2004,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MSDOS_PARTITION_H
|
||||
#define MSDOS_PARTITION_H 1
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* The signature. */
|
||||
#define MSDOS_PARTITION_SIGNATURE ((0xaa << 8) | 0x55)
|
||||
|
||||
/* This is not a flag actually, but used as if it were a flag. */
|
||||
#define MSDOS_PARTITION_TYPE_HIDDEN_FLAG 0x10
|
||||
|
||||
/* The partition entry. */
|
||||
struct msdos_partition_entry
|
||||
{
|
||||
/* If active, 0x80, otherwise, 0x00. */
|
||||
uint8_t flag;
|
||||
|
||||
/* The head of the start. */
|
||||
uint8_t start_head;
|
||||
|
||||
/* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
|
||||
is the cylinder of the start. Note that S is counted from one. */
|
||||
uint8_t start_sector;
|
||||
|
||||
/* (C & 0xFF) where C is the cylinder of the start. */
|
||||
uint8_t start_cylinder;
|
||||
|
||||
/* The partition type. */
|
||||
uint8_t type;
|
||||
|
||||
/* The end versions of start_head, start_sector and start_cylinder,
|
||||
respectively. */
|
||||
uint8_t end_head;
|
||||
uint8_t end_sector;
|
||||
uint8_t end_cylinder;
|
||||
|
||||
/* The start sector. Note that this is counted from zero. */
|
||||
uint32_t start;
|
||||
|
||||
/* The length in sector units. */
|
||||
uint32_t length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The structure of MBR. */
|
||||
struct msdos_partition_mbr
|
||||
{
|
||||
/* The code area (actually, including BPB). */
|
||||
uint8_t code[446];
|
||||
|
||||
/* Four partition entries. */
|
||||
struct msdos_partition_entry entries[4];
|
||||
|
||||
/* The signature 0xaa55. */
|
||||
uint16_t signature;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* File multi.c - scan existing iso9660 image and merge into
|
||||
* File multi.c - scan existing iso9660 image and merge into
|
||||
* iso9660 filesystem. Used for multisession support.
|
||||
*
|
||||
* Written by Eric Youngdale (1996).
|
||||
|
@ -166,7 +166,7 @@ readsecs(startsecno, buffer, sectorcount)
|
|||
/*
|
||||
* 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;
|
||||
|
@ -219,10 +219,10 @@ FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
|
|||
} /* 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;
|
||||
|
@ -233,8 +233,8 @@ FDECL4(check_rr_dates, struct directory_entry *, dpnt,
|
|||
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;
|
||||
|
@ -270,14 +270,14 @@ FDECL4(check_rr_dates, struct directory_entry *, dpnt,
|
|||
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;
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
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;
|
||||
|
@ -378,7 +378,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
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;
|
||||
|
@ -413,16 +413,16 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
*/
|
||||
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--;
|
||||
|
@ -444,7 +444,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
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)) )
|
||||
|
@ -485,7 +485,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
tt_extent = isonum_733((unsigned char *)idr->extent);
|
||||
tt_size = isonum_733((unsigned char *)idr->size);
|
||||
}
|
||||
|
||||
|
||||
pnt++;
|
||||
i += idr->length[0];
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
{
|
||||
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);
|
||||
|
@ -534,7 +534,7 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
cpnt = cpnt1 + 1;
|
||||
cpnt1 = cpnt;
|
||||
}
|
||||
|
||||
|
||||
free(tt_buf);
|
||||
}
|
||||
else if( !seen_rockridge && !warning_given )
|
||||
|
@ -553,14 +553,14 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
|
|||
{
|
||||
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;
|
||||
|
@ -792,7 +792,7 @@ struct iso_directory_record * FDECL1(merge_isofs, char *, path)
|
|||
/*
|
||||
* 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));
|
||||
|
@ -820,7 +820,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if( pnt[i]->name != NULL && pnt[i]->whole_name == NULL)
|
||||
{
|
||||
/*
|
||||
|
@ -868,7 +868,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
|
|||
this_dir->contents = pnt[i];
|
||||
pnt[i] = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* If we don't have an entry for the translation table, then
|
||||
|
@ -945,7 +945,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
|
|||
* location. FIXME(eric).
|
||||
*/
|
||||
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;
|
||||
|
@ -997,7 +997,7 @@ FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt,
|
|||
/*
|
||||
* We can always reuse the TRANS.TBL in this particular case.
|
||||
*/
|
||||
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) )
|
||||
|
@ -1059,7 +1059,7 @@ FDECL2(merge_old_directory_into_tree, struct directory_entry *, dpnt,
|
|||
char * cdwrite_data = NULL;
|
||||
|
||||
int
|
||||
FDECL1(get_session_start, int *, file_addr)
|
||||
FDECL1(get_session_start, int *, file_addr)
|
||||
{
|
||||
char * pnt;
|
||||
|
||||
|
@ -1171,14 +1171,14 @@ FDECL2(merge_previous_session,struct directory *, this_dir,
|
|||
{
|
||||
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)
|
||||
|
@ -1188,14 +1188,14 @@ FDECL2(merge_previous_session,struct directory *, this_dir,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Whatever is left over, are things which are no longer in the tree
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
extern int allow_leading_dots;
|
||||
|
||||
|
||||
/*
|
||||
* Function: iso9660_file_length
|
||||
*
|
||||
|
@ -43,8 +43,8 @@ extern int allow_leading_dots;
|
|||
* 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;
|
||||
|
@ -69,7 +69,7 @@ int FDECL3(iso9660_file_length,
|
|||
*/
|
||||
if(strcmp(name,".") == 0)
|
||||
{
|
||||
if(result)
|
||||
if(result)
|
||||
{
|
||||
*result = 0;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ int FDECL3(iso9660_file_length,
|
|||
*/
|
||||
if(strcmp(name,"..") == 0)
|
||||
{
|
||||
if(result)
|
||||
if(result)
|
||||
{
|
||||
*result++ = 1;
|
||||
*result++ = 0;
|
||||
|
@ -115,7 +115,7 @@ int FDECL3(iso9660_file_length,
|
|||
while(*pnt)
|
||||
{
|
||||
#ifdef VMS
|
||||
if( strcmp(pnt,".DIR;1") == 0 )
|
||||
if( strcmp(pnt,".DIR;1") == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -126,11 +126,11 @@ int FDECL3(iso9660_file_length,
|
|||
* generated by some editors. Lower the priority of
|
||||
* the file.
|
||||
*/
|
||||
if(*pnt == '#')
|
||||
if(*pnt == '#')
|
||||
{
|
||||
priority = 1;
|
||||
pnt++;
|
||||
continue;
|
||||
priority = 1;
|
||||
pnt++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -138,11 +138,11 @@ int FDECL3(iso9660_file_length,
|
|||
* generated by some editors. Lower the priority of
|
||||
* the file.
|
||||
*/
|
||||
if(*pnt == '~')
|
||||
if(*pnt == '~')
|
||||
{
|
||||
priority = 1;
|
||||
tildes++;
|
||||
pnt++;
|
||||
priority = 1;
|
||||
tildes++;
|
||||
pnt++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,9 @@ int FDECL3(iso9660_file_length,
|
|||
* If we have a name with multiple '.' characters, we ignore everything
|
||||
* after we have gotten the extension.
|
||||
*/
|
||||
if(ignore)
|
||||
if(ignore)
|
||||
{
|
||||
pnt++;
|
||||
pnt++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ int FDECL3(iso9660_file_length,
|
|||
*/
|
||||
if(seen_semic)
|
||||
{
|
||||
if(*pnt >= '0' && *pnt <= '9')
|
||||
if(*pnt >= '0' && *pnt <= '9')
|
||||
{
|
||||
*result++ = *pnt;
|
||||
}
|
||||
|
@ -197,19 +197,19 @@ int FDECL3(iso9660_file_length,
|
|||
* 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))
|
||||
{
|
||||
|
@ -222,21 +222,21 @@ int FDECL3(iso9660_file_length,
|
|||
}
|
||||
}
|
||||
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 */
|
||||
}
|
||||
|
@ -247,36 +247,36 @@ int FDECL3(iso9660_file_length,
|
|||
* 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) )
|
||||
|
@ -289,7 +289,7 @@ int FDECL3(iso9660_file_length,
|
|||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Descriptions of DOS's 'Parse Filename'
|
||||
* (function 29H) describes V1 and V2.0+
|
||||
* separator and terminator characters.
|
||||
|
@ -329,7 +329,7 @@ int FDECL3(iso9660_file_length,
|
|||
current_length++;
|
||||
pnt++;
|
||||
} /* while (*pnt) */
|
||||
|
||||
|
||||
/*
|
||||
* OK, that wraps up the scan of the name. Now tidy up a few other
|
||||
* things.
|
||||
|
@ -345,11 +345,11 @@ int FDECL3(iso9660_file_length,
|
|||
{
|
||||
int prio1 = 0;
|
||||
pnt = name;
|
||||
while (*pnt && *pnt != '~')
|
||||
while (*pnt && *pnt != '~')
|
||||
{
|
||||
pnt++;
|
||||
}
|
||||
if (*pnt)
|
||||
if (*pnt)
|
||||
{
|
||||
pnt++;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ int FDECL3(iso9660_file_length,
|
|||
}
|
||||
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
|
||||
|
@ -368,12 +368,12 @@ int FDECL3(iso9660_file_length,
|
|||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -383,8 +383,8 @@ int FDECL3(iso9660_file_length,
|
|||
extra += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(result)
|
||||
|
||||
if(result)
|
||||
{
|
||||
*result++ = 0;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
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
|
||||
|
@ -210,13 +210,13 @@ int deep_opt;
|
|||
};
|
||||
|
||||
/*
|
||||
* Add the posix modes
|
||||
* Add the posix modes
|
||||
*/
|
||||
if(MAYBE_ADD_CE_ENTRY(PX_SIZE)) add_CE_entry();
|
||||
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;
|
||||
|
@ -236,7 +236,7 @@ int deep_opt;
|
|||
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 ));
|
||||
|
@ -286,25 +286,25 @@ int deep_opt;
|
|||
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);
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ int deep_opt;
|
|||
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){
|
||||
|
@ -326,7 +326,7 @@ int deep_opt;
|
|||
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();
|
||||
|
@ -349,7 +349,7 @@ int deep_opt;
|
|||
/* 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)
|
||||
|
@ -397,7 +397,7 @@ int deep_opt;
|
|||
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();
|
||||
|
@ -422,7 +422,7 @@ int deep_opt;
|
|||
iso9660_date((char *) &Rock[ipnt], lstatbuf->st_ctime);
|
||||
ipnt += 7;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Add in the Rock Ridge RE time field
|
||||
*/
|
||||
if(deep_opt & NEED_RE){
|
||||
|
@ -433,7 +433,7 @@ int deep_opt;
|
|||
Rock[ipnt++] = SU_VERSION;
|
||||
flagval |= (1<<6);
|
||||
};
|
||||
/*
|
||||
/*
|
||||
* Add in the Rock Ridge PL record, if required.
|
||||
*/
|
||||
if(deep_opt & NEED_PL){
|
||||
|
@ -447,7 +447,7 @@ int deep_opt;
|
|||
flagval |= (1<<5);
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
* Add in the Rock Ridge CL field, if required.
|
||||
*/
|
||||
if(deep_opt & NEED_CL){
|
||||
|
@ -464,7 +464,7 @@ int deep_opt;
|
|||
#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){
|
||||
|
@ -498,8 +498,8 @@ int deep_opt;
|
|||
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);
|
||||
|
@ -534,7 +534,7 @@ int deep_opt;
|
|||
};
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
/*
|
||||
* Add in the Rock Ridge CE field, if required. We use this for the
|
||||
* extension record that is stored in the root directory.
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -21,11 +21,10 @@
|
|||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
#include "mkisofs.h"
|
||||
#include "iso9660.h"
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -37,7 +36,11 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "mkisofs.h"
|
||||
#include "iso9660.h"
|
||||
#include "msdos_partition.h"
|
||||
|
||||
#ifdef __SVR4
|
||||
extern char * strdup(const char *);
|
||||
#endif
|
||||
|
@ -158,7 +161,7 @@ void FDECL4(xfwrite, void *, buffer, uint64_t, count, uint64_t, size, FILE *, fi
|
|||
error (1, errno, _("Cannot open '%s'"), nbuf);
|
||||
|
||||
}
|
||||
while(count)
|
||||
while(count)
|
||||
{
|
||||
size_t got = fwrite (buffer, size, count, file);
|
||||
|
||||
|
@ -193,7 +196,7 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
|
|||
struct directory * dpnt;
|
||||
|
||||
dpnt = node;
|
||||
|
||||
|
||||
while (dpnt)
|
||||
{
|
||||
/* skip if it's hidden */
|
||||
|
@ -211,13 +214,13 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
@ -225,7 +228,7 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
|
|||
}
|
||||
}
|
||||
|
||||
if(dpnt->subdir)
|
||||
if(dpnt->subdir)
|
||||
{
|
||||
assign_directory_addresses(dpnt->subdir);
|
||||
}
|
||||
|
@ -235,7 +238,7 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
|
|||
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];
|
||||
|
@ -244,7 +247,7 @@ static void FDECL3(write_one_file, char *, filename,
|
|||
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;
|
||||
|
||||
|
@ -253,12 +256,12 @@ static void FDECL3(write_one_file, char *, filename,
|
|||
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);
|
||||
}
|
||||
|
@ -268,7 +271,7 @@ static void FDECL3(write_one_file, char *, filename,
|
|||
time_t now;
|
||||
time_t the_end;
|
||||
double frac;
|
||||
|
||||
|
||||
time(&now);
|
||||
frac = last_extent_written / (double)last_extent;
|
||||
the_end = begun + (now - begun) / frac;
|
||||
|
@ -287,13 +290,13 @@ static void FDECL1(write_files, FILE *, outfile)
|
|||
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
|
||||
|
@ -324,11 +327,11 @@ static void dump_filelist()
|
|||
}
|
||||
#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;
|
||||
|
@ -341,7 +344,7 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
|
|||
{
|
||||
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
|
||||
|
@ -373,16 +376,16 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
|
|||
if((*l)->isorec.name_len[0] == 1 && *lpnt == 1) return 1;
|
||||
#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++;
|
||||
|
@ -392,7 +395,7 @@ static int FDECL2(compare_dirs, const void *, rr, const void *, ll)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Function: sort_directory
|
||||
*
|
||||
* Purpose: Sort the directory in the appropriate ISO9660
|
||||
|
@ -408,7 +411,7 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
|
|||
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)
|
||||
|
@ -425,9 +428,9 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
|
|||
}
|
||||
|
||||
/*
|
||||
* OK, now we know how many there are. Build a vector for sorting.
|
||||
* OK, now we know how many there are. Build a vector for sorting.
|
||||
*/
|
||||
sortlist = (struct directory_entry **)
|
||||
sortlist = (struct directory_entry **)
|
||||
e_malloc(sizeof(struct directory_entry *) * dcount);
|
||||
|
||||
j = dcount - 1;
|
||||
|
@ -449,29 +452,29 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
|
|||
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.
|
||||
*/
|
||||
|
@ -479,7 +482,7 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
|
|||
{
|
||||
sortlist[i]->next = sortlist[i+1];
|
||||
}
|
||||
|
||||
|
||||
sortlist[dcount+xcount-1]->next = NULL;
|
||||
*sort_dir = sortlist[0];
|
||||
}
|
||||
|
@ -491,7 +494,7 @@ int FDECL1(sort_directory, struct directory_entry **, sort_dir)
|
|||
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;
|
||||
|
@ -530,16 +533,16 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
{
|
||||
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);
|
||||
|
@ -548,12 +551,12 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
}
|
||||
|
||||
/*
|
||||
* If this is for a directory that is not a . or a .. entry,
|
||||
* If this is for a directory that is not a . or a .. entry,
|
||||
* then look up the information for the entry. We have already
|
||||
* 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;
|
||||
|
@ -561,7 +564,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
{
|
||||
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);
|
||||
|
@ -578,45 +581,45 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
* 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
|
||||
|
@ -624,28 +627,28 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
* 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);
|
||||
|
@ -669,15 +672,15 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
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);
|
||||
|
@ -696,7 +699,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
|
|||
*/
|
||||
set_733((char *) s_entry->isorec.extent, last_extent);
|
||||
}
|
||||
if(dpnt->subdir)
|
||||
if(dpnt->subdir)
|
||||
{
|
||||
assign_file_addresses(dpnt->subdir);
|
||||
}
|
||||
|
@ -708,13 +711,13 @@ static void FDECL1(free_one_directory, struct directory *, dpnt)
|
|||
{
|
||||
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);
|
||||
|
@ -750,31 +753,31 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
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) {
|
||||
|
@ -782,25 +785,25 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
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)
|
||||
{
|
||||
|
@ -809,20 +812,20 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
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)
|
||||
|
@ -834,30 +837,30 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
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++;
|
||||
}
|
||||
|
@ -865,11 +868,11 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
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;
|
||||
}
|
||||
|
@ -877,14 +880,14 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
{
|
||||
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;
|
||||
|
@ -912,16 +915,16 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
|
|||
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 */
|
||||
|
@ -933,7 +936,7 @@ void FDECL1(build_pathlist, struct directory *, node)
|
|||
}
|
||||
} /* 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;
|
||||
|
@ -943,13 +946,13 @@ static int FDECL2(compare_paths, void const *, r, void const *, l)
|
|||
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()
|
||||
|
@ -965,7 +968,7 @@ 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);
|
||||
|
@ -974,7 +977,7 @@ static int generate_path_tables()
|
|||
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 )
|
||||
{
|
||||
|
@ -983,7 +986,7 @@ static int generate_path_tables()
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -992,10 +995,10 @@ static int generate_path_tables()
|
|||
{
|
||||
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
|
||||
|
||||
|
@ -1017,55 +1020,55 @@ static int generate_path_tables()
|
|||
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)
|
||||
{
|
||||
|
@ -1108,7 +1111,7 @@ static int FDECL1(file_write, FILE *, outfile)
|
|||
/*
|
||||
* 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;
|
||||
|
@ -1124,16 +1127,16 @@ static int FDECL1(file_write, FILE *, outfile)
|
|||
#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.
|
||||
*/
|
||||
|
@ -1145,8 +1148,8 @@ static int FDECL1(file_write, FILE *, outfile)
|
|||
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)
|
||||
|
@ -1192,7 +1195,7 @@ static int FDECL1(pvd_write, FILE *, outfile)
|
|||
|
||||
/*
|
||||
* This will break in the year 2000, I supose, but there is no good way
|
||||
* 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,
|
||||
|
@ -1204,28 +1207,28 @@ static int FDECL1(pvd_write, FILE *, outfile)
|
|||
iso_time[16] = (local.tm_min + 60*(local.tm_hour + 24*local.tm_yday)) / 15;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
@ -1235,9 +1238,9 @@ static int FDECL1(pvd_write, FILE *, outfile)
|
|||
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);
|
||||
|
||||
/*
|
||||
|
@ -1257,15 +1260,15 @@ static int FDECL1(pvd_write, FILE *, outfile)
|
|||
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);
|
||||
|
@ -1281,7 +1284,7 @@ static int FDECL1(pvd_write, FILE *, outfile)
|
|||
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++;
|
||||
|
@ -1296,7 +1299,7 @@ static int FDECL1(evd_write, FILE *, outfile)
|
|||
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;
|
||||
|
@ -1313,7 +1316,7 @@ static int FDECL1(evd_write, FILE *, outfile)
|
|||
static int FDECL1(pathtab_write, FILE *, outfile)
|
||||
{
|
||||
/*
|
||||
* Next we write the path tables
|
||||
* Next we write the path tables
|
||||
*/
|
||||
xfwrite(path_table_l, 1, path_blocks << 11, outfile);
|
||||
xfwrite(path_table_m, 1, path_blocks << 11, outfile);
|
||||
|
@ -1344,6 +1347,9 @@ int FDECL1(oneblock_size, int, starting_extent)
|
|||
/*
|
||||
* Functions to describe padding block at the start of the disc.
|
||||
*/
|
||||
|
||||
#define PADBLOCK_SIZE 16
|
||||
|
||||
static int FDECL1(pathtab_size, int, starting_extent)
|
||||
{
|
||||
path_table[0] = starting_extent;
|
||||
|
@ -1357,7 +1363,7 @@ static int FDECL1(pathtab_size, int, starting_extent)
|
|||
|
||||
static int FDECL1(padblock_size, int, starting_extent)
|
||||
{
|
||||
last_extent += 16;
|
||||
last_extent += PADBLOCK_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1420,17 +1426,48 @@ static int FDECL1(dirtree_cleanup, FILE *, outfile)
|
|||
|
||||
static int FDECL1(padblock_write, FILE *, outfile)
|
||||
{
|
||||
char buffer[2048];
|
||||
int i;
|
||||
char *buffer;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
buffer = e_malloc (2048 * PADBLOCK_SIZE);
|
||||
memset (buffer, 0, 2048 * PADBLOCK_SIZE);
|
||||
|
||||
for(i=0; i<16; i++)
|
||||
if (use_embedded_boot)
|
||||
{
|
||||
xfwrite(buffer, 1, sizeof(buffer), outfile);
|
||||
FILE *fp = fopen (boot_image_embed, "rb");
|
||||
if (! fp)
|
||||
error (1, errno, _("Unable to open %s"), boot_image_embed);
|
||||
|
||||
fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp);
|
||||
if (fgetc (fp) != EOF)
|
||||
error (1, 0, _("%s is too big for embed area"), boot_image_embed);
|
||||
}
|
||||
|
||||
last_extent_written += 16;
|
||||
if (use_protective_msdos_label)
|
||||
{
|
||||
struct msdos_partition_mbr *mbr = (void *) buffer;
|
||||
|
||||
memset (mbr->entries, 0, sizeof(mbr->entries));
|
||||
|
||||
/* Some idiotic BIOSes refuse to boot if they don't find at least
|
||||
one partition with active bit set. */
|
||||
mbr->entries[0].flag = 0x80;
|
||||
|
||||
/* Doesn't really matter, as long as it's non-zero. It seems that
|
||||
0xCD is used elsewhere, so we follow suit. */
|
||||
mbr->entries[0].type = 0xcd;
|
||||
|
||||
/* Start immediately (sector 1). */
|
||||
mbr->entries[0].start = 1;
|
||||
|
||||
/* We don't know yet. Let's keep it safe. */
|
||||
mbr->entries[0].length = UINT32_MAX;
|
||||
|
||||
mbr->signature = MSDOS_PARTITION_SIGNATURE;
|
||||
}
|
||||
|
||||
xfwrite (buffer, 1, 2048 * PADBLOCK_SIZE, outfile);
|
||||
last_extent_written += PADBLOCK_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue