Sketched split file scheme with partno,totalparts,offset,count,totalsize

This commit is contained in:
Thomas Schmitt 2008-03-11 11:35:04 +00:00
parent 4f047c0cf6
commit 2309710729
3 changed files with 60 additions and 8 deletions

View File

@ -4240,6 +4240,7 @@ much_too_long:;
bit14= early eof of iso file
bit15= content bytes differ
bit16= symbolic link on disk pointing to dir, dir in iso
>>> bit17= file chunks detected and compared
@param flag bit0= compare atime
bit1= compare ctime
bit2= check only existence of both file objects
@ -4255,7 +4256,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
int *result, int flag)
{
struct stat s1, s2, stbuf;
int ret, r1, r2, fd1= -1, i, done, wanted, missing= 0;
int ret, r1, r2, fd1= -1, i, done, wanted, missing= 0, is_split= 0;
void *stream2= NULL;
char *respt;
char buf1[32*1024], buf2[32*1024], a[5*SfileadrL], sfe[5*SfileadrL];
@ -4301,6 +4302,17 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
/* Attributes */
if(s1.st_mode != s2.st_mode) {
if((S_ISREG(s1.st_mode) || S_ISBLK(s1.st_mode)) && S_ISDIR(s2.st_mode)) {
/* >>> SPLIT */
/* >>> check whether there are only part_files in the directory */;
/* >>> is_split= 1; */;
/* >>> count this as content chunk container */;
/* >>> compare access permissions of first chunk */;
}
if((s1.st_mode&~S_IFMT)!=(s2.st_mode&~S_IFMT)) {
sprintf(respt, "%s st_mode : %7.7o <> %7.7o\n",
a, s1.st_mode, s2.st_mode);
@ -4405,8 +4417,15 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
(*result)|= 4096;
return(0);
}
if(is_split) {
/* >>> SPLIT */
/* >>> for each chunk file : do content comparison */;
}
/* Content */
/* >>> SPLIT */
/* <<< outsource this as separate content comparison function */
done= 0;
while(!done) {
/* fd1 is a regular file and should deliver full buffers */
@ -4508,6 +4527,7 @@ I thought to have seen a libisofs bug here but it seems that it was an illusion
@param flag bit0= update rather than compare
bit1= find[ix] is in recursion
@return <=0 error, 1= ok , 2= iso_path was deleted
3=ok, do not dive into directory (e.g. because it is a split file)
*/
int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
char *iso_path, char *iso_prefix, char *disk_prefix,
@ -4549,6 +4569,8 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
return(ret);
if(deleted)
return(2);
if(result&(1<<17))
return(3);
return(ret);
}
@ -7155,6 +7177,9 @@ 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 */
ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, iso_rr_path, 1); /* rm_r */
if(ret>0) {
deleted= 1;
@ -7165,6 +7190,10 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
} else if(compare_result&(1)) {
/* disk_adr not existing */
/* ??? SPLIT : Shall i recognize a splitfile without disk file ?
*/
ret= Xorriso_rmi(xorriso, boss_iter, (off_t) 0, iso_rr_path, 1);
deleted= 1;
sprintf(xorriso->info_text, "Deleted ");
@ -7172,12 +7201,20 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
} else if(compare_result&(2|128|(1<<12)|(1<<14)|(1<<15))) {
/* iso_adr not existing, size, cannot open iso file, early eof of iso file
content bytes differ */
/* >>> SPLIT : differing content or size */
/* >>> overwrite all parts in the directory */
ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path,
(off_t) 0, (off_t) 0, 2|(flag&4));
sprintf(xorriso->info_text, "Added/overwrote ");
} else if(compare_result&(4|16|32|256|512|1024)) {
/* access permissions, user id, group id, mtime, atime, ctime */
/* >>> SPLIT : differing content or size */
/* >>> renew attributes of all parts in the directory */
ret= Xorriso_copy_properties(xorriso, disk_path, iso_rr_path, 0);
sprintf(xorriso->info_text, "Adjusted attributes of ");
@ -8078,6 +8115,11 @@ ex:;
}
/* >>> SPLIT : proposed target format
part_{partno}_of_{total_parts}_at_{offset}_with_{bytes}_of_{total_bytes}
*/
/* Option -cut_out */
int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
char *start, char *count, char *iso_rr_path, int flag)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.03.09.211041"
#define Xorriso_timestamP "2008.03.11.113444"

View File

@ -4107,14 +4107,17 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t,
/* @param flag bit0= not a command parameter (directory iteration or recursion)
bit1= do not count deleted files with rm and rm_r
@return <=0 error, 1=ok, 2=ok, node has been deleted
@return <=0 error,
1=ok
2=ok, node has been deleted,
3=ok, do not dive into directory (e.g. because it is a split file)
*/
int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
IsoDirIter *boss_iter, off_t boss_mem,
char *abs_path, char *show_path,
IsoNode *node, int depth, int flag)
{
int ret= 0, type, action= 0, hflag, deleted= 0;
int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0;
uid_t user= 0;
gid_t group= 0;
time_t date= 0;
@ -4164,6 +4167,8 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
iso_prefix, target, (action==17)|((flag&1)<<1));
if(ret==2)
deleted= 1;
if(ret==3)
no_dive= 1;
if(ret>=0)
ret= 1;
} else if(action==16 || action==18) { /* not_in_iso , add_missing */
@ -4177,6 +4182,8 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
return(ret);
if(deleted)
return(2);
if(no_dive)
return(3);
return(1);
}
@ -4190,7 +4197,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
void *dir_node_generic, char *dir_path,
struct stat *dir_stbuf, int depth, int flag)
{
int ret, action= 0, hflag, deleted= 0;
int ret, action= 0, hflag, deleted= 0, no_dive= 0;
IsoDirIter *iter= NULL;
IsoDir *dir_node= NULL;
IsoNode *node, *iso_node;
@ -4253,9 +4260,11 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
deleted= 1;
goto ex;
}
if(ret==3)
no_dive= 1;
}
}
if(!LIBISO_ISDIR((IsoNode *) dir_node))
if(no_dive || !LIBISO_ISDIR((IsoNode *) dir_node))
{ret= 1; goto ex;}
mem= boss_mem;
@ -4303,13 +4312,14 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
abs_path, path, node, depth, 1|(flag&2));
if(ret==2) /* node has been deleted */
continue;
no_dive= (ret==3);
if(ret<=0) {
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
goto ex;
}
}
if(S_ISDIR(stbuf.st_mode)) {
if(S_ISDIR(stbuf.st_mode) && !no_dive) {
ret= Xorriso_findi(xorriso, job, (void *) iter, mem,
(void *) node, path, &stbuf, depth+1, flag|1);
if(ret<0)