[Debburn-changes] r706 - in cdrkit/trunk: . genisoimage
Eduard Bloch
blade at alioth.debian.org
Wed Mar 14 22:14:34 CET 2007
Author: blade
Date: 2007-03-14 21:14:33 +0000 (Wed, 14 Mar 2007)
New Revision: 706
Modified:
cdrkit/trunk/Changelog
cdrkit/trunk/genisoimage/boot.c
cdrkit/trunk/genisoimage/genisoimage.1
cdrkit/trunk/genisoimage/genisoimage.c
cdrkit/trunk/genisoimage/genisoimage.h
cdrkit/trunk/genisoimage/hash.c
cdrkit/trunk/genisoimage/joliet.c
cdrkit/trunk/genisoimage/multi.c
cdrkit/trunk/genisoimage/stream.c
cdrkit/trunk/genisoimage/write.c
Log:
* various small bugfixes or cosmetic fixes picked from still GPLed parts of
cdrtools-2.01.01a24, excluding meta changes and big tree.c and mkisofs.c
refactoring. Stream file name option enabled now.
Modified: cdrkit/trunk/Changelog
===================================================================
--- cdrkit/trunk/Changelog 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/Changelog 2007-03-14 21:14:33 UTC (rev 706)
@@ -11,6 +11,9 @@
incorrect iso9660 but having it this way is better than no LFS at all.
* removed md5* parts and integration from icedax, patch by
Vladimir Nadvornik <nadvornik at suse.cz>
+ * various small bugfixes or cosmetic fixes picked from still GPLed parts of
+ cdrtools-2.01.01a24, excluding meta changes and big tree.c and mkisofs.c
+ refactoring. Stream file name option enabled now.
[ Peter Samuelson ]
* Clean up Linux-2.6 CD/DVD-R drive detection, clearer error messages.
Modified: cdrkit/trunk/genisoimage/boot.c
===================================================================
--- cdrkit/trunk/genisoimage/boot.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/boot.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -411,7 +411,7 @@
}
close(f);
}
- fprintf(stderr, "Total extents including %s boot = %d\n",
+ fprintf(stderr, "Total extents including %s boot = %u\n",
use_sunx86boot ? "Solaris x86":"sparc",
last_extent_written - session_start);
return (0);
Modified: cdrkit/trunk/genisoimage/genisoimage.1
===================================================================
--- cdrkit/trunk/genisoimage/genisoimage.1 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/genisoimage.1 2007-03-14 21:14:33 UTC (rev 706)
@@ -2743,8 +2743,8 @@
.B mkisofs
from the
.B cdrtools 2.01.01a08
-package from May 2006,
-.IR http://cdrecord.berlios.de/ ,
+package from May 2006 (with few updates extracted from cdrtools 2.01.01a24 from
+March 2007) from .IR http://cdrecord.berlios.de/ ,
but is now part of the
.B cdrkit
suite, maintained by Joerg Jaspert, Eduard Bloch, Steve McIntyre, Peter
@@ -2775,6 +2775,7 @@
Copyright 1996-1997 by Robert Leslie
Copyright 1997-2001 by James Pearson
Copyright 1999-2006 by J\(:org Schilling
+Copyright 2007 by J\(:org Schilling (originating few updates)
Copyright 2002-2003 by Jungshik Shin
Copyright 2003 by Jaakko Heinonen
Copyright 2006 by the Cdrkit maintainers
Modified: cdrkit/trunk/genisoimage/genisoimage.c
===================================================================
--- cdrkit/trunk/genisoimage/genisoimage.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/genisoimage.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -17,7 +17,8 @@
*
* Eduard Bloch <blade at debian.org>
*/
-/* @(#)genisoimage.c 1.167 06/01/30 joerg */
+/* @(#)mkisofs.c 1.167 06/01/30 joerg */
+/* Parts from @(#)mkisofs.c 1.206 07/02/26 joerg */
/*
* Program genisoimage.c - generate iso9660 filesystem based upon directory
* tree on hard disk.
@@ -205,7 +206,7 @@
int split_SL_field = 1; /* circumvent a bug in the SunOS */
char *trans_tbl = "TRANS.TBL"; /* default name for translation table */
int stream_media_size = 0; /* # of blocks on the media */
-char *stream_filename = "STREAM.IMG;1"; /* Default stream file name */
+char *stream_filename = NULL; /* Stream file, 0 to use default STREAM.IMG */
#ifdef APPLE_HYB
int apple_hyb = 0; /* create HFS hybrid flag */
@@ -1910,7 +1911,6 @@
break;
case OPTION_STREAM_FILE_NAME:
- comerrno(EX_BAD, "-stream-file-name not yet implemented\n");
stream_filename = optarg;
break;
@@ -2427,6 +2427,36 @@
if (use_udf && !use_Joliet)
jlen = 255;
+ if (preparer) {
+ if (strlen(preparer) > 128) {
+ comerrno(EX_BAD, "Preparer string too long\n");
+ }
+ }
+ if (publisher) {
+ if (strlen(publisher) > 128) {
+ comerrno(EX_BAD,
+ "Publisher string too long\n");
+ }
+ }
+ if (stream_filename) {
+ if (strlen(stream_filename) > MAX_ISONAME)
+ comerrno(EX_BAD,
+ "stream-file-name too long (%d), max is %d.\n",
+ strlen(stream_filename), MAX_ISONAME);
+ if (strchr(stream_filename, '/'))
+ comerrno(EX_BAD, "Illegal character '/' in stream-file-name.\n");
+ iso9660_level = 4;
+ } else {
+ stream_filename = "STREAM.IMG;1";
+ }
+ if (system_id) {
+ if (strlen(system_id) > 32) {
+ comerrno(EX_BAD,
+ "System ID string too long\n");
+ }
+ }
+
+
if (use_RockRidge && (iso9660_namelen > MAX_ISONAME_V2_RR))
iso9660_namelen = MAX_ISONAME_V2_RR;
@@ -2605,11 +2635,11 @@
struct rlimit rlp;
if (getrlimit(RLIMIT_DATA, &rlp) == -1)
- perror("Warning: getrlimit");
+ perror("Warning: getrlimit failed");
else {
rlp.rlim_cur = 33554432;
if (setrlimit(RLIMIT_DATA, &rlp) == -1)
- perror("Warning: setrlimit");
+ perror("Warning: setrlimit failed");
}
}
#endif
@@ -3591,9 +3621,9 @@
if (print_size > 0) {
if (verbose > 0)
fprintf(stderr,
- "Total extents scheduled to be written = %d\n",
+ "Total extents scheduled to be written = %u\n",
(last_extent - session_start));
- printf("%d\n", (last_extent - session_start));
+ printf("%u\n", (last_extent - session_start));
exit(0);
}
/*
@@ -3621,7 +3651,7 @@
opnt->of_name, last_extent_written);
(*opnt->of_write) (discimage);
if (verbose > 1)
- fprintf(stderr, "Done with: %-40sBlock(s) %d\n",
+ fprintf(stderr, "Done with: %-40sBlock(s) %u\n",
opnt->of_name, last_extent_written-oext);
}
}
@@ -3643,7 +3673,7 @@
fprintf(stderr, "Max brk space used %x\n",
(unsigned int)(((unsigned long) sbrk(0)) - mem_start));
#endif
- fprintf(stderr, "%d extents written (%d MB)\n",
+ fprintf(stderr, "%u extents written (%u MB)\n",
last_extent, last_extent >> 9);
}
#ifdef VMS
Modified: cdrkit/trunk/genisoimage/genisoimage.h
===================================================================
--- cdrkit/trunk/genisoimage/genisoimage.h 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/genisoimage.h 2007-03-14 21:14:33 UTC (rev 706)
@@ -139,6 +139,7 @@
struct file_hash *next;
ino_t inode; /* Used in the hash table */
dev_t dev; /* Used in the hash table */
+ nlink_t nlink; /* Used to compute new link count */
unsigned int starting_block;
off_t size;
#ifdef SORTING
Modified: cdrkit/trunk/genisoimage/hash.c
===================================================================
--- cdrkit/trunk/genisoimage/hash.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/hash.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -11,13 +11,14 @@
*/
/* @(#)hash.c 1.18 04/06/18 joerg */
+/* @(#)hash.c 1.23 06/10/04 joerg */
/*
* File hash.c - generate hash tables for iso9660 filesystem.
*
* Written by Eric Youngdale (1993).
*
* Copyright 1993 Yggdrasil Computing, Incorporated
- * Copyright (c) 1999,2000 J. Schilling
+ * Copyright (c) 1999,2000-2006 J. Schilling
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,11 +58,11 @@
#include "genisoimage.h"
#include <schily.h>
-#define NR_HASH 1024
+#define NR_HASH (16*1024)
-#define HASH_FN(DEV, INO) ((DEV + INO + (INO >> 2) + (INO << 8)) % NR_HASH)
+#define HASH_FN(DEV, INO) ((DEV + INO + (INO >> 8) + (INO << 16)) % NR_HASH)
-static struct file_hash *hash_table[NR_HASH] = {0, };
+static struct file_hash *hash_table[NR_HASH];
void add_hash(struct directory_entry *spnt);
struct file_hash *find_hash(dev_t dev, ino_t inode);
@@ -82,23 +83,16 @@
unsigned int hash_number;
if (spnt->size == 0 || spnt->starting_block == 0)
- if (spnt->size != 0 || spnt->starting_block != 0) {
-#ifdef USE_LIBSCHILY
+ if (spnt->size != 0 && spnt->starting_block == 0) {
comerrno(EX_BAD,
"Non zero-length file '%s' assigned zero extent.\n",
spnt->name);
-#else
- fprintf(stderr,
- "Non zero-length file '%s' assigned zero extent.\n",
- spnt->name);
- exit(1);
-#endif
};
if (!cache_inodes)
return;
- if (spnt->dev == (dev_t) UNCACHED_DEVICE ||
- spnt->inode == UNCACHED_INODE) {
+ if (spnt->dev == UNCACHED_DEVICE &&
+ (spnt->inode == TABLE_INODE || spnt->inode == UNCACHED_INODE)) {
return;
}
hash_number = HASH_FN((unsigned int) spnt->dev,
@@ -112,6 +106,7 @@
s_hash->next = hash_table[hash_number];
s_hash->inode = spnt->inode;
s_hash->dev = spnt->dev;
+ s_hash->nlink = 0;
s_hash->starting_block = spnt->starting_block;
s_hash->size = spnt->size;
#ifdef SORTING
@@ -128,7 +123,8 @@
if (!cache_inodes)
return (NULL);
- if (dev == (dev_t) UNCACHED_DEVICE || inode == UNCACHED_INODE)
+ if (dev == UNCACHED_DEVICE &&
+ (inode == TABLE_INODE || inode == UNCACHED_INODE))
return (NULL);
hash_number = HASH_FN((unsigned int) dev, (unsigned int) inode);
@@ -163,7 +159,7 @@
}
}
-static struct file_hash *directory_hash_table[NR_HASH] = {0, };
+static struct file_hash *directory_hash_table[NR_HASH];
void
add_directory_hash(dev_t dev, ino_t inode)
@@ -173,7 +169,8 @@
if (!cache_inodes)
return;
- if (dev == (dev_t) UNCACHED_DEVICE || inode == UNCACHED_INODE)
+ if (dev == UNCACHED_DEVICE &&
+ (inode == TABLE_INODE || inode == UNCACHED_INODE))
return;
hash_number = HASH_FN((unsigned int) dev, (unsigned int) inode);
@@ -182,6 +179,7 @@
s_hash->next = directory_hash_table[hash_number];
s_hash->inode = inode;
s_hash->dev = dev;
+ s_hash->nlink = 0;
directory_hash_table[hash_number] = s_hash;
}
@@ -193,7 +191,8 @@
if (!cache_inodes)
return (NULL);
- if (dev == (dev_t) UNCACHED_DEVICE || inode == UNCACHED_INODE)
+ if (dev == UNCACHED_DEVICE &&
+ (inode == TABLE_INODE || inode == UNCACHED_INODE))
return (NULL);
hash_number = HASH_FN((unsigned int) dev, (unsigned int) inode);
@@ -209,6 +208,7 @@
struct name_hash {
struct name_hash *next;
struct directory_entry *de;
+ int sum;
};
#define NR_NAME_HASH (256*1024)
@@ -235,7 +235,7 @@
if (*p == ';') {
break;
}
- hash = (hash << 15) + (hash << 3) + (hash >> 3) + *p++;
+ hash = (hash << 15) + (hash << 3) + (hash >> 3) + (*p++ & 0xFF);
}
return (hash % NR_NAME_HASH);
}
@@ -245,10 +245,18 @@
{
struct name_hash *new;
int hash;
+ Uchar *p;
+ int sum = 0;
new = (struct name_hash *) e_malloc(sizeof (struct name_hash));
new->de = de;
new->next = NULL;
+ for (p = (Uchar *)de->isorec.name; *p; p++) {
+ if (*p == ';')
+ break;
+ sum += *p & 0xFF;
+ }
+ new->sum = sum;
hash = name_hash(de->isorec.name);
/* Now insert into the hash table */
@@ -262,11 +270,21 @@
register char *p1;
register char *p2;
register struct name_hash *nh;
+ register int sum = 0;
if (debug > 1)
fprintf(stderr, "find_hash('%s')\n", name);
+ for (p1 = name; *p1; p1++) {
+ if (*p1 == ';')
+ break;
+ sum += *p1 & 0xFF;
+ }
+
for (nh = name_hash_table[name_hash(name)]; nh; nh = nh->next) {
+ if (nh->sum != sum)
+ continue;
+
p1 = name;
p2 = nh->de->isorec.name;
if (debug > 1)
@@ -301,7 +319,6 @@
p2++;
continue;
}
-
}
/*
Modified: cdrkit/trunk/genisoimage/joliet.c
===================================================================
--- cdrkit/trunk/genisoimage/joliet.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/joliet.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -434,6 +434,8 @@
get_joliet_vol_desc(struct iso_primary_descriptor *jvol_desc)
{
jvol_desc->type[0] = ISO_VD_SUPPLEMENTARY;
+ jvol_desc->version[0] = 1;
+ jvol_desc->file_structure_version[0] = 1;
/*
* For now, always do Unicode level 3.
Modified: cdrkit/trunk/genisoimage/multi.c
===================================================================
--- cdrkit/trunk/genisoimage/multi.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/multi.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -1064,6 +1064,7 @@
}
/* We found it and we can reuse the extent */
memcpy(curr_entry->isorec.extent, ptr[i]->isorec.extent, 8);
+ curr_entry->starting_block = isonum_733(ptr[i]->isorec.extent);
curr_entry->de_flags |= SAFE_TO_REUSE_TABLE_ENTRY;
goto found_it;
}
Modified: cdrkit/trunk/genisoimage/stream.c
===================================================================
--- cdrkit/trunk/genisoimage/stream.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/stream.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -11,6 +11,7 @@
*/
/* @(#)stream.c 1.3 04/03/04 Copyright 2002-2003 J. Schilling */
+/* Parts from @(#)stream.c 1.9 07/02/17 Copyright 2002-2007 J. Schilling */
/*
* ISO-9660 stream (pipe) file module for genisoimage
*
@@ -206,14 +207,15 @@
set_733((char *)s_dir.extent, root->extent);
set_733((char *)s_dir.size, SECTOR_SIZE);
iso9660_date(s_dir.date, begun);
- s_dir.flags[0] = 2;
+ s_dir.flags[0] = ISO_DIRECTORY;
s_dir.file_unit_size[0] = 0;
s_dir.interleave[0] = 0;
set_723((char *)s_dir.volume_sequence_number, volume_sequence_number);
s_dir.name_len[0] = 1;
- s_dir.name[0] = 0;
+ s_dir.name[0] = 0; /* "." */
jtwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, 0, FALSE);
xfwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, outfile, 0, FALSE);
+ s_dir.name[0] = 1; /* ".." */
jtwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, 0, FALSE);
xfwrite(&s_dir, offsetof(struct iso_directory_record, name[0]) + 1, 1, outfile, 0, FALSE);
memset(&s_dir, 0, sizeof (struct iso_directory_record));
Modified: cdrkit/trunk/genisoimage/write.c
===================================================================
--- cdrkit/trunk/genisoimage/write.c 2007-02-09 22:22:35 UTC (rev 705)
+++ cdrkit/trunk/genisoimage/write.c 2007-03-14 21:14:33 UTC (rev 706)
@@ -11,6 +11,7 @@
*/
/* @(#)write.c 1.88 06/02/01 joerg */
+/* Parts from @(#)write.c 1.106 07/02/17 joerg */
/*
* Program write.c - dump memory structures to file for iso9660 filesystem.
*
@@ -104,7 +105,7 @@
static int compare_dirs(const void *rr, const void *ll);
int sort_directory(struct directory_entry **sort_dir, int rr);
static int root_gen(void);
-static BOOL assign_file_addresses(struct directory *dpnt);
+static BOOL assign_file_addresses(struct directory *dpnt, BOOL isnest);
static void free_one_directory(struct directory *dpnt);
static void free_directories(struct directory *dpnt);
void generate_one_directory(struct directory *dpnt, FILE *outfile);
@@ -276,6 +277,7 @@
while (count) {
int got;
+ seterrno(0);
if (osecsize != 0)
got = xawrite(buffer, size, count, file, submode, islast);
else
@@ -1020,7 +1022,7 @@
static BOOL
-assign_file_addresses(struct directory *dpnt)
+assign_file_addresses(struct directory *dpnt, BOOL isnest)
{
struct directory *finddir;
struct directory_entry *s_entry;
@@ -1030,18 +1032,22 @@
#ifdef DVD_VIDEO
char dvd_path[PATH_MAX];
title_set_info_t * title_set_info = NULL;
+ char *p;
#endif
BOOL ret = FALSE;
while (dpnt) {
#ifdef DVD_VIDEO
- if (dvd_video && (strstr(dpnt->whole_name, "VIDEO_TS") != 0)) {
- int maxlen = strlen(dpnt->whole_name)-8;
+ if (dvd_video && root == dpnt->parent &&
+ ((p = strstr(dpnt->whole_name, "VIDEO_TS")) != 0)&&
+ strcmp(p, "VIDEO_TS") == 0) {
+ int maxlen = strlen(dpnt->whole_name)-8;
if (maxlen > (sizeof (dvd_path)-1))
maxlen = sizeof (dvd_path)-1;
strncpy(dvd_path, dpnt->whole_name, maxlen);
dvd_path[maxlen] = '\0';
+
#ifdef DEBUG
fprintf(stderr, "Found 'VIDEO_TS', the path is %s \n", dvd_path);
#endif
@@ -1067,8 +1073,7 @@
* previous session on the disc. Note that we don't
* end up scheduling the thing for writing either.
*/
- if (isonum_733((unsigned char *)
- s_entry->isorec.extent) != 0) {
+ if (get_733(s_entry->isorec.extent) != 0) {
continue;
}
/*
@@ -1112,7 +1117,6 @@
break;
finddir = finddir->next;
if (!finddir) {
-#ifdef USE_LIBSCHILY
#ifdef DVD_VIDEO
if (title_set_info != 0) {
DVDFreeFileSet(title_set_info);
@@ -1121,17 +1125,6 @@
comerrno(EX_BAD,
"Fatal goof - could not find dir entry for '%s'\n",
s_entry->name);
-#else
- fprintf(stderr,
- "Fatal goof - could not find dir entry for '%s'\n",
- s_entry->name);
-#ifdef DVD_VIDEO
- if (title_set_info != 0) {
- DVDFreeFileSet(title_set_info);
- }
-#endif
- exit(1);
-#endif
}
}
set_733((char *) s_entry->isorec.extent,
@@ -1244,8 +1237,7 @@
SPATH_SEPARATOR, trans_tbl);
} else {
dwpnt->table = NULL;
- strcpy(whole_path,
- s_entry->whole_name);
+ strcpy(whole_path, s_entry->whole_name);
dwpnt->name = strdup(whole_path);
}
dwpnt->next = NULL;
@@ -1263,7 +1255,7 @@
}
#endif /* DVD_VIDEO */
if (verbose > 2 && !do_sort) {
- fprintf(stderr, "%8d %8d %s\n",
+ fprintf(stderr, "%8d %8u %s\n",
s_entry->starting_block,
last_extent - 1, whole_path);
}
@@ -1309,7 +1301,7 @@
set_733((char *) s_entry->isorec.extent, last_extent);
}
if (dpnt->subdir) {
- if (assign_file_addresses(dpnt->subdir))
+ if (assign_file_addresses(dpnt->subdir, TRUE))
ret = TRUE;
}
dpnt = dpnt->next;
@@ -1318,9 +1310,13 @@
if (title_set_info != NULL) {
DVDFreeFileSet(title_set_info);
}
+ if (dvd_video && !ret && !isnest) {
+ errmsgno(EX_BAD,
+ "Could not find correct 'VIDEO_TS' directory.\n");
+ }
#endif /* DVD_VIDEO */
return (ret);
-}/* assign_file_addresses(... */
+} /* assign_file_addresses(... */
static void
free_one_directory(struct directory *dpnt)
@@ -1804,7 +1800,7 @@
#endif /* APPLE_HYB */
fprintf(stderr,
- "Total extents scheduled to be written = %d\n",
+ "Total extents scheduled to be written = %u\n",
last_extent - session_start);
}
/* Now write all of the files that we need. */
@@ -1907,6 +1903,8 @@
local.tm_min -= gmt.tm_min;
local.tm_hour -= gmt.tm_hour;
local.tm_yday -= gmt.tm_yday;
+ if (local.tm_yday < -2) /* Hit new-year limit */
+ local.tm_yday = 1; /* Local is GMT + 1 day */
iso_time[16] = (local.tm_min + 60 *
(local.tm_hour + 24 * local.tm_yday)) / 15;
@@ -2260,7 +2258,7 @@
#endif /* APPLE_HYB */
- if (!assign_file_addresses(root)) {
+ if (!assign_file_addresses(root, FALSE)) {
#ifdef DVD_VIDEO
if (dvd_video) {
comerrno(EX_BAD, "Unable to make a DVD-Video image.\n"
More information about the Debburn-changes
mailing list