New option -session_log
This commit is contained in:
parent
992996f902
commit
9992f64247
@ -326,6 +326,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
|||||||
|
|
||||||
if (new_img) {
|
if (new_img) {
|
||||||
iso_write_opts_set_ms_block(wopts, 0);
|
iso_write_opts_set_ms_block(wopts, 0);
|
||||||
|
opts->effective_lba= 0;
|
||||||
iso_write_opts_set_appendable(wopts, 0);
|
iso_write_opts_set_appendable(wopts, 0);
|
||||||
iso_write_opts_set_overwrite_buf(wopts, NULL);
|
iso_write_opts_set_overwrite_buf(wopts, NULL);
|
||||||
} else {
|
} else {
|
||||||
@ -343,6 +344,7 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc,
|
|||||||
{ret= -4; goto ex;}
|
{ret= -4; goto ex;}
|
||||||
}
|
}
|
||||||
iso_write_opts_set_ms_block(wopts, nwa);
|
iso_write_opts_set_ms_block(wopts, nwa);
|
||||||
|
opts->effective_lba= nwa;
|
||||||
iso_write_opts_set_appendable(wopts, 1);
|
iso_write_opts_set_appendable(wopts, 1);
|
||||||
iso_write_opts_set_overwrite_buf(wopts, o->target_iso_head);
|
iso_write_opts_set_overwrite_buf(wopts, o->target_iso_head);
|
||||||
}
|
}
|
||||||
@ -678,6 +680,7 @@ int isoburn_igopt_new(struct isoburn_imgen_opts **new_o, int flag)
|
|||||||
o->gid= 0;
|
o->gid= 0;
|
||||||
o->output_charset= 0;
|
o->output_charset= 0;
|
||||||
o->fifo_size= 4*1024*1024;
|
o->fifo_size= 4*1024*1024;
|
||||||
|
o->effective_lba= -1;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,3 +840,10 @@ int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba)
|
||||||
|
{
|
||||||
|
*lba= o->effective_lba;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,6 +319,13 @@ struct isoburn_imgen_opts {
|
|||||||
*/
|
*/
|
||||||
int fifo_size;
|
int fifo_size;
|
||||||
|
|
||||||
|
|
||||||
|
/** Output value: Block address of session start as evaluatedfrom media
|
||||||
|
and other options by libisoburn and libburn.
|
||||||
|
If <0 : Invalid
|
||||||
|
If >=0: Valid block number. Block size is always 2 KiB.
|
||||||
|
*/
|
||||||
|
int effective_lba;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* Isoburn_includeD */
|
#endif /* Isoburn_includeD */
|
||||||
|
@ -723,6 +723,18 @@ int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size);
|
|||||||
int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size);
|
int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size);
|
||||||
|
|
||||||
|
|
||||||
|
/** Obtain after image preparation the block address where the session will
|
||||||
|
start on media.
|
||||||
|
This value cannot be set by the application but only be inquired.
|
||||||
|
@since 0.1.4
|
||||||
|
@param o The option set to work on
|
||||||
|
@param lba The block number of the session start on media.
|
||||||
|
<0 means that no address has been determined yet.
|
||||||
|
@return 1 success, <=0 failure
|
||||||
|
*/
|
||||||
|
int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba);
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* End of Options for image generation */
|
/* End of Options for image generation */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
.\" First parameter, NAME, should be all caps
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
.TH XORRISO 1 "March, 29, 2008"
|
.TH XORRISO 1 "April, 3, 2008"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
@ -1559,6 +1559,17 @@ some input file arguments might not have been processed at all.
|
|||||||
The errfile paths are transported as messages of very low priority "ERRFILE".
|
The errfile paths are transported as messages of very low priority "ERRFILE".
|
||||||
This transport becomes visible with -report_about "ALL".
|
This transport becomes visible with -report_about "ALL".
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-session_log\fR path
|
||||||
|
If path is not empty it gives the address of a plain text file where
|
||||||
|
a log record gets appended after each session. This log can be used to
|
||||||
|
determine the start_lba of a session for mount option sbsector= from
|
||||||
|
date or volume id. With non-multi-session media this is currently the only
|
||||||
|
way to obtain this parameter.
|
||||||
|
.br
|
||||||
|
Record format is: timestamp start_lba size volume-id
|
||||||
|
.br
|
||||||
|
The first three items are single words, the rest of the line is the volume id.
|
||||||
|
.TP
|
||||||
\fB\-end\fR
|
\fB\-end\fR
|
||||||
.br
|
.br
|
||||||
End program immediately
|
End program immediately
|
||||||
@ -1849,11 +1860,12 @@ DVD-R, DVD+R if the full backup leaves substantial remaining capacity
|
|||||||
on media and if the expected changes are much smaller than the full backup.
|
on media and if the expected changes are much smaller than the full backup.
|
||||||
An update run will probably save no time but last longer than a full backup.
|
An update run will probably save no time but last longer than a full backup.
|
||||||
.br
|
.br
|
||||||
With overwriteable media like DVD+RW or disk files, the older backup versions
|
With \fBmount\fR option \fB"sbsector="\fR it is possible to access the session
|
||||||
cannot be retrieved. But with multi-session media and mount option "sbsector="
|
trees which represent the older backup versions. Multi-session media can tell
|
||||||
it is possible to access the session trees which represent the older backup
|
the sbsector by xorriso option -toc, as "data lba:". For other media one
|
||||||
versions. sbsector of a session is its "data lba:" number from xorriso
|
may set before writing a suitable path for xorriso option -session_log where
|
||||||
option -toc.
|
the sbsector number gets recorded as the second word in each line.
|
||||||
|
.br
|
||||||
With CD media, Linux mount accepts session numbers directly by its option
|
With CD media, Linux mount accepts session numbers directly by its option
|
||||||
"session=".
|
"session=".
|
||||||
.br
|
.br
|
||||||
|
@ -1491,6 +1491,7 @@ completed:;
|
|||||||
|
|
||||||
|
|
||||||
/* @param flag bit0=with year and seconds
|
/* @param flag bit0=with year and seconds
|
||||||
|
bit1=timestamp format YYYY.MM.DD.hhmmss
|
||||||
*/
|
*/
|
||||||
char *Ftimetxt(time_t t, char timetext[40], int flag)
|
char *Ftimetxt(time_t t, char timetext[40], int flag)
|
||||||
{
|
{
|
||||||
@ -1504,6 +1505,10 @@ char *Ftimetxt(time_t t, char timetext[40], int flag)
|
|||||||
rpt[0]= 0;
|
rpt[0]= 0;
|
||||||
if(tmpt==0)
|
if(tmpt==0)
|
||||||
sprintf(rpt+strlen(rpt), "%12.f", (double) t);
|
sprintf(rpt+strlen(rpt), "%12.f", (double) t);
|
||||||
|
else if (flag&2)
|
||||||
|
sprintf(rpt+strlen(rpt), "%4.4d.%2.2d.%2.2d.%2.2d%2.2d%2.2d",
|
||||||
|
1900+tms.tm_year, tms.tm_mon, tms.tm_mday,
|
||||||
|
tms.tm_hour, tms.tm_min, tms.tm_sec);
|
||||||
else if (flag&1)
|
else if (flag&1)
|
||||||
sprintf(rpt+strlen(rpt), "%2d %3s %4.4d %2.2d:%2.2d:%2.2d",
|
sprintf(rpt+strlen(rpt), "%2d %3s %4.4d %2.2d:%2.2d:%2.2d",
|
||||||
tms.tm_mday, months[tms.tm_mon], 1900+tms.tm_year,
|
tms.tm_mday, months[tms.tm_mon], 1900+tms.tm_year,
|
||||||
@ -2971,8 +2976,11 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|||||||
m->global_uid= 0;
|
m->global_uid= 0;
|
||||||
strcpy(m->volid, "ISOIMAGE");
|
strcpy(m->volid, "ISOIMAGE");
|
||||||
m->loaded_volid[0]= 0;
|
m->loaded_volid[0]= 0;
|
||||||
m->publisher[0]= 0;
|
|
||||||
m->volid_default= 1;
|
m->volid_default= 1;
|
||||||
|
m->publisher[0]= 0;
|
||||||
|
m->session_logfile[0]= 0;
|
||||||
|
m->session_lba= -1;
|
||||||
|
m->session_blocks= 0;
|
||||||
m->do_global_gid= 0;
|
m->do_global_gid= 0;
|
||||||
m->global_gid= 0;
|
m->global_gid= 0;
|
||||||
m->do_global_mode= 0;
|
m->do_global_mode= 0;
|
||||||
@ -4288,6 +4296,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
|||||||
if(!(is_default && no_defaults))
|
if(!(is_default && no_defaults))
|
||||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||||
|
|
||||||
|
is_default= (xorriso->session_logfile[0]==0);
|
||||||
|
sprintf(line,"-session_log %s\n",
|
||||||
|
Text_shellsafe(xorriso->session_logfile,sfe,0));
|
||||||
|
if(!(is_default && no_defaults))
|
||||||
|
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||||
|
|
||||||
is_default= (strcmp(xorriso->return_with_text,"SORRY")==0 &&
|
is_default= (strcmp(xorriso->return_with_text,"SORRY")==0 &&
|
||||||
xorriso->return_with_value==32);
|
xorriso->return_with_value==32);
|
||||||
sprintf(line,"-return_with %s %d\n",
|
sprintf(line,"-return_with %s %d\n",
|
||||||
@ -7761,6 +7775,37 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_write_session_log(struct XorrisO *xorriso, int flag)
|
||||||
|
{
|
||||||
|
FILE *fp= NULL;
|
||||||
|
char sfe[5*SfileadrL], timetext[40], *rpt, *wpt;
|
||||||
|
|
||||||
|
if(xorriso->session_logfile[0]==0)
|
||||||
|
return(2);
|
||||||
|
fp= fopen(xorriso->session_logfile, "a");
|
||||||
|
if(fp==0) {
|
||||||
|
sprintf(xorriso->info_text, "-session_log: Cannot open file %s",
|
||||||
|
Text_shellsafe(xorriso->session_logfile, sfe, 0));
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
wpt= sfe;
|
||||||
|
for(rpt= xorriso->volid; *rpt!=0; rpt++) {
|
||||||
|
if(*rpt=='\n') {
|
||||||
|
*(wpt++)= '\\';
|
||||||
|
*(wpt++)= 'n';
|
||||||
|
} else
|
||||||
|
*(wpt++)= *rpt;
|
||||||
|
}
|
||||||
|
*wpt= 0;
|
||||||
|
fprintf(fp, "%s %d %d %s\n",
|
||||||
|
Ftimetxt(time(0), timetext, 2), xorriso->session_lba,
|
||||||
|
xorriso->session_blocks, sfe);
|
||||||
|
fclose(fp);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------- Options API ------------------------ */
|
/* ---------------------------- Options API ------------------------ */
|
||||||
|
|
||||||
|
|
||||||
@ -8468,6 +8513,7 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
|
|||||||
Xorriso_process_errfile(xorriso, 0, "burn session end", 0, 1);
|
Xorriso_process_errfile(xorriso, 0, "burn session end", 0, 1);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
return(ret);
|
return(ret);
|
||||||
|
Xorriso_write_session_log(xorriso, 0);
|
||||||
xorriso->volset_change_pending= 0;
|
xorriso->volset_change_pending= 0;
|
||||||
xorriso->no_volset_present= 0;
|
xorriso->no_volset_present= 0;
|
||||||
if(flag&1)
|
if(flag&1)
|
||||||
@ -9520,7 +9566,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" exit_value may be 0 or 32 to 63.",
|
" exit_value may be 0 or 32 to 63.",
|
||||||
" -report_about severity Set the threshhold for events to be reported.",
|
" -report_about severity Set the threshhold for events to be reported.",
|
||||||
" Use -abort_on severities or: HINT, NOTE, UPDATE, DEBUG, ALL",
|
" Use -abort_on severities or: HINT, NOTE, UPDATE, DEBUG, ALL",
|
||||||
" -dialog after all arguments are processed, enter dialog mode.",
|
" -dialog After all arguments are processed, enter dialog mode.",
|
||||||
" In this mode you may enter searchtexts or any of the options",
|
" In this mode you may enter searchtexts or any of the options",
|
||||||
" described here. One per line.",
|
" described here. One per line.",
|
||||||
" -dialog_reset Revoke -dialog (works only if given as argument)",
|
" -dialog_reset Revoke -dialog (works only if given as argument)",
|
||||||
@ -9572,6 +9618,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" Wait for Enter key resp. for a line of input at stdin.",
|
" Wait for Enter key resp. for a line of input at stdin.",
|
||||||
" -errfile_log mode path|channel",
|
" -errfile_log mode path|channel",
|
||||||
" Log disk paths of files involved in problem events.",
|
" Log disk paths of files involved in problem events.",
|
||||||
|
" -session_log path",
|
||||||
|
" Set path of a file where a log record gets appended after",
|
||||||
|
" each session. Form: timestamp start_lba size volume-id",
|
||||||
" # any text Is ignored. In dialog mode the input line will be stored in",
|
" # any text Is ignored. In dialog mode the input line will be stored in",
|
||||||
" the eventual readline history, nevertheless.",
|
" the eventual readline history, nevertheless.",
|
||||||
" -version Tell program and version number",
|
" -version Tell program and version number",
|
||||||
@ -10508,6 +10557,15 @@ int Xorriso_option_rollback(struct XorrisO *xorriso, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Option -session_log */
|
||||||
|
int Xorriso_option_session_log(struct XorrisO *xorriso, char *path, int flag)
|
||||||
|
{
|
||||||
|
if(Sfile_str(xorriso->session_logfile, path, 0)<=0)
|
||||||
|
return(-1);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Option -speed */
|
/* Option -speed */
|
||||||
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
|
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
|
||||||
{
|
{
|
||||||
@ -11244,6 +11302,10 @@ next_command:;
|
|||||||
if(end_ret!=2)
|
if(end_ret!=2)
|
||||||
{ret= 3; goto ex;}
|
{ret= 3; goto ex;}
|
||||||
|
|
||||||
|
} else if(strcmp(cmd,"session_log")==0) {
|
||||||
|
(*idx)++;
|
||||||
|
ret= Xorriso_option_session_log(xorriso, arg1, 0);
|
||||||
|
|
||||||
} else if(strcmp(cmd,"speed")==0) {
|
} else if(strcmp(cmd,"speed")==0) {
|
||||||
(*idx)++;
|
(*idx)++;
|
||||||
ret= Xorriso_option_speed(xorriso, arg1, 0);
|
ret= Xorriso_option_speed(xorriso, arg1, 0);
|
||||||
|
@ -104,6 +104,10 @@ struct XorrisO { /* the global context of xorriso */
|
|||||||
|
|
||||||
char publisher[129];
|
char publisher[129];
|
||||||
|
|
||||||
|
char session_logfile[SfileadrL];
|
||||||
|
int session_lba;
|
||||||
|
int session_blocks;
|
||||||
|
|
||||||
/* >>> put libburn/isoburn aspects here */
|
/* >>> put libburn/isoburn aspects here */
|
||||||
|
|
||||||
char indev[SfileadrL];
|
char indev[SfileadrL];
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.04.01.213121"
|
#define Xorriso_timestamP "2008.04.03.204051"
|
||||||
|
@ -959,6 +959,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
|||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||||
{ret= 0; goto ex;}
|
{ret= 0; goto ex;}
|
||||||
}
|
}
|
||||||
|
isoburn_igopt_get_effective_lba(sopts, &(xorriso->session_lba));
|
||||||
|
|
||||||
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
|
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
@ -995,10 +996,11 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
|||||||
tracks= burn_session_get_tracks(sessions[0], &num_tracks);
|
tracks= burn_session_get_tracks(sessions[0], &num_tracks);
|
||||||
if(tracks!=NULL && num_tracks>0) {
|
if(tracks!=NULL && num_tracks>0) {
|
||||||
burn_track_get_counters(tracks[0],&readcounter,&writecounter);
|
burn_track_get_counters(tracks[0],&readcounter,&writecounter);
|
||||||
|
xorriso->session_blocks= (int) (writecounter/ (off_t) 2048);
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"ISO image produced: %d sectors. Written to media: %d sectors\n",
|
"ISO image produced: %d sectors. Written to media: %d sectors at LBA %d\n",
|
||||||
(int) (readcounter/ (off_t) 2048),
|
(int) (readcounter/ (off_t) 2048),
|
||||||
(int) (writecounter/ (off_t) 2048));
|
xorriso->session_blocks, xorriso->session_lba);
|
||||||
Xorriso_info(xorriso, 0);
|
Xorriso_info(xorriso, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user