Gave up adapter to old libisofs. Renaming libisoburn and xorriso dirs.
This commit is contained in:
parent
06f9faea54
commit
7229e2949c
@ -1,26 +1,24 @@
|
||||
pkgconfigdir=$(libdir)/pkgconfig
|
||||
libincludedir=$(includedir)/libisoburn
|
||||
|
||||
lib_LTLIBRARIES = src/libisoburn.la
|
||||
lib_LTLIBRARIES = libisoburn/libisoburn.la
|
||||
|
||||
## ========================================================================= ##
|
||||
|
||||
# Build libraries
|
||||
src_libisoburn_la_LDFLAGS = \
|
||||
libisoburn_libisoburn_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
src_libisoburn_la_SOURCES = \
|
||||
src/burn_wrap.c \
|
||||
src/data_source.c \
|
||||
src/isoburn.c \
|
||||
src/isoburn.h \
|
||||
src/isofs_wrap.c \
|
||||
src/libisoburn.h \
|
||||
libisoburn_libisoburn_la_SOURCES = \
|
||||
libisoburn/burn_wrap.c \
|
||||
libisoburn/data_source.c \
|
||||
libisoburn/isoburn.c \
|
||||
libisoburn/isoburn.h \
|
||||
libisoburn/isofs_wrap.c \
|
||||
libisoburn/libisoburn.h \
|
||||
version.h
|
||||
|
||||
## libburn/sg-@ARCH@.c \
|
||||
|
||||
libinclude_HEADERS = \
|
||||
src/libisoburn.h
|
||||
libisoburn/libisoburn.h
|
||||
|
||||
## ========================================================================= ##
|
||||
|
||||
@ -32,7 +30,7 @@ noinst_PROGRAMS =
|
||||
# test/test
|
||||
|
||||
# test_test_CPPFLAGS = -Ilibisofs -Ilibburn -Ilibisoburn
|
||||
# test_test_LDADD = $(src_libisoburn_la_OBJECTS) $(THREAD_LIBS) -lburn -lisofs
|
||||
# test_test_LDADD = $(libisoburn_libisoburn_la_OBJECTS) $(THREAD_LIBS) -lburn -lisofs
|
||||
# test_test_SOURCES = test/test.c
|
||||
|
||||
bin_PROGRAMS =
|
||||
@ -71,7 +69,7 @@ uninstall-local:
|
||||
|
||||
# Indent source files
|
||||
indent_files = \
|
||||
$(src_libisoburn_la_SOURCES)
|
||||
$(libisoburn_libisoburn_la_SOURCES)
|
||||
|
||||
|
||||
indent: $(indent_files)
|
||||
|
@ -29,8 +29,7 @@
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
/* >>> NG */
|
||||
#include <libisofs/nglibisofs.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
|
||||
#else /* ! Xorriso_standalonE */
|
||||
|
@ -12,8 +12,7 @@
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
/* >>> NG */
|
||||
#include <libisofs/nglibisofs.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
|
||||
#else /* ! Xorriso_standalonE */
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
/* >>> NG */
|
||||
#include <libisofs/nglibisofs.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
|
||||
#else /* ! Xorriso_standalonE */
|
||||
|
||||
@ -304,6 +303,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
||||
wopts.file_mode = opts->file_mode;
|
||||
wopts.gid = opts->gid;
|
||||
wopts.uid = opts->uid;
|
||||
wopts.timestamp = 0;
|
||||
wopts.output_charset = opts->output_charset;
|
||||
#ifdef Libisoburn_no_fifO
|
||||
wopts.fifo_size= fifo_chunks;
|
@ -17,8 +17,7 @@
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
|
||||
/* >>> NG */
|
||||
#include <libisofs/nglibisofs.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
|
||||
#else /* ! Xorriso_standalonE */
|
||||
|
@ -1,457 +0,0 @@
|
||||
|
||||
/*
|
||||
cc -g -c \
|
||||
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE \
|
||||
burn_wrap.c
|
||||
*/
|
||||
/* libburn wrappers for libisoburn
|
||||
|
||||
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
*/
|
||||
|
||||
/* <<< A70929 : hardcoded CD-RW with fabricated -msinfo
|
||||
#define Hardcoded_cd_rW 1
|
||||
#define Hardcoded_cd_rw_c1 12999
|
||||
#define Hardcoded_cd_rw_nwA 152660
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
#include "libisoburn.h"
|
||||
#include "isoburn.h"
|
||||
|
||||
|
||||
/* The global list of isoburn objects. Usually there is only one. */
|
||||
extern struct isoburn *isoburn_list_start; /* in isoburn.c */
|
||||
|
||||
|
||||
int isoburn_initialize(void)
|
||||
{
|
||||
if(!iso_init())
|
||||
return(0);
|
||||
if(!burn_initialize())
|
||||
return(0);
|
||||
isoburn_destroy_all(&isoburn_list_start, 0); /* isoburn_list_start= NULL */
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/** Examine the media and sets appropriate emulation if needed.
|
||||
*/
|
||||
static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d,
|
||||
int flag)
|
||||
{
|
||||
int ret, lba, nwa;
|
||||
struct burn_multi_caps *caps= NULL;
|
||||
|
||||
ret= burn_disc_get_multi_caps(d, BURN_WRITE_NONE, &caps, 0);
|
||||
if(ret<0) /* == 0 is read-only media, but it is too early to reject it here */
|
||||
goto ex;
|
||||
ret= isoburn_new(o, 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
(*o)->drive= d;
|
||||
ret= isoburn_create_data_source(*o);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
|
||||
#ifdef Hardcoded_cd_rW
|
||||
/* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
|
||||
caps->start_adr= 0;
|
||||
(*o)->fabricated_disc_status= BURN_DISC_APPENDABLE;
|
||||
#endif
|
||||
|
||||
if(caps->start_adr) { /* set emulation to overwriteable */
|
||||
(*o)->emulation_mode= 1;
|
||||
ret= isoburn_start_emulation(*o, 0);
|
||||
if(ret<=0) {
|
||||
(*o)->emulation_mode= -1;
|
||||
goto ex;
|
||||
}
|
||||
} else {
|
||||
|
||||
/* >>> recognize unsuitable media (but allow read-only media) */;
|
||||
|
||||
#ifdef Hardcoded_cd_rW
|
||||
(*o)->nwa= Hardcoded_cd_rw_nwA;
|
||||
#else
|
||||
ret= burn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa);
|
||||
if(ret>0)
|
||||
(*o)->nwa= nwa;
|
||||
#endif
|
||||
|
||||
}
|
||||
ret= 1;
|
||||
ex:
|
||||
if(caps!=NULL)
|
||||
burn_disc_free_multi_caps(&caps);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
|
||||
char *adr, int load)
|
||||
{
|
||||
int ret, conv_ret, drive_grabbed= 0;
|
||||
char libburn_drive_adr[BURN_DRIVE_ADR_LEN];
|
||||
struct isoburn *o= NULL;
|
||||
char msg[BURN_MSGS_MESSAGE_LEN+4096];
|
||||
|
||||
conv_ret= burn_drive_convert_fs_adr(adr, libburn_drive_adr);
|
||||
if(conv_ret<=0) {
|
||||
sprintf(msg, "Unsuitable drive address: '%s'\n",adr);
|
||||
msg[BURN_MSGS_MESSAGE_LEN-1]= 0;
|
||||
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
|
||||
ret= burn_drive_scan_and_grab(drive_infos, libburn_drive_adr, load);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
drive_grabbed= 1;
|
||||
ret= isoburn_welcome_media(&o, (*drive_infos)[0].drive, 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
|
||||
ret= 1;
|
||||
ex:
|
||||
if(ret<=0) {
|
||||
if(drive_grabbed)
|
||||
burn_drive_release((*drive_infos)[0].drive, 0);
|
||||
isoburn_destroy(&o, 0);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_drive_grab(struct burn_drive *drive, int load)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o= NULL;
|
||||
|
||||
ret= burn_drive_grab(drive, load);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
ret= isoburn_welcome_media(&o, drive, 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
|
||||
ret= 1;
|
||||
ex:
|
||||
if(ret<=0)
|
||||
isoburn_destroy(&o,0);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/** Retrieve media emulation and eventual isoburn emulator of drive.
|
||||
@return -1 unsuitable media, 0 generic media, 1 emulated media.
|
||||
*/
|
||||
int isoburn_find_emulator(struct isoburn **pt,
|
||||
struct burn_drive *drive, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret= isoburn_find_by_drive(pt, drive, 0);
|
||||
if(ret<=0)
|
||||
return(0);
|
||||
if((*pt)->emulation_mode==-1)
|
||||
return(-1);
|
||||
if((*pt)->emulation_mode==0)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, drive, 0);
|
||||
if(ret<0)
|
||||
return(BURN_DISC_UNSUITABLE);
|
||||
if(o!=NULL)
|
||||
if(o->fabricated_disc_status!=BURN_DISC_UNREADY)
|
||||
return(o->fabricated_disc_status);
|
||||
if(ret==0)
|
||||
return(burn_disc_get_status(drive));
|
||||
|
||||
/* emulated status */
|
||||
if(o->emulation_mode==-1)
|
||||
return(BURN_DISC_UNSUITABLE);
|
||||
if(o->nwa>0)
|
||||
return(BURN_DISC_APPENDABLE);
|
||||
return(BURN_DISC_BLANK);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_disc_erasable(struct burn_drive *d)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret>0)
|
||||
if(o->emulation_mode==1)
|
||||
return(1);
|
||||
return burn_disc_erasable(d);
|
||||
}
|
||||
|
||||
|
||||
void isoburn_disc_erase(struct burn_drive *drive, int fast)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, drive, 0);
|
||||
if(ret>0) {
|
||||
if(o->emulation_mode==-1) {
|
||||
/* To cause a negative reply with burn_drive_wrote_well() */
|
||||
burn_drive_cancel(drive);
|
||||
return;
|
||||
}
|
||||
if(o->emulation_mode>0) {
|
||||
ret= isoburn_invalidate_iso(o, 0);
|
||||
if(ret<=0)
|
||||
burn_drive_cancel(drive);
|
||||
return;
|
||||
}
|
||||
}
|
||||
burn_disc_erase(drive, fast);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
#ifdef Hardcoded_cd_rW
|
||||
/* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
|
||||
*start_lba= Hardcoded_cd_rw_c1;
|
||||
return(1);
|
||||
#endif
|
||||
|
||||
if(isoburn_disc_get_status(d)!=BURN_DISC_APPENDABLE &&
|
||||
isoburn_disc_get_status(d)!=BURN_DISC_FULL)
|
||||
return(0);
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
return(0);
|
||||
if(ret>0) if(o->emulation_mode>0) {
|
||||
*start_lba= 0;
|
||||
return(1);
|
||||
}
|
||||
return(burn_disc_get_msc1(d, start_lba));
|
||||
}
|
||||
|
||||
|
||||
int isoburn_disc_track_lba_nwa(struct burn_drive *d,
|
||||
struct burn_write_opts *opts,
|
||||
int trackno, int *lba, int *nwa)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
#ifdef Hardcoded_cd_rW
|
||||
/* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
|
||||
*lba= Hardcoded_cd_rw_c1;
|
||||
*nwa= Hardcoded_cd_rw_nwA;
|
||||
return(1);
|
||||
#endif
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
return(0);
|
||||
if(ret>0) if(o->emulation_mode>0) {
|
||||
*lba= 0;
|
||||
*nwa= o->nwa;
|
||||
return(1);
|
||||
}
|
||||
return(burn_disc_track_lba_nwa(d, opts, trackno, lba, nwa));
|
||||
}
|
||||
|
||||
|
||||
void isoburn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
struct burn_drive *drive;
|
||||
char reasons[BURN_REASONS_LEN],msg[160+BURN_REASONS_LEN];
|
||||
enum burn_write_types write_type;
|
||||
|
||||
drive= burn_write_opts_get_drive(opts);
|
||||
ret= isoburn_find_emulator(&o, drive, 0);
|
||||
if(ret<0)
|
||||
return;
|
||||
if(o!=NULL) {
|
||||
o->wrote_well= -1;
|
||||
if(o->emulation_mode!=0) {
|
||||
burn_write_opts_set_multi(opts, 0);
|
||||
if(o->emulation_mode>0 && o->nwa >= 0)
|
||||
burn_write_opts_set_start_byte(opts, ((off_t) o->nwa) * (off_t) 2048);
|
||||
}
|
||||
}
|
||||
|
||||
write_type= burn_write_opts_auto_write_type(opts, disc, reasons, 0);
|
||||
if (write_type == BURN_WRITE_NONE) {
|
||||
sprintf(msg, "Failed to find a suitable write mode:\n%s", reasons);
|
||||
burn_msgs_submit(0, msg, 0, "SORRY", NULL);
|
||||
if(o!=NULL)
|
||||
o->wrote_well= 0;
|
||||
/* To cause a negative reply with burn_drive_wrote_well() */
|
||||
burn_drive_cancel(drive);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
sprintf(reasons, "%d", (int) write_type);
|
||||
fprintf(stderr, "isoburn_EXPERIMENTAL: write_type = %s\n",
|
||||
(write_type == BURN_WRITE_SAO ? "SAO" :
|
||||
(write_type == BURN_WRITE_TAO ? "TAO" : reasons)));
|
||||
*/
|
||||
|
||||
#ifdef Hardcoded_cd_rW
|
||||
/* <<< A70929 : hardcoded CD-RW with fabricated -msinfo */
|
||||
fprintf(stderr, "Setting write address to LBA %d\n", Hardcoded_cd_rw_nwA);
|
||||
burn_write_opts_set_start_byte(opts,
|
||||
((off_t) Hardcoded_cd_rw_nwA) * (off_t) 2048);
|
||||
#endif
|
||||
|
||||
burn_disc_write(opts, disc);
|
||||
}
|
||||
|
||||
|
||||
void isoburn_drive_release(struct burn_drive *drive, int eject)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, drive, 0);
|
||||
if(ret<0)
|
||||
return;
|
||||
if(o!=NULL) {
|
||||
isoburn_free_data_source(o);
|
||||
isoburn_destroy(&o, 0);
|
||||
}
|
||||
burn_drive_release(drive, eject);
|
||||
}
|
||||
|
||||
|
||||
void isoburn_finish(void)
|
||||
{
|
||||
isoburn_destroy_all(&isoburn_list_start, 0);
|
||||
burn_finish();
|
||||
iso_finish();
|
||||
}
|
||||
|
||||
|
||||
int isoburn_needs_emulation(struct burn_drive *drive)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
enum burn_disc_status s;
|
||||
|
||||
s= isoburn_disc_get_status(drive);
|
||||
if(s!=BURN_DISC_BLANK && s!=BURN_DISC_APPENDABLE)
|
||||
return(-1);
|
||||
ret= isoburn_find_emulator(&o, drive, 0);
|
||||
if(ret<0)
|
||||
return(-1);
|
||||
if(ret>0)
|
||||
if(o->emulation_mode>0)
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag)
|
||||
{
|
||||
int ret;
|
||||
struct burn_drive *drive = o->drive;
|
||||
struct burn_multi_caps *caps= NULL;
|
||||
|
||||
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
if(!caps->start_adr)
|
||||
{ret= 0; goto ex;}
|
||||
o->min_start_byte= value;
|
||||
if(value % caps->start_alignment)
|
||||
value+= caps->start_alignment - (value % caps->start_alignment);
|
||||
o->nwa= value/2048;
|
||||
/* If suitable for alignment, round up to full 16 sector addresses */
|
||||
if((o->nwa%16) && ((16*2048) % caps->start_alignment)==0 )
|
||||
o->nwa+= 16 - (o->nwa%16);
|
||||
ret= 1;
|
||||
ex:
|
||||
if(caps!=NULL)
|
||||
burn_disc_free_multi_caps(&caps);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
|
||||
int flag)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
return(-1);
|
||||
if(ret==0)
|
||||
return(0);
|
||||
*start_byte= o->min_start_byte;
|
||||
if(o->min_start_byte<=0)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_drive_wrote_well(struct burn_drive *d)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
return(-1);
|
||||
if(o!=NULL)
|
||||
if(o->wrote_well>=0)
|
||||
return(o->wrote_well);
|
||||
ret= burn_drive_wrote_well(d);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes,
|
||||
char **status_text)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
return(-1);
|
||||
if(o==NULL)
|
||||
return(0);
|
||||
if(o->fifo==NULL)
|
||||
return(0);
|
||||
ret= burn_fifo_inquire_status(o->fifo, size, free_bytes, status_text);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
data source for libisoburn.
|
||||
|
||||
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
#include "isoburn.h"
|
||||
|
||||
struct disc_data_src {
|
||||
struct burn_drive *d;
|
||||
int nblocks;
|
||||
};
|
||||
|
||||
static int
|
||||
ds_read_block(struct data_source *src, int lba, unsigned char *buffer)
|
||||
{
|
||||
int ret;
|
||||
struct disc_data_src *data;
|
||||
off_t count;
|
||||
|
||||
assert(src && buffer);
|
||||
|
||||
data = (struct disc_data_src*)src->data;
|
||||
|
||||
/* if (lba >= data->nblocks)
|
||||
* return BLOCK_OUT_OF_FILE;
|
||||
*/
|
||||
|
||||
ret = burn_read_data(data->d, (off_t) lba * (off_t) 2048, (char *) buffer,
|
||||
2048, &count, 0);
|
||||
if (ret <= 0 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ds_get_size(struct data_source *src)
|
||||
{
|
||||
struct disc_data_src *data;
|
||||
|
||||
assert(src);
|
||||
|
||||
data = (struct disc_data_src*)src->data;
|
||||
return data->nblocks;
|
||||
}
|
||||
|
||||
static void
|
||||
ds_free_data(struct data_source *src)
|
||||
{
|
||||
free(src->data);
|
||||
}
|
||||
|
||||
struct data_source *
|
||||
isoburn_data_source_new(struct burn_drive *d)
|
||||
{
|
||||
struct disc_data_src *data;
|
||||
struct data_source *ret;
|
||||
|
||||
assert(d);
|
||||
|
||||
data = malloc(sizeof(struct disc_data_src));
|
||||
if (!data)
|
||||
return NULL;
|
||||
data->d = d;
|
||||
|
||||
/* TODO should be filled with the size of disc (or track?) */
|
||||
data->nblocks = 0;
|
||||
|
||||
ret = malloc(sizeof(struct data_source));
|
||||
if (!ret) {
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
ret->refcount = 1;
|
||||
ret->read_block = ds_read_block;
|
||||
ret->get_size = ds_get_size;
|
||||
ret->free_data = ds_free_data;
|
||||
ret->data = data;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,335 +0,0 @@
|
||||
|
||||
/*
|
||||
cc -g -c isoburn.c
|
||||
*/
|
||||
|
||||
/*
|
||||
Class core of libisoburn.
|
||||
|
||||
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
and Thomas Schmitt <scdbackup@gmx.net>
|
||||
*/
|
||||
|
||||
/* ( derived from stub generated by CgeN on Sat, 01 Sep 2007 12:04:36 GMT ) */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
#include "libisoburn.h"
|
||||
#include "isoburn.h"
|
||||
|
||||
|
||||
|
||||
/* -------------------------- isoburn ----------------------- */
|
||||
|
||||
|
||||
/* The global list of isoburn objects. Usually there is only one.
|
||||
>>> we are not ready for multiple control threads yet. See >>> mutex .
|
||||
Multiple burns under one control thread should work.
|
||||
*/
|
||||
struct isoburn *isoburn_list_start= NULL;
|
||||
|
||||
|
||||
int isoburn_new(struct isoburn **objpt, int flag)
|
||||
{
|
||||
struct isoburn *o;
|
||||
int i;
|
||||
|
||||
*objpt= o= (struct isoburn *) malloc(sizeof(struct isoburn));
|
||||
if(o==NULL)
|
||||
return(-1);
|
||||
|
||||
o->drive= NULL;
|
||||
o->emulation_mode= 0;
|
||||
o->min_start_byte= 0;
|
||||
o->nwa= 0;
|
||||
o->fifo= NULL;
|
||||
o->wrote_well= -1;
|
||||
o->src= NULL;
|
||||
o->fabricated_disc_status= BURN_DISC_UNREADY;
|
||||
for(i=0;i<65536;i++)
|
||||
o->target_iso_head[i]= 0;
|
||||
o->target_volset= NULL;
|
||||
o->prev= NULL;
|
||||
o->next= NULL;
|
||||
|
||||
isoburn_link(o, isoburn_list_start, 1);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_destroy(struct isoburn **objpt, int flag)
|
||||
{
|
||||
struct isoburn *o;
|
||||
|
||||
o= *objpt;
|
||||
if(o==NULL)
|
||||
return(0);
|
||||
|
||||
/* >>> mutex */
|
||||
|
||||
if(o==isoburn_list_start)
|
||||
isoburn_list_start= o->next;
|
||||
if(o->prev!=NULL)
|
||||
o->prev->next= o->next;
|
||||
if(o->next!=NULL)
|
||||
o->next->prev= o->prev;
|
||||
|
||||
/* >>> end mutex */
|
||||
|
||||
if(o->target_volset!=NULL)
|
||||
iso_volset_free(o->target_volset);
|
||||
if(o->fifo!=NULL)
|
||||
burn_source_free(o->fifo);
|
||||
|
||||
free((char *) o);
|
||||
*objpt= NULL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_destroy_all(struct isoburn **objpt, int flag)
|
||||
{
|
||||
struct isoburn *o,*n;
|
||||
|
||||
o= *objpt;
|
||||
if(o==NULL)
|
||||
return(0);
|
||||
for(;o->prev!=NULL;o= o->prev);
|
||||
for(;o!=NULL;o= n) {
|
||||
n= o->next;
|
||||
isoburn_destroy(&o,0);
|
||||
}
|
||||
*objpt= NULL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_emulation_mode(struct isoburn *o, int *pt, int flag)
|
||||
{
|
||||
*pt= o->emulation_mode;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_target_volset(struct isoburn *o, struct iso_volset **pt,
|
||||
int flag)
|
||||
{
|
||||
*pt= o->target_volset;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_prev(struct isoburn *o, struct isoburn **pt, int flag)
|
||||
{
|
||||
*pt= o->prev;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_next(struct isoburn *o, struct isoburn **pt, int flag)
|
||||
{
|
||||
*pt= o->next;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_link(struct isoburn *o, struct isoburn *link, int flag)
|
||||
/*
|
||||
bit0= insert as link->prev rather than as link->next
|
||||
*/
|
||||
{
|
||||
|
||||
/* >>> mutex */
|
||||
|
||||
if(isoburn_list_start==NULL ||
|
||||
(isoburn_list_start==link && (flag&1)))
|
||||
isoburn_list_start= o;
|
||||
if(o->prev!=NULL)
|
||||
o->prev->next= o->next;
|
||||
if(o->next!=NULL)
|
||||
o->next->prev= o->prev;
|
||||
o->prev= o->next= NULL;
|
||||
if(link==NULL)
|
||||
return(1);
|
||||
if(flag&1) {
|
||||
o->next= link;
|
||||
o->prev= link->prev;
|
||||
if(o->prev!=NULL)
|
||||
o->prev->next= o;
|
||||
link->prev= o;
|
||||
} else {
|
||||
o->prev= link;
|
||||
o->next= link->next;
|
||||
if(o->next!=NULL)
|
||||
o->next->prev= o;
|
||||
link->next= o;
|
||||
}
|
||||
|
||||
/* >>> end mutex */
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_count(struct isoburn *o, int flag)
|
||||
/* flag: bit1= count from start of list */
|
||||
{
|
||||
int counter= 0;
|
||||
|
||||
if(flag&2)
|
||||
for(;o->prev!=NULL;o= o->prev);
|
||||
for(;o!=NULL;o= o->next)
|
||||
counter++;
|
||||
return(counter);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_by_idx(struct isoburn *o, int idx, struct isoburn **pt, int flag)
|
||||
/* flag: bit0= fetch first (idx<0) or last (idx>0) item in list
|
||||
bit1= address from start of list */
|
||||
{
|
||||
int i,abs_idx;
|
||||
struct isoburn *npt;
|
||||
|
||||
if(flag&2)
|
||||
for(;o->prev!=NULL;o= o->prev);
|
||||
abs_idx= (idx>0?idx:-idx);
|
||||
*pt= o;
|
||||
for(i= 0;(i<abs_idx || (flag&1)) && *pt!=NULL;i++) {
|
||||
if(idx>0)
|
||||
npt= o->next;
|
||||
else
|
||||
npt= o->prev;
|
||||
if(npt==NULL && (flag&1))
|
||||
break;
|
||||
*pt= npt;
|
||||
}
|
||||
return(*pt!=NULL);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag)
|
||||
{
|
||||
struct isoburn *o;
|
||||
|
||||
*pt= NULL;
|
||||
for(o= isoburn_list_start;o!=NULL;o= o->next)
|
||||
if(o->drive==d) {
|
||||
*pt= o;
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static
|
||||
int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
||||
struct isoburn_source_opts *opts, int new_img)
|
||||
{
|
||||
struct burn_source *wsrc;
|
||||
struct burn_session *session;
|
||||
struct burn_track *track;
|
||||
struct isoburn *o;
|
||||
struct ecma119_source_opts wopts;
|
||||
enum burn_disc_status state;
|
||||
int ret, chunks;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0 || o==NULL)
|
||||
return -1;
|
||||
o->wrote_well= 0; /* early end will be registered as failure */
|
||||
|
||||
|
||||
state = isoburn_disc_get_status(d);
|
||||
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE
|
||||
&& (state != BURN_DISC_FULL || ! new_img)) {
|
||||
/* unsuitable status */
|
||||
return -2;
|
||||
}
|
||||
|
||||
wopts.volnum = 0;
|
||||
wopts.level = opts->level;
|
||||
wopts.flags = opts->flags;
|
||||
wopts.relaxed_constraints = opts->relaxed_constraints;
|
||||
wopts.copy_eltorito = opts->copy_eltorito;
|
||||
wopts.no_cache_inodes = opts->no_cache_inodes;
|
||||
wopts.sort_files = opts->sort_files;
|
||||
wopts.default_mode = opts->default_mode;
|
||||
wopts.replace_dir_mode = opts->replace_dir_mode;
|
||||
wopts.replace_file_mode = opts->replace_file_mode;
|
||||
wopts.replace_uid = opts->replace_uid;
|
||||
wopts.replace_gid = opts->replace_gid;
|
||||
wopts.dir_mode = opts->dir_mode;
|
||||
wopts.file_mode = opts->file_mode;
|
||||
wopts.gid = opts->gid;
|
||||
wopts.uid = opts->uid;
|
||||
wopts.input_charset = opts->input_charset;
|
||||
wopts.ouput_charset = opts->ouput_charset;
|
||||
|
||||
if (new_img) {
|
||||
wopts.ms_block = 0;
|
||||
} else {
|
||||
int lba, nwa;
|
||||
ret = isoburn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa);
|
||||
if (ret != 1)
|
||||
return -3;
|
||||
if (nwa == 0 && state == BURN_DISC_APPENDABLE) {
|
||||
/* invalid nwa */
|
||||
return -4;
|
||||
}
|
||||
|
||||
wopts.ms_block = nwa;
|
||||
}
|
||||
|
||||
wopts.src = o->src;
|
||||
wopts.overwrite = (new_img ? NULL : o->target_iso_head);
|
||||
wsrc = iso_source_new_ecma119(o->target_volset, &wopts);
|
||||
if (wsrc == NULL)
|
||||
return -1;
|
||||
|
||||
/* TODO check return values for failure. propertly clean-up on error */
|
||||
|
||||
chunks= 32;
|
||||
if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){
|
||||
chunks= opts->fifo_size/2048;
|
||||
if(chunks*2048 < opts->fifo_size)
|
||||
chunks++;
|
||||
}
|
||||
o->fifo = burn_fifo_source_new(wsrc, 2048, chunks, 0);
|
||||
burn_source_free(wsrc);
|
||||
if (o->fifo == NULL) {
|
||||
fprintf(stderr, "Cannot attach fifo\n");
|
||||
return -1;
|
||||
}
|
||||
*disc = burn_disc_create();
|
||||
session = burn_session_create();
|
||||
burn_disc_add_session(*disc, session, BURN_POS_END);
|
||||
track = burn_track_create();
|
||||
burn_track_set_source(track, o->fifo);
|
||||
burn_session_add_track(session, track, BURN_POS_END);
|
||||
|
||||
/* give up local references */
|
||||
burn_track_free(track);
|
||||
burn_session_free(session);
|
||||
|
||||
o->wrote_well= -1; /* neutral */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc,
|
||||
struct isoburn_source_opts *opts)
|
||||
{
|
||||
return isoburn_prepare_disc_aux(d, disc, opts, 0);
|
||||
}
|
||||
|
||||
int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc,
|
||||
struct isoburn_source_opts *opts)
|
||||
{
|
||||
return isoburn_prepare_disc_aux(d, disc, opts, 1);
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
|
||||
/*
|
||||
Class struct of libisoburn.
|
||||
|
||||
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
and Thomas Schmitt <scdbackup@gmx.net>
|
||||
*/
|
||||
|
||||
#ifndef Isoburn_includeD
|
||||
#define Isoburn_includeD
|
||||
|
||||
|
||||
|
||||
/* for uint8_t */
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
struct isoburn {
|
||||
|
||||
|
||||
/* The libburn drive to which this isoburn object is related
|
||||
Most isoburn calls will use a burn_drive as object handle */
|
||||
struct burn_drive *drive;
|
||||
|
||||
/* -1= inappropriate media state detected
|
||||
0= libburn multi-session media, resp. undecided yet
|
||||
1= random access media */
|
||||
int emulation_mode;
|
||||
|
||||
/* Although rarely used, libburn can operate on several
|
||||
drives simultaneously. */
|
||||
struct isoburn *prev;
|
||||
struct isoburn *next;
|
||||
|
||||
|
||||
/* --- My part --- */
|
||||
|
||||
/* Start address as given by image examination (bytes, not blocks) */
|
||||
off_t min_start_byte;
|
||||
|
||||
/* Aligned start address to be used for processing (counted in blocks) */
|
||||
int nwa;
|
||||
|
||||
/* Eventual freely fabricated isoburn_disc_get_status().
|
||||
BURN_DISC_UNREADY means that normally emulated status is in effect.
|
||||
*/
|
||||
enum burn_disc_status fabricated_disc_status;
|
||||
|
||||
/* The fifo which is installed between track and libisofs burn_source
|
||||
*/
|
||||
struct burn_source *fifo;
|
||||
|
||||
/* Indicator wether the most recent burn run worked :
|
||||
-1 = undetermined, ask libburn , 0 = failure , 1 = success
|
||||
To be inquired by isoburn_drive_wrote_well()
|
||||
*/
|
||||
int wrote_well;
|
||||
|
||||
|
||||
/* --- Vreixo's part --- */
|
||||
|
||||
/* The data source for reading the old image */
|
||||
struct data_source *src;
|
||||
|
||||
/* Buffered ISO head from media (should that become part of
|
||||
ecma119_read_opts ?) */
|
||||
uint8_t target_iso_head[65536];
|
||||
|
||||
/* The filesystem structure of the old image from media. */
|
||||
struct iso_volset *target_volset;
|
||||
};
|
||||
|
||||
|
||||
/* Creation and disposal function */
|
||||
int isoburn_new(struct isoburn **objpt, int flag);
|
||||
int isoburn_destroy(struct isoburn **objpt, int flag);
|
||||
|
||||
/* Eventual readers for public attributes */
|
||||
/* ( put into separate .h file then ) */
|
||||
int isoburn_get_emulation_mode(struct isoburn *o, int *pt, int flag);
|
||||
int isoburn_get_target_volset(struct isoburn *o, struct iso_volset **pt,
|
||||
int flag);
|
||||
/* List management */
|
||||
int isoburn_get_prev(struct isoburn *o, struct isoburn **pt, int flag);
|
||||
int isoburn_get_next(struct isoburn *o, struct isoburn **pt, int flag);
|
||||
int isoburn_destroy_all(struct isoburn **objpt, int flag);
|
||||
int isoburn_link(struct isoburn *o, struct isoburn *link, int flag);
|
||||
int isoburn_count(struct isoburn *o, int flag);
|
||||
int isoburn_by_idx(struct isoburn *o, int idx, struct isoburn **pt, int flag);
|
||||
int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag);
|
||||
|
||||
|
||||
/* Non API inner interfaces */
|
||||
|
||||
/* Calls from burn_wrap.c into isofs_wrap.c */
|
||||
|
||||
int isoburn_start_emulation(struct isoburn *o, int flag);
|
||||
int isoburn_create_data_source(struct isoburn *o);
|
||||
int isoburn_free_data_source(struct isoburn *o);
|
||||
int isoburn_invalidate_iso(struct isoburn *o, int flag);
|
||||
|
||||
|
||||
/* Calls from isofs_wrap.c into burn_wrap.c */
|
||||
|
||||
/** Get an eventual isoburn object which is wrapped around the drive.
|
||||
@param pt Eventually returns a pointer to the found object.
|
||||
It is allowed to become NULL if return value is -1 or 0.
|
||||
In this case, the drive is a genuine libburn drive
|
||||
with no emulation activated by isoburn.
|
||||
@param drive The drive to be searched for
|
||||
@param flag unused yet
|
||||
@return -1 unsuitable media, 0 generic media, 1 emulated media.
|
||||
*/
|
||||
int isoburn_find_emulator(struct isoburn **pt,
|
||||
struct burn_drive *drive, int flag);
|
||||
|
||||
|
||||
/** Set the start address for an emulated add-on session. The value will
|
||||
be rounded up to the alignment necessary for the media. The aligned
|
||||
value will be divided by 2048 and then put into o->nwa .
|
||||
@param o The isoburn object to be programmed.
|
||||
@param value The start address in bytes
|
||||
@param flag unused yet
|
||||
@return <=0 is failure , >0 success
|
||||
*/
|
||||
int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag);
|
||||
|
||||
/** Get a data source suitable for read from a drive using burn_read_data()
|
||||
function.
|
||||
@param d drive to read from. Must be grabbed.
|
||||
@return the data source, NULL on error. Must be freed with libisofs
|
||||
data_source_free() function. Note that that doesn't release the
|
||||
drive.
|
||||
*/
|
||||
struct data_source *
|
||||
isoburn_data_source_new(struct burn_drive *d);
|
||||
|
||||
#endif /* Isoburn_includeD */
|
||||
|
@ -1,319 +0,0 @@
|
||||
|
||||
/*
|
||||
cc -g -c isofs_wrap.c
|
||||
*/
|
||||
|
||||
/*
|
||||
libisofs related functions of libisoburn.
|
||||
|
||||
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
Thomas Schmitt <scdbackup@gmx.net>
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libburn/libburn.h>
|
||||
#include <libisofs/libisofs.h>
|
||||
#include "isoburn.h"
|
||||
#include "libisoburn.h"
|
||||
|
||||
#define BP(a,b) [(b) - (a) + 1]
|
||||
|
||||
struct ecma119_pri_vol_desc
|
||||
{
|
||||
uint8_t vol_desc_type BP(1, 1);
|
||||
uint8_t std_identifier BP(2, 6);
|
||||
uint8_t vol_desc_version BP(7, 7);
|
||||
uint8_t unused1 BP(8, 8);
|
||||
uint8_t system_id BP(9, 40);
|
||||
uint8_t volume_id BP(41, 72);
|
||||
uint8_t unused2 BP(73, 80);
|
||||
uint8_t vol_space_size BP(81, 88);
|
||||
uint8_t unused3 BP(89, 120);
|
||||
uint8_t vol_set_size BP(121, 124);
|
||||
uint8_t vol_seq_number BP(125, 128);
|
||||
uint8_t block_size BP(129, 132);
|
||||
uint8_t path_table_size BP(133, 140);
|
||||
uint8_t l_path_table_pos BP(141, 144);
|
||||
uint8_t opt_l_path_table_pos BP(145, 148);
|
||||
uint8_t m_path_table_pos BP(149, 152);
|
||||
uint8_t opt_m_path_table_pos BP(153, 156);
|
||||
uint8_t root_dir_record BP(157, 190);
|
||||
uint8_t vol_set_id BP(191, 318);
|
||||
uint8_t publisher_id BP(319, 446);
|
||||
uint8_t data_prep_id BP(447, 574);
|
||||
uint8_t application_id BP(575, 702);
|
||||
uint8_t copyright_file_id BP(703, 739);
|
||||
uint8_t abstract_file_id BP(740, 776);
|
||||
uint8_t bibliographic_file_id BP(777, 813);
|
||||
uint8_t vol_creation_time BP(814, 830);
|
||||
uint8_t vol_modification_time BP(831, 847);
|
||||
uint8_t vol_expiration_time BP(848, 864);
|
||||
uint8_t vol_effective_time BP(865, 881);
|
||||
uint8_t file_structure_version BP(882, 882);
|
||||
uint8_t reserved1 BP(883, 883);
|
||||
uint8_t app_use BP(884, 1395);
|
||||
uint8_t reserved2 BP(1396, 2048);
|
||||
};
|
||||
|
||||
static
|
||||
uint32_t iso_read_lsb(const uint8_t *buf, int bytes)
|
||||
{
|
||||
int i;
|
||||
uint32_t ret = 0;
|
||||
|
||||
for (i=0; i<bytes; i++) {
|
||||
ret += ((uint32_t) buf[i]) << (i*8);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* API function. See libisoburn.h
|
||||
*/
|
||||
int isoburn_read_volset(struct burn_drive *d,
|
||||
struct isoburn_read_opts *read_opts,
|
||||
struct iso_volset **volset)
|
||||
{
|
||||
int ret;
|
||||
struct ecma119_read_opts ropts;
|
||||
enum burn_disc_status status= BURN_DISC_BLANK;
|
||||
struct isoburn *o= NULL;
|
||||
|
||||
if(read_opts==NULL || volset==NULL) {
|
||||
|
||||
/* >>> program error */;
|
||||
|
||||
return(-1);
|
||||
}
|
||||
if(d != NULL) {
|
||||
ret = isoburn_find_emulator(&o, d, 0);
|
||||
if (ret < 0)
|
||||
return 0;
|
||||
|
||||
if (o == NULL) {
|
||||
return -1;
|
||||
}
|
||||
status = isoburn_disc_get_status(d);
|
||||
if(o->target_volset != NULL)
|
||||
iso_volset_free(o->target_volset);
|
||||
o->target_volset= NULL;
|
||||
}
|
||||
if (d == NULL || status == BURN_DISC_BLANK || read_opts->pretend_blank) {
|
||||
struct iso_volume *volume;
|
||||
struct iso_tree_node_dir *root;
|
||||
|
||||
/*
|
||||
* Blank disc, we create a new volset without files.
|
||||
*/
|
||||
|
||||
root = iso_tree_new_root();
|
||||
if (!root)
|
||||
return -1;
|
||||
|
||||
volume = iso_volume_new_with_root("NEW DISC", "", "LIBISOBURN", root);
|
||||
if (!volume)
|
||||
return -1;
|
||||
|
||||
*volset = iso_volset_new(volume, "NEW VOLSET");
|
||||
if (!*volset)
|
||||
return -1;
|
||||
|
||||
if(o!=NULL) {
|
||||
o->target_volset = *volset;
|
||||
iso_volset_ref(o->target_volset); /*protects object from premature free*/
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (status != BURN_DISC_APPENDABLE && status != BURN_DISC_FULL) {
|
||||
/* incorrect disc status */
|
||||
return -4;
|
||||
}
|
||||
|
||||
ret = isoburn_disc_get_msc1(d, (int*) &ropts.block);
|
||||
if (ret < 0)
|
||||
return -2;
|
||||
|
||||
ropts.norock = read_opts->norock;
|
||||
ropts.nojoliet = read_opts->nojoliet;
|
||||
ropts.preferjoliet = read_opts->preferjoliet;
|
||||
ropts.mode = read_opts->mode;
|
||||
ropts.uid = read_opts->uid;
|
||||
ropts.gid = read_opts->gid;
|
||||
|
||||
assert(o->src);
|
||||
*volset = iso_volset_read(o->src, &ropts);
|
||||
|
||||
if (!(*volset))
|
||||
return -3;
|
||||
|
||||
o->target_volset = *volset;
|
||||
iso_volset_ref(o->target_volset); /* protects object from premature free */
|
||||
|
||||
read_opts->hasRR = ropts.hasRR;
|
||||
read_opts->hasJoliet = ropts.hasJoliet;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* API function. See libisoburn.h
|
||||
*/
|
||||
int isoburn_attach_volset(struct burn_drive *d, struct iso_volset *volset)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
if (volset == NULL)
|
||||
return -1;
|
||||
ret = isoburn_find_emulator(&o, d, 0);
|
||||
if (ret < 0)
|
||||
return 0;
|
||||
if (o == NULL)
|
||||
return -1;
|
||||
if(o->target_volset != NULL)
|
||||
iso_volset_free(o->target_volset);
|
||||
o->target_volset = volset;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* API function. See libisoburn.h
|
||||
*/
|
||||
int isoburn_activate_session(struct burn_drive *drive)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret = isoburn_find_emulator(&o, drive, 0);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
if (o->emulation_mode != 1)
|
||||
return 1; /* don't need to activate session */
|
||||
|
||||
if (o->fabricated_disc_status != BURN_DISC_APPENDABLE)
|
||||
return 1;
|
||||
|
||||
ret = burn_random_access_write(drive, 0, (char*)o->target_iso_head,
|
||||
32*2048, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/** Create a new data source suitable for reading from the given drive.
|
||||
@param o A freshly created isoburn object, without any data_source
|
||||
(src field == NULL), but with the drive field set.
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_create_data_source(struct isoburn *o)
|
||||
{
|
||||
|
||||
/* create and initialize the data source */
|
||||
o->src = isoburn_data_source_new(o->drive);
|
||||
return (o->src ? 1 : -1);
|
||||
}
|
||||
|
||||
|
||||
/** Dispose the data source created by isoburn_create_data_source().
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_free_data_source(struct isoburn *o)
|
||||
{
|
||||
if (o->src)
|
||||
data_source_free(o->src);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/** Initialize the emulation of multi-session on random access media.
|
||||
The need for emulation is confirmed already.
|
||||
@param o A freshly created isoburn object. isoburn_create_data_source() was
|
||||
already called, nevertheless.
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_start_emulation(struct isoburn *o, int flag)
|
||||
{
|
||||
int ret, i;
|
||||
off_t data_count;
|
||||
struct burn_drive *drive;
|
||||
struct ecma119_pri_vol_desc *pvm;
|
||||
|
||||
assert(o);
|
||||
|
||||
drive= o->drive;
|
||||
|
||||
/* we can assume 0 as start block for image */
|
||||
/* TODO what about ms? where we validate valid iso image in ms disc? */
|
||||
ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head,
|
||||
sizeof(o->target_iso_head), &data_count, 1);
|
||||
|
||||
/* an error means an empty disc */
|
||||
if (ret <= 0) {
|
||||
o->fabricated_disc_status= BURN_DISC_BLANK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* check first 64K. If 0's, the disc is treated as a blank disc, and thus
|
||||
overwritten without extra check. */
|
||||
i = sizeof(o->target_iso_head);
|
||||
while (i && !o->target_iso_head[i-1])
|
||||
--i;
|
||||
|
||||
if (!i) {
|
||||
o->fabricated_disc_status= BURN_DISC_BLANK;
|
||||
return 1;
|
||||
}
|
||||
|
||||
pvm = (struct ecma119_pri_vol_desc *)(o->target_iso_head + 16 * 2048);
|
||||
|
||||
if (!strncmp((char*)pvm->std_identifier, "CD001", 5)) {
|
||||
off_t size;
|
||||
|
||||
/* sanity check */
|
||||
if (pvm->vol_desc_type[0] != 1 || pvm->vol_desc_version[0] != 1
|
||||
|| pvm->file_structure_version[0] != 1 ) {
|
||||
/* TODO for now I treat this as a full disc */
|
||||
o->fabricated_disc_status= BURN_DISC_FULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ok, PVM found, set size */
|
||||
size = (off_t) iso_read_lsb(pvm->vol_space_size, 4);
|
||||
size *= (off_t) 2048; /* block size in bytes */
|
||||
isoburn_set_start_byte(o, size, 0);
|
||||
o->fabricated_disc_status= BURN_DISC_APPENDABLE;
|
||||
} else if (!strncmp((char*)pvm->std_identifier, "CDXX1", 5)) {
|
||||
|
||||
/* empty image */
|
||||
isoburn_set_start_byte(o, (off_t) 0, 0);
|
||||
o->fabricated_disc_status= BURN_DISC_BLANK;
|
||||
} else {
|
||||
/* treat any disc in an unknown format as full */
|
||||
o->fabricated_disc_status= BURN_DISC_FULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/** Alters and writes the first 64 kB of a "media" to invalidate
|
||||
an ISO image. (It shall stay restorable by skilled humans, though).
|
||||
The result shall especially keep libisoburn from accepting the media
|
||||
image as ISO filesystem.
|
||||
@param o A fully activated isoburn object. isoburn_start_emulation()
|
||||
was already called.
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_invalidate_iso(struct isoburn *o, int flag)
|
||||
{
|
||||
/*
|
||||
* replace CD001 with CDXX1 in PVM.
|
||||
* I think this is enought for invalidating an iso image
|
||||
*/
|
||||
strncpy((char*)o->target_iso_head + 16 * 2048 + 1, "CDXX1", 5);
|
||||
return isoburn_activate_session(o->drive);
|
||||
}
|
||||
|
@ -1,378 +0,0 @@
|
||||
|
||||
/*
|
||||
API definition of libisoburn.
|
||||
|
||||
Copyright 2007 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
|
||||
and Thomas Schmitt <scdbackup@gmx.net>
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
libisoburn is a frontend for libraries libburn and libisofs which enables
|
||||
creation and expansion of ISO-9660 filesystems on all CD/DVD media supported
|
||||
by libburn. This includes media like DVD+RW, which do not support multi-session
|
||||
management on media level and even plain disk files or block devices.
|
||||
|
||||
The price for that is thorough specialization on data files in ISO-9660
|
||||
filesystem images. So libisoburn is not suitable for audio (CD-DA) or any
|
||||
other CD layout which does not entirely consist of ISO-9660 sessions.
|
||||
|
||||
The priciple of this frontend is that you may use any call of libisofs or
|
||||
libburn unless it has a isoburn_*() wrapper listed in the following function
|
||||
documentation.
|
||||
|
||||
E.g. call isoburn_initialize() rather than iso_init(); burn_initialize()
|
||||
and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab().
|
||||
But you may call burn_disc_get_profile() directly if you want to display
|
||||
the media type.
|
||||
|
||||
>>>
|
||||
>>> Take into respect Vreixo's (mandatory ?) shortcuts which are to come
|
||||
>>>
|
||||
|
||||
The usage model is like with libburn: the target is a "media" in a "drive".
|
||||
The wrappers will transparently provide the necessary emulations which
|
||||
are appropriate for particular target "drives".
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* API functions */
|
||||
|
||||
|
||||
/** Initialize libisoburn, libisofs and libburn.
|
||||
Wrapper for : iso_init() and burn_initialize()
|
||||
@return 1 indicates success, 0 is failure
|
||||
*/
|
||||
int isoburn_initialize(void);
|
||||
|
||||
|
||||
/** Aquire a target drive by its filesystem path resp. libburn persistent
|
||||
address.
|
||||
Wrapper for: burn_drive_scan_and_grab()
|
||||
*/
|
||||
int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
|
||||
char* adr, int load);
|
||||
|
||||
|
||||
/** Aquire a drive from the burn_drive_info[] array which was obtained by
|
||||
a previous call of burn_drive_scan().
|
||||
Wrapper for: burn_drive_grab()
|
||||
*/
|
||||
int isoburn_drive_grab(struct burn_drive *drive, int load);
|
||||
|
||||
|
||||
/** Inquire the media status. Expect the whole spectrum of libburn BURN_DISC_*
|
||||
with multi-session media. Emulated states with random access media are
|
||||
BURN_DISC_BLANK and BURN_DISC_APPENDABLE.
|
||||
Wrapper for: burn_disc_get_status()
|
||||
*/
|
||||
enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive);
|
||||
|
||||
|
||||
/** Tells whether the media can be treated by isoburn_disc_erase().
|
||||
Wrapper for: burn_disc_erasable()
|
||||
*/
|
||||
int isoburn_disc_erasable(struct burn_drive *d);
|
||||
|
||||
|
||||
/** Mark the media as blank. With multi-session media this will call
|
||||
burn_disc_erase(). With random access media, an eventual ISO-9660
|
||||
filesystem will get invalidated by altering its start blocks on media.
|
||||
In case of success, the media is in status BURN_DISC_BLANK afterwards.
|
||||
Wrapper for: burn_disc_erase()
|
||||
*/
|
||||
void isoburn_disc_erase(struct burn_drive *drive, int fast);
|
||||
|
||||
/**
|
||||
* Options for image reading.
|
||||
*/
|
||||
struct isoburn_read_opts {
|
||||
unsigned int norock:1; /*< Do not read Rock Ridge extensions */
|
||||
unsigned int nojoliet:1; /*< Do not read Joliet extensions */
|
||||
unsigned int preferjoliet:1;
|
||||
/*< When both Joliet and RR extensions are present, the RR
|
||||
* tree is used. If you prefer using Joliet, set this to 1. */
|
||||
uid_t uid; /**< Default uid when no RR */
|
||||
gid_t gid; /**< Default uid when no RR */
|
||||
mode_t mode; /**< Default mode when no RR (only permissions) */
|
||||
|
||||
/* modified by the function isoburn_read_volset */
|
||||
unsigned int hasRR:1; /*< It will be set to 1 if RR extensions are present,
|
||||
to 0 if not. */
|
||||
unsigned int hasJoliet:1; /*< It will be set to 1 if Joliet extensions are
|
||||
present, to 0 if not. */
|
||||
uint32_t size; /**< Will be filled with the size (in 2048 byte block) of
|
||||
* the image, as reported in the PVM. */
|
||||
unsigned int pretend_blank:1; /* always create empty image */
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for image generation by libisofs and image transport to libburn.
|
||||
*/
|
||||
struct isoburn_source_opts {
|
||||
|
||||
/* Options for image generation */
|
||||
|
||||
int level; /**< ISO level to write at. */
|
||||
int flags; /**< Which extensions to support. */
|
||||
int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */
|
||||
|
||||
unsigned int copy_eltorito:1;
|
||||
/**<
|
||||
* In multisession discs, select whether to copy el-torito catalog
|
||||
* and boot image. Copy is needed for isolinux images, that need to
|
||||
* be patched. However, it can lead to problems when the image is
|
||||
* not present in the iso filesystem, because we can't figure out
|
||||
* its size. In those cases, we only copy 1 block of data.
|
||||
*/
|
||||
|
||||
unsigned int no_cache_inodes:1;
|
||||
/**< If use inode caching or not. Set it to 1 to prevent
|
||||
* inode caching.
|
||||
* Usage of inode caching allows detection of hard-links,
|
||||
* which contents are only written once to disc this way.
|
||||
* Don't use inode caching in systems with non unique inodes
|
||||
* per device.
|
||||
*/
|
||||
unsigned int sort_files:1;
|
||||
/**< If files should be sorted based on their weight. */
|
||||
unsigned int default_mode:1;
|
||||
/**<
|
||||
* The default values for files and directory permissions,
|
||||
* gid and uid. This option can be overwritten when set
|
||||
* one of the following.
|
||||
* 0 to use useful values, 1 to use node modes (this are
|
||||
* the same as filesystem ones if not changed after added
|
||||
* to tree).
|
||||
*/
|
||||
unsigned int replace_dir_mode:1;
|
||||
/**<
|
||||
* When 1, permissions for all dirs will be replaced by the
|
||||
* specified in dir_mode field.
|
||||
*/
|
||||
unsigned int replace_file_mode:1;
|
||||
/**<
|
||||
* When 1, permissions for all files will be replaced by the
|
||||
* specified in file_mode field.
|
||||
*/
|
||||
unsigned int replace_uid:1;
|
||||
/**<
|
||||
* When 1, uid of all nodes (both files and dirs) will be
|
||||
* replaced by the specified in uid field.
|
||||
*/
|
||||
unsigned int replace_gid:1;
|
||||
/**<
|
||||
* When 1, gid of all nodes (both files and dirs) will be
|
||||
* replaced by the specified in gid field.
|
||||
*/
|
||||
mode_t dir_mode; /**< Mode to use on dirs when replace_dir_mode is set. */
|
||||
mode_t file_mode; /**< Mode to use on files when replace_file_mode is set. */
|
||||
gid_t gid; /**< gid to use when replace_gid is set. */
|
||||
uid_t uid; /**< uid to use when replace_uid is set. */
|
||||
char *input_charset; /**< NULL to use default charset */
|
||||
char *ouput_charset; /**< NULL to use default charset */
|
||||
|
||||
|
||||
/* Options for image transport */
|
||||
|
||||
/** The number of bytes to be used for the fifo which decouples libisofs
|
||||
and libburn for better throughput and for reducing the risk of
|
||||
interrupting signals hitting the libburn thread which operates the
|
||||
MMC drive.
|
||||
The size will be rounded up to the next full 2048.
|
||||
Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway).
|
||||
*/
|
||||
int fifo_size;
|
||||
|
||||
};
|
||||
|
||||
/** Load the ISO filesystem directory tree from the media in the given drive.
|
||||
This will give libisoburn the base on which it can let libisofs perform
|
||||
image growing or image modification. The loaded volset gets attached
|
||||
to the drive object and handed out to the application.
|
||||
Not a wrapper, but peculiar to libisoburn.
|
||||
@param d The drive which holds an existing ISO filesystem or blank media.
|
||||
d is allowed to be NULL which produces an empty ISO image. In
|
||||
this case one has to call before writing isoburn_attach_volset()
|
||||
with the volset from this call and with the intended output
|
||||
drive.
|
||||
@param read_opts The read options which can be chosen by the application
|
||||
@param volset the volset that represents the image, if the disc is blank
|
||||
it will have no files.
|
||||
This reference needs to be released via iso_volset_free() when
|
||||
it is not longer needed. The drive, if not NULL, will hold an
|
||||
own reference which it will release when it gets a new volset
|
||||
or when it gets released via isoburn_drive_release().
|
||||
@return <=0 error , 1 = success
|
||||
>>>>> error means damaged or unsupported image
|
||||
error code is stored in ecma119_read_opts in libisofs
|
||||
also error msgs are enqueued. Any need to pass them to usr? <<<<<<
|
||||
*/
|
||||
int isoburn_read_volset(struct burn_drive *d,
|
||||
struct isoburn_read_opts *read_opts,
|
||||
struct iso_volset **volset);
|
||||
|
||||
|
||||
/** Attach a ISO filesystem directory tree to a drive. This eventually releases
|
||||
the reference to the old volset attached to the drive.
|
||||
Caution: Use with care. It hardly makes sense to replace a volset that
|
||||
reflects a valid ISO image on media.
|
||||
This call is rather intended for writing a newly created and populated
|
||||
image to blank media. The use case in xorriso is to let a volset survive
|
||||
the change or demise of the outdev target drive.
|
||||
@param d The drive which shall be write target of the volset.
|
||||
@param volset The volset that represents the image to be written.
|
||||
This volset pointer MUST already be a valid reference suitable
|
||||
for iso_volset_free().
|
||||
It may have been obtained by appropriate libisofs calls or by
|
||||
isoburn_read_volset() with d==NULL.
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_attach_volset(struct burn_drive *d, struct iso_volset *volset);
|
||||
|
||||
|
||||
/** Obtain the start block number of the most recent session on media. In
|
||||
case of random access media this will always be 0. Succesfull return is
|
||||
not a guarantee that there is a ISO-9660 image at all. The call will fail,
|
||||
nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE.
|
||||
Wrapper for: burn_disc_get_msc1()
|
||||
*/
|
||||
int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba);
|
||||
|
||||
|
||||
/** Use this with trackno==0 to obtain the predicted start block number of the
|
||||
new session. The interesting number is returned in parameter nwa.
|
||||
Wrapper for: burn_disc_track_lba_nwa()
|
||||
*/
|
||||
int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o,
|
||||
int trackno, int *lba, int *nwa);
|
||||
|
||||
|
||||
/** Obtain the size which was attributed to an emulated appendable on actually
|
||||
overwriteable media. This value is supposed to be <= 2048 * nwa as of
|
||||
isoburn_disc_track_lba_nwa().
|
||||
@param drive The drive holding the media.
|
||||
@param start_byte The reply value counted in bytes, not in sectors.
|
||||
@param flag Unused yet. Submit 0.
|
||||
@return 1=stat_byte is valid, 0=not an emulated appendable, -1=error
|
||||
*/
|
||||
int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
|
||||
int flag);
|
||||
|
||||
|
||||
/** Create a disc object for writing the new session from the created or loaded
|
||||
iso_volset which has been manipulated via libisofs, to the same media from
|
||||
where the image was eventually loaded. This struct burn_disc is ready for
|
||||
use by a subsequent call to isoburn_disc_write().
|
||||
After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE
|
||||
again, the burn_disc object has to be disposed by burn_disc_free().
|
||||
@param drive The combined source and target drive, grabbed with
|
||||
isoburn_drive_scan_and_grab(). .
|
||||
@param disc Returns the newly created burn_disc object.
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc,
|
||||
struct isoburn_source_opts *opts);
|
||||
|
||||
|
||||
/** Create a disc object for producing a new image from a previous image
|
||||
plus the changes made by user. The generated burn_disc is suitable
|
||||
to be written to any other libburn drive. You must not use the same drive
|
||||
for writing as you are using here as source, because data will be
|
||||
read from the source drive while the target drive gets written to.
|
||||
The resulting burn_disc object has to be disposed when all its writing
|
||||
is done and the drive is BURN_DRIVE_IDLE again after asynchronous
|
||||
burn_disc_write().
|
||||
@param d The source drive, grabbed with isoburn_drive_scan_and_grab().
|
||||
@param disc Returns the newly created burn_disc object.
|
||||
@return <=0 error , 1 = success
|
||||
*/
|
||||
int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc,
|
||||
struct isoburn_source_opts *opts);
|
||||
|
||||
/** Start writing of the new session.
|
||||
This call is asynchrounous. I.e. it returns quite soon and the progress has
|
||||
to be watched by a loop with call burn_drive_get_status() until
|
||||
BURN_DRIVE_IDLE is returned.
|
||||
Wrapper for: burn_disc_write()
|
||||
*/
|
||||
void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc);
|
||||
|
||||
|
||||
/** Inquire state and fill parameters of the fifo which is attached to
|
||||
the emerging track. This should be done in the pacifier loop while
|
||||
isoburn_disc_write() or burn_disc_write() are active.
|
||||
Hint: If only burn_write_opts and not burn_drive is known, then the drive
|
||||
can be obtained by burn_write_opts_get_drive().
|
||||
@parm d The drive to which the track with the fifo gets burned.
|
||||
@param size The total size of the fifo
|
||||
@param free_bytes The current free capacity of the fifo
|
||||
@param status_text Returns a pointer to a constant text, see below
|
||||
@return <0 reply invalid, >=0 fifo status code:
|
||||
bit0+1=input status, bit2=consumption status, i.e:
|
||||
0="standby" : data processing not started yet
|
||||
1="active" : input and consumption are active
|
||||
2="ending" : input has ended without error
|
||||
3="failing" : input had error and ended,
|
||||
4="unused" : ( consumption has ended before processing start )
|
||||
5="abandoned" : consumption has ended prematurely
|
||||
6="ended" : consumption has ended without input error
|
||||
7="aborted" : consumption has ended after input error
|
||||
*/
|
||||
int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes,
|
||||
char **status_text);
|
||||
|
||||
|
||||
/** Inquire whether the most recent write run was successful.
|
||||
Wrapper for: burn_drive_wrote_well()
|
||||
*/
|
||||
int isoburn_drive_wrote_well(struct burn_drive *d);
|
||||
|
||||
|
||||
/** Call this after isoburn_disc_write has finished and burn_drive_wrote_well()
|
||||
indicates success. It will eventually complete the emulation of
|
||||
multi-session functionality, if needed at all. Let libisoburn decide.
|
||||
Not a wrapper, but peculiar to libisoburn.
|
||||
*/
|
||||
int isoburn_activate_session(struct burn_drive *drive);
|
||||
|
||||
|
||||
/** Write a new session to a disc.
|
||||
This is a synchronous call equivalent to isoburn_prepare_disc +
|
||||
isoburn_disc_write + isoburn_activate_session
|
||||
@param pacifier_func If not NULL: a function to produce appeasing messages.
|
||||
See burn_abort_pacifier() in libburn.h for an example.
|
||||
*/
|
||||
/* TODO implement this */
|
||||
int isoburn_perform_write(struct burn_write_opts *o,
|
||||
int (*pacifier_func)(void *handle, int patience,
|
||||
int elapsed));
|
||||
|
||||
/** Release an aquired drive.
|
||||
Wrapper for: burn_drive_release()
|
||||
*/
|
||||
void isoburn_drive_release(struct burn_drive *drive, int eject);
|
||||
|
||||
|
||||
/** Shutdown all three libraries.
|
||||
Wrapper for : iso_finish() and burn_finish().
|
||||
*/
|
||||
void isoburn_finish(void);
|
||||
|
||||
|
||||
/*
|
||||
The following two calls are for expert applications only.
|
||||
An application should have a special reason to use them.
|
||||
*/
|
||||
|
||||
|
||||
/** Inquire wether the media needs emulation or would be suitable for
|
||||
generic multi-session via libburn.
|
||||
@return 0 is generic multi-session
|
||||
1 is emulated multi-session
|
||||
-1 is not suitable for isoburn
|
||||
*/
|
||||
int isoburn_needs_emulation(struct burn_drive *drive);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,49 +0,0 @@
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
The architecture of the xorriso application is planned as follows:
|
||||
|
||||
The main program module creates a xorriso object, calls startup-file reading,
|
||||
argument reading, and eventual dialog shell function.
|
||||
|
||||
The xorriso class module implements the xorriso state object and above three
|
||||
main functions. These functions rely on a common interpreter of a list of
|
||||
words as described in man xorriso, paragraph "Command processing".
|
||||
The list may contain more than one command with its parameters. It is intended
|
||||
to be either the list of program arguments or a list parsed from a single
|
||||
input line.
|
||||
|
||||
The interpreter converts the words command-wise into suitable parameters
|
||||
for an actor function which performs the command's action resp. a setter
|
||||
function which brings the command's setting into effect. The interpreter then
|
||||
calls this function immediately and synchronously.
|
||||
|
||||
These option functions form a well documented API which may be used by
|
||||
interpreters of things other than words. E.g. by a GUI module or as libxorriso.
|
||||
|
||||
xorriso will encapsulate libisoburn, libisofs and libburn. Although i know
|
||||
it is not popular, i propose to link it with the object files of those
|
||||
libraries and not against external library objects.
|
||||
|
||||
(Did i watch somebody having an allergy against external programs ?
|
||||
I got an allergy against .so . My immune system mistakes them for .DLL .)
|
||||
|
||||
|
||||
>>> currently a stub for xorriso is derived from the source of scdbackup_askme.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
Emerging man page is now in text/xorriso.1
|
||||
|
||||
( Needs enhancement in libisofs:
|
||||
-cut_out disk_path startbyte bytecount iso_rr_path
|
||||
Cut out a piece of file disk_path and insert it into the ISO
|
||||
image under the given iso_rr_path.
|
||||
This is advised for files > 2 GiB - 2 KiB if you are not
|
||||
certain that all your systems with ISO filesystem driver can
|
||||
handle such large files. Depending on the libisofs
|
||||
implementation, files of larger size may generate SORRY
|
||||
events if they are processed uncut.
|
||||
When reading those files pieces from media, you will have to
|
||||
concatenate them in the correct sequence:
|
||||
cat /mnt/file_part1 /mnt/file_part2 > $HOME/file
|
||||
)
|
||||
|
@ -1 +0,0 @@
|
||||
#define Xorriso_timestamP "2008.01.25.175353"
|
@ -1,138 +0,0 @@
|
||||
|
||||
|
||||
/* Adapter to libisoburn, libisofs and libburn for xorriso,
|
||||
a command line oriented batch and dialog tool which creates, loads,
|
||||
manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2.
|
||||
|
||||
This file contains the inner isofs- and burn-library interface of xorriso.
|
||||
*/
|
||||
|
||||
#ifndef Xorrisoburn_includeD
|
||||
#define Xorrisoburn_includeD yes
|
||||
|
||||
struct XorrisO;
|
||||
struct FindjoB;
|
||||
|
||||
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param flag bit0= global shutdown of libraries */
|
||||
int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param flag bit0=aquire as isoburn input drive
|
||||
bit1=aquire as libburn output drive (as isoburn drive if bit0)
|
||||
@return <=0 failure , 1=success , 2=neither readable or writeable
|
||||
*/
|
||||
int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag);
|
||||
|
||||
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_write_session(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param flag bit0=graft in as empty directory, not as copy from disk
|
||||
@return <=0 = error , 1 = added simple node , 2 = added directory
|
||||
*/
|
||||
int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
|
||||
int flag);
|
||||
|
||||
int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag);
|
||||
|
||||
/* @param flag bit0=report about output drive
|
||||
bit1=short report form
|
||||
*/
|
||||
int Xorriso_toc(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_show_devices(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_tell_media_space(struct XorrisO *xorriso,
|
||||
int *media_space, int *free_space, int flag);
|
||||
|
||||
int Xorriso_blank_media(struct XorrisO *xorriso, int flag);
|
||||
|
||||
int Xorriso_format_media(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param boss_iter Opaque internal handle. Use NULL outside xorrisoburn.c :
|
||||
If not NULL then this is an iterator suitable for
|
||||
iso_tree_node_remove_iter() which is then to be used instead
|
||||
of iso_tree_node_remove().
|
||||
@param flag bit0= remove whole sub tree: rm -r
|
||||
bit1= remove empty directory: rmdir
|
||||
bit2= recursion: do not reassure in mode 2 "tree"
|
||||
bit3= this is for overwriting and not for plain removal
|
||||
@return <=0 = error
|
||||
1 = removed simple node
|
||||
2 = removed directory or tree
|
||||
3 = did not remove on user revocation
|
||||
*/
|
||||
int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
|
||||
char *path, int flag);
|
||||
|
||||
/* @param flag bit0= long format
|
||||
bit1= do not print count of nodes
|
||||
bit2= du format
|
||||
bit3= print directories as themselves (ls -d)
|
||||
*/
|
||||
int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
|
||||
int filec, char **filev, off_t boss_mem, int flag);
|
||||
|
||||
/* This function needs less buffer memory than Xorriso_ls_filev() but cannot
|
||||
perform structured pattern matching.
|
||||
@param flag bit0= long format
|
||||
bit1= only check for directory existence
|
||||
bit2= do not apply search pattern but accept any file
|
||||
*/
|
||||
int Xorriso_ls(struct XorrisO *xorriso, int flag);
|
||||
|
||||
/* @param wd Path to prepend in case img_path is not absolute
|
||||
@param img_path Absolute or relative path to be normalized
|
||||
@param eff_path returns resulting effective path.
|
||||
Must provide at least SfileadrL bytes of storage.
|
||||
@param flag bit0= do not produce problem events (unless faulty path format)
|
||||
bit1= work purely literally, do not use libisofs
|
||||
bit2= (with bit1) this is an address in the disk world
|
||||
@return -1 = faulty path format, 0 = not found ,
|
||||
1 = found simple node , 2 = found directory
|
||||
*/
|
||||
int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd,
|
||||
char *img_path, char eff_path[], int flag);
|
||||
|
||||
int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest,int flag);
|
||||
|
||||
/* @param flag bit0= do not produce info message on success
|
||||
@return 1=success, 0=was already directory, -1=was other type, -2=bad path
|
||||
*/
|
||||
int Xorriso_mkdir(struct XorrisO *xorriso, char *img_path, int flag);
|
||||
|
||||
/* @param flag bit0= a match count !=1 is a SORRY event */
|
||||
int Xorriso_expand_pattern(struct XorrisO *xorriso,
|
||||
int num_patterns, char **patterns, int extra_filec,
|
||||
int *filec, char ***filev, off_t *mem, int flag);
|
||||
|
||||
int Xorriso_set_st_mode(struct XorrisO *xorriso, char *path,
|
||||
mode_t mode_and, mode_t mode_or, int flag);
|
||||
|
||||
int Xorriso_set_uid(struct XorrisO *xorriso, char *in_path, uid_t uid,
|
||||
int flag);
|
||||
|
||||
int Xorriso_set_gid(struct XorrisO *xorriso, char *in_path, gid_t gid,
|
||||
int flag);
|
||||
|
||||
/* @parm flag bit0= atime, bit1= ctime, bit2= mtime, bit8=no auto ctime */
|
||||
int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t,
|
||||
int flag);
|
||||
|
||||
int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
void *dir_node_generic, char *dir_path,
|
||||
struct stat *dir_stbuf, int depth, int flag);
|
||||
|
||||
int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag);
|
||||
|
||||
int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag);
|
||||
|
||||
#endif /* Xorrisoburn_includeD */
|
||||
|
@ -5,10 +5,10 @@
|
||||
# to be executed in a common parent of the directories given with
|
||||
# $isofs $isoburn $burn
|
||||
|
||||
isofs=./libisofs-develop/libisofs
|
||||
isofs=./nglibisofs-develop/src
|
||||
burn=./libburn-develop/libburn
|
||||
isoburn=./libisoburn-develop/og_src
|
||||
xorr=./libisoburn-develop/test
|
||||
isoburn=./libisoburn-develop/libisoburn
|
||||
xorr=./libisoburn-develop/xorriso
|
||||
|
||||
debug_opts="-O2"
|
||||
def_opts=
|
||||
@ -16,8 +16,7 @@ largefile_opts="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1"
|
||||
do_strip=0
|
||||
static_opts=
|
||||
warn_opts="-Wall"
|
||||
nglibisofs=0
|
||||
gen=
|
||||
nglibisofs=1
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
@ -40,21 +39,7 @@ do
|
||||
echo " -do_strip apply program strip to compiled programs."
|
||||
echo " -g produce debuggable programm."
|
||||
echo " -static compile with cc option -static."
|
||||
echo " -nglibisofs ... will fail at compile time."
|
||||
echo " -oglibisofs ... might fail at run time."
|
||||
exit 0
|
||||
elif test "$i" = "-nglibisofs"
|
||||
then
|
||||
nglibisofs=1
|
||||
isofs=./nglibisofs-develop/src
|
||||
isoburn=./libisoburn-develop/ng_src
|
||||
gen=-nglibisofs
|
||||
elif test "$i" = "-oglibisofs"
|
||||
then
|
||||
nglibisofs=0
|
||||
isofs=./libisofs-develop/libisofs
|
||||
isoburn=./libisoburn-develop/og_src
|
||||
gen=-oglibisofs
|
||||
elif test "$i" = "-static"
|
||||
then
|
||||
static_opts="-static"
|
||||
@ -62,59 +47,35 @@ do
|
||||
done
|
||||
|
||||
libisofs=
|
||||
if test "$nglibisofs" = 1
|
||||
then
|
||||
libisofs="$libisofs $isofs"/buffer.o
|
||||
libisofs="$libisofs $isofs"/builder.o
|
||||
libisofs="$libisofs $isofs"/data_source.o
|
||||
libisofs="$libisofs $isofs"/ecma119.o
|
||||
libisofs="$libisofs $isofs"/ecma119_tree.o
|
||||
libisofs="$libisofs $isofs"/eltorito.o
|
||||
libisofs="$libisofs $isofs"/filesrc.o
|
||||
libisofs="$libisofs $isofs"/fs_image.o
|
||||
libisofs="$libisofs $isofs"/fs_local.o
|
||||
libisofs="$libisofs $isofs"/fsource.o
|
||||
libisofs="$libisofs $isofs"/image.o
|
||||
libisofs="$libisofs $isofs"/iso1999.o
|
||||
libisofs="$libisofs $isofs"/joliet.o
|
||||
libisofs="$libisofs $isofs"/libiso_msgs.o
|
||||
libisofs="$libisofs $isofs"/messages.o
|
||||
libisofs="$libisofs $isofs"/node.o
|
||||
libisofs="$libisofs $isofs"/rockridge.o
|
||||
libisofs="$libisofs $isofs"/rockridge_read.o
|
||||
libisofs="$libisofs $isofs"/stream.o
|
||||
libisofs="$libisofs $isofs"/tree.o
|
||||
libisofs="$libisofs $isofs"/util.o
|
||||
libisofs="$libisofs $isofs"/util_htable.o
|
||||
libisofs="$libisofs $isofs"/util_rbtree.o
|
||||
xorrisoburn_c="ng_xorrisoburn.c"
|
||||
else
|
||||
libisofs="$libisofs $isofs"/data_source.o
|
||||
libisofs="$libisofs $isofs"/ecma119.o
|
||||
libisofs="$libisofs $isofs"/ecma119_read.o
|
||||
libisofs="$libisofs $isofs"/ecma119_read_rr.o
|
||||
libisofs="$libisofs $isofs"/ecma119_tree.o
|
||||
libisofs="$libisofs $isofs"/eltorito.o
|
||||
libisofs="$libisofs $isofs"/exclude.o
|
||||
libisofs="$libisofs $isofs"/file.o
|
||||
libisofs="$libisofs $isofs"/file_src.o
|
||||
libisofs="$libisofs $isofs"/hash.o
|
||||
libisofs="$libisofs $isofs"/joliet.o
|
||||
libisofs="$libisofs $isofs"/libiso_msgs.o
|
||||
libisofs="$libisofs $isofs"/messages.o
|
||||
libisofs="$libisofs $isofs"/rockridge.o
|
||||
libisofs="$libisofs $isofs"/susp.o
|
||||
libisofs="$libisofs $isofs"/tree.o
|
||||
libisofs="$libisofs $isofs"/util.o
|
||||
libisofs="$libisofs $isofs"/volume.o
|
||||
xorrisoburn_c="xorrisoburn.c"
|
||||
fi
|
||||
libisofs="$libisofs $isofs"/buffer.o
|
||||
libisofs="$libisofs $isofs"/builder.o
|
||||
libisofs="$libisofs $isofs"/data_source.o
|
||||
libisofs="$libisofs $isofs"/ecma119.o
|
||||
libisofs="$libisofs $isofs"/ecma119_tree.o
|
||||
libisofs="$libisofs $isofs"/eltorito.o
|
||||
libisofs="$libisofs $isofs"/filesrc.o
|
||||
libisofs="$libisofs $isofs"/fs_image.o
|
||||
libisofs="$libisofs $isofs"/fs_local.o
|
||||
libisofs="$libisofs $isofs"/fsource.o
|
||||
libisofs="$libisofs $isofs"/image.o
|
||||
libisofs="$libisofs $isofs"/iso1999.o
|
||||
libisofs="$libisofs $isofs"/joliet.o
|
||||
libisofs="$libisofs $isofs"/libiso_msgs.o
|
||||
libisofs="$libisofs $isofs"/messages.o
|
||||
libisofs="$libisofs $isofs"/node.o
|
||||
libisofs="$libisofs $isofs"/rockridge.o
|
||||
libisofs="$libisofs $isofs"/rockridge_read.o
|
||||
libisofs="$libisofs $isofs"/stream.o
|
||||
libisofs="$libisofs $isofs"/tree.o
|
||||
libisofs="$libisofs $isofs"/util.o
|
||||
libisofs="$libisofs $isofs"/util_htable.o
|
||||
libisofs="$libisofs $isofs"/util_rbtree.o
|
||||
|
||||
timestamp="$(date -u '+%Y.%m.%d.%H%M%S')"
|
||||
echo "Version timestamp : $(sed -e 's/#define Xorriso_timestamP "//' -e 's/"$//' "$xorr"/xorriso_timestamp.h)"
|
||||
echo "Build timestamp : $timestamp"
|
||||
|
||||
echo "compiling program $xorr/xorriso.c $static_opts $debug_opts $def_opts $gen"
|
||||
echo "compiling program $xorr/xorriso.c $static_opts $debug_opts $def_opts"
|
||||
cc -I. -DXorriso_with_maiN -DXorriso_with_regeX -DXorriso_with_readlinE \
|
||||
$warn_opts \
|
||||
$static_opts \
|
||||
@ -128,7 +89,7 @@ cc -I. -DXorriso_with_maiN -DXorriso_with_regeX -DXorriso_with_readlinE \
|
||||
\
|
||||
"$xorr"/xorriso.c \
|
||||
\
|
||||
"$xorr"/"$xorrisoburn_c" \
|
||||
"$xorr"/xorrisoburn.c \
|
||||
\
|
||||
"$burn"/async.o \
|
||||
"$burn"/debug.o \
|
@ -5,16 +5,16 @@
|
||||
#
|
||||
# Generates a HTML version of man page xorriso.1
|
||||
#
|
||||
# To be executed within the libburn toplevel directory (eg. ./libisoburn-0.1.0)
|
||||
# To be executed in the libisoburn toplevel directory (eg. ./libisoburn-0.1.0)
|
||||
#
|
||||
|
||||
# set -x
|
||||
|
||||
man_dir=$(pwd)"/test"
|
||||
man_dir=$(pwd)"/xorriso"
|
||||
export MANPATH="$man_dir"
|
||||
manpage="xorriso"
|
||||
raw_html=$(pwd)/"test/raw_man_1_xorriso.html"
|
||||
htmlpage=$(pwd)/"test/man_1_xorriso.html"
|
||||
raw_html=$(pwd)/"xorriso/raw_man_1_xorriso.html"
|
||||
htmlpage=$(pwd)/"xorriso/man_1_xorriso.html"
|
||||
|
||||
if test -r "$man_dir"/"$manpage".1
|
||||
then
|
||||
@ -87,6 +87,7 @@ then
|
||||
-e 's/-outdev \/dev\/sr0 -blank fast \\ -commit -eject all/-outdev \/dev\/sr0 -blank fast -commit -eject all/' \
|
||||
-e 's/See section FILES/See section <A HREF="#FILES">FILES<\/A>/' \
|
||||
-e 's/See section EXAMPLES/See section <A HREF="#EXAMPLES">EXAMPLES<\/A>/' \
|
||||
-e 's/<\/body>/<BR><HR><FONT SIZE=-1><CENTER>(HTML generated from '"$manpage"'.1 on '"$(date)"' by '$(basename "$0")' )<\/CENTER><\/FONT><\/body>/' \
|
||||
<"$2" >"$htmlpage"
|
||||
|
||||
set +x
|
@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Create version timestamp test/xorriso_timestamp.h
|
||||
# Create version timestamp xorriso/xorriso_timestamp.h
|
||||
# to be executed within ./libisoburn-develop
|
||||
|
||||
timestamp="$(date -u '+%Y.%m.%d.%H%M%S')"
|
||||
echo "Version timestamp : $timestamp"
|
||||
echo '#define Xorriso_timestamP "'"$timestamp"'"' >test/xorriso_timestamp.h
|
||||
echo '#define Xorriso_timestamP "'"$timestamp"'"' >xorriso/xorriso_timestamp.h
|
||||
|
@ -88,13 +88,13 @@ copy_files \
|
||||
\
|
||||
"$lone_dir"
|
||||
|
||||
copy_files test/configure_ac.txt "$lone_dir"/configure.ac
|
||||
copy_files xorriso/configure_ac.txt "$lone_dir"/configure.ac
|
||||
|
||||
copy_files test/xorriso_makefile_am.txt "$lone_dir"/Makefile.am
|
||||
copy_files xorriso/xorriso_makefile_am.txt "$lone_dir"/Makefile.am
|
||||
|
||||
copy_files test/xorriso_pc_in.txt "$lone_dir"/xorriso.pc.in
|
||||
copy_files xorriso/xorriso_pc_in.txt "$lone_dir"/xorriso.pc.in
|
||||
|
||||
copy_files test/README "$lone_dir"/README
|
||||
copy_files xorriso/README "$lone_dir"/README
|
||||
|
||||
echo "See end of xorriso/changelog.txt" >"$lone_dir"/TODO
|
||||
|
||||
@ -103,24 +103,22 @@ echo "See end of xorriso/changelog.txt" >"$lone_dir"/TODO
|
||||
|
||||
create_dir "$lone_dir"/libisoburn
|
||||
copy_files \
|
||||
ng_src/*.[ch] \
|
||||
libisoburn/*.[ch] \
|
||||
"$lone_dir"/libisoburn
|
||||
|
||||
test/convert_man_to_html.sh
|
||||
xorriso/convert_man_to_html.sh
|
||||
|
||||
create_dir "$lone_dir"/xorriso
|
||||
copy_files \
|
||||
test/ng_xorrisoburn.[ch] \
|
||||
test/xorriso.[ch1] \
|
||||
test/xorriso_private.h \
|
||||
test/xorriso_timestamp.h \
|
||||
test/changelog.txt \
|
||||
test/xorriso_eng.html \
|
||||
test/man_1_xorriso.html \
|
||||
xorriso/xorrisoburn.[ch] \
|
||||
xorriso/xorriso.[ch1] \
|
||||
xorriso/xorriso_private.h \
|
||||
xorriso/xorriso_timestamp.h \
|
||||
xorriso/changelog.txt \
|
||||
xorriso/xorriso_eng.html \
|
||||
xorriso/man_1_xorriso.html \
|
||||
"$lone_dir"/xorriso
|
||||
|
||||
mv "$lone_dir"/xorriso/ng_xorrisoburn.h "$lone_dir"/xorriso/xorrisoburn.h
|
||||
mv "$lone_dir"/xorriso/ng_xorrisoburn.c "$lone_dir"/xorriso/xorrisoburn.c
|
||||
|
||||
# >>> create compile_xorriso.sh for standalone
|
||||
|
@ -1,15 +1,15 @@
|
||||
|
||||
/*
|
||||
|
||||
( cd .. ; libisoburn-develop/test/compile_xorriso.sh -g )
|
||||
( cd .. ; libisoburn-develop/xorriso/compile_xorriso.sh -g )
|
||||
|
||||
or
|
||||
|
||||
cc -g -DXorriso_with_maiN -DXorriso_with_regeX -DXorriso_with_readlinE \
|
||||
-DXorriso_build_timestamP='"'"$(date -u '+%Y.%m.%d.%H%M%S')"'"' \
|
||||
-Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
|
||||
-o test/xorriso \
|
||||
test/xorriso.c test/xorrisoburn.c \
|
||||
-o xorriso/xorriso \
|
||||
xorriso/xorriso.c xorriso/xorrisoburn.c \
|
||||
-lpthread -lreadline -lburn -lisofs -lisoburn
|
||||
|
||||
or
|
||||
@ -18,7 +18,7 @@ or
|
||||
-DXorriso_build_timestamP='"'"$(date -u '+%Y.%m.%d.%H%M%S')"'"' \
|
||||
-Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
|
||||
-c \
|
||||
test/xorriso.c test/xorrisoburn.c
|
||||
xorriso/xorriso.c xorriso/xorrisoburn.c
|
||||
|
||||
*/
|
||||
|
1
libisoburn/trunk/xorriso/xorriso_timestamp.h
Normal file
1
libisoburn/trunk/xorriso/xorriso_timestamp.h
Normal file
@ -0,0 +1 @@
|
||||
#define Xorriso_timestamP "2008.01.26.002011"
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user