Removed outdated alternative code for support of libisofs-0.6.6

This commit is contained in:
Thomas Schmitt 2008-09-07 14:48:05 +00:00
parent 33f590c84d
commit 51fe94c159
2 changed files with 1 additions and 150 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.09.05.114936" #define Xorriso_timestamP "2008.09.07.144714"

View File

@ -98,10 +98,6 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node,
#define Xorriso_cd_min_track_sizE 300 #define Xorriso_cd_min_track_sizE 300
/* >>> transitional macro */
#define Xorriso_libisofs_0_6_7 yes
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
@ -2379,12 +2375,7 @@ int Xorriso_restore_is_identical(struct XorrisO *xorriso, void *in_node,
IsoImage *volume; IsoImage *volume;
IsoNode *node; IsoNode *node;
struct stat stbuf; struct stat stbuf;
#ifdef Xorriso_libisofs_0_6_7
int dummy; int dummy;
#else
uint32_t dummy;
#endif
memset(type_text, 0, 5); memset(type_text, 0, 5);
if(!xorriso->volset_change_pending) if(!xorriso->volset_change_pending)
@ -2399,23 +2390,11 @@ int Xorriso_restore_is_identical(struct XorrisO *xorriso, void *in_node,
if(ret<=0) if(ret<=0)
return(-1); return(-1);
} }
#ifdef Xorriso_libisofs_0_6_7
ret= Xorriso__file_start_lba(node, &dummy, 0); ret= Xorriso__file_start_lba(node, &dummy, 0);
if(ret != 0) { if(ret != 0) {
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
return(0); return(0);
} }
#else /* Xorriso_libisofs_0_6_7 */
ret= iso_node_get_old_image_lba(node, &dummy, 0);
if(ret!=0)
return(0);
#endif /* ! Xorriso_libisofs_0_6_7 */
if(!LIBISO_ISREG(node)) if(!LIBISO_ISREG(node))
return(0); return(0);
stream= iso_file_get_stream((IsoFile *) node); stream= iso_file_get_stream((IsoFile *) node);
@ -4225,9 +4204,6 @@ int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error,int flag)
int Xorriso__node_lba_cmp(const void *node1, const void *node2) int Xorriso__node_lba_cmp(const void *node1, const void *node2)
{ {
int ret; int ret;
#ifdef Xorriso_libisofs_0_6_7
int lba1= 0, lba2= 0; int lba1= 0, lba2= 0;
ret= Xorriso__file_start_lba(*((IsoNode **) node1), &lba1, 0); ret= Xorriso__file_start_lba(*((IsoNode **) node1), &lba1, 0);
@ -4236,20 +4212,6 @@ int Xorriso__node_lba_cmp(const void *node1, const void *node2)
ret= Xorriso__file_start_lba(*((IsoNode **) node2), &lba2, 0); ret= Xorriso__file_start_lba(*((IsoNode **) node2), &lba2, 0);
if(ret!=1) if(ret!=1)
lba2= 0; lba2= 0;
#else /* Xorriso_libisofs_0_6_7 */
uint32_t lba1= 0, lba2= 0;
ret = iso_node_get_old_image_lba(*((IsoNode **) node1), &lba1, 0);
if(ret!=1)
lba1= 0;
ret = iso_node_get_old_image_lba(*((IsoNode **) node2), &lba2, 0);
if(ret!=1)
lba2= 0;
#endif /* ! Xorriso_libisofs_0_6_7 */
return(lba1-lba2); return(lba1-lba2);
} }
@ -5623,8 +5585,6 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t,
} }
#ifdef Xorriso_libisofs_0_6_7
int Xorriso__start_end_lbas(IsoNode *node, int Xorriso__start_end_lbas(IsoNode *node,
int *lba_count, int **start_lbas, int **end_lbas, int *lba_count, int **start_lbas, int **end_lbas,
off_t *size, int flag) off_t *size, int flag)
@ -5778,93 +5738,6 @@ ex:;
return(ret); return(ret);
} }
#else /* Xorriso_libisofs_0_6_7 */
int Xorriso_start_end_lba(struct XorrisO *xorriso, IsoNode *node,
int *start_lba, int *end_lba, off_t *size, int flag)
{
uint32_t iso_start_lba;
int ret;
*size= 0;
*start_lba= *end_lba= -1;
ret= iso_node_get_old_image_lba(node, &iso_start_lba, 0);
if(ret < 0)
return(-1);
if(ret != 1)
return(0);
*start_lba= iso_start_lba;
if(LIBISO_ISREG(node))
*size= iso_file_get_size((IsoFile *) node);
*end_lba= *start_lba + *size / 2048;
if((*size % 2048) == 0 && *end_lba > *start_lba)
(*end_lba)--;
return(1);
}
/* @param damage_start Returns first damaged byte address
@param damage_end Returns first byte address after last damaged byte
@return <0 error, 0=undamaged , 1=damaged
*/
int Xorriso_file_eval_damage(struct XorrisO *xorriso, IsoNode *node,
off_t *damage_start, off_t *damage_end,
int flag)
{
int start_lba, end_lba, i, sectors, sector_size, damaged= 0, ret;
int next_good_lba= -1, first_bad_lba= -1;
int i, sectors, sector_size, ret;
off_t size= 0;
struct SectorbitmaP *map;
*damage_start= *damage_end= -1;
map= xorriso->in_sector_map;
if(map == NULL)
return(0);
Sectorbitmap_get_layout(map, &sectors, &sector_size, 0);
sector_size/= 2048;
ret= Xorriso_start_end_lba(xorriso, node, &start_lba, &end_lba, &size, 0);
if(ret <= 0)
return(ret);
for(i= start_lba; i <= end_lba; i+= sector_size)
if(Sectorbitmap_is_set(map, i / sector_size, 0) == 0) {
damaged= 1;
if(first_bad_lba < 0)
first_bad_lba= i;
next_good_lba= (i / sector_size + 1) * sector_size;
}
if(damaged) {
*damage_start= (first_bad_lba - start_lba) * 2048;
*damage_end= (next_good_lba - start_lba) * 2048;
if(*damage_end > size)
*damage_end= size;
return(1);
}
return(0);
}
int Xorriso_report_lba(struct XorrisO *xorriso, char *show_path,
IsoNode *node, int flag)
{
int ret, start_lba, end_lba;
off_t size;
char sfe[5*SfileadrL];
ret= Xorriso_start_end_lba(xorriso, node, &start_lba, &end_lba, &size, 0);
if(ret < 0)
return(ret);
if(ret == 0)
return(1); /* it is ok to ignore other types */
sprintf(xorriso->result_line, "File data lba: %2d , %8d , %8d , %8.f , %s\n",
0, start_lba, end_lba + 1 - start_lba, (double) size,
Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);
return(1);
}
#endif /* ! Xorriso_libisofs_0_6_7 */
int Xorriso_report_damage(struct XorrisO *xorriso, char *show_path, int Xorriso_report_damage(struct XorrisO *xorriso, char *show_path,
IsoNode *node, int flag) IsoNode *node, int flag)
@ -5987,11 +5860,7 @@ int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
{ {
int ret, start_lba, end_lba, damage_filter; int ret, start_lba, end_lba, damage_filter;
off_t damage_start, damage_end, size; off_t damage_start, damage_end, size;
#ifdef Xorriso_libisofs_0_6_7
int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i; int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i;
#else
int file_end_lba, file_start_lba;
#endif
ret= Findjob_test(job, name, boss_stbuf, stbuf, depth, 0); ret= Findjob_test(job, name, boss_stbuf, stbuf, depth, 0);
if(ret<=0) if(ret<=0)
@ -6005,9 +5874,6 @@ int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
if((damage_filter > 0) != (ret > 0)) if((damage_filter > 0) != (ret > 0))
return(0); return(0);
} }
#ifdef Xorriso_libisofs_0_6_7
if(start_lba >= 0 && end_lba >= 0) { if(start_lba >= 0 && end_lba >= 0) {
ret= Xorriso__start_end_lbas(node, &lba_count, ret= Xorriso__start_end_lbas(node, &lba_count,
&file_start_lbas, &file_end_lbas, &size, 0); &file_start_lbas, &file_end_lbas, &size, 0);
@ -6027,21 +5893,6 @@ ex:;
if(file_end_lbas != NULL) if(file_end_lbas != NULL)
free((char *) file_end_lbas); free((char *) file_end_lbas);
return(ret); return(ret);
#else /* Xorriso_libisofs_0_6_7 */
if(start_lba >= 0 && end_lba >= 0) {
ret= Xorriso_start_end_lba(xorriso, node, &file_start_lba, &file_end_lba,
&size, 0);
if(ret <= 0)
return(ret);
if(file_end_lba < start_lba || file_start_lba > end_lba)
return(0);
}
return(1);
#endif /* ! Xorriso_libisofs_0_6_7 */
} }