New option -check_media_defaults
This commit is contained in:
parent
62dbe3cbd0
commit
0be7fe3329
@ -1735,9 +1735,25 @@ Try to read data blocks from the indev drive, eventually copy them to a
|
|||||||
disk file, and finally report about the encountered quality. Several options
|
disk file, and finally report about the encountered quality. Several options
|
||||||
may be used to modify the default behavior.
|
may be used to modify the default behavior.
|
||||||
.br
|
.br
|
||||||
An option consists of a keyword, a "=" character, and a value.
|
The options given with this command override the default settings which
|
||||||
|
may have been changed by option -check_media_defaults. See there for a
|
||||||
|
description of options.
|
||||||
.br
|
.br
|
||||||
Default is:
|
The result list tells intervals of 2 KiB blocks with start address, number
|
||||||
|
of blocks and quality. Qualities which begin with "+" are
|
||||||
|
supposed to be valid readable data. Qualities with "-" are no valid data.
|
||||||
|
.br
|
||||||
|
Alternatively it is possible to report damaged files rather than blocks.
|
||||||
|
.TP
|
||||||
|
\fB\-check_media_defaults\fR [option [option ...]] --
|
||||||
|
Preset options for runs of -check_media, -extract_cut and best_effort
|
||||||
|
file extraction. Eventual options given with -check_media will override the
|
||||||
|
preset options. -extract_cut will override some options automatically.
|
||||||
|
.br
|
||||||
|
An option consists of a keyword, a "=" character, and a value. Options
|
||||||
|
may override each other. So their sequence matters.
|
||||||
|
.br
|
||||||
|
The default setting at program start is:
|
||||||
.br
|
.br
|
||||||
use=indev what=tracks min_lba=-1 max_lba=-1 retry=default
|
use=indev what=tracks min_lba=-1 max_lba=-1 retry=default
|
||||||
time_limit=28800 item_limit=100000
|
time_limit=28800 item_limit=100000
|
||||||
@ -1746,11 +1762,9 @@ abort_file=/var/opt/xorriso/do_abort_check_media
|
|||||||
.br
|
.br
|
||||||
data_to='' sector_map='' map_with_volid=off patch_lba0=off report=blocks
|
data_to='' sector_map='' map_with_volid=off patch_lba0=off report=blocks
|
||||||
.br
|
.br
|
||||||
Non-default settings:
|
Option "reset=now" restores these startup defaults.
|
||||||
.br
|
.br
|
||||||
The result list tells intervals of 2 KiB blocks with start address, number
|
Non-default options are:
|
||||||
of blocks and quality. Qualities which begin with "+" are
|
|
||||||
supposed to be valid readable data. Qualities with "-" are no valid data.
|
|
||||||
.br
|
.br
|
||||||
"report=files" lists the files which use damaged blocks (not with use=outdev).
|
"report=files" lists the files which use damaged blocks (not with use=outdev).
|
||||||
The format is like with find -exec report_damage.
|
The format is like with find -exec report_damage.
|
||||||
@ -1887,7 +1901,8 @@ The data bytes of iso_rr_path need to be already stored in the loaded ISO image
|
|||||||
and byte_offset must be a multiple of 2048, e.g. an integer with suffix
|
and byte_offset must be a multiple of 2048, e.g. an integer with suffix
|
||||||
s, m, or g.
|
s, m, or g.
|
||||||
.br
|
.br
|
||||||
This option is implemented by a special run of -check_media.
|
This option is implemented by a special run of -check_media and governed by
|
||||||
|
most of the options which can be set iby -check_media_defaults.
|
||||||
Its main purpose is to allow handling of large files if they are not supported
|
Its main purpose is to allow handling of large files if they are not supported
|
||||||
by mount -t iso9660 and if the reading system is unable to buffer them as
|
by mount -t iso9660 and if the reading system is unable to buffer them as
|
||||||
a whole.
|
a whole.
|
||||||
|
@ -3253,6 +3253,32 @@ int Checkmediajob_destroy(struct CheckmediajoB **o, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Checkmediajob_copy(struct CheckmediajoB *from, struct CheckmediajoB *to,
|
||||||
|
int flag)
|
||||||
|
{
|
||||||
|
to->use_dev= from->use_dev;
|
||||||
|
to->min_lba= from->min_lba;
|
||||||
|
to->max_lba= from->max_lba;
|
||||||
|
to->min_block_size= from->min_block_size;
|
||||||
|
to->mode= from->mode;
|
||||||
|
to->time_limit= from->time_limit;
|
||||||
|
to->item_limit= from->item_limit;
|
||||||
|
strcpy(to->abort_file_path, from->abort_file_path);
|
||||||
|
strcpy(to->data_to_path, from->data_to_path);
|
||||||
|
/* not copied: data_to_fd */
|
||||||
|
to->data_to_offset= from->data_to_offset;
|
||||||
|
to->data_to_limit= from->data_to_limit;
|
||||||
|
to->patch_lba0= from->patch_lba0;
|
||||||
|
to->patch_lba0_msc1= from->patch_lba0_msc1;
|
||||||
|
strcpy(to->sector_map_path, from->sector_map_path);
|
||||||
|
/* not copied: sector_map */
|
||||||
|
to->map_with_volid= from->map_with_volid;
|
||||||
|
to->retry= from->retry;
|
||||||
|
to->report_mode= from->report_mode;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------- End CheckmediajoB --------------------------- */
|
/* -------------------------- End CheckmediajoB --------------------------- */
|
||||||
|
|
||||||
/* ------------------------------- Xorriso -------------------------------- */
|
/* ------------------------------- Xorriso -------------------------------- */
|
||||||
@ -3327,6 +3353,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|||||||
m->volset_change_pending= 0;
|
m->volset_change_pending= 0;
|
||||||
m->no_volset_present= 0;
|
m->no_volset_present= 0;
|
||||||
m->in_sector_map= NULL;
|
m->in_sector_map= NULL;
|
||||||
|
m->check_media_default= NULL;
|
||||||
m->outdev[0]= 0;
|
m->outdev[0]= 0;
|
||||||
m->out_drive_handle= NULL;
|
m->out_drive_handle= NULL;
|
||||||
m->dev_fd_1= -1;
|
m->dev_fd_1= -1;
|
||||||
@ -4595,6 +4622,217 @@ bit1= do only report to fp
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_check_media_setup_job(struct XorrisO *xorriso,
|
||||||
|
struct CheckmediajoB *job,
|
||||||
|
char **argv, int old_idx, int end_idx, int flag)
|
||||||
|
{
|
||||||
|
int ret, i;
|
||||||
|
double num;
|
||||||
|
struct CheckmediajoB *default_job;
|
||||||
|
|
||||||
|
if(xorriso->check_media_default != NULL)
|
||||||
|
Checkmediajob_copy(xorriso->check_media_default, job, 0);
|
||||||
|
for(i= old_idx; i < end_idx; i++) {
|
||||||
|
if(strncmp(argv[i], "abort_file=", 11) == 0) {
|
||||||
|
ret= Sfile_str(job->abort_file_path, argv[i] + 11, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
|
} else if(strncmp(argv[i], "data_to=", 8) == 0) {
|
||||||
|
ret= Sfile_str(job->data_to_path, argv[i] + 8, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
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 ||
|
||||||
|
strncmp(argv[i], "min_lba=", 8) == 0) {
|
||||||
|
num= -1;
|
||||||
|
sscanf(argv[i] + 8, "%lf", &num);
|
||||||
|
if(num > 0x7fffffff || num < 0)
|
||||||
|
num= -1;
|
||||||
|
if(strncmp(argv[i], "max_lba=", 8) == 0)
|
||||||
|
job->max_lba= num;
|
||||||
|
else
|
||||||
|
job->min_lba= num;
|
||||||
|
} else if(strncmp(argv[i], "patch_lba0=", 11) == 0) {
|
||||||
|
job->patch_lba0_msc1= -1;
|
||||||
|
if(strcmp(argv[i] + 11, "on") == 0)
|
||||||
|
job->patch_lba0= 1;
|
||||||
|
else if(strcmp(argv[i] + 11, "off") == 0)
|
||||||
|
job->patch_lba0= 0;
|
||||||
|
else if(strcmp(argv[i] + 11, "force") == 0)
|
||||||
|
job->patch_lba0= 2;
|
||||||
|
else if(argv[i][11] >= '1' && argv[i][11] <= '9') {
|
||||||
|
num= -1;
|
||||||
|
sscanf(argv[i] + 11, "%lf", &num);
|
||||||
|
if(num > 0x7fffffff || num < 0)
|
||||||
|
goto unknown_value;
|
||||||
|
job->patch_lba0_msc1= num;
|
||||||
|
job->patch_lba0= (num >= 32) + (strstr(argv[i] + 11, ":force") != NULL);
|
||||||
|
} else
|
||||||
|
goto unknown_value;
|
||||||
|
} else if(strncmp(argv[i], "report=", 7) == 0) {
|
||||||
|
if(strcmp(argv[i] + 7, "blocks") == 0)
|
||||||
|
job->report_mode= 0;
|
||||||
|
else if(strcmp(argv[i] + 7, "files") == 0)
|
||||||
|
job->report_mode= 1;
|
||||||
|
else if(strcmp(argv[i] + 7, "blocks_files") == 0)
|
||||||
|
job->report_mode= 2;
|
||||||
|
else
|
||||||
|
goto unknown_value;
|
||||||
|
} else if(strcmp(argv[i], "reset=now") == 0) {
|
||||||
|
ret= Checkmediajob_new(&default_job, 0);
|
||||||
|
if(ret <= 0) {
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"-check_media: Cannot reset optionis due to lack of resources");
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||||
|
ret= -1; goto ex;
|
||||||
|
}
|
||||||
|
Checkmediajob_copy(default_job, job, 0);
|
||||||
|
Checkmediajob_destroy(&default_job, 0);
|
||||||
|
} else if(strncmp(argv[i], "retry=", 6) == 0) {
|
||||||
|
if(strcmp(argv[i] + 6, "on") == 0)
|
||||||
|
job->retry= 1;
|
||||||
|
else if(strcmp(argv[i] + 6, "off") == 0)
|
||||||
|
job->retry= -1;
|
||||||
|
else if(strcmp(argv[i] + 6, "default") == 0)
|
||||||
|
job->retry= 0;
|
||||||
|
else
|
||||||
|
goto unknown_value;
|
||||||
|
} else if(strncmp(argv[i], "sector_map=", 11) == 0) {
|
||||||
|
ret= Sfile_str(job->sector_map_path, argv[i] + 11, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
|
} else if(strncmp(argv[i], "time_limit=", 11) == 0 ||
|
||||||
|
strncmp(argv[i], "item_limit=", 11) == 0 ) {
|
||||||
|
num= -1;
|
||||||
|
sscanf(argv[i] + 11, "%lf", &num);
|
||||||
|
if(num > 0x7fffffff || num < 0)
|
||||||
|
num= -1;
|
||||||
|
if(strncmp(argv[i], "time_limit=", 11) == 0)
|
||||||
|
job->time_limit= num;
|
||||||
|
else
|
||||||
|
job->item_limit= num;
|
||||||
|
} else if(strncmp(argv[i], "use=", 4) == 0) {
|
||||||
|
if(strcmp(argv[i] + 4, "outdev") == 0)
|
||||||
|
job->use_dev= 1;
|
||||||
|
else if(strcmp(argv[i] + 4, "indev") == 0)
|
||||||
|
job->use_dev= 0;
|
||||||
|
else if(strcmp(argv[i] + 4, "sector_map") == 0)
|
||||||
|
job->use_dev= 2;
|
||||||
|
else
|
||||||
|
goto unknown_value;
|
||||||
|
} else if(strncmp(argv[i], "what=", 5) == 0) {
|
||||||
|
if(strcmp(argv[i]+5, "tracks") == 0)
|
||||||
|
job->mode= 0;
|
||||||
|
else if(strcmp(argv[i]+5, "disc")== 0)
|
||||||
|
job->mode= 1;
|
||||||
|
else {
|
||||||
|
unknown_value:;
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"-check_media: Unknown value with option %s", argv[i]);
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||||
|
ret= 0; goto ex;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sprintf(xorriso->info_text, "-check_media: Unknown option '%s'", argv[i]);
|
||||||
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||||
|
ret= 0; goto ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret= 1;
|
||||||
|
ex:;
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param report Buffer of at least 10*SfileadrL
|
||||||
|
@param flag bit0= only report non-default settings
|
||||||
|
@return <=0 error , 1 ok , 2 with bit0: every option is on default setting
|
||||||
|
*/
|
||||||
|
int Xorriso_check_media_list_job(struct XorrisO *xorriso,
|
||||||
|
struct CheckmediajoB *job,
|
||||||
|
char *report, int flag)
|
||||||
|
{
|
||||||
|
int all, ret;
|
||||||
|
struct CheckmediajoB *dflt= NULL;
|
||||||
|
|
||||||
|
all= !(flag&1);
|
||||||
|
report[0]= 0;
|
||||||
|
ret= Checkmediajob_new(&dflt, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
return(-1);
|
||||||
|
sprintf(report, "-check_media_defaults");
|
||||||
|
if(!all)
|
||||||
|
strcat(report, " reset=now");
|
||||||
|
if(all || job->use_dev != dflt->use_dev)
|
||||||
|
sprintf(report + strlen(report), " use=%s",
|
||||||
|
job->use_dev == 1 ? "outdev" :
|
||||||
|
job->use_dev == 2 ? "sector_map" : "indev");
|
||||||
|
if(all || job->mode != dflt->mode)
|
||||||
|
sprintf(report + strlen(report), " what=%s",
|
||||||
|
job->mode == 1 ? "disc" : "tracks");
|
||||||
|
if(all || job->min_lba != dflt->min_lba)
|
||||||
|
sprintf(report + strlen(report), " min_lba=%d", job->min_lba);
|
||||||
|
if(all || job->max_lba != dflt->max_lba)
|
||||||
|
sprintf(report + strlen(report), " max_lba=%d", job->max_lba);
|
||||||
|
if(all || job->retry != dflt->retry)
|
||||||
|
sprintf(report + strlen(report), " retry=%s",
|
||||||
|
job->retry == 1 ? "on" : job->retry == -1 ? "off" : "default");
|
||||||
|
if(all || job->time_limit != dflt->time_limit)
|
||||||
|
sprintf(report + strlen(report), " time_limit=%d", job->time_limit);
|
||||||
|
if(all || job->item_limit != dflt->item_limit)
|
||||||
|
sprintf(report + strlen(report), " item_limit=%d", job->item_limit);
|
||||||
|
if(all || strcmp(job->abort_file_path, dflt->abort_file_path)) {
|
||||||
|
strcat(report, " abort_file=");
|
||||||
|
Text_shellsafe(job->abort_file_path, report + strlen(report), 0);
|
||||||
|
}
|
||||||
|
if(strlen(report) > 4 * SfileadrL)
|
||||||
|
{ret= 0; goto ex;}
|
||||||
|
if(all || strcmp(job->data_to_path, dflt->data_to_path)) {
|
||||||
|
strcat(report, " data_to=");
|
||||||
|
Text_shellsafe(job->data_to_path, report + strlen(report), 0);
|
||||||
|
}
|
||||||
|
if(strlen(report) > 4 * SfileadrL)
|
||||||
|
{ret= 0; goto ex;}
|
||||||
|
if(all || strcmp(job->sector_map_path, dflt->sector_map_path)) {
|
||||||
|
strcat(report, " sector_map=");
|
||||||
|
Text_shellsafe(job->sector_map_path, report + strlen(report), 0);
|
||||||
|
}
|
||||||
|
if(all || job->map_with_volid != dflt->map_with_volid)
|
||||||
|
sprintf(report + strlen(report), " map_with_volid=%s",
|
||||||
|
job->map_with_volid == 1 ? "on" : "off");
|
||||||
|
if(all || job->patch_lba0 != dflt->patch_lba0) {
|
||||||
|
sprintf(report + strlen(report), " patch_lba0=");
|
||||||
|
if(job->patch_lba0 == 0)
|
||||||
|
sprintf(report + strlen(report), "off");
|
||||||
|
else if(job->patch_lba0_msc1 >= 0)
|
||||||
|
sprintf(report + strlen(report), "%d%s",
|
||||||
|
job->patch_lba0_msc1, job->patch_lba0 == 2 ? ":force" : "");
|
||||||
|
else
|
||||||
|
sprintf(report + strlen(report), "%s",
|
||||||
|
job->patch_lba0 == 2 ? "force" : "on");
|
||||||
|
}
|
||||||
|
if(all || job->report_mode != dflt->report_mode)
|
||||||
|
sprintf(report + strlen(report), " report=%s",
|
||||||
|
job->report_mode == 0 ? "blocks" :
|
||||||
|
job->report_mode == 1 ? "files" : "blocks_files");
|
||||||
|
if(strlen(report) > 4 * SfileadrL)
|
||||||
|
{ret= 0; goto ex;}
|
||||||
|
ret= 1;
|
||||||
|
ex:;
|
||||||
|
strcat(report, " --");
|
||||||
|
Checkmediajob_destroy(&dflt, 0);
|
||||||
|
if(ret > 0 && strcmp(report, "-check_media_defaults reset=now --") == 0)
|
||||||
|
return(2);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||||
/*
|
/*
|
||||||
bit0= do only report non-default settings
|
bit0= do only report non-default settings
|
||||||
@ -4660,6 +4898,18 @@ 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);
|
||||||
|
|
||||||
|
if(xorriso->check_media_default == NULL) {
|
||||||
|
is_default= 1;
|
||||||
|
sprintf(line, "-check_media_defaults --\n");
|
||||||
|
} else {
|
||||||
|
ret= Xorriso_check_media_list_job(xorriso, xorriso->check_media_default,
|
||||||
|
line, no_defaults);
|
||||||
|
is_default= (ret == 2);
|
||||||
|
strcat(line, "\n");
|
||||||
|
}
|
||||||
|
if(!(is_default && no_defaults))
|
||||||
|
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||||
|
|
||||||
is_default= (xorriso->img_read_error_mode==2);
|
is_default= (xorriso->img_read_error_mode==2);
|
||||||
treatment= "best_effort";
|
treatment= "best_effort";
|
||||||
if(xorriso->img_read_error_mode==1)
|
if(xorriso->img_read_error_mode==1)
|
||||||
@ -9647,7 +9897,6 @@ int Xorriso_option_check_media(struct XorrisO *xorriso,
|
|||||||
int ret, i, count, lba, blocks, quality;
|
int ret, i, count, lba, blocks, quality;
|
||||||
int end_idx, old_idx, os_errno;
|
int end_idx, old_idx, os_errno;
|
||||||
char quality_name[80], head_buffer[64*1024];
|
char quality_name[80], head_buffer[64*1024];
|
||||||
double num;
|
|
||||||
struct SpotlisT *spotlist= NULL;
|
struct SpotlisT *spotlist= NULL;
|
||||||
struct CheckmediajoB *job= NULL;
|
struct CheckmediajoB *job= NULL;
|
||||||
struct FindjoB *findjob= NULL;
|
struct FindjoB *findjob= NULL;
|
||||||
@ -9660,109 +9909,9 @@ int Xorriso_option_check_media(struct XorrisO *xorriso,
|
|||||||
ret= Checkmediajob_new(&job, 0);
|
ret= Checkmediajob_new(&job, 0);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
ret= Xorriso_check_media_setup_job(xorriso, job, argv, old_idx, end_idx, 0);
|
||||||
for(i= old_idx; i < end_idx; i++) {
|
if(ret <= 0)
|
||||||
if(strncmp(argv[i], "abort_file=", 11) == 0) {
|
goto ex;
|
||||||
ret= Sfile_str(job->abort_file_path, argv[i] + 11, 0);
|
|
||||||
if(ret <= 0)
|
|
||||||
goto ex;
|
|
||||||
} else if(strncmp(argv[i], "data_to=", 8) == 0) {
|
|
||||||
ret= Sfile_str(job->data_to_path, argv[i] + 8, 0);
|
|
||||||
if(ret <= 0)
|
|
||||||
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 ||
|
|
||||||
strncmp(argv[i], "min_lba=", 8) == 0) {
|
|
||||||
num= -1;
|
|
||||||
sscanf(argv[i] + 8, "%lf", &num);
|
|
||||||
if(num > 0x7fffffff || num < 0)
|
|
||||||
num= -1;
|
|
||||||
if(strncmp(argv[i], "max_lba=", 8) == 0)
|
|
||||||
job->max_lba= num;
|
|
||||||
else
|
|
||||||
job->min_lba= num;
|
|
||||||
} else if(strncmp(argv[i], "patch_lba0=", 11) == 0) {
|
|
||||||
job->patch_lba0_msc1= -1;
|
|
||||||
if(strcmp(argv[i] + 11, "on") == 0)
|
|
||||||
job->patch_lba0= 1;
|
|
||||||
else if(strcmp(argv[i] + 11, "off") == 0)
|
|
||||||
job->patch_lba0= 0;
|
|
||||||
else if(strcmp(argv[i] + 11, "force") == 0)
|
|
||||||
job->patch_lba0= 2;
|
|
||||||
else if(argv[i][11] >= '1' && argv[i][11] <= '9') {
|
|
||||||
num= -1;
|
|
||||||
sscanf(argv[i] + 11, "%lf", &num);
|
|
||||||
if(num > 0x7fffffff || num < 0)
|
|
||||||
goto unknown_value;
|
|
||||||
job->patch_lba0_msc1= num;
|
|
||||||
job->patch_lba0= (num >= 32) + (strstr(argv[i] + 11, ":force") != NULL);
|
|
||||||
} else
|
|
||||||
goto unknown_value;
|
|
||||||
} else if(strncmp(argv[i], "report=", 7) == 0) {
|
|
||||||
if(strcmp(argv[i] + 7, "blocks") == 0)
|
|
||||||
job->report_mode= 0;
|
|
||||||
else if(strcmp(argv[i] + 7, "files") == 0)
|
|
||||||
job->report_mode= 1;
|
|
||||||
else if(strcmp(argv[i] + 7, "blocks_files") == 0)
|
|
||||||
job->report_mode= 2;
|
|
||||||
else
|
|
||||||
goto unknown_value;
|
|
||||||
} else if(strncmp(argv[i], "retry=", 6) == 0) {
|
|
||||||
if(strcmp(argv[i] + 6, "on") == 0)
|
|
||||||
job->retry= 1;
|
|
||||||
else if(strcmp(argv[i] + 6, "off") == 0)
|
|
||||||
job->retry= -1;
|
|
||||||
else if(strcmp(argv[i] + 6, "default") == 0)
|
|
||||||
job->retry= 0;
|
|
||||||
else
|
|
||||||
goto unknown_value;
|
|
||||||
} else if(strncmp(argv[i], "sector_map=", 11) == 0) {
|
|
||||||
ret= Sfile_str(job->sector_map_path, argv[i] + 11, 0);
|
|
||||||
if(ret <= 0)
|
|
||||||
goto ex;
|
|
||||||
} else if(strncmp(argv[i], "time_limit=", 11) == 0 ||
|
|
||||||
strncmp(argv[i], "item_limit=", 11) == 0 ) {
|
|
||||||
num= -1;
|
|
||||||
sscanf(argv[i] + 11, "%lf", &num);
|
|
||||||
if(num > 0x7fffffff || num < 0)
|
|
||||||
num= -1;
|
|
||||||
if(strncmp(argv[i], "time_limit=", 11) == 0)
|
|
||||||
job->time_limit= num;
|
|
||||||
else
|
|
||||||
job->item_limit= num;
|
|
||||||
} else if(strncmp(argv[i], "use=", 4) == 0) {
|
|
||||||
if(strcmp(argv[i] + 4, "outdev") == 0)
|
|
||||||
job->use_dev= 1;
|
|
||||||
else if(strcmp(argv[i] + 4, "indev") == 0)
|
|
||||||
job->use_dev= 0;
|
|
||||||
else if(strcmp(argv[i] + 4, "sector_map") == 0)
|
|
||||||
job->use_dev= 2;
|
|
||||||
else
|
|
||||||
goto unknown_value;
|
|
||||||
} else if(strncmp(argv[i], "what=", 5) == 0) {
|
|
||||||
if(strcmp(argv[i]+5, "tracks") == 0)
|
|
||||||
job->mode= 0;
|
|
||||||
else if(strcmp(argv[i]+5, "disc")== 0)
|
|
||||||
job->mode= 1;
|
|
||||||
else {
|
|
||||||
unknown_value:;
|
|
||||||
sprintf(xorriso->info_text,
|
|
||||||
"-check_media: Unknown value with option %s", argv[i]);
|
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
||||||
ret= 0; goto ex;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sprintf(xorriso->info_text, "-check_media: Unknown option '%s'", argv[i]);
|
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
||||||
ret= 0; goto ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((job->report_mode == 1 || job->report_mode == 2) && job->use_dev == 1) {
|
if((job->report_mode == 1 || job->report_mode == 2) && job->use_dev == 1) {
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
@ -9855,6 +10004,33 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Option -check_media_defaults */
|
||||||
|
int Xorriso_option_check_media_defaults(struct XorrisO *xorriso,
|
||||||
|
int argc, char **argv, int *idx, int flag)
|
||||||
|
{
|
||||||
|
int ret, old_idx, end_idx;
|
||||||
|
struct CheckmediajoB *job= NULL;
|
||||||
|
|
||||||
|
old_idx= *idx;
|
||||||
|
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
|
||||||
|
(*idx)= end_idx;
|
||||||
|
|
||||||
|
ret= Checkmediajob_new(&job, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
|
ret= Xorriso_check_media_setup_job(xorriso, job, argv, old_idx, end_idx, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto ex;
|
||||||
|
Checkmediajob_destroy(&(xorriso->check_media_default), 0);
|
||||||
|
xorriso->check_media_default= job;
|
||||||
|
job= NULL;
|
||||||
|
ret= 1;
|
||||||
|
ex:;
|
||||||
|
Checkmediajob_destroy(&job, 0);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */
|
/* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */
|
||||||
/* @param flag bit0=recursive (-chgrp_r)
|
/* @param flag bit0=recursive (-chgrp_r)
|
||||||
*/
|
*/
|
||||||
@ -10738,8 +10914,8 @@ int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path,
|
|||||||
|
|
||||||
|
|
||||||
/* Option -extract_cut */
|
/* Option -extract_cut */
|
||||||
int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *isorr_path,
|
int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path,
|
||||||
char *start, char *count, char *disk_path, int flag)
|
char *start, char *count, char *disk_path, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
double num;
|
double num;
|
||||||
@ -10766,10 +10942,10 @@ int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *isorr_path,
|
|||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"-extract_cut from %s , byte %.f to %.f, and store as %s",
|
"-extract_cut from %s , byte %.f to %.f, and store as %s",
|
||||||
disk_path, (double) startbyte, (double) (startbyte+bytecount),
|
disk_path, (double) startbyte, (double) (startbyte+bytecount),
|
||||||
isorr_path);
|
iso_rr_path);
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||||
|
|
||||||
ret= Xorriso_extract_cut(xorriso, isorr_path, disk_path,
|
ret= Xorriso_extract_cut(xorriso, iso_rr_path, disk_path,
|
||||||
startbyte, bytecount, 0);
|
startbyte, bytecount, 0);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@ -11445,6 +11621,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" Like -extract but with directory do not restore sub tree.",
|
" Like -extract but with directory do not restore sub tree.",
|
||||||
" -extract_cut iso_rr_path byte_offset byte_count disk_path",
|
" -extract_cut iso_rr_path byte_offset byte_count disk_path",
|
||||||
" Copy a byte interval from iso_rr_path to disk_path.",
|
" Copy a byte interval from iso_rr_path to disk_path.",
|
||||||
|
" This is governed in part by -check_media_defaults.",
|
||||||
" -cpx iso_rr_path [***] disk_path",
|
" -cpx iso_rr_path [***] disk_path",
|
||||||
" Copy leaf file objects from ISO image to disk filesystem.",
|
" Copy leaf file objects from ISO image to disk filesystem.",
|
||||||
" -cpax iso_rr_path [***] disk_path",
|
" -cpax iso_rr_path [***] disk_path",
|
||||||
@ -11467,6 +11644,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" sector_map=filepath , map_with_volid=on|off ,",
|
" sector_map=filepath , map_with_volid=on|off ,",
|
||||||
" patch_lba0=on|off|force|blockadr[:force] ,",
|
" patch_lba0=on|off|force|blockadr[:force] ,",
|
||||||
" report=blocks|files|blocks_files",
|
" report=blocks|files|blocks_files",
|
||||||
|
" -check_media_defaults [options] --",
|
||||||
|
" Preset options for runs of -check_media and -extract_cut.",
|
||||||
"",
|
"",
|
||||||
"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|",
|
||||||
@ -13523,7 +13702,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
|||||||
};
|
};
|
||||||
static char argn_commands[][40]= {
|
static char argn_commands[][40]= {
|
||||||
"add","as",
|
"add","as",
|
||||||
"check_media","chgrp","chgrpi","chgrp_r","chgrp_ri","chmod","chmodi",
|
"check_media","check_media_defaults",
|
||||||
|
"chgrp","chgrpi","chgrp_r","chgrp_ri","chmod","chmodi",
|
||||||
"chmod_r","chmod_ri","chown","chowni","chown_r","chown_ri",
|
"chmod_r","chmod_ri","chown","chowni","chown_r","chown_ri",
|
||||||
"compare_l","cpr","cpri","cp_rax","cp_rx","cpax","cpx",
|
"compare_l","cpr","cpri","cp_rax","cp_rx","cpax","cpx",
|
||||||
"du","dui","dus","dusi","dux","dusx","extract_l",
|
"du","dui","dus","dusi","dux","dusx","extract_l",
|
||||||
@ -13692,6 +13872,9 @@ next_command:;
|
|||||||
} else if(strcmp(cmd,"check_media")==0) {
|
} else if(strcmp(cmd,"check_media")==0) {
|
||||||
ret= Xorriso_option_check_media(xorriso, argc, argv, idx, 0);
|
ret= Xorriso_option_check_media(xorriso, argc, argv, idx, 0);
|
||||||
|
|
||||||
|
} else if(strcmp(cmd,"check_media_defaults")==0) {
|
||||||
|
ret= Xorriso_option_check_media_defaults(xorriso, argc, argv, idx, 0);
|
||||||
|
|
||||||
} else if(strcmp(cmd,"chgrp")==0 || strcmp(cmd,"chgrpi")==0) {
|
} else if(strcmp(cmd,"chgrp")==0 || strcmp(cmd,"chgrpi")==0) {
|
||||||
(*idx)+= 1;
|
(*idx)+= 1;
|
||||||
ret= Xorriso_option_chgrpi(xorriso, arg1, argc, argv, idx, 0);
|
ret= Xorriso_option_chgrpi(xorriso, arg1, argc, argv, idx, 0);
|
||||||
|
@ -305,6 +305,10 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag);
|
|||||||
int Xorriso_option_check_media(struct XorrisO *xorriso,
|
int Xorriso_option_check_media(struct XorrisO *xorriso,
|
||||||
int argc, char **argv, int *idx, int flag);
|
int argc, char **argv, int *idx, int flag);
|
||||||
|
|
||||||
|
/* Option -check_media_defaults */
|
||||||
|
int Xorriso_option_check_media_defaults(struct XorrisO *xorriso,
|
||||||
|
int argc, char **argv, int *idx, int flag);
|
||||||
|
|
||||||
/* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */
|
/* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */
|
||||||
/* @param flag bit0=recursive (-chgrp_r)
|
/* @param flag bit0=recursive (-chgrp_r)
|
||||||
*/
|
*/
|
||||||
@ -410,6 +414,10 @@ int Xorriso_option_error_behavior(struct XorrisO *xorriso,
|
|||||||
int Xorriso_option_extract(struct XorrisO *xorriso, char *disk_path,
|
int Xorriso_option_extract(struct XorrisO *xorriso, char *disk_path,
|
||||||
char *iso_path, int flag);
|
char *iso_path, int flag);
|
||||||
|
|
||||||
|
/* Option -extract_cut */
|
||||||
|
int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path,
|
||||||
|
char *start, char *count, char *disk_path, int flag);
|
||||||
|
|
||||||
/* Option -follow */
|
/* Option -follow */
|
||||||
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag);
|
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag);
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ struct XorrisO { /* the global context of xorriso */
|
|||||||
int volset_change_pending; /* whether -commit would make sense */
|
int volset_change_pending; /* whether -commit would make sense */
|
||||||
int no_volset_present; /* set to 1 on first failure */
|
int no_volset_present; /* set to 1 on first failure */
|
||||||
|
|
||||||
|
struct CheckmediajoB *check_media_default;
|
||||||
struct SectorbitmaP *in_sector_map; /* eventual sector validity bitmap */
|
struct SectorbitmaP *in_sector_map; /* eventual sector validity bitmap */
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +312,7 @@ struct XorrisO { /* the global context of xorriso */
|
|||||||
struct PermiteM *perm_stack; /* Temporarily altered dir access permissions */
|
struct PermiteM *perm_stack; /* Temporarily altered dir access permissions */
|
||||||
|
|
||||||
/* result (stdout, R: ) */
|
/* result (stdout, R: ) */
|
||||||
char result_line[5*SfileadrL];
|
char result_line[10*SfileadrL];
|
||||||
int result_line_counter;
|
int result_line_counter;
|
||||||
int result_page_counter;
|
int result_page_counter;
|
||||||
int result_open_line_len;
|
int result_open_line_len;
|
||||||
@ -719,6 +720,8 @@ int Checkmediajob_new(struct CheckmediajoB **o, int flag);
|
|||||||
|
|
||||||
int Checkmediajob_destroy(struct CheckmediajoB **o, int flag);
|
int Checkmediajob_destroy(struct CheckmediajoB **o, int flag);
|
||||||
|
|
||||||
|
int Checkmediajob_copy(struct CheckmediajoB *from, struct CheckmediajoB *to,
|
||||||
|
int flag);
|
||||||
|
|
||||||
int Sectorbitmap_new(struct SectorbitmaP **o, int sectors, int sector_size,
|
int Sectorbitmap_new(struct SectorbitmaP **o, int sectors, int sector_size,
|
||||||
int flag);
|
int flag);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2008.09.03.143218"
|
#define Xorriso_timestamP "2008.09.04.100158"
|
||||||
|
@ -7629,17 +7629,18 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
|
|||||||
ret= Checkmediajob_new(&job, 0);
|
ret= Checkmediajob_new(&job, 0);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
if(xorriso->check_media_default != NULL)
|
||||||
|
Checkmediajob_copy(xorriso->check_media_default, job, 0);
|
||||||
|
job->min_lba= -1;
|
||||||
|
job->max_lba= -1;
|
||||||
|
job->sector_map_path[0]= 0;
|
||||||
|
|
||||||
ret= Spotlist_new(&spotlist, 0);
|
ret= Spotlist_new(&spotlist, 0);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
{ret= -1; goto ex;}
|
{ret= -1; goto ex;}
|
||||||
|
|
||||||
/* do overall job programming:
|
|
||||||
>>> ??? time_limit, item_limit
|
|
||||||
>>> ??? abort_file_path
|
|
||||||
*/
|
|
||||||
if(Sfile_str(job->data_to_path, disk_path, 0) <= 0)
|
if(Sfile_str(job->data_to_path, disk_path, 0) <= 0)
|
||||||
{ret= -1; goto ex;}
|
{ret= -1; goto ex;}
|
||||||
|
|
||||||
Xorriso_open_job_data_to(xorriso, job, 0);
|
Xorriso_open_job_data_to(xorriso, job, 0);
|
||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
Loading…
Reference in New Issue
Block a user