Made struct ExprtesT test -lba_range ready for long block adresses
This commit is contained in:
parent
435521a2c9
commit
cdffa4efee
@ -917,16 +917,39 @@ int Findjob_set_size_filter(struct FindjoB *o, int test_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count,
|
int Findjob_set_off_t_filter(struct FindjoB *o, int test_type,
|
||||||
|
off_t num1, off_t num2, int flag)
|
||||||
|
{
|
||||||
|
struct ExprtesT *t;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret= Findjob_default_and(o, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
return(ret);
|
||||||
|
|
||||||
|
t= o->cursor->test;
|
||||||
|
t->test_type= test_type;
|
||||||
|
t->arg1= calloc(sizeof(off_t), 1);
|
||||||
|
t->arg2= calloc(sizeof(off_t), 1);
|
||||||
|
if(t->arg1 == NULL || t->arg2 == NULL)
|
||||||
|
return(-1);
|
||||||
|
*((off_t *) t->arg1)= num1;
|
||||||
|
*((off_t *) t->arg2)= num2;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Findjob_set_lba_range(struct FindjoB *o, off_t start_lba, off_t count,
|
||||||
int flag)
|
int flag)
|
||||||
{
|
{
|
||||||
int ret, end_lba;
|
int ret;
|
||||||
|
off_t end_lba;
|
||||||
|
|
||||||
if(start_lba > 0)
|
if(start_lba > 0)
|
||||||
end_lba= start_lba + count - 1;
|
end_lba= start_lba + count - 1;
|
||||||
else
|
else
|
||||||
end_lba= start_lba - count + 1;
|
end_lba= start_lba - count + 1;
|
||||||
ret= Findjob_set_num_filter(o, 4, start_lba, end_lba, 0);
|
ret= Findjob_set_off_t_filter(o, 4, start_lba, end_lba, 0);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ struct ExprtesT {
|
|||||||
1= -name char *arg1 (regex_t in *arg2)
|
1= -name char *arg1 (regex_t in *arg2)
|
||||||
2= -type char *arg1
|
2= -type char *arg1
|
||||||
3= -damaged
|
3= -damaged
|
||||||
4= -lba_range int *arg1 int *arg2
|
4= -lba_range off_t *arg1 off_t *arg2
|
||||||
5= -has_acl
|
5= -has_acl
|
||||||
6= -has_xattr
|
6= -has_xattr
|
||||||
7= -has_aaip
|
7= -has_aaip
|
||||||
@ -250,7 +250,10 @@ int Findjob_set_num_filter(struct FindjoB *o, int test_type,
|
|||||||
int Findjob_set_size_filter(struct FindjoB *o, int test_type,
|
int Findjob_set_size_filter(struct FindjoB *o, int test_type,
|
||||||
off_t num1, int num2, int flag);
|
off_t num1, int num2, int flag);
|
||||||
|
|
||||||
int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count,
|
int Findjob_set_off_t_filter(struct FindjoB *o, int test_type,
|
||||||
|
off_t num1, off_t num2, int flag);
|
||||||
|
|
||||||
|
int Findjob_set_lba_range(struct FindjoB *o, off_t start_lba, off_t count,
|
||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag);
|
int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag);
|
||||||
|
@ -3055,7 +3055,8 @@ return:
|
|||||||
3 = immediate decision : does match
|
3 = immediate decision : does match
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int value=0, ret, start_lba, end_lba, bless_idx, size_mode;
|
int value=0, ret, start_lba, bless_idx, size_mode;
|
||||||
|
off_t range_lba, end_lba;
|
||||||
int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i, mask;
|
int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i, mask;
|
||||||
void *arg1, *arg2;
|
void *arg1, *arg2;
|
||||||
char ft, *decision, md5[16], bless_code[17];
|
char ft, *decision, md5[16], bless_code[17];
|
||||||
@ -3146,10 +3147,10 @@ return:
|
|||||||
|
|
||||||
break; case 4: /* -lba_range *arg1 *arg2 */
|
break; case 4: /* -lba_range *arg1 *arg2 */
|
||||||
value= 1;
|
value= 1;
|
||||||
start_lba= *((int *) ftest->arg1);
|
range_lba= *((off_t *) ftest->arg1);
|
||||||
end_lba= *((int *) ftest->arg2);
|
end_lba= *((off_t *) ftest->arg2);
|
||||||
if(node == NULL) {
|
if(node == NULL) {
|
||||||
value= !(start_lba >= 0);
|
value= !(range_lba >= 0);
|
||||||
goto ex;
|
goto ex;
|
||||||
}
|
}
|
||||||
ret= Xorriso__start_end_lbas(node, &lba_count, &file_start_lbas,
|
ret= Xorriso__start_end_lbas(node, &lba_count, &file_start_lbas,
|
||||||
@ -3157,15 +3158,15 @@ return:
|
|||||||
if(ret <= 0) {
|
if(ret <= 0) {
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
Xorriso_process_msg_queues(xorriso, 0);
|
Xorriso_process_msg_queues(xorriso, 0);
|
||||||
if(start_lba >= 0)
|
if(range_lba >= 0)
|
||||||
value= 0;
|
value= 0;
|
||||||
} else {
|
} else {
|
||||||
for(i= 0; i < lba_count; i++) {
|
for(i= 0; i < lba_count; i++) {
|
||||||
if(start_lba >= 0) {
|
if(range_lba >= 0) {
|
||||||
if(file_end_lbas[i] < start_lba || file_start_lbas[i] > end_lba)
|
if(file_end_lbas[i] < range_lba || file_start_lbas[i] > end_lba)
|
||||||
value= 0;
|
value= 0;
|
||||||
} else {
|
} else {
|
||||||
if(file_end_lbas[i] >= -start_lba && file_start_lbas[i] <= -end_lba)
|
if(file_end_lbas[i] >= -range_lba && file_start_lbas[i] <= -end_lba)
|
||||||
value= 0;
|
value= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ int Xorriso_path_from_lba(struct XorrisO *xorriso, IsoNode *node, int lba,
|
|||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
if(flag & 1)
|
if(flag & 1)
|
||||||
Findjob_set_lba_range(job, lba, 1, 0);
|
Findjob_set_lba_range(job, (off_t) lba, (off_t) 1, 0);
|
||||||
else
|
else
|
||||||
Findjob_set_wanted_node(job, (void *) node, 0);
|
Findjob_set_wanted_node(job, (void *) node, 0);
|
||||||
Findjob_set_action_found_path(job, 0);
|
Findjob_set_action_found_path(job, 0);
|
||||||
|
@ -835,7 +835,8 @@ static int Xorriso_truncate_const_find_name(struct XorrisO *xorriso,
|
|||||||
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
||||||
int *idx, int flag)
|
int *idx, int flag)
|
||||||
{
|
{
|
||||||
int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count;
|
int ret, i, end_idx, type= 0, action, deleter= 0, count;
|
||||||
|
off_t start_lba, block_count;
|
||||||
int list_extattr_head= 0, bsl_mem, disk_path, name_space, prefix_code;
|
int list_extattr_head= 0, bsl_mem, disk_path, name_space, prefix_code;
|
||||||
struct FindjoB *job, *first_job= NULL, *new_job;
|
struct FindjoB *job, *first_job= NULL, *new_job;
|
||||||
char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt;
|
char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt;
|
||||||
@ -919,9 +920,16 @@ not_enough_arguments:;
|
|||||||
i+= 2;
|
i+= 2;
|
||||||
|
|
||||||
/* >>> if letter suffix: use Scanf_io_size */
|
/* >>> if letter suffix: use Scanf_io_size */
|
||||||
sscanf(argv[i-1], "%d", &start_lba);
|
ret= Sfile_text_to_off_t(argv[i - 1], &start_lba, 0);
|
||||||
sscanf(argv[i], "%d", &count);
|
if(ret <= 0) {
|
||||||
Findjob_set_lba_range(job, start_lba, count, 0);
|
off_t_overflow:;
|
||||||
|
sprintf(xorriso->info_text, "-find[ix]: -lba_range number too large");
|
||||||
|
goto sorry_ex;
|
||||||
|
}
|
||||||
|
ret= Sfile_text_to_off_t(argv[i], &block_count, 0);
|
||||||
|
if(ret <= 0)
|
||||||
|
goto off_t_overflow;
|
||||||
|
Findjob_set_lba_range(job, start_lba, block_count, 0);
|
||||||
} else if(strcmp(argv[i], "-pending_data")==0) {
|
} else if(strcmp(argv[i], "-pending_data")==0) {
|
||||||
Findjob_set_commit_filter_2(job, 0);
|
Findjob_set_commit_filter_2(job, 0);
|
||||||
} else if(strcmp(argv[i], "-has_acl")==0) {
|
} else if(strcmp(argv[i], "-has_acl")==0) {
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2024.03.20.114449"
|
#define Xorriso_timestamP "2024.03.20.150514"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user