Commit 19a77a6c authored by Carlos Maddela's avatar Carlos Maddela

Merge branch 'experimental/master'

parents 2b5666fc f2da0d56
This diff is collapsed.
......@@ -254,21 +254,14 @@ install: dvdisaster manual
@echo "# dvdisaster uninstaller script" > $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "# Usage: sh dvdisaster-uninstall.sh" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(BINDIR)/dvdisaster\" \"$(BINDIR)/dvdisaster-uninstall.sh\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/CHANGELOG\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/COPYING\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/CREDITS.de\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/CREDITS.en\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/manual.pdf\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/README.MODIFYING\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f \"$(DOCSUBDIR)/TODO\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rmdir \"$(DOCSUBDIR)\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f $(BINDIR)/dvdisaster $(BINDIR)/dvdisaster-uninstall.sh" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -rf $(DOCSUBDIR)" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@for i in $(PO_LOCALES); do \
echo "rm -f \"$(LOCALEDIR)/$$i/LC_MESSAGES/dvdisaster.mo\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh ; \
echo "rm $(LOCALEDIR)/$$i/LC_MESSAGES/dvdisaster.mo" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh ; \
done
@echo "rm -f \"$(MANDIR)/man1/dvdisaster.1\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@echo "rm -f $(MANDIR)/man1/dvdisaster.1" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
@for i in $(MAN_LOCALES); do \
echo "rm -f \"$(MANDIR)/$$i/man1/dvdisaster.1\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh ; \
echo "rm $(MANDIR)/$$i/man1/dvdisaster.1" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh ; \
done
@echo "echo \"dvdisaster has been uninstalled.\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
......
......@@ -111,11 +111,11 @@ Please change into a directory which is writeable
for you and unpack the source code archive:
user@host> cd /var/tmp
user@host> tar xjf dvdisaster-0.79.5.tar.bz2
user@host> tar xjf dvdisaster-0.79.6.tar.bz2
Then change into the newly created directory:
user@host> cd /var/tmp/dvdisaster-0.79.5
user@host> cd /var/tmp/dvdisaster-0.79.6
3.2. Configuring the package
----------------------------
......@@ -199,8 +199,7 @@ please remove the directory you have created as described
in section 3.1:
user@host> cd /var/tmp
user@host> rm -rf dvdisaster-0.79.5
user@host> rm -rf dvdisaster-0.79.6
5. Running the program
======================
......@@ -228,16 +227,7 @@ Use camcontrol to find out which passthrough device
is assigned to your drive:
root@freebsd# camcontrol devlist
<NAME OF YOUR DRIVE> at scbus1 target 0 lun 0 (pass1,cd0)
You can change permission permanently by adding the
following line to /etc/devfs.conf:
perm pass1 0660
To make the change available immediately, restart devfs:
root@freebsd# /etc/rc.d/devfs restart
<NAME OF YOUR DRIVE> at scbus1 target 0 lun 0 (pass0,cd0)
Avoid copy-on-write filesystems
......
Tentative to do/ release schedule
Version 0.79: new RS03 codec
Version 0.79: new RS03 codec (encoding part)
- lots of speed optimizations in error correction data encoding
- multithreaded / multicore processor support for encoding
(decoding still single threaded)
- multithreaded / multicore processor support
- add missing functionality, e.g. adaptive reading
0.79.5: project re-launch
0.79.6: re-introduce CRC and MD5 caching between reading
and ecc creation; cosmetical changes; support
for 100G BD
and ecc creation; cosmetical changes
0.79.7: re-introduce adaptive reading
Version 0.80: milestone release
......
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2015 Carsten Gnoerlich.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
*
* Email: carsten@dvdisaster.org -or- cgnoerlich@fsfe.org
* Project homepage: http://www.dvdisaster.org
......@@ -55,9 +55,9 @@ void FreeBitmap(Bitmap *bm)
* Count the '1' bits in the bitmap
*/
int CountBits(Bitmap *bm)
{ int i;
int sum = 0;
gint32 CountBits(Bitmap *bm)
{ gint32 i;
gint32 sum = 0;
for(i=0; i<bm->size; i++)
if(GetBit(bm, i))
......
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2015 Carsten Gnoerlich.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
*
* Email: carsten@dvdisaster.org -or- cgnoerlich@fsfe.org
* Project homepage: http://www.dvdisaster.org
......
#define BUILD 2789
#define BDATE "15.12.15 (Dienstag, 16:39)"
#define BUILD 272
#define BDATE "17.11.17 (Freitag, 09:57)"
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2015 Carsten Gnoerlich.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
*
* Email: carsten@dvdisaster.org -or- cgnoerlich@fsfe.org
* Project homepage: http://www.dvdisaster.org
......
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2015 Carsten Gnoerlich.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
*
* Email: carsten@dvdisaster.org -or- cgnoerlich@fsfe.org
* Project homepage: http://www.dvdisaster.org
......@@ -225,17 +225,20 @@ void ReadDotfile()
if(!strcmp(symbol, "last-image")) { g_free(Closure->imageName);
if(!strcmp(value, "none"))
Closure->imageName = g_strdup("");
else Closure->imageName = g_strdup(value); continue;
else Closure->imageName = g_strdup(value);
continue;
}
if(!strcmp(symbol, "last-ecc")) { g_free(Closure->eccName);
if(!strcmp(value, "none"))
Closure->eccName = g_strdup("");
else Closure->eccName = g_strdup(value); continue;
else Closure->eccName = g_strdup(value);
continue;
}
if(!strcmp(symbol, "adaptive-read")) { Closure->adaptiveRead = atoi(value); continue; }
if(!strcmp(symbol, "auto-suffix")) { Closure->autoSuffix = atoi(value); continue; }
if(!strcmp(symbol, "bd-size1")) { Closure->bdSize1 = Closure->savedBDSize1 = atoll(value); continue; }
if(!strcmp(symbol, "bd-size2")) { Closure->bdSize2 = Closure->savedBDSize2 = atoll(value); continue; }
if(!strcmp(symbol, "bd-size3")) { Closure->bdSize3 = Closure->savedBDSize3 = atoll(value); continue; }
if(!strcmp(symbol, "cache-size")) { Closure->cacheMiB = atoi(value); continue; }
if(!strcmp(symbol, "cd-size")) { Closure->cdSize = Closure->savedCDSize = atoll(value); continue; }
if(!strcmp(symbol, "codec-threads")) { Closure->codecThreads = atoi(value); continue; }
......@@ -305,8 +308,8 @@ void ReadDotfile()
}
if(fclose(dotfile))
g_fprintf(stderr, "Error closing configuration file %s: %s\n",
Closure->dotFile, strerror(errno));
g_printf("Error closing configuration file %s: %s\n",
Closure->dotFile, strerror(errno));
}
static void update_dotfile()
......@@ -325,7 +328,7 @@ static void update_dotfile()
dotfile = portable_fopen(Closure->dotFile, "wb");
if(!dotfile)
{ g_fprintf(stderr, "Could not open configuration file %s: %s\n",
{ g_printf("Could not open configuration file %s: %s\n",
Closure->dotFile, strerror(errno));
return;
}
......@@ -344,6 +347,7 @@ static void update_dotfile()
g_fprintf(dotfile, "auto-suffix: %d\n", Closure->autoSuffix);
g_fprintf(dotfile, "bd-size1: %lld\n", (long long int)Closure->bdSize1);
g_fprintf(dotfile, "bd-size2: %lld\n", (long long int)Closure->bdSize2);
g_fprintf(dotfile, "bd-size3: %lld\n", (long long int)Closure->bdSize3);
g_fprintf(dotfile, "cache-size: %d\n", Closure->cacheMiB);
g_fprintf(dotfile, "cd-size: %lld\n", (long long int)Closure->cdSize);
g_fprintf(dotfile, "codec-threads: %d\n", Closure->codecThreads);
......@@ -400,8 +404,8 @@ static void update_dotfile()
save_colors(dotfile, "present-sector", Closure->darkSector);
if(fclose(dotfile))
g_fprintf(stderr, "Error closing configuration file %s: %s\n",
Closure->dotFile, strerror(errno));
g_printf("Error closing configuration file %s: %s\n",
Closure->dotFile, strerror(errno));
}
/***
......@@ -419,7 +423,12 @@ void InitClosure()
/* Extract the version string */
#ifdef HAVE_UNSTABLE_RELEASE
Closure->cookedVersion = g_strdup_printf("%s (unstable)", VERSION);
Closure->releaseFlags = MFLAG_DEVEL;
#else
Closure->cookedVersion = g_strdup(VERSION);
#endif
/* Generate a more comprehensive version string */
......@@ -491,6 +500,7 @@ void InitClosure()
Closure->dvdSize2 = Closure->savedDVDSize2 = DVD_DL_SIZE;
Closure->bdSize1 = Closure->savedBDSize1 = BD_SL_SIZE;
Closure->bdSize2 = Closure->savedBDSize2 = BD_DL_SIZE;
Closure->bdSize3 = Closure->savedBDSize3 = BDXL_TL_SIZE;
Closure->logString = g_string_sized_new(1024);
Closure->logLock = g_malloc0(sizeof(GMutex));
......@@ -535,21 +545,6 @@ void LocalizedFileDefaults()
Closure->dDumpPrefix = g_strdup(_("sector-"));
}
/*
* Clear the CRC cache
*/
void ClearCrcCache(void)
{ if(Closure->crcCache)
g_free(Closure->crcCache);
if(Closure->crcImageName)
g_free(Closure->crcImageName);
Closure->crcCache = NULL;
Closure->crcImageName = NULL;
memset(Closure->md5Cache, 0, 16);
}
/*
* Clean up properly
*/
......@@ -575,8 +570,6 @@ void FreeClosure()
if(Closure->guiMode)
update_dotfile();
ClearCrcCache();
cond_free(Closure->cookedVersion);
cond_free(Closure->versionString);
cond_free(Closure->device);
......
......@@ -19,7 +19,9 @@ fi
# Set the package name and version
PACKAGE dvdisaster 0.79.5
PACKAGE dvdisaster 0.79.6
CFG_HAVE_OPTIONS="$CFG_HAVE_OPTIONS -DHAVE_UNSTABLE_RELEASE"
# Check for some essential tools.
......@@ -124,7 +126,6 @@ WITH_OPTION embedded-src-path yes "[yes | no]"
PRINT_MESSAGE "\nDebugging options (do not use in production system):"
WITH_OPTION memdebug no "[no | yes]"
WITH_OPTION efence no "[no | yes]"
if test "$cfg_with_efence" == "yes"; then
if ! CHECK_LIBRARY efence malloc efence; then
......
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2015 Carsten Gnoerlich.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
* CRC32 code based upon public domain code by Ross Williams (see notes below)
*
* Email: carsten@dvdisaster.org -or- cgnoerlich@fsfe.org
......
/* dvdisaster: Additional error correction for optical media.
* Copyright (C) 2004-2015 Carsten Gnoerlich.
* Copyright (C) 2004-2017 Carsten Gnoerlich.
*
* Email: carsten@dvdisaster.org -or- cgnoerlich@fsfe.org
* Project homepage: http://www.dvdisaster.org
......@@ -26,27 +26,133 @@
#include "rs02-includes.h"
/***
*** Create an uninitialized CRC buffer
*** Create a CRC buffer ready for accumulating CRC and MD5 sums
***/
CrcBuf *CreateCrcBuf(guint64 sectors)
{ CrcBuf *cb = g_malloc(sizeof(CrcBuf));
CrcBuf *CreateCrcBuf(Image *image)
{ CrcBuf *cb = g_malloc0(sizeof(CrcBuf));
cb->crcbuf = g_malloc(sectors * sizeof(guint32));
cb->size = sectors;
cb->valid = CreateBitmap0(sectors);
/* MD5 sum related data */
cb->md5Ctxt = g_malloc(sizeof(struct MD5Context));
MD5Init(cb->md5Ctxt);
cb->md5State = MD5_BUILDING;
cb->lastSector = 0;
memset(cb->dataMD5sum, 0, 16);
memset(cb->imageMD5sum, 0, 16);
/* image identification */
if(image->type == IMAGE_FILE)
cb->imageName = g_strdup(image->file->path);
/* For augmented images we need both the pure data size and the full size
in order to compute MD5 sums for both. Depending on what the user wants
to do with the image (create an ecc file or re-augment the image) we'll
need the first or the last version.
There's one catch, though: If the augmented image is accompanied with
an ecc file, we must treat the image as raw data; e.g. do not set
the data size to the portion protected by the augmented ecc.
Otherwise, the CRC sums from the ecc file which do also protect
the augmented ecc part will become unreachable. */
if(image->eccHeader && !image->eccFileHeader) /* augmented image, and no ecc file? */
{ cb->dataSectors = uchar_to_gint64(image->eccHeader->sectors);
if(image->type == IMAGE_FILE)
cb->allSectors = image->sectorSize;
else cb->allSectors = image->dh->sectors;
}
else
{ if(image->type == IMAGE_FILE)
cb->dataSectors = cb->allSectors = image->sectorSize;
else cb->dataSectors = cb->allSectors = image->dh->sectors;
}
/* Note: The following statement is not correct for RS03.
It does not hurt since RS03 will set the correct value when
the CrcBuf is created via RS03GetCrcBuf(), and in all other
cases it does currently not matter. Especially, CRC sums
created during an image read are not used when subsequently
creating new ecc data. */
cb->coveredSectors = cb->dataSectors;
/* Extract the fingerprint */
if(image->fpState == FP_PRESENT)
{ memcpy(cb->mediumFP, image->imageFP, 16);
cb->fpValid = TRUE;
}
cb->fpSector = image->fpSector;
/* CRC sum array */
cb->crcbuf = g_malloc(cb->allSectors * sizeof(guint32));
cb->crcSize = cb->allSectors;
cb->valid = CreateBitmap0(cb->allSectors);
image->crcCache = cb;
return cb;
}
/***
*** Test a 2048 byte block against the checksum in the buffer
***/
/*
* Add a 2048 byte block into the checksum buffer
*/
int AddSectorToCrcBuffer(CrcBuf *cb, int mode, guint64 idx, unsigned char *buf, int buf_size)
{ guint32 crc;
if(idx < 0 || idx >= cb->crcSize)
return CRC_OUTSIDE_BOUND;
/* Update the CRC sums */
if( (mode & CRCBUF_UPDATE_CRC)
|| ((mode & CRCBUF_UPDATE_CRC_AFTER_DATA) && idx >= cb->coveredSectors))
{ crc = Crc32(buf, 2048); /* should be buf_size, but remains at 2048 for backwards compatibility. */
cb->crcbuf[idx] = crc; /* does not harm except that the last sector is padded with the contents */
SetBit(cb->valid, idx); /* of the previous sector when reading an image file whole size is not */
} /* a multiple of 2048 */
/* Update the MD5 sums */
if(!(mode & CRCBUF_UPDATE_MD5))
return CRC_GOOD;
if(cb->lastSector != idx) /* sector out of order -> md5sum dead */
{ cb->md5State = MD5_INVALID;
return CRC_BAD;
}
cb->lastSector++;
if(idx <= cb->allSectors-1)
MD5Update(cb->md5Ctxt, buf, buf_size);
if(idx == cb->dataSectors-1)
{ MD5Context *dataCtxt = alloca(sizeof(MD5Context));
memcpy(dataCtxt, cb->md5Ctxt, sizeof(MD5Context));
MD5Final(cb->dataMD5sum, dataCtxt);
cb->md5State |= MD5_DATA_COMPLETE;
}
if(idx == cb->allSectors-1)
{ MD5Final(cb->imageMD5sum, cb->md5Ctxt);
cb->md5State |= MD5_IMAGE_COMPLETE;
cb->md5State &= ~MD5_BUILDING;
}
return CRC_GOOD;
}
/*
* Test a 2048 byte block against the checksum in the buffer
*/
int CheckAgainstCrcBuffer(CrcBuf *cb, gint64 idx, unsigned char *buf)
{ guint32 crc;
if(idx < 0 || idx >= cb->size)
if(idx < 0 || idx >= cb->crcSize)
return CRC_OUTSIDE_BOUND;
crc = Crc32(buf, 2048);
......@@ -60,6 +166,36 @@ int CheckAgainstCrcBuffer(CrcBuf *cb, gint64 idx, unsigned char *buf)
return CRC_BAD;
}
/*
* Make sure that the current image and ecc file match the
* cached CRC and md5 informaton
*/
int CrcBufValid(CrcBuf *crcbuf, Image *image, EccHeader *eh)
{
if(!crcbuf)
{ Verbose("CrcBufValid: crcbuf==NULL\n");
return FALSE;
}
/* if still in building state we do not have all CRC sums */
if(crcbuf->md5State & MD5_BUILDING)
{ Verbose("CrcBufValid: NO, still building\n");
return FALSE;
}
/* presence of one MD5 sum suffices (data md5sum may not be present
under some circumstances) */
if((!(crcbuf->md5State & MD5_COMPLETE)))
{ Verbose("CrcBufValid: NOT complete\n");
return FALSE;
}