New option -split_size, automated splitting of oversized files
This commit is contained in:
@ -2960,6 +2960,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
strcpy(m->wdx, m->initial_wdx);
|
||||
m->did_something_useful= 0;
|
||||
m->add_plainly= 0;
|
||||
m->split_size= 0;
|
||||
m->do_joliet= 0;
|
||||
m->do_follow_pattern= 1;
|
||||
m->do_follow_param= 0;
|
||||
@ -4152,6 +4153,18 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
(xorriso->wdx[0] ? Text_shellsafe(xorriso->wdx,sfe,0) : "'/'"));
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (xorriso->split_size==0);
|
||||
strcpy(line,"-split_size ");
|
||||
if(xorriso->split_size % (1024*1024) || xorriso->split_size==0) {
|
||||
Sfile_off_t_text(line+strlen(line), xorriso->split_size, 0);
|
||||
} else {
|
||||
Sfile_off_t_text(line+strlen(line), xorriso->split_size / (1024*1024), 0);
|
||||
strcat(line, "m");
|
||||
}
|
||||
strcat(line, "\n");
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (xorriso->add_plainly==0);
|
||||
sprintf(line,"-add_plainly %s\n",
|
||||
(xorriso->add_plainly == 1 ? "unknown" :
|
||||
@ -4679,7 +4692,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
|
||||
|
||||
/* Splitfile parts */
|
||||
if((S_ISREG(s1.st_mode) || S_ISBLK(s1.st_mode)) && S_ISDIR(s2.st_mode)) {
|
||||
is_split= Xorriso_identify_split(xorriso, iso_adr, &split_parts,
|
||||
is_split= Xorriso_identify_split(xorriso, iso_adr, NULL, &split_parts,
|
||||
&split_count, &s2, 0);
|
||||
if(is_split>0)
|
||||
(*result)|= (1<<17);
|
||||
@ -7620,9 +7633,6 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
|
||||
|
||||
if(compare_result&(8|64)) {
|
||||
/* file type, minor+major with device file */
|
||||
|
||||
/* <<< ??? SPLIT : cannot happen here ??? really ? */
|
||||
|
||||
ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, iso_rr_path, 1); /* rm_r */
|
||||
if(ret>0) {
|
||||
deleted= 1;
|
||||
@ -7643,8 +7653,7 @@ delete:;
|
||||
content bytes differ */
|
||||
|
||||
if(is_split) {
|
||||
/* >>> SPLIT : differing content or size */;
|
||||
ret= Xorriso_identify_split(xorriso, iso_rr_path,
|
||||
ret= Xorriso_identify_split(xorriso, iso_rr_path, NULL,
|
||||
&split_parts, &split_count, &stbuf, 0);
|
||||
if(ret<=0)
|
||||
{ret= -1; goto ex;} /* (should not happen) */
|
||||
@ -7709,7 +7718,7 @@ delete:;
|
||||
/* access permissions, user id, group id, mtime, atime, ctime */
|
||||
|
||||
if(is_split) {
|
||||
ret= Xorriso_identify_split(xorriso, iso_rr_path,
|
||||
ret= Xorriso_identify_split(xorriso, iso_rr_path, NULL,
|
||||
&split_parts, &split_count, &stbuf, 0);
|
||||
if(ret<=0)
|
||||
{ret= -1; goto ex;} /* (should not happen) */
|
||||
@ -8637,7 +8646,6 @@ ex:;
|
||||
|
||||
|
||||
/* SPLIT : proposed target format
|
||||
|
||||
part_{partno}_of_{total_parts}_at_{offset}_with_{bytes}_of_{total_bytes}
|
||||
*/
|
||||
|
||||
@ -10554,6 +10562,25 @@ dvd_speed:;
|
||||
}
|
||||
|
||||
|
||||
/* Option -split_size */
|
||||
int Xorriso_option_split_size(struct XorrisO *xorriso, char *size, int flag)
|
||||
{
|
||||
double num;
|
||||
static off_t limit= ((off_t) 4) * ((off_t) 1024*1024*1024) - (off_t) 1;
|
||||
|
||||
num= Scanf_io_size(size, 0);
|
||||
if(num > limit) {
|
||||
sprintf(xorriso->info_text, "-split_size: too large %.f (allowed: %.f)",
|
||||
num, (double) limit);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
} else if(num < 0)
|
||||
num= 0.0;
|
||||
xorriso->split_size= num;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -status */
|
||||
int Xorriso_option_status(struct XorrisO *xorriso, char *mode, int flag)
|
||||
{
|
||||
@ -11220,6 +11247,10 @@ next_command:;
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_speed(xorriso, arg1, 0);
|
||||
|
||||
} else if(strcmp(cmd,"split_size")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_split_size(xorriso, arg1, 0);
|
||||
|
||||
} else if(strcmp(cmd,"status")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_status(xorriso, arg1, 0);
|
||||
|
Reference in New Issue
Block a user