Enabled printing of sector bitmaps by use=sector_map
This commit is contained in:
parent
ffb0dc8e54
commit
633ecc7131
@ -2,7 +2,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH XORRISO 1 "Aug 14, 2008"
|
||||
.TH XORRISO 1 "Aug 15, 2008"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -1667,7 +1667,7 @@ An option consists of a keyword, a "=" character, and a value.
|
||||
Default is:
|
||||
.br
|
||||
use=indev what=tracks min_lba=-1 max_lba=-1 retry=default
|
||||
time_limit=-1 item_limit=-1
|
||||
time_limit=28800 item_limit=100000
|
||||
.br
|
||||
abort_file=/var/opt/xorriso/do_abort_check_media
|
||||
.br
|
||||
@ -1676,7 +1676,7 @@ data_to= sector_map= map_with_volid=off
|
||||
Non-default settings:
|
||||
.br
|
||||
"use=outdev" reads from the output drive instead of the input drive. This
|
||||
avoids reading of the ISO image tree from media.
|
||||
avoids loading the ISO image tree from media.
|
||||
.br
|
||||
"what=disc" scans the payload range of a media without respecting track gaps.
|
||||
.br
|
||||
@ -1698,21 +1698,30 @@ blocks and go on with running xorriso.
|
||||
aborted. This is useful for unattended scanning of media which may else
|
||||
overwork the drive in its effort to squeeze out some readable blocks.
|
||||
Abort may be delayed by the drive gnawing on the last single read operation.
|
||||
Value -1 means unlimited time.
|
||||
.br
|
||||
"item_limit=" gives the number of report list items after which to abort.
|
||||
Value -1 means unlimited item number.
|
||||
.br
|
||||
"data_to=" copies the valid blocks to the file which is given as option value.
|
||||
.br
|
||||
"sector_map=" tries to read the file given by option value as
|
||||
"xorriso sector bitmap" and to store such a map file after the scan run.
|
||||
sector bitmap and to store such a map file after the scan run.
|
||||
The bitmap tells which blocks have been read successfully in previous runs.
|
||||
It allows to do several scans on the same media, eventually with intermediate
|
||||
eject, in order to collect readable blocks whenever the drive is lucky enough
|
||||
to produce them. The stored file also contains a human readable TOC of tracks
|
||||
and their start block addresses.
|
||||
to produce them. The stored file contains a human readable TOC of tracks
|
||||
and their start block addresses, followed by binary bitmap data.
|
||||
.br
|
||||
"map_with_volid=on" examines tracks whether they are ISO images and eventually
|
||||
prints their volume ids into the human readable TOC of sector_map=.
|
||||
.br
|
||||
"use=sector_map" does not read any media but loads the file given by option
|
||||
sector_map= and processes this virtual outcome.
|
||||
.br
|
||||
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.
|
||||
.TP
|
||||
.B osirrox restore options:
|
||||
.PP
|
||||
|
@ -2792,23 +2792,23 @@ int Spotlist_get_item(struct SpotlisT *o, int idx,
|
||||
char *Spotlist__quality_name(int quality, char name[80], int flag)
|
||||
{
|
||||
if(quality == Xorriso_read_quality_gooD)
|
||||
strcpy(name, "good");
|
||||
strcpy(name, "+ good");
|
||||
else if(quality == Xorriso_read_quality_sloW)
|
||||
strcpy(name, "slow");
|
||||
strcpy(name, "+ slow");
|
||||
else if(quality == Xorriso_read_quality_partiaL)
|
||||
strcpy(name, "partial");
|
||||
strcpy(name, "+ partial");
|
||||
else if(quality == Xorriso_read_quality_valiD)
|
||||
strcpy(name, "valid");
|
||||
else if(quality == Xorriso_read_quality_invaliD)
|
||||
strcpy(name, "invalid");
|
||||
else if(quality == Xorriso_read_quality_tao_enD)
|
||||
strcpy(name, "tao end");
|
||||
else if(quality == Xorriso_read_quality_off_tracK)
|
||||
strcpy(name, "off track");
|
||||
strcpy(name, "+ valid");
|
||||
else if(quality == Xorriso_read_quality_untesteD)
|
||||
strcpy(name, "untested");
|
||||
strcpy(name, "0 untested");
|
||||
else if(quality == Xorriso_read_quality_invaliD)
|
||||
strcpy(name, "- invalid");
|
||||
else if(quality == Xorriso_read_quality_tao_enD)
|
||||
strcpy(name, "- tao end");
|
||||
else if(quality == Xorriso_read_quality_off_tracK)
|
||||
strcpy(name, "- off track");
|
||||
else if(quality == Xorriso_read_quality_unreadablE)
|
||||
strcpy(name, "unreadable");
|
||||
strcpy(name, "- unreadable");
|
||||
else
|
||||
sprintf(name, "0x%8.8X", (unsigned) quality);
|
||||
return(name);
|
||||
@ -3118,14 +3118,14 @@ int Checkmediajob_new(struct CheckmediajoB **o, int flag)
|
||||
if(m==NULL)
|
||||
return(-1);
|
||||
*o= m;
|
||||
m->use_outdev= 0;
|
||||
m->use_dev= 0;
|
||||
m->min_lba= -1;
|
||||
m->max_lba= -1;
|
||||
m->min_block_size= 16;
|
||||
m->mode= 0;
|
||||
m->start_time= time(NULL);
|
||||
m->time_limit= -1;
|
||||
m->item_limit= -1;
|
||||
m->time_limit= 28800;
|
||||
m->item_limit= 100000;
|
||||
strcpy(m->abort_file_path, "/var/opt/xorriso/do_abort_check_media");
|
||||
m->data_to_path[0]= 0;
|
||||
m->data_to_fd= -1;
|
||||
@ -8818,6 +8818,70 @@ int Xorriso_spotlist_to_sectormap(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_sectormap_to_spotlist(struct XorrisO *xorriso,
|
||||
struct CheckmediajoB *job,
|
||||
struct SpotlisT **spotlist,
|
||||
int flag)
|
||||
{
|
||||
struct SectorbitmaP *map;
|
||||
int ret, i, sectors, sector_size, value, old_value= -1, old_start= -1;
|
||||
|
||||
map= job->sector_map;
|
||||
if(map == NULL)
|
||||
return(-1);
|
||||
ret= Spotlist_new(spotlist, 0);
|
||||
if(ret <= 0)
|
||||
{ret= -1; goto ex;}
|
||||
Sectorbitmap_get_layout(map, §ors, §or_size, 0);
|
||||
sector_size/= 2048;
|
||||
if(job->max_lba >= 0)
|
||||
sectors= (job->max_lba + 1) / sector_size;
|
||||
i= 0;
|
||||
if(job->min_lba >= 0)
|
||||
i= job->min_lba / sector_size;
|
||||
for(; i < sectors; i++) {
|
||||
value= Sectorbitmap_is_set(map, i, 0);
|
||||
if(value == old_value)
|
||||
continue;
|
||||
if(old_value >= 0) {
|
||||
ret= Spotlist_add_item(*spotlist, old_start, i * sector_size - old_start,
|
||||
(old_value ? Xorriso_read_quality_valiD :
|
||||
Xorriso_read_quality_invaliD), 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(job->item_limit > 0 &&
|
||||
Spotlist_count(*spotlist, 0) + 1 >= job->item_limit) {
|
||||
sprintf(xorriso->info_text, "-check_media: Reached item_limit=%d",
|
||||
job->item_limit);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
if(sectors - i > 1) {
|
||||
ret= Spotlist_add_item(*spotlist, i * sector_size,
|
||||
(sectors - i - 1) * sector_size,
|
||||
Xorriso_read_quality_untesteD, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
ret= 2; goto ex;
|
||||
}
|
||||
}
|
||||
old_value= value;
|
||||
old_start= i * sector_size;
|
||||
}
|
||||
if(old_value >= 0) {
|
||||
ret= Spotlist_add_item(*spotlist, old_start, i * sector_size - old_start,
|
||||
(old_value ? Xorriso_read_quality_valiD :
|
||||
Xorriso_read_quality_invaliD), 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
ret= 1;
|
||||
ex:;
|
||||
if(ret <= 0)
|
||||
Spotlist_destroy(spotlist, 0);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_afile_fopen(struct XorrisO *xorriso,
|
||||
char *filename, char *mode, FILE **ret_fp, int flag)
|
||||
/*
|
||||
@ -9402,7 +9466,7 @@ int Xorriso_option_check_media(struct XorrisO *xorriso,
|
||||
int argc, char **argv, int *idx, int flag)
|
||||
{
|
||||
int ret, i, count, lba, blocks, quality;
|
||||
int end_idx, old_idx;
|
||||
int end_idx, old_idx, os_errno;
|
||||
char quality_name[80];
|
||||
double num;
|
||||
struct SpotlisT *spotlist= NULL;
|
||||
@ -9467,9 +9531,11 @@ int Xorriso_option_check_media(struct XorrisO *xorriso,
|
||||
job->item_limit= num;
|
||||
} else if(strncmp(argv[i], "use=", 4) == 0) {
|
||||
if(strcmp(argv[i] + 4, "outdev") == 0)
|
||||
job->use_outdev= 1;
|
||||
job->use_dev= 1;
|
||||
else if(strcmp(argv[i] + 4, "indev") == 0)
|
||||
job->use_outdev= 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) {
|
||||
@ -9490,9 +9556,30 @@ unknown_value:;
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
ret= Xorriso_check_media(xorriso, &spotlist, job, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
|
||||
if(job->use_dev == 2) {
|
||||
if(job->sector_map_path[0] == 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-check_media: option use=sector_map but sector_map=''");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
ret= Sectorbitmap_from_file(&(job->sector_map), job->sector_map_path,
|
||||
xorriso->info_text, &os_errno, 0);
|
||||
if(ret <= 0) {
|
||||
if(xorriso->info_text[0])
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, os_errno,
|
||||
"FAILURE", 0);
|
||||
goto ex;
|
||||
}
|
||||
ret= Xorriso_sectormap_to_spotlist(xorriso, job, &spotlist, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
} else {
|
||||
ret= Xorriso_check_media(xorriso, &spotlist, job, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
sprintf(xorriso->result_line,
|
||||
"MCL layout : lba , size , quality\n");
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.08.15.102849"
|
||||
#define Xorriso_timestamP "2008.08.15.155421"
|
||||
|
@ -6578,7 +6578,7 @@ int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
|
||||
int flag)
|
||||
{
|
||||
int i, j, ret, total_count= 0, sectors= -1, sector_size= -1, skip_reading;
|
||||
int prev_quality= -1, quality= -1, retry= 0, profile_no, is_cd;
|
||||
int prev_quality= -1, quality= -1, retry= 0, profile_no, is_cd= 0;
|
||||
int start_sec, end_sec, first_value, fret;
|
||||
char profile_name[80];
|
||||
int start_lba= 0;
|
||||
@ -6592,7 +6592,7 @@ int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to check media readability",
|
||||
!!job->use_outdev);
|
||||
!!job->use_dev);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
ret= burn_disc_get_profile(drive, &profile_no, profile_name);
|
||||
@ -6812,7 +6812,7 @@ int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
|
||||
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to check media readability",
|
||||
!!job->use_outdev);
|
||||
!!job->use_dev);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
|
||||
@ -6854,10 +6854,15 @@ int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
|
||||
Xorriso_pacifier_reset(xorriso, 0);
|
||||
job->start_time= time(NULL);
|
||||
mode= job->mode;
|
||||
if(job->min_lba >= 0)
|
||||
start_lba= job->min_lba;
|
||||
if(job->min_lba >= 0) {
|
||||
start_lba= job->min_lba;
|
||||
ret= Spotlist_add_item(*spotlist, 0, job->min_lba,
|
||||
Xorriso_read_quality_untesteD, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
if(job->max_lba >= 0) {
|
||||
blocks= job->max_lba - start_lba;
|
||||
blocks= job->max_lba + 1 - start_lba;
|
||||
xorriso->pacifier_total= blocks;
|
||||
ret= Xorriso_check_interval(xorriso, *spotlist, job, start_lba, blocks,
|
||||
read_chunk, 0);
|
||||
@ -6969,7 +6974,7 @@ ex:;
|
||||
}
|
||||
if(toc_info != NULL)
|
||||
free(toc_info);
|
||||
if(ret < 0)
|
||||
if(ret <= 0)
|
||||
Spotlist_destroy(spotlist, 0);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ int Xorriso_msinfo(struct XorrisO *xorriso, int *msc1, int *msc2, int flag);
|
||||
|
||||
|
||||
struct CheckmediajoB {
|
||||
int use_outdev; /* 0= use indev , 1= use outdev */
|
||||
int use_dev; /* 0= use indev , 1= use outdev , 2= use sector map*/
|
||||
|
||||
int min_lba; /* if >=0 : begin checking at this address */
|
||||
int max_lba; /* if >=0 : read up to this address, else use mode */
|
||||
|
Loading…
Reference in New Issue
Block a user