New capability to redirect program output used for toc in sector map file
This commit is contained in:
parent
9b85bc0fed
commit
c0cc40121f
@ -723,133 +723,6 @@ decode:;
|
|||||||
/* --------------------------------- misc --------------------------------- */
|
/* --------------------------------- misc --------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
int Write_to_channel(char *text, int channel_no, int flag)
|
|
||||||
/*
|
|
||||||
bit0= packet write disabled, write to stdin resp. stderr
|
|
||||||
bit1= text is the name of the log file for the given channel
|
|
||||||
bit2= text is the name of the consolidated packet log file for all channels
|
|
||||||
bit15= with bit1 or bit2: close depicted log file
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
char *rpt,*npt,ret= 1;
|
|
||||||
char prefix[16];
|
|
||||||
static int num_channels= 4;
|
|
||||||
static char channel_prefixes[4][4]= {".","R","I","M"};
|
|
||||||
static FILE *logfile_fp[4]= {NULL,NULL,NULL,NULL};
|
|
||||||
static FILE *pktlog_fp= NULL;
|
|
||||||
|
|
||||||
if(channel_no<0 || channel_no>=num_channels)
|
|
||||||
return(-1);
|
|
||||||
|
|
||||||
/* Logfiles */
|
|
||||||
if((flag&2) && logfile_fp[channel_no]!=NULL) {
|
|
||||||
fprintf(logfile_fp[channel_no],
|
|
||||||
"! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n",
|
|
||||||
channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
|
|
||||||
fclose(logfile_fp[channel_no]);
|
|
||||||
logfile_fp[channel_no]= NULL;
|
|
||||||
}
|
|
||||||
if((flag&4) && pktlog_fp!=NULL) {
|
|
||||||
fprintf(pktlog_fp,
|
|
||||||
"I:1:! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n",
|
|
||||||
channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
|
|
||||||
fclose(pktlog_fp);
|
|
||||||
pktlog_fp= NULL;
|
|
||||||
}
|
|
||||||
if(flag&(1<<15))
|
|
||||||
return(1);
|
|
||||||
if((flag&2)) {
|
|
||||||
logfile_fp[channel_no]= fopen(text,"a");
|
|
||||||
if(logfile_fp[channel_no]==NULL)
|
|
||||||
return(0);
|
|
||||||
fprintf(logfile_fp[channel_no],
|
|
||||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : %s : %s\n",
|
|
||||||
channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
|
|
||||||
fflush(logfile_fp[channel_no]);
|
|
||||||
}
|
|
||||||
if((flag&4)) {
|
|
||||||
pktlog_fp= fopen(text,"a");
|
|
||||||
if(pktlog_fp==NULL)
|
|
||||||
return(0);
|
|
||||||
fprintf(pktlog_fp,
|
|
||||||
"I:1:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : . : %s\n",
|
|
||||||
Sfile_datestr(time(0),1|2|256));
|
|
||||||
fflush(pktlog_fp);
|
|
||||||
}
|
|
||||||
if(flag&(2|4))
|
|
||||||
return(1);
|
|
||||||
if(flag&1) {
|
|
||||||
if(channel_no==1 || channel_no==3) {
|
|
||||||
printf("%s",text);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
if(channel_no==2 || channel_no==3)
|
|
||||||
fprintf(stderr,"%s",text);
|
|
||||||
if(logfile_fp[channel_no]!=NULL) {
|
|
||||||
fprintf(logfile_fp[channel_no],"%s",text);
|
|
||||||
fflush(logfile_fp[channel_no]);
|
|
||||||
}
|
|
||||||
if(pktlog_fp!=NULL)
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
rpt= text;
|
|
||||||
sprintf(prefix,"%s:x: ",channel_prefixes[channel_no]);
|
|
||||||
while(*rpt!=0) {
|
|
||||||
npt= strchr(rpt,'\n');
|
|
||||||
if(npt==NULL)
|
|
||||||
prefix[2]= '0';
|
|
||||||
else
|
|
||||||
prefix[2]= '1';
|
|
||||||
if(!(flag&1)) {
|
|
||||||
ret= fwrite(prefix,5,1,stdout);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if(pktlog_fp!=NULL) {
|
|
||||||
ret= fwrite(prefix,5,1,pktlog_fp);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if(npt==NULL) {
|
|
||||||
if(!(flag&1)) {
|
|
||||||
ret= fwrite(rpt,strlen(rpt),1,stdout);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
ret= fwrite("\n",1,1,stdout);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if(pktlog_fp!=NULL) {
|
|
||||||
ret= fwrite(rpt,strlen(rpt),1,pktlog_fp);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
ret= fwrite("\n",1,1,pktlog_fp);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
if(!(flag&1)) {
|
|
||||||
ret= fwrite(rpt,npt+1-rpt,1,stdout);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if(pktlog_fp!=NULL) {
|
|
||||||
ret= fwrite(rpt,npt+1-rpt,1,pktlog_fp);
|
|
||||||
if(ret<=0)
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rpt= npt+1;
|
|
||||||
}
|
|
||||||
if(!(flag&1))
|
|
||||||
fflush(stdout);
|
|
||||||
if(pktlog_fp!=NULL)
|
|
||||||
fflush(pktlog_fp);
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Strcmp(const void *pt1, const void *pt2)
|
int Strcmp(const void *pt1, const void *pt2)
|
||||||
{
|
{
|
||||||
return(strcmp(*((char **) pt1), *((char **) pt2)));
|
return(strcmp(*((char **) pt1), *((char **) pt2)));
|
||||||
@ -865,43 +738,6 @@ int Sort_argv(int argc, char **argv, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FILE *Afile_fopen(char *filename, char *mode, int flag)
|
|
||||||
/*
|
|
||||||
bit0= do not print error message on failure
|
|
||||||
bit6= write packeted error messages (see Write_to_channel())
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
FILE *fp= NULL;
|
|
||||||
char errmsg[2*SfileadrL];
|
|
||||||
|
|
||||||
if(strcmp(filename,"-")==0) {
|
|
||||||
if(mode[0]=='a' || mode[0]=='w' ||
|
|
||||||
(mode[0]=='r' && mode[1]=='+') ||
|
|
||||||
(mode[0]=='r' && mode[1]=='b' && mode[2]=='+'))
|
|
||||||
fp= stdout;
|
|
||||||
else
|
|
||||||
fp= stdin;
|
|
||||||
} else if(strncmp(filename,"tcp:",4)==0){
|
|
||||||
sprintf(errmsg,"sorry - TCP/IP service isn't implemented yet.\n");
|
|
||||||
Write_to_channel(errmsg,2,!(flag&64));
|
|
||||||
} else if(strncmp(filename,"file:",5)==0){
|
|
||||||
fp= fopen(filename+5,mode);
|
|
||||||
} else {
|
|
||||||
fp= fopen(filename,mode);
|
|
||||||
}
|
|
||||||
if(fp==NULL){
|
|
||||||
if(!(flag&1)) {
|
|
||||||
sprintf(errmsg,"failed to open file '%s' in %s mode\n",filename,mode);
|
|
||||||
if(errno>0)
|
|
||||||
sprintf(errmsg+strlen(errmsg)," %s\n",strerror(errno));
|
|
||||||
Write_to_channel(errmsg,2,!(flag&64));
|
|
||||||
}
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
return(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Convert a text into a number of type double and multiply it by unit code
|
/** Convert a text into a number of type double and multiply it by unit code
|
||||||
[kmgtpe] (2^10 to 2^60) or [s] (2048). (Also accepts capital letters.)
|
[kmgtpe] (2^10 to 2^60) or [s] (2048). (Also accepts capital letters.)
|
||||||
@param text Input like "42", "2k", "3.14m" or "-1g"
|
@param text Input like "42", "2k", "3.14m" or "-1g"
|
||||||
@ -1790,9 +1626,7 @@ return:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef Xorriso_sregex_externaL
|
/* --------------------------------- Xorriso_lsT --------------------------- */
|
||||||
|
|
||||||
/* ---------------------------------- LstrinG --------------------------- */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1800,13 +1634,13 @@ return:
|
|||||||
bit0= insert before link rather than after it
|
bit0= insert before link rather than after it
|
||||||
bit1= do not copy data (e.g. because *data is invalid)
|
bit1= do not copy data (e.g. because *data is invalid)
|
||||||
*/
|
*/
|
||||||
int Lstring_new_binary(struct LstrinG **lstring, char *data, int data_len,
|
int Xorriso_lst_new_binary(struct Xorriso_lsT **lstring, char *data,
|
||||||
struct LstrinG *link, int flag)
|
int data_len, struct Xorriso_lsT *link, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct LstrinG *s;
|
struct Xorriso_lsT *s;
|
||||||
|
|
||||||
s= TSOB_FELD(struct LstrinG,1);
|
s= TSOB_FELD(struct Xorriso_lsT,1);
|
||||||
if(s==NULL)
|
if(s==NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
s->text= NULL;
|
s->text= NULL;
|
||||||
@ -1839,7 +1673,7 @@ int Lstring_new_binary(struct LstrinG **lstring, char *data, int data_len,
|
|||||||
return(1);
|
return(1);
|
||||||
failed:;
|
failed:;
|
||||||
*lstring= s;
|
*lstring= s;
|
||||||
Lstring_destroy(lstring,0);
|
Xorriso_lst_destroy(lstring,0);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1848,12 +1682,12 @@ failed:;
|
|||||||
@param flag Bitfield for control purposes
|
@param flag Bitfield for control purposes
|
||||||
bit0= insert before link rather than after it
|
bit0= insert before link rather than after it
|
||||||
*/
|
*/
|
||||||
int Lstring_new(struct LstrinG **lstring, char *text, struct LstrinG *link,
|
int Xorriso_lst_new(struct Xorriso_lsT **lstring, char *text,
|
||||||
int flag)
|
struct Xorriso_lsT *link, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret= Lstring_new_binary(lstring,text,strlen(text)+1,link,flag&1);
|
ret= Xorriso_lst_new_binary(lstring,text,strlen(text)+1,link,flag&1);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1862,9 +1696,9 @@ int Lstring_new(struct LstrinG **lstring, char *text, struct LstrinG *link,
|
|||||||
@param flag Bitfield for control purposes
|
@param flag Bitfield for control purposes
|
||||||
bit0= do not set *lstring to NULL
|
bit0= do not set *lstring to NULL
|
||||||
*/
|
*/
|
||||||
int Lstring_destroy(struct LstrinG **lstring, int flag)
|
int Xorriso_lst_destroy(struct Xorriso_lsT **lstring, int flag)
|
||||||
{
|
{
|
||||||
struct LstrinG *s;
|
struct Xorriso_lsT *s;
|
||||||
|
|
||||||
s= *lstring;
|
s= *lstring;
|
||||||
if(s==NULL)
|
if(s==NULL)
|
||||||
@ -1882,30 +1716,30 @@ int Lstring_destroy(struct LstrinG **lstring, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Lstring_destroy_all(struct LstrinG **lstring, int flag)
|
int Xorriso_lst_destroy_all(struct Xorriso_lsT **lstring, int flag)
|
||||||
{
|
{
|
||||||
struct LstrinG *s,*next;
|
struct Xorriso_lsT *s,*next;
|
||||||
|
|
||||||
if((*lstring)==NULL)
|
if((*lstring)==NULL)
|
||||||
return(0);
|
return(0);
|
||||||
for(s= *lstring; s->prev!=NULL; s= s->prev);
|
for(s= *lstring; s->prev!=NULL; s= s->prev);
|
||||||
for(;s!=NULL;s= next){
|
for(;s!=NULL;s= next){
|
||||||
next= s->next;
|
next= s->next;
|
||||||
Lstring_destroy(&s,0);
|
Xorriso_lst_destroy(&s,0);
|
||||||
}
|
}
|
||||||
*lstring= NULL;
|
*lstring= NULL;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Lstring_append_binary(struct LstrinG **entry, char *data, int data_len,
|
int Xorriso_lst_append_binary(struct Xorriso_lsT **entry,
|
||||||
int flag)
|
char *data, int data_len, int flag)
|
||||||
{
|
{
|
||||||
struct LstrinG *target= NULL,*newby;
|
struct Xorriso_lsT *target= NULL,*newby;
|
||||||
|
|
||||||
if(*entry!=NULL)
|
if(*entry!=NULL)
|
||||||
for(target= *entry; target->next!=NULL; target= target->next);
|
for(target= *entry; target->next!=NULL; target= target->next);
|
||||||
if(Lstring_new_binary(&newby, data, data_len, target, 0)<=0)
|
if(Xorriso_lst_new_binary(&newby, data, data_len, target, 0)<=0)
|
||||||
return(-1);
|
return(-1);
|
||||||
if(*entry==NULL)
|
if(*entry==NULL)
|
||||||
*entry= newby;
|
*entry= newby;
|
||||||
@ -1913,9 +1747,23 @@ int Lstring_append_binary(struct LstrinG **entry, char *data, int data_len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* Xorriso_sregex_externaL */
|
struct Xorriso_lsT *Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag)
|
||||||
|
{
|
||||||
|
return(entry->next);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct Xorriso_lsT *Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag)
|
||||||
|
{
|
||||||
|
return(entry->prev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag)
|
||||||
|
{
|
||||||
|
return(entry->text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------ LinkiteM -------------------------------- */
|
/* ------------------------------ LinkiteM -------------------------------- */
|
||||||
|
|
||||||
@ -2541,16 +2389,16 @@ int Splitparts_sort(struct SplitparT *o, int count, int flag)
|
|||||||
struct ExclusionS {
|
struct ExclusionS {
|
||||||
|
|
||||||
/* Absolute input patterns which lead to not_paths */
|
/* Absolute input patterns which lead to not_paths */
|
||||||
struct LstrinG *not_paths_descr;
|
struct Xorriso_lsT *not_paths_descr;
|
||||||
|
|
||||||
/* Actually banned absolute paths */
|
/* Actually banned absolute paths */
|
||||||
struct LstrinG *not_paths;
|
struct Xorriso_lsT *not_paths;
|
||||||
|
|
||||||
/* Input patterns which lead to not_leafs */
|
/* Input patterns which lead to not_leafs */
|
||||||
struct LstrinG *not_leafs_descr;
|
struct Xorriso_lsT *not_leafs_descr;
|
||||||
|
|
||||||
/* Compiled not_leaf patterns. Caution: not char[] but regex_t */
|
/* Compiled not_leaf patterns. Caution: not char[] but regex_t */
|
||||||
struct LstrinG *not_leafs;
|
struct Xorriso_lsT *not_leafs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2572,17 +2420,17 @@ int Exclusions_new(struct ExclusionS **o, int flag)
|
|||||||
|
|
||||||
int Exclusions_destroy(struct ExclusionS **o, int flag)
|
int Exclusions_destroy(struct ExclusionS **o, int flag)
|
||||||
{
|
{
|
||||||
struct LstrinG *s,*next;
|
struct Xorriso_lsT *s,*next;
|
||||||
|
|
||||||
if((*o)==NULL)
|
if((*o)==NULL)
|
||||||
return(0);
|
return(0);
|
||||||
Lstring_destroy_all(&((*o)->not_paths_descr), 0);
|
Xorriso_lst_destroy_all(&((*o)->not_paths_descr), 0);
|
||||||
Lstring_destroy_all(&((*o)->not_paths), 0);
|
Xorriso_lst_destroy_all(&((*o)->not_paths), 0);
|
||||||
Lstring_destroy_all(&((*o)->not_leafs_descr), 0);
|
Xorriso_lst_destroy_all(&((*o)->not_leafs_descr), 0);
|
||||||
for(s= (*o)->not_leafs; s!=NULL; s= next){
|
for(s= (*o)->not_leafs; s!=NULL; s= next){
|
||||||
next= s->next;
|
next= s->next;
|
||||||
regfree((regex_t *) s->text);
|
regfree((regex_t *) s->text);
|
||||||
Lstring_destroy(&s, 0);
|
Xorriso_lst_destroy(&s, 0);
|
||||||
}
|
}
|
||||||
(*o)= NULL;
|
(*o)= NULL;
|
||||||
return(1);
|
return(1);
|
||||||
@ -2592,14 +2440,14 @@ int Exclusions_destroy(struct ExclusionS **o, int flag)
|
|||||||
int Exclusions_add_not_paths(struct ExclusionS *o, int descrc, char **descrs,
|
int Exclusions_add_not_paths(struct ExclusionS *o, int descrc, char **descrs,
|
||||||
int pathc, char **paths, int flag)
|
int pathc, char **paths, int flag)
|
||||||
{
|
{
|
||||||
struct LstrinG *s, *new_s;
|
struct Xorriso_lsT *s, *new_s;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
s= NULL;
|
s= NULL;
|
||||||
if(o->not_paths_descr!=NULL)
|
if(o->not_paths_descr!=NULL)
|
||||||
for(s= o->not_paths_descr; s->next!=NULL; s= s->next);
|
for(s= o->not_paths_descr; s->next!=NULL; s= s->next);
|
||||||
for(i= 0; i<descrc; i++) {
|
for(i= 0; i<descrc; i++) {
|
||||||
ret= Lstring_new(&new_s, descrs[i], s, 0);
|
ret= Xorriso_lst_new(&new_s, descrs[i], s, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(ret);
|
return(ret);
|
||||||
if(o->not_paths_descr==NULL)
|
if(o->not_paths_descr==NULL)
|
||||||
@ -2610,7 +2458,7 @@ int Exclusions_add_not_paths(struct ExclusionS *o, int descrc, char **descrs,
|
|||||||
if(o->not_paths!=NULL)
|
if(o->not_paths!=NULL)
|
||||||
for(s= o->not_paths; s->next!=NULL; s= s->next);
|
for(s= o->not_paths; s->next!=NULL; s= s->next);
|
||||||
for(i= 0; i<pathc; i++) {
|
for(i= 0; i<pathc; i++) {
|
||||||
ret= Lstring_new(&new_s, paths[i], s, 0);
|
ret= Xorriso_lst_new(&new_s, paths[i], s, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(ret);
|
return(ret);
|
||||||
if(o->not_paths==NULL)
|
if(o->not_paths==NULL)
|
||||||
@ -2628,11 +2476,11 @@ int Exclusions_add_not_leafs(struct ExclusionS *o, char *not_leafs_descr,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret= Lstring_append_binary(&(o->not_leafs_descr),
|
ret= Xorriso_lst_append_binary(&(o->not_leafs_descr),
|
||||||
not_leafs_descr, strlen(not_leafs_descr)+1, 0);
|
not_leafs_descr, strlen(not_leafs_descr)+1, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(-1);
|
return(-1);
|
||||||
ret= Lstring_append_binary(&(o->not_leafs), (char *) re, sizeof(regex_t), 0);
|
ret= Xorriso_lst_append_binary(&(o->not_leafs), (char *) re, sizeof(regex_t), 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(-1);
|
return(-1);
|
||||||
return(1);
|
return(1);
|
||||||
@ -2644,7 +2492,7 @@ int Exclusions_add_not_leafs(struct ExclusionS *o, char *not_leafs_descr,
|
|||||||
*/
|
*/
|
||||||
int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
|
int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
|
||||||
{
|
{
|
||||||
struct LstrinG *s;
|
struct Xorriso_lsT *s;
|
||||||
char leaf[SfileadrL], *leaf_pt;
|
char leaf[SfileadrL], *leaf_pt;
|
||||||
regmatch_t match[1];
|
regmatch_t match[1];
|
||||||
int ret, was_non_slash, l;
|
int ret, was_non_slash, l;
|
||||||
@ -2692,8 +2540,8 @@ int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
|
|||||||
|
|
||||||
|
|
||||||
int Exclusions_get_descrs(struct ExclusionS *o,
|
int Exclusions_get_descrs(struct ExclusionS *o,
|
||||||
struct LstrinG **not_paths_descr,
|
struct Xorriso_lsT **not_paths_descr,
|
||||||
struct LstrinG **not_leafs_descr, int flag)
|
struct Xorriso_lsT **not_leafs_descr, int flag)
|
||||||
{
|
{
|
||||||
*not_paths_descr= o->not_paths_descr;
|
*not_paths_descr= o->not_paths_descr;
|
||||||
*not_leafs_descr= o->not_leafs_descr;
|
*not_leafs_descr= o->not_leafs_descr;
|
||||||
@ -3016,7 +2864,7 @@ int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag)
|
|||||||
int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
|
int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
|
||||||
int *os_errno, int flag)
|
int *os_errno, int flag)
|
||||||
{
|
{
|
||||||
int ret, fd= -1, sectors, sector_size, i, todo, map_size;
|
int ret, fd= -1, sectors, sector_size, i, todo, map_size, skip;
|
||||||
unsigned char *map;
|
unsigned char *map;
|
||||||
unsigned char buf[1024];
|
unsigned char buf[1024];
|
||||||
|
|
||||||
@ -3043,7 +2891,22 @@ wrong_filetype:;
|
|||||||
}
|
}
|
||||||
ret= 0; goto ex;
|
ret= 0; goto ex;
|
||||||
}
|
}
|
||||||
if(strncmp((char *) buf, "xorriso sector bitmap v1 ", 32) != 0)
|
if(strncmp((char *) buf, "xorriso sector bitmap v1 ", 32) == 0)
|
||||||
|
/* ok */;
|
||||||
|
else if(strncmp((char *) buf, "xorriso sector bitmap v2 ", 25) == 0) {
|
||||||
|
skip= -1;
|
||||||
|
sscanf(((char *) buf) + 25, "%d", &skip);
|
||||||
|
if(skip < 0)
|
||||||
|
{ret= 0; goto wrong_filetype;}
|
||||||
|
for(i= 0; i < skip; i+= sizeof(buf)) {
|
||||||
|
todo= sizeof(buf);
|
||||||
|
if(i + todo > skip)
|
||||||
|
todo= skip - i;
|
||||||
|
ret= read(fd, buf, todo);
|
||||||
|
if(ret < todo)
|
||||||
|
goto wrong_filetype;
|
||||||
|
}
|
||||||
|
} else
|
||||||
{ret= 0; goto wrong_filetype;}
|
{ret= 0; goto wrong_filetype;}
|
||||||
ret= read(fd, buf, 8);
|
ret= read(fd, buf, 8);
|
||||||
if(ret < 4)
|
if(ret < 4)
|
||||||
@ -3079,11 +2942,11 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *msg,
|
int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *info,
|
||||||
int *os_errno, int flag)
|
char *msg, int *os_errno, int flag)
|
||||||
{
|
{
|
||||||
int ret, fd= -1, j;
|
int ret, fd= -1, j, l;
|
||||||
unsigned char buf[32];
|
unsigned char buf[40];
|
||||||
|
|
||||||
*os_errno= 0;
|
*os_errno= 0;
|
||||||
fd= open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
fd= open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||||
@ -3095,7 +2958,17 @@ int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *msg,
|
|||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
ret= write(fd, "xorriso sector bitmap v1 ", 32);
|
|
||||||
|
l= 0;
|
||||||
|
if(info != NULL)
|
||||||
|
l= strlen(info);
|
||||||
|
if(l > 999999) {
|
||||||
|
strcpy(msg, "Info string is longer than 999999 bytes");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
sprintf((char *) buf, "xorriso sector bitmap v2 %-6d\n", l);
|
||||||
|
|
||||||
|
ret= write(fd, buf, 32);
|
||||||
if(ret != 32) {
|
if(ret != 32) {
|
||||||
cannot_write:;
|
cannot_write:;
|
||||||
*os_errno= errno;
|
*os_errno= errno;
|
||||||
@ -3105,6 +2978,12 @@ cannot_write:;
|
|||||||
}
|
}
|
||||||
ret= 0; goto ex;
|
ret= 0; goto ex;
|
||||||
}
|
}
|
||||||
|
if(l > 0) {
|
||||||
|
ret= write(fd, info, l);
|
||||||
|
if(ret != l)
|
||||||
|
goto cannot_write;
|
||||||
|
}
|
||||||
|
|
||||||
for(j= 0; j < 4; j++) {
|
for(j= 0; j < 4; j++) {
|
||||||
buf[j]= o->sectors >> (24 - j * 8);
|
buf[j]= o->sectors >> (24 - j * 8);
|
||||||
buf[j+4]= o->sector_size >> (24 - j * 8);
|
buf[j+4]= o->sector_size >> (24 - j * 8);
|
||||||
@ -3246,6 +3125,7 @@ int Checkmediajob_new(struct CheckmediajoB **o, int flag)
|
|||||||
m->data_to_fd= -1;
|
m->data_to_fd= -1;
|
||||||
m->sector_map_path[0]= 0;
|
m->sector_map_path[0]= 0;
|
||||||
m->sector_map= NULL;
|
m->sector_map= NULL;
|
||||||
|
m->map_with_volid= 0;
|
||||||
m->retry= 0;
|
m->retry= 0;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@ -3365,8 +3245,16 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|||||||
m->result_page_width= 80;
|
m->result_page_width= 80;
|
||||||
m->mark_text[0]= 0;
|
m->mark_text[0]= 0;
|
||||||
m->packet_output= 0;
|
m->packet_output= 0;
|
||||||
for(i=0; i<4; i++)
|
for(i=0; i<4; i++) {
|
||||||
m->logfile[i][0]= 0;
|
m->logfile[i][0]= 0;
|
||||||
|
m->logfile_fp[i]= NULL;
|
||||||
|
}
|
||||||
|
m->pktlog_fp= NULL;
|
||||||
|
for(i= 0; i < Xorriso_max_outlist_stacK; i++) {
|
||||||
|
m->result_msglists[i]= NULL;
|
||||||
|
m->info_msglists[i]= NULL;
|
||||||
|
}
|
||||||
|
m->msglist_stackfill= 0;
|
||||||
m->status_history_max= Xorriso_status_history_maX;
|
m->status_history_max= Xorriso_status_history_maX;
|
||||||
strcpy(m->report_about_text, "UPDATE");
|
strcpy(m->report_about_text, "UPDATE");
|
||||||
Xorriso__text_to_sev(m->report_about_text, &m->report_about_severity, 0);
|
Xorriso__text_to_sev(m->report_about_text, &m->report_about_severity, 0);
|
||||||
@ -3774,6 +3662,197 @@ ask_for_page:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_write_to_channel(struct XorrisO *xorriso,
|
||||||
|
char *text, int channel_no, int flag)
|
||||||
|
/*
|
||||||
|
bit1= text is the name of the log file for the given channel
|
||||||
|
bit2= text is the name of the consolidated packet log file for all channels
|
||||||
|
bit15= with bit1 or bit2: close depicted log file
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
char *rpt,*npt,ret= 1;
|
||||||
|
char prefix[16];
|
||||||
|
FILE *logfile_fp, *pktlog_fp;
|
||||||
|
struct Xorriso_lsT *msglist;
|
||||||
|
static int num_channels= 4;
|
||||||
|
static char channel_prefixes[4][4]= {".","R","I","M"};
|
||||||
|
|
||||||
|
if(channel_no<0 || channel_no>=num_channels)
|
||||||
|
return(-1);
|
||||||
|
|
||||||
|
/* Logfiles */
|
||||||
|
logfile_fp= xorriso->logfile_fp[channel_no];
|
||||||
|
pktlog_fp= xorriso->pktlog_fp;
|
||||||
|
if((flag&2) && logfile_fp!=NULL) {
|
||||||
|
fprintf(logfile_fp,
|
||||||
|
"! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n",
|
||||||
|
channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
|
||||||
|
fclose(logfile_fp);
|
||||||
|
xorriso->logfile_fp[channel_no]= logfile_fp= NULL;
|
||||||
|
}
|
||||||
|
if((flag&4) && pktlog_fp!=NULL) {
|
||||||
|
fprintf(pktlog_fp,
|
||||||
|
"I:1:! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n",
|
||||||
|
channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
|
||||||
|
fclose(pktlog_fp);
|
||||||
|
xorriso->pktlog_fp= pktlog_fp= NULL;
|
||||||
|
}
|
||||||
|
if(flag&(1<<15))
|
||||||
|
return(1);
|
||||||
|
if((flag&2)) {
|
||||||
|
xorriso->logfile_fp[channel_no]= logfile_fp= fopen(text,"a");
|
||||||
|
if(logfile_fp==NULL)
|
||||||
|
return(0);
|
||||||
|
fprintf(logfile_fp,
|
||||||
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : %s : %s\n",
|
||||||
|
channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
|
||||||
|
fflush(logfile_fp);
|
||||||
|
}
|
||||||
|
if((flag&4)) {
|
||||||
|
xorriso->pktlog_fp= pktlog_fp= fopen(text,"a");
|
||||||
|
if(pktlog_fp==NULL)
|
||||||
|
return(0);
|
||||||
|
fprintf(pktlog_fp,
|
||||||
|
"I:1:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : . : %s\n",
|
||||||
|
Sfile_datestr(time(0),1|2|256));
|
||||||
|
fflush(pktlog_fp);
|
||||||
|
}
|
||||||
|
if(flag&(2|4))
|
||||||
|
return(1);
|
||||||
|
|
||||||
|
/* Eventually perform messag redirection */
|
||||||
|
if(xorriso->msglist_stackfill > 0) {
|
||||||
|
if(channel_no==1 || channel_no==3) {
|
||||||
|
msglist= xorriso->result_msglists[xorriso->msglist_stackfill - 1];
|
||||||
|
ret= Xorriso_lst_append_binary(&msglist, text, strlen(text) + 1, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
return(-1);
|
||||||
|
if(xorriso->result_msglists[xorriso->msglist_stackfill - 1] == NULL)
|
||||||
|
xorriso->result_msglists[xorriso->msglist_stackfill - 1]= msglist;
|
||||||
|
}
|
||||||
|
if(channel_no==2 || channel_no==3) {
|
||||||
|
msglist= xorriso->info_msglists[xorriso->msglist_stackfill - 1];
|
||||||
|
ret= Xorriso_lst_append_binary(&msglist, text, strlen(text) + 1, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
return(-1);
|
||||||
|
if(xorriso->info_msglists[xorriso->msglist_stackfill - 1] == NULL)
|
||||||
|
xorriso->info_msglists[xorriso->msglist_stackfill - 1]= msglist;
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Non-redirected output */
|
||||||
|
if(!xorriso->packet_output) {
|
||||||
|
if(channel_no==1 || channel_no==3) {
|
||||||
|
printf("%s",text);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
if(channel_no==2 || channel_no==3)
|
||||||
|
fprintf(stderr,"%s",text);
|
||||||
|
if(logfile_fp!=NULL) {
|
||||||
|
fprintf(logfile_fp,"%s",text);
|
||||||
|
fflush(logfile_fp);
|
||||||
|
}
|
||||||
|
if(pktlog_fp==NULL)
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
rpt= text;
|
||||||
|
sprintf(prefix,"%s:x: ",channel_prefixes[channel_no]);
|
||||||
|
while(*rpt!=0) {
|
||||||
|
npt= strchr(rpt,'\n');
|
||||||
|
if(npt==NULL)
|
||||||
|
prefix[2]= '0';
|
||||||
|
else
|
||||||
|
prefix[2]= '1';
|
||||||
|
if(xorriso->packet_output) {
|
||||||
|
ret= fwrite(prefix,5,1,stdout);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(pktlog_fp!=NULL) {
|
||||||
|
ret= fwrite(prefix,5,1,pktlog_fp);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(npt==NULL) {
|
||||||
|
if(xorriso->packet_output) {
|
||||||
|
ret= fwrite(rpt,strlen(rpt),1,stdout);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
ret= fwrite("\n",1,1,stdout);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(pktlog_fp!=NULL) {
|
||||||
|
ret= fwrite(rpt,strlen(rpt),1,pktlog_fp);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
ret= fwrite("\n",1,1,pktlog_fp);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if(xorriso->packet_output) {
|
||||||
|
ret= fwrite(rpt,npt+1-rpt,1,stdout);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(pktlog_fp!=NULL) {
|
||||||
|
ret= fwrite(rpt,npt+1-rpt,1,pktlog_fp);
|
||||||
|
if(ret<=0)
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rpt= npt+1;
|
||||||
|
}
|
||||||
|
if(xorriso->packet_output)
|
||||||
|
fflush(stdout);
|
||||||
|
if(pktlog_fp!=NULL)
|
||||||
|
fflush(pktlog_fp);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_push_outlists(struct XorrisO *xorriso, int *stack_handle,
|
||||||
|
int flag)
|
||||||
|
{
|
||||||
|
if(xorriso->msglist_stackfill + 1 >= Xorriso_max_outlist_stacK) {
|
||||||
|
Xorriso_msgs_submit(xorriso, 0,
|
||||||
|
"Overflow of message output redirection stack", 0, "FATAL", 0);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
xorriso->msglist_stackfill++;
|
||||||
|
xorriso->result_msglists[xorriso->msglist_stackfill - 1]= NULL;
|
||||||
|
xorriso->info_msglists[xorriso->msglist_stackfill - 1]= NULL;
|
||||||
|
*stack_handle= xorriso->msglist_stackfill - 1;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_pull_outlists(struct XorrisO *xorriso, int stack_handle,
|
||||||
|
struct Xorriso_lsT **result_list,
|
||||||
|
struct Xorriso_lsT **info_list, int flag)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(stack_handle < 0 || stack_handle >= xorriso->msglist_stackfill) {
|
||||||
|
Xorriso_msgs_submit(xorriso, 0,
|
||||||
|
"Program error: Wrong message output redirection stack handle",
|
||||||
|
0, "FATAL", 0);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
*result_list= xorriso->result_msglists[stack_handle];
|
||||||
|
*info_list= xorriso->info_msglists[stack_handle];
|
||||||
|
for(i = stack_handle + 1; i < xorriso->msglist_stackfill - 1; i++) {
|
||||||
|
xorriso->result_msglists[i - 1]= xorriso->result_msglists[i];
|
||||||
|
xorriso->info_msglists[i - 1]= xorriso->info_msglists[i];
|
||||||
|
}
|
||||||
|
xorriso->msglist_stackfill--;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Xorriso_result(struct XorrisO *xorriso, int flag)
|
int Xorriso_result(struct XorrisO *xorriso, int flag)
|
||||||
/*
|
/*
|
||||||
bit0= no considerations or computations or dialog. Just put out.
|
bit0= no considerations or computations or dialog. Just put out.
|
||||||
@ -3785,7 +3864,7 @@ int Xorriso_result(struct XorrisO *xorriso, int flag)
|
|||||||
goto put_it_out;
|
goto put_it_out;
|
||||||
if(xorriso->request_to_abort)
|
if(xorriso->request_to_abort)
|
||||||
return(1);
|
return(1);
|
||||||
if(xorriso->result_page_length>0) {
|
if(xorriso->result_page_length>0 && xorriso->msglist_stackfill <= 0) {
|
||||||
ret= Xorriso_pager(xorriso,xorriso->result_line,2);
|
ret= Xorriso_pager(xorriso,xorriso->result_line,2);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(ret);
|
return(ret);
|
||||||
@ -3796,7 +3875,7 @@ int Xorriso_result(struct XorrisO *xorriso, int flag)
|
|||||||
}
|
}
|
||||||
put_it_out:;
|
put_it_out:;
|
||||||
xorriso->bar_is_fresh= 0;
|
xorriso->bar_is_fresh= 0;
|
||||||
ret= Write_to_channel(xorriso->result_line,1,!xorriso->packet_output);
|
ret= Xorriso_write_to_channel(xorriso, xorriso->result_line, 1,0);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3832,7 +3911,7 @@ int Xorriso_info(struct XorrisO *xorriso, int flag)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
xorriso->bar_is_fresh= 0;
|
xorriso->bar_is_fresh= 0;
|
||||||
ret= Write_to_channel(xorriso->info_text,2,!xorriso->packet_output);
|
ret=Xorriso_write_to_channel(xorriso, xorriso->info_text, 2, 0);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3844,7 +3923,7 @@ int Xorriso_mark(struct XorrisO *xorriso, int flag)
|
|||||||
if(xorriso->mark_text[0]==0)
|
if(xorriso->mark_text[0]==0)
|
||||||
return(1);
|
return(1);
|
||||||
if(xorriso->packet_output)
|
if(xorriso->packet_output)
|
||||||
ret= Write_to_channel(xorriso->mark_text,3,0);
|
ret=Xorriso_write_to_channel(xorriso, xorriso->mark_text, 3, 0);
|
||||||
else {
|
else {
|
||||||
sprintf(xorriso->result_line,"%s\n",xorriso->mark_text);
|
sprintf(xorriso->result_line,"%s\n",xorriso->mark_text);
|
||||||
r_ret= Xorriso_result(xorriso,1);
|
r_ret= Xorriso_result(xorriso,1);
|
||||||
@ -4398,7 +4477,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
|||||||
static char channel_prefixes[4][4]= {".","R","I","M"};
|
static char channel_prefixes[4][4]= {".","R","I","M"};
|
||||||
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
||||||
static int max_load_mode= 4;
|
static int max_load_mode= 4;
|
||||||
struct LstrinG *paths, *leafs;
|
struct Xorriso_lsT *paths, *leafs;
|
||||||
|
|
||||||
no_defaults= flag&1;
|
no_defaults= flag&1;
|
||||||
line= xorriso->result_line;
|
line= xorriso->result_line;
|
||||||
@ -8712,6 +8791,81 @@ int Xorriso_spotlist_to_sectormap(struct XorrisO *xorriso,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_afile_fopen(struct XorrisO *xorriso,
|
||||||
|
char *filename, char *mode, FILE **ret_fp, int flag)
|
||||||
|
/*
|
||||||
|
bit0= do not print error message on failure
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
FILE *fp= NULL;
|
||||||
|
|
||||||
|
*ret_fp= NULL;
|
||||||
|
if(strcmp(filename,"-")==0) {
|
||||||
|
if(mode[0]=='a' || mode[0]=='w' ||
|
||||||
|
(mode[0]=='r' && mode[1]=='+') ||
|
||||||
|
(mode[0]=='r' && mode[1]=='b' && mode[2]=='+'))
|
||||||
|
fp= stdout;
|
||||||
|
else
|
||||||
|
fp= stdin;
|
||||||
|
} else if(strncmp(filename,"tcp:",4)==0){
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, "TCP/IP service isn't implemented yet.", 0,
|
||||||
|
"FAILURE", 0);
|
||||||
|
} else if(strncmp(filename,"file:",5)==0){
|
||||||
|
fp= fopen(filename+5,mode);
|
||||||
|
} else {
|
||||||
|
fp= fopen(filename,mode);
|
||||||
|
}
|
||||||
|
if(fp==NULL){
|
||||||
|
if(!(flag&1)) {
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"Failed to open file '%s' in %s mode\n", filename, mode);
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
*ret_fp= fp;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit2=do not try to read ISO heads
|
||||||
|
*/
|
||||||
|
int Xorriso_toc_to_string(struct XorrisO *xorriso, char **toc_text, int flag)
|
||||||
|
{
|
||||||
|
int ret, stack_handle, toc_ret, l;
|
||||||
|
struct Xorriso_lsT *results= NULL, *infos= NULL, *lpt;
|
||||||
|
|
||||||
|
*toc_text= NULL;
|
||||||
|
ret= Xorriso_push_outlists(xorriso, &stack_handle, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
|
toc_ret= Xorriso_toc(xorriso, flag & 4);
|
||||||
|
ret= Xorriso_pull_outlists(xorriso, stack_handle, &results, &infos, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
|
for(lpt= infos; lpt != NULL; lpt= Xorriso_lst_get_next(lpt, 0)) {
|
||||||
|
strcpy(xorriso->info_text, Xorriso_lst_get_text(lpt, 0));
|
||||||
|
Xorriso_info(xorriso, 0);
|
||||||
|
}
|
||||||
|
if(toc_ret <= 0)
|
||||||
|
{ret= toc_ret; goto ex;}
|
||||||
|
|
||||||
|
l= 0;
|
||||||
|
for(lpt= results; lpt != NULL; lpt= Xorriso_lst_get_next(lpt, 0))
|
||||||
|
l+= strlen(Xorriso_lst_get_text(lpt, 0));
|
||||||
|
*toc_text= calloc(l + 1, 1);
|
||||||
|
l= 0;
|
||||||
|
for(lpt= results; lpt != NULL; lpt= Xorriso_lst_get_next(lpt, 0)) {
|
||||||
|
strcpy((*toc_text) + l, Xorriso_lst_get_text(lpt, 0));
|
||||||
|
l+= strlen(Xorriso_lst_get_text(lpt, 0));
|
||||||
|
}
|
||||||
|
ex:;
|
||||||
|
Xorriso_lst_destroy_all(&results, 0);
|
||||||
|
Xorriso_lst_destroy_all(&infos, 0);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- Options API ------------------------ */
|
/* ---------------------------- Options API ------------------------ */
|
||||||
|
|
||||||
|
|
||||||
@ -9235,6 +9389,13 @@ int Xorriso_option_check_media(struct XorrisO *xorriso,
|
|||||||
ret= Sfile_str(job->data_to_path, argv[i] + 8, 0);
|
ret= Sfile_str(job->data_to_path, argv[i] + 8, 0);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
} else if(strncmp(argv[i], "map_with_volid=", 15) == 0) {
|
||||||
|
if(strcmp(argv[i] + 15, "on") == 0)
|
||||||
|
job->map_with_volid= 1;
|
||||||
|
else if(strcmp(argv[i] + 15, "off") == 0)
|
||||||
|
job->map_with_volid= 0;
|
||||||
|
else
|
||||||
|
goto unknown_value;
|
||||||
} else if(strncmp(argv[i], "max_lba=", 8) == 0 ||
|
} else if(strncmp(argv[i], "max_lba=", 8) == 0 ||
|
||||||
strncmp(argv[i], "min_lba=", 8) == 0) {
|
strncmp(argv[i], "min_lba=", 8) == 0) {
|
||||||
num= -1;
|
num= -1;
|
||||||
@ -10813,8 +10974,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" -check_media [options] --",
|
" -check_media [options] --",
|
||||||
" Try to read data blocks from media and report about the",
|
" Try to read data blocks from media and report about the",
|
||||||
" outcome. Several options modify the behavior:",
|
" outcome. Several options modify the behavior:",
|
||||||
" min_lba= , max_lba= , time_limit= , item_limit= ,",
|
" what=track|session , min_lba=blockadr , max_lba=blockadr ,",
|
||||||
" data_to= ,",
|
" time_limit=seconds , item_limit=number ,",
|
||||||
|
" retry=on|off|default , data_to=filepath ,",
|
||||||
|
" sector_map=filepath , map_with_volid=on|off",
|
||||||
"",
|
"",
|
||||||
"Compatibility emulation (argument list may be ended by --):",
|
"Compatibility emulation (argument list may be ended by --):",
|
||||||
" -as mkisofs [-help|-version|-o|-R|-J|-V|-P|-f|-m|-exclude-list|-no-pad|",
|
" -as mkisofs [-help|-version|-o|-R|-J|-V|-P|-f|-m|-exclude-list|-no-pad|",
|
||||||
@ -11080,7 +11243,7 @@ logfile_wrong_form:;
|
|||||||
if(strcmp(fileadr,"-")==0 || fileadr[0]==0)
|
if(strcmp(fileadr,"-")==0 || fileadr[0]==0)
|
||||||
hflag|= (1<<15);
|
hflag|= (1<<15);
|
||||||
xorriso->logfile[channel_no][0]= 0;
|
xorriso->logfile[channel_no][0]= 0;
|
||||||
ret= Write_to_channel(fileadr,channel_no,hflag);
|
ret= Xorriso_write_to_channel(xorriso, fileadr, channel_no, hflag);
|
||||||
if(ret<=0) {
|
if(ret<=0) {
|
||||||
sprintf(xorriso->info_text, "Cannot open logfile: %s", fileadr);
|
sprintf(xorriso->info_text, "Cannot open logfile: %s", fileadr);
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||||
@ -11564,8 +11727,8 @@ int Xorriso_option_not_list(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
fp= Afile_fopen(adr,"rb",((!!xorriso->packet_output)<<6));
|
ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0);
|
||||||
if(fp==NULL)
|
if(ret <= 0)
|
||||||
return(0);
|
return(0);
|
||||||
while(1) {
|
while(1) {
|
||||||
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
|
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
|
||||||
@ -11750,8 +11913,8 @@ return:
|
|||||||
shellsafe);
|
shellsafe);
|
||||||
Xorriso_info(xorriso,1);
|
Xorriso_info(xorriso,1);
|
||||||
}
|
}
|
||||||
fp= Afile_fopen(adr,"rb",((!!xorriso->packet_output)<<6));
|
ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0);
|
||||||
if(fp==NULL)
|
if(ret <= 0)
|
||||||
return(0);
|
return(0);
|
||||||
while(1) {
|
while(1) {
|
||||||
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
|
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
|
||||||
@ -11976,8 +12139,8 @@ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
|
|||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
fp= Afile_fopen(adr,"rb",((!!xorriso->packet_output)<<6));
|
ret= Xorriso_afile_fopen(xorriso, adr, "rb", &fp, 0);
|
||||||
if(fp==NULL)
|
if(ret <= 0)
|
||||||
return(0);
|
return(0);
|
||||||
while(1) {
|
while(1) {
|
||||||
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
|
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
|
||||||
|
@ -150,6 +150,96 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* The outlist stack allows to redirect the info and result messages from
|
||||||
|
their normal channels into a pair of string lists which can at some
|
||||||
|
later time be retrieved by the application.
|
||||||
|
These redirection caches can be stacked to allow stacked applications.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* A list item able of forming double chained lists */
|
||||||
|
struct Xorriso_lsT;
|
||||||
|
|
||||||
|
/** Maximum number of stacked redirections */
|
||||||
|
#define Xorriso_max_outlist_stacK 32
|
||||||
|
|
||||||
|
/** Enable a new redirection of info and result channel. The normal message
|
||||||
|
output and eventual older redirections will not see new messages until
|
||||||
|
the redirection is ended by a call to Xorriso_pull_outlists() with the
|
||||||
|
stack_handle value returned by this call.
|
||||||
|
Redirected output is not written to the files of Xorriso_option_logfile()
|
||||||
|
and the Xorriso_option_pkt_output() protocol will not be applied.
|
||||||
|
@param xorriso The environment handle
|
||||||
|
@param stack_handle returns an id number which is unique as long as
|
||||||
|
its redirection is stacked. It may be re-used after
|
||||||
|
its redirection was pulled from the stack.
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 on success, <=0 if failure
|
||||||
|
*/
|
||||||
|
int Xorriso_push_outlists(struct XorrisO *xorriso, int *stack_handle,
|
||||||
|
int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Disable the redirection given by stack_handle. If it was the current
|
||||||
|
receiver of messages then switch output to the next older redirection.
|
||||||
|
The messages collected by the disabled redirection are handed out as
|
||||||
|
two lists. Both lists have to be disposed via Xorriso_lst_destroy_all()
|
||||||
|
when they are no longer needed.
|
||||||
|
The message lists are either NULL or represented by their first
|
||||||
|
Xorriso_lsT item.
|
||||||
|
@param xorriso The environment handle
|
||||||
|
@param stack_handle The id number returned by Xorriso_push_outlists()
|
||||||
|
@param result_list Result and mark messages (usually directed to stdout)
|
||||||
|
@param info_list Info and mark messages (usually directed to stderr)
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 1 on success, <=0 if failure
|
||||||
|
*/
|
||||||
|
int Xorriso_pull_outlists(struct XorrisO *xorriso, int stack_handle,
|
||||||
|
struct Xorriso_lsT **result_list,
|
||||||
|
struct Xorriso_lsT **info_list, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Obtain the text message from the current list item.
|
||||||
|
@param entry The current list item
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return pointer to the text content of the list item.
|
||||||
|
This pointer does not have to be freed.
|
||||||
|
*/
|
||||||
|
char *Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Obtain the address of the next item in the chain of messages.
|
||||||
|
An iteration over the output of Xorriso_pull_outlists() starts at the
|
||||||
|
returned result_list resp. info_list and ends when this function returns
|
||||||
|
NULL.
|
||||||
|
@param entry The current list item
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return pointer to the next list item or NULL if end of list
|
||||||
|
This pointer does not have to be freed.
|
||||||
|
*/
|
||||||
|
struct Xorriso_lsT *Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Obtain the address of the previous item in the chain of messages.
|
||||||
|
@param entry The current list item
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return pointer to the previous list item or NULL if start of list
|
||||||
|
This pointer does not have to be freed.
|
||||||
|
*/
|
||||||
|
struct Xorriso_lsT *Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Destroy all list items which are directly or indirectly connected to
|
||||||
|
the given link item.
|
||||||
|
Apply this to each of the two list handles obtained by
|
||||||
|
Xorriso_pull_outlists() when the lists are no longer needed.
|
||||||
|
@param lstring pointer to the pointer to be freed and set to NULL
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 0= *lstring was alredy NULL, 1= ok
|
||||||
|
*/
|
||||||
|
int Xorriso_lst_destroy_all(struct Xorriso_lsT **lstring, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- Options API ------------------------ */
|
/* ---------------------------- Options API ------------------------ */
|
||||||
/* See man 1 xorriso for explanation of the particular options */
|
/* See man 1 xorriso for explanation of the particular options */
|
||||||
/*
|
/*
|
||||||
|
@ -226,8 +226,15 @@ struct XorrisO { /* the global context of xorriso */
|
|||||||
char mark_text[SfileadrL]; /* ( stdout+stderr, M: ) */
|
char mark_text[SfileadrL]; /* ( stdout+stderr, M: ) */
|
||||||
int packet_output;
|
int packet_output;
|
||||||
char logfile[4][SfileadrL];
|
char logfile[4][SfileadrL];
|
||||||
|
FILE *logfile_fp[4];
|
||||||
|
FILE *pktlog_fp;
|
||||||
|
struct Xorriso_lsT *result_msglists[Xorriso_max_outlist_stacK];
|
||||||
|
struct Xorriso_lsT *info_msglists[Xorriso_max_outlist_stacK];
|
||||||
|
int msglist_stackfill;
|
||||||
|
|
||||||
int status_history_max; /* for -status long_history */
|
int status_history_max; /* for -status long_history */
|
||||||
|
|
||||||
|
|
||||||
char report_about_text[20];
|
char report_about_text[20];
|
||||||
int report_about_severity;
|
int report_about_severity;
|
||||||
int library_msg_direct_print;
|
int library_msg_direct_print;
|
||||||
@ -460,6 +467,62 @@ int Xorriso_spotlist_to_sectormap(struct XorrisO *xorriso,
|
|||||||
struct SectorbitmaP **map,
|
struct SectorbitmaP **map,
|
||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
|
int Xorriso_toc_to_string(struct XorrisO *xorriso, char **toc_text, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
struct Xorriso_lsT {
|
||||||
|
char *text;
|
||||||
|
struct Xorriso_lsT *prev,*next;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Create a new list item with arbitrary byte content.
|
||||||
|
@param lstring The newly created object or NULL on failure
|
||||||
|
@param data An array of bytes to be copied into the new object
|
||||||
|
@param data_len Number of bytes to be copied
|
||||||
|
@param link Xorriso_lsT object to which the new object shall be linked
|
||||||
|
@param flag Bitfield for control purposes
|
||||||
|
bit0= insert before link rather than after it
|
||||||
|
bit1= do not copy data (e.g. because *data is invalid)
|
||||||
|
@return <=0 error, 1 ok
|
||||||
|
*/
|
||||||
|
int Xorriso_lst_new_binary(struct Xorriso_lsT **lstring, char *data,
|
||||||
|
int data_len, struct Xorriso_lsT *link, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Create a new list item with a 0-terminated text as content.
|
||||||
|
@param lstring The newly created object or NULL on failure
|
||||||
|
@param text A 0-terminated array of bytes
|
||||||
|
@param link Xorriso_lsT object to which the new object shall be linked
|
||||||
|
@param flag Bitfield for control purposes
|
||||||
|
bit0= insert before link rather than after it
|
||||||
|
@return <=0 error, 1 ok
|
||||||
|
*/
|
||||||
|
int Xorriso_lst_new(struct Xorriso_lsT **lstring, char *text,
|
||||||
|
struct Xorriso_lsT *link, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Create a new list item at the end of a given list.
|
||||||
|
@param lstring Contains as input a pointer to a pointer to any existing
|
||||||
|
list item. As output this list item pointer will be
|
||||||
|
changed to the address of the new list item.
|
||||||
|
@param data An array of bytes to be copied into the new object
|
||||||
|
@param data_len Number of bytes to be copied
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return <=0 error, 1 ok
|
||||||
|
*/
|
||||||
|
int Xorriso_lst_append_binary(struct Xorriso_lsT **entry,
|
||||||
|
char *data, int data_len, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
/** Destroy a single list item and connect its eventual list neighbors.
|
||||||
|
@param lstring pointer to the pointer to be freed and set to NULL
|
||||||
|
@param flag unused yet, submit 0
|
||||||
|
@return 0= *lstring was alredy NULL, 1= ok
|
||||||
|
*/
|
||||||
|
int Xorriso_lst_destroy(struct Xorriso_lsT **lstring, int flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Sfile_str(char target[SfileadrL], char *source, int flag);
|
int Sfile_str(char target[SfileadrL], char *source, int flag);
|
||||||
|
|
||||||
double Sfile_microtime(int flag);
|
double Sfile_microtime(int flag);
|
||||||
@ -587,33 +650,6 @@ int Splitpart__compose(char *adr, int partno, int total_parts,
|
|||||||
|
|
||||||
int Splitparts_sort(struct SplitparT *o, int count, int flag);
|
int Splitparts_sort(struct SplitparT *o, int count, int flag);
|
||||||
|
|
||||||
struct LstrinG {
|
|
||||||
char *text;
|
|
||||||
struct LstrinG *prev,*next;
|
|
||||||
};
|
|
||||||
|
|
||||||
int Lstring_destroy(struct LstrinG **lstring, int flag);
|
|
||||||
|
|
||||||
int Lstring_destroy_all(struct LstrinG **lstring, int flag);
|
|
||||||
|
|
||||||
/*
|
|
||||||
@param flag Bitfield for control purposes
|
|
||||||
bit0= insert before link rather than after it
|
|
||||||
bit1= do not copy data (e.g. because *data is invalid)
|
|
||||||
*/
|
|
||||||
int Lstring_new_binary(struct LstrinG **lstring, char *data, int data_len,
|
|
||||||
struct LstrinG *link, int flag);
|
|
||||||
|
|
||||||
/*
|
|
||||||
@param flag Bitfield for control purposes
|
|
||||||
bit0= insert before link rather than after it
|
|
||||||
*/
|
|
||||||
int Lstring_new(struct LstrinG **lstring, char *text, struct LstrinG *link,
|
|
||||||
int flag);
|
|
||||||
|
|
||||||
int Lstring_append_binary(struct LstrinG **entry, char *data, int data_len,
|
|
||||||
int flag);
|
|
||||||
|
|
||||||
|
|
||||||
int Permstack_push(struct PermiteM **o, char *disk_path, struct stat *stbuf,
|
int Permstack_push(struct PermiteM **o, char *disk_path, struct stat *stbuf,
|
||||||
int flag);
|
int flag);
|
||||||
@ -657,8 +693,8 @@ int Sectorbitmap_new(struct SectorbitmaP **o, int sectors, int sector_size,
|
|||||||
int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag);
|
int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag);
|
||||||
int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
|
int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
|
||||||
int *os_errno, int flag);
|
int *os_errno, int flag);
|
||||||
int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *msg,
|
int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *info,
|
||||||
int *os_errno, int flag);
|
char *msg, int *os_errno, int flag);
|
||||||
int Sectorbitmap_set(struct SectorbitmaP *o, int sector, int flag);
|
int Sectorbitmap_set(struct SectorbitmaP *o, int sector, int flag);
|
||||||
int Sectorbitmap_set_range(struct SectorbitmaP *o,
|
int Sectorbitmap_set_range(struct SectorbitmaP *o,
|
||||||
int start_sector, int sectors, int flag);
|
int start_sector, int sectors, int flag);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.08.13.185434"
|
#define Xorriso_timestamP "2008.08.13.190704"
|
||||||
|
@ -3455,6 +3455,7 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
|
|||||||
|
|
||||||
/* @param flag bit0=short report form
|
/* @param flag bit0=short report form
|
||||||
bit1=report about output drive
|
bit1=report about output drive
|
||||||
|
bit2=do not try to read ISO heads
|
||||||
*/
|
*/
|
||||||
int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
||||||
{
|
{
|
||||||
@ -3463,7 +3464,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
|
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
|
||||||
int is_inout_drive= 0, drive_role, status, num_formats;
|
int is_inout_drive= 0, drive_role, status, num_formats;
|
||||||
int num_payload= 0, num_wasted= 0, num_nondata= 0;
|
int num_payload= 0, num_wasted= 0, num_nondata= 0;
|
||||||
char profile_name[80],*respt,*devadr;
|
char profile_name[80],*respt,*devadr, *typetext= "";
|
||||||
struct burn_toc_entry toc_entry;
|
struct burn_toc_entry toc_entry;
|
||||||
struct burn_drive_info *dinfo;
|
struct burn_drive_info *dinfo;
|
||||||
struct burn_drive *drive;
|
struct burn_drive *drive;
|
||||||
@ -3556,6 +3557,11 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fabricate TOC */
|
/* fabricate TOC */
|
||||||
|
typetext= "Other session";
|
||||||
|
if(flag & 4) {
|
||||||
|
ret= 0;
|
||||||
|
typetext= "Session ";
|
||||||
|
} else
|
||||||
ret= isoburn_read_iso_head(drive, 0, &image_blocks, volume_id, 1);
|
ret= isoburn_read_iso_head(drive, 0, &image_blocks, volume_id, 1);
|
||||||
if(ret>0) {
|
if(ret>0) {
|
||||||
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
|
sprintf(respt, "ISO session : %3d , %9d , %9ds , %s\n",
|
||||||
@ -3567,8 +3573,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
&num_formats);
|
&num_formats);
|
||||||
if(ret>0 && status==BURN_FORMAT_IS_FORMATTED)
|
if(ret>0 && status==BURN_FORMAT_IS_FORMATTED)
|
||||||
nwa= size/2048;
|
nwa= size/2048;
|
||||||
sprintf(respt, "Other session: %3d , %9d , %9ds , \n",
|
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
|
||||||
1, 0, nwa);
|
typetext, 1, 0, nwa);
|
||||||
}
|
}
|
||||||
if(!(flag&1))
|
if(!(flag&1))
|
||||||
Xorriso_result(xorriso,0);
|
Xorriso_result(xorriso,0);
|
||||||
@ -3603,7 +3609,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
track_size= burn_msf_to_lba(next_toc_entry.pmin, next_toc_entry.psec,
|
track_size= burn_msf_to_lba(next_toc_entry.pmin, next_toc_entry.psec,
|
||||||
next_toc_entry.pframe) - lba;
|
next_toc_entry.pframe) - lba;
|
||||||
}
|
}
|
||||||
if(flag&1)
|
if(flag&(1|4))
|
||||||
ret= 0;
|
ret= 0;
|
||||||
else
|
else
|
||||||
ret= isoburn_read_iso_head(drive, lba, &image_blocks, volume_id, 1);
|
ret= isoburn_read_iso_head(drive, lba, &image_blocks, volume_id, 1);
|
||||||
@ -3614,11 +3620,17 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
sprintf(respt, "ISO track : %3d , %9d , %9ds , %s\n",
|
sprintf(respt, "ISO track : %3d , %9d , %9ds , %s\n",
|
||||||
track_count, lba, image_blocks , volume_id);
|
track_count, lba, image_blocks , volume_id);
|
||||||
} else if(track_no==0) {
|
} else if(track_no==0) {
|
||||||
sprintf(respt, "Other session: %3d , %9d , %9ds , \n",
|
typetext= "Other session";
|
||||||
session_no+1, lba, track_size);
|
if(flag & 4)
|
||||||
|
typetext= "Session ";
|
||||||
|
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
|
||||||
|
typetext, session_no+1, lba, track_size);
|
||||||
} else {
|
} else {
|
||||||
sprintf(respt, "Other track : %3d , %9d , %9ds , \n",
|
typetext= "Other track ";
|
||||||
track_count, lba, track_size);
|
if(flag & 4)
|
||||||
|
typetext= "Track ";
|
||||||
|
sprintf(respt, "%13s: %3d , %9d , %9ds , \n",
|
||||||
|
typetext, track_count, lba, track_size);
|
||||||
}
|
}
|
||||||
if(!(flag&1))
|
if(!(flag&1))
|
||||||
Xorriso_result(xorriso,0);
|
Xorriso_result(xorriso,0);
|
||||||
@ -6767,7 +6779,7 @@ int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
|
|||||||
int blocks, os_errno, i, j, last_track_end= -1, track_blocks, track_lba;
|
int blocks, os_errno, i, j, last_track_end= -1, track_blocks, track_lba;
|
||||||
int num_sessions, num_tracks, declare_untested= 0, sector_size, count;
|
int num_sessions, num_tracks, declare_untested= 0, sector_size, count;
|
||||||
int lba, quality;
|
int lba, quality;
|
||||||
char sfe[5*SfileadrL];
|
char sfe[5*SfileadrL], *toc_info= NULL;
|
||||||
struct burn_drive *drive;
|
struct burn_drive *drive;
|
||||||
struct burn_drive_info *dinfo;
|
struct burn_drive_info *dinfo;
|
||||||
struct isoburn_toc_disc *isoburn_disc= NULL;
|
struct isoburn_toc_disc *isoburn_disc= NULL;
|
||||||
@ -6783,6 +6795,7 @@ int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
|
|||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
|
||||||
|
|
||||||
/* >>> determine media type dependent blocking factor:
|
/* >>> determine media type dependent blocking factor:
|
||||||
2 kB for CD and disk , 32 kB for DVD, 64 kB for BD
|
2 kB for CD and disk , 32 kB for DVD, 64 kB for BD
|
||||||
eventually adjust min_block_size and read_chunk
|
eventually adjust min_block_size and read_chunk
|
||||||
@ -6806,6 +6819,7 @@ int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
|
|||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Xorriso_toc_to_string(xorriso, &toc_info, 4 * !job->map_with_volid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(job->data_to_path[0]) {
|
if(job->data_to_path[0]) {
|
||||||
@ -6925,7 +6939,7 @@ ex:;
|
|||||||
ret= Xorriso_spotlist_to_sectormap(xorriso, *spotlist, sector_size,
|
ret= Xorriso_spotlist_to_sectormap(xorriso, *spotlist, sector_size,
|
||||||
&(job->sector_map), 0);
|
&(job->sector_map), 0);
|
||||||
if(ret > 0) {
|
if(ret > 0) {
|
||||||
ret= Sectorbitmap_to_file(job->sector_map, job->sector_map_path,
|
ret= Sectorbitmap_to_file(job->sector_map, job->sector_map_path, toc_info,
|
||||||
xorriso->info_text, &os_errno, 0);
|
xorriso->info_text, &os_errno, 0);
|
||||||
if(ret <= 0) {
|
if(ret <= 0) {
|
||||||
if(xorriso->info_text[0])
|
if(xorriso->info_text[0])
|
||||||
@ -6934,6 +6948,8 @@ ex:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(toc_info != NULL)
|
||||||
|
free(toc_info);
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
Spotlist_destroy(spotlist, 0);
|
Spotlist_destroy(spotlist, 0);
|
||||||
return(ret);
|
return(ret);
|
||||||
|
@ -285,7 +285,7 @@ struct CheckmediajoB {
|
|||||||
int min_block_size; /* >>> not yet implemented:
|
int min_block_size; /* >>> not yet implemented:
|
||||||
granularity desired by user
|
granularity desired by user
|
||||||
*/
|
*/
|
||||||
int mode; /* >>> 0= track by track
|
int mode; /* 0= track by track
|
||||||
1= single sweep over libisoburn media capacity
|
1= single sweep over libisoburn media capacity
|
||||||
>>> 2= single sweep over libburn media capacity
|
>>> 2= single sweep over libburn media capacity
|
||||||
*/
|
*/
|
||||||
@ -299,6 +299,9 @@ struct CheckmediajoB {
|
|||||||
|
|
||||||
char sector_map_path[SfileadrL];
|
char sector_map_path[SfileadrL];
|
||||||
struct SectorbitmaP *sector_map;
|
struct SectorbitmaP *sector_map;
|
||||||
|
int map_with_volid; /* 0=add quick toc to map file,
|
||||||
|
1=read ISO heads for toc
|
||||||
|
*/
|
||||||
|
|
||||||
int retry; /* -1= only try full read_chunk, 1=retry with 2k blocks
|
int retry; /* -1= only try full read_chunk, 1=retry with 2k blocks
|
||||||
0= retry with CD, full chunk else
|
0= retry with CD, full chunk else
|
||||||
|
Loading…
Reference in New Issue
Block a user