From 354c145c6543cc45f3a17c982875d2aa5fba0dac Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 27 Aug 2008 12:13:07 +0000 Subject: [PATCH] New option -file_size_limit, -as mkisofs now supports -iso-level 1 to 3 --- libisoburn/trunk/xorriso/xorriso.1 | 35 ++- libisoburn/trunk/xorriso/xorriso.c | 229 ++++++++++++------- libisoburn/trunk/xorriso/xorriso_private.h | 8 + libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 11 +- 5 files changed, 192 insertions(+), 93 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index db461848..a432296e 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -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 26, 2008" +.TH XORRISO 1 "Aug 27, 2008" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -941,8 +941,9 @@ E.g.: .br "report_lba" prints files which are associated to image data blocks. It tells the logical block address, the block number, the byte size, -and the path of each file. In future there may be reported more than one -line per file if the file is very large. +and the path of each file. There may be reported more than one +line per file if the file is very large. In this case each line has a +different extent number in column "xt". .br E.g.: .br @@ -1093,6 +1094,22 @@ Smaller format size with DVD-RAM or BD-RE means more reserve space. .TP .B Settings for data insertion: .TP +\fB\-file_size_limit\fR value [value [...]] -- +Set the maximum permissible size for a single data file. The values get +summed up for the actual limit. If the only value is "off" then the file +size is not limited by xorriso. Default is a limit of 100 extents, 4g -2k each: +.br + -file_size_limit 400g -800k -- +.br +When mounting ISO 9660 filesystems, old operating systems can handle only files +up to 2g -1 --. Newer ones are good up to 4g -1 --. +You need quite a new Linux kernel to read correctly the final bytes +of a file >= 4g if its size is not aligned to 2048 KiB. +.br +xorriso's own data read capabilities are not affected by eventual +operating system size limits. They apply to mounting only. Nevertheless, +the target filesystem of an -extract must be able to take the file size. +.TP \fB\-not_mgt\fR code[:code[...]] Control the behavior of the exclusion lists. .br @@ -1229,13 +1246,15 @@ target file objects on disk as well, but "on" is downgraded to "nondir". \fB\-split_size\fR number["k"|"m"] Set the threshold for automatic splitting of regular files. Such splitting maps a large disk file onto a ISO directory with several part files in it. -This is necessary if the size of the disk file exceeds MAX = 400 GiB - 800 KiB. -Older operating systems can handle files only if they are smaller than 2 GiB -or 4 GiB. But osirrox is not affected by eventual operating system size limits. +This is necessary if the size of the disk file exceeds -file_size_limit. +Older operating systems can handle files in mounted ISO 9660 filesystems +only if they are smaller than 2 GiB resp. 4 GiB. See also option -cut_out for more information about file parts. .br -Default is 0 which will exclude files >= MAX by a FAILURE event. -A well tested -split_size is 2047m. Sizes of MAX or more are not permissible. +Default is 0 which will exclude files larger than -file_size_limit by a +FAILURE event. +A well tested -split_size is 2047m. Sizes above -file_size_limit are not +permissible. .TP .B Settings for result writing: .TP diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index f5bc5473..71db6558 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -3348,6 +3348,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->do_iso_rr_pattern= 1; m->do_disk_pattern= 2; m->temp_mem_limit= 16*1024*1024; + m->file_size_limit= Xorriso_default_file_size_limiT; m->disk_exclusions= NULL; m->disk_excl_mode= 1; m->use_stdin= 0; @@ -4760,6 +4761,16 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) } } + is_default= (xorriso->file_size_limit == + Xorriso_default_file_size_limiT); + if(xorriso->file_size_limit <= 0) + sprintf(line, "-file_size_limit off --\n"); + else + sprintf(line, "-file_size_limit %.lf --\n", + (double) xorriso->file_size_limit); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->disk_excl_mode==1); sprintf(line, "-not_mgt %s:%s:%s:%s\n", (xorriso->disk_excl_mode&1 ? "on" : "off"), @@ -8208,7 +8219,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, int argc, char **argv, int flag) { int ret, i, k, was_path= 0, was_other_option= 0, mem_graft_points, mem; - int do_print_size= 0, idx_offset= 0, fd, idx; + int do_print_size= 0, idx_offset= 0, fd, idx, iso_level= 0; char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL]; char *ept, *add_pt, eff_path[SfileadrL], indev[SfileadrL+8], msc[80], *cpt; @@ -8233,6 +8244,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, " -f, -follow-links Follow symbolic links", " -graft-points Allow to use graft points for filenames", " -help Print option help", +" -iso-level LEVEL Set ISO9660 conformance level (1..3)", " -J, -joliet Generate Joliet directory information", " -o FILE, -output FILE Set output file name", " -m GLOBFILE, -exclude GLOBFILE", @@ -8308,6 +8320,23 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, ret= Xorriso_option_follow(xorriso, "on", 0); if(ret<=0) goto ex; + } else if(strcmp(argv[i], "-iso-level")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + sscanf(argv[i], "%d", &iso_level); + if(iso_level < 1 || iso_level > 3) { + sprintf(xorriso->info_text, + "-as %s: unsupported -iso-level '%s' (use one of: 1,2,3)", + whom, argv[i]); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + ret= 0; goto ex; + } + if(iso_level < 3) + xorriso->file_size_limit= + ((off_t) 4) * ((off_t) 1024*1024*1024) - ((off_t) 1); + else + xorriso->file_size_limit= 0; } else was_other_option= 1; } @@ -8484,6 +8513,10 @@ not_enough_args:; sprintf(xorriso->info_text, "-as %s: Unknown option %s", whom, Text_shellsafe(argv[i], sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + } else if(strcmp(argv[i], "-iso-level")==0) { + i++; + /* was already handled in first argument scan */; + } else { int zero= 0; @@ -10698,78 +10731,41 @@ int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path, } -/* Option -follow */ -int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) +/* Option -file_size_limit */ +int Xorriso_option_file_size_limit(struct XorrisO *xorriso, + int argc, char **argv, int *idx, int flag) { - int was_fl, was_fm, was_fpr, was_fpt, l; - double num; - char *cpt, *npt; + int ret, i, end_idx; + off_t new_limit= 0; - was_fpt= xorriso->do_follow_pattern; - was_fpr= xorriso->do_follow_param; - was_fl= xorriso->do_follow_links; - was_fm= xorriso->do_follow_mount; - xorriso->do_follow_pattern= 0; - xorriso->do_follow_param= 0; - xorriso->do_follow_links= 0; - xorriso->do_follow_mount= 0; - npt= cpt= mode; - for(cpt= mode; npt!=NULL; cpt= npt+1) { - npt= strchr(cpt,':'); - if(npt==NULL) - l= strlen(cpt); - else - l= npt-cpt; - if(l==0) - goto unknown_mode; - if(strncmp(cpt, "off", l)==0) { - xorriso->do_follow_pattern= 0; - xorriso->do_follow_param= 0; - xorriso->do_follow_links= 0; - xorriso->do_follow_mount= 0; - } else if(strncmp(cpt, "on", l)==0) { - xorriso->do_follow_pattern= 1; - xorriso->do_follow_param= 1; - xorriso->do_follow_links= 1; - xorriso->do_follow_mount= 1; - } else if(strncmp(cpt, "default", l)==0) { - xorriso->do_follow_pattern= 1; - xorriso->do_follow_param= 0; - xorriso->do_follow_links= 0; - xorriso->do_follow_mount= 1; - xorriso->follow_link_limit= 100; - } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) { - xorriso->do_follow_links= 1; - } else if(strncmp(cpt, "mount", l)==0) { - xorriso->do_follow_mount= 1; - } else if(strncmp(cpt,"param", l)==0) { - xorriso->do_follow_param= 1; - } else if(strncmp(cpt, "pattern", l)==0) { - xorriso->do_follow_pattern= 1; - } else if(strncmp(cpt, "limit=", 6)==0) { - sscanf(cpt+6, "%lf", &num); - if(num<=0 || num>1.0e6) { - sprintf(xorriso->info_text, "-follow: Value too %s with '%s'", - num<=0 ? "small" : "large", cpt+6); - goto sorry_ex; - } - xorriso->follow_link_limit= num; - } else { -unknown_mode:; - if(linfo_text, "-follow: unknown mode '%s'", cpt); - else - sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l); -sorry_ex: - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - xorriso->do_follow_pattern= was_fpt; - xorriso->do_follow_param= was_fpr; - xorriso->do_follow_links= was_fl; - xorriso->do_follow_mount= was_fm; - return(0); - } + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + if(*idx >= end_idx) + {ret= 2; goto ex;} + if(*idx + 1 == end_idx && strcmp(argv[*idx], "off") == 0) { + xorriso->file_size_limit= 0; + ret= 1; goto ex; } - return(1); + for(i= *idx; i < end_idx; i++) + new_limit+= Scanf_io_size(argv[i], 0); + if(new_limit <= 0) { + sprintf(xorriso->info_text, "-file_size_limit: values sum up to %.lf", + (double) new_limit); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); + ret= 0; goto ex; + } + xorriso->file_size_limit= new_limit; + ret= 1; +ex:; + (*idx)= end_idx; + if(ret > 0) { + if(xorriso->file_size_limit > 0) + sprintf(xorriso->info_text, "-file_size_limit now at %.lf\n", + (double) xorriso->file_size_limit); + else + sprintf(xorriso->info_text, "-file_size_limit now off\n"); + Xorriso_info(xorriso,0); + } + return(ret); } @@ -11012,6 +11008,81 @@ ex:; } +/* Option -follow */ +int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag) +{ + int was_fl, was_fm, was_fpr, was_fpt, l; + double num; + char *cpt, *npt; + + was_fpt= xorriso->do_follow_pattern; + was_fpr= xorriso->do_follow_param; + was_fl= xorriso->do_follow_links; + was_fm= xorriso->do_follow_mount; + xorriso->do_follow_pattern= 0; + xorriso->do_follow_param= 0; + xorriso->do_follow_links= 0; + xorriso->do_follow_mount= 0; + npt= cpt= mode; + for(cpt= mode; npt!=NULL; cpt= npt+1) { + npt= strchr(cpt,':'); + if(npt==NULL) + l= strlen(cpt); + else + l= npt-cpt; + if(l==0) + goto unknown_mode; + if(strncmp(cpt, "off", l)==0) { + xorriso->do_follow_pattern= 0; + xorriso->do_follow_param= 0; + xorriso->do_follow_links= 0; + xorriso->do_follow_mount= 0; + } else if(strncmp(cpt, "on", l)==0) { + xorriso->do_follow_pattern= 1; + xorriso->do_follow_param= 1; + xorriso->do_follow_links= 1; + xorriso->do_follow_mount= 1; + } else if(strncmp(cpt, "default", l)==0) { + xorriso->do_follow_pattern= 1; + xorriso->do_follow_param= 0; + xorriso->do_follow_links= 0; + xorriso->do_follow_mount= 1; + xorriso->follow_link_limit= 100; + } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) { + xorriso->do_follow_links= 1; + } else if(strncmp(cpt, "mount", l)==0) { + xorriso->do_follow_mount= 1; + } else if(strncmp(cpt,"param", l)==0) { + xorriso->do_follow_param= 1; + } else if(strncmp(cpt, "pattern", l)==0) { + xorriso->do_follow_pattern= 1; + } else if(strncmp(cpt, "limit=", 6)==0) { + sscanf(cpt+6, "%lf", &num); + if(num<=0 || num>1.0e6) { + sprintf(xorriso->info_text, "-follow: Value too %s with '%s'", + num<=0 ? "small" : "large", cpt+6); + goto sorry_ex; + } + xorriso->follow_link_limit= num; + } else { +unknown_mode:; + if(linfo_text, "-follow: unknown mode '%s'", cpt); + else + sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l); +sorry_ex: + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); + xorriso->do_follow_pattern= was_fpt; + xorriso->do_follow_param= was_fpr; + xorriso->do_follow_links= was_fl; + xorriso->do_follow_mount= was_fm; + return(0); + } + } + return(1); +} + + /* Option -fs */ int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag) { @@ -12969,13 +13040,11 @@ bd_speed:; int Xorriso_option_split_size(struct XorrisO *xorriso, char *size, int flag) { double num; - /* At most: 100 extents with 4 GB - 2 kB each = 400 GB - 800 kB */ - static off_t limit= ((off_t) 400) * ((off_t) 1024*1024*1024) - (off_t) 819200; num= Scanf_io_size(size, 0); - if(num > limit) { + if(num > xorriso->file_size_limit && xorriso->file_size_limit > 0) { sprintf(xorriso->info_text, "-split_size: too large %.f (allowed: %.f)", - num, (double) limit); + num, (double) xorriso->file_size_limit); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); } else if(num < 0) @@ -13408,7 +13477,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv, "check_media","chgrp","chgrpi","chgrp_r","chgrp_ri","chmod","chmodi", "chmod_r","chmod_ri","chown","chowni","chown_r","chown_ri", "compare_l","cpr","cpri","cp_rax","cp_rx","cpax","cpx", - "du","dui","dus","dusi","dux","dusx","extract_l","find","findi","findx", + "du","dui","dus","dusi","dux","dusx","extract_l", + "file_size_limit","find","findi","findx", "ls","lsi","lsl","lsli","lsd","lsdi","lsdl","lsdli", "lsx","lslx","lsdx","lsdlx","map_l","mv","mvi","mkdir","mkdiri", "not_paths","rm","rmi","rm_r","rm_ri","rmdir","rmdiri","update_l", @@ -13698,9 +13768,8 @@ next_command:; (*idx)+= 2; ret= Xorriso_option_extract(xorriso, arg1, arg2, 32); - } else if(strcmp(cmd,"follow")==0) { - (*idx)++; - ret= Xorriso_option_follow(xorriso, arg1, 0); + } else if(strcmp(cmd,"file_size_limit")==0) { + ret= Xorriso_option_file_size_limit(xorriso, argc, argv, idx, 0); } else if(strcmp(cmd,"find")==0 || strcmp(cmd,"findi")==0) { ret= Xorriso_option_find(xorriso, argc, argv, idx, 0); @@ -13708,6 +13777,10 @@ next_command:; } else if(strcmp(cmd,"findx")==0) { ret= Xorriso_option_find(xorriso, argc, argv, idx, 1); + } else if(strcmp(cmd,"follow")==0) { + (*idx)++; + ret= Xorriso_option_follow(xorriso, arg1, 0); + } else if(strcmp(cmd,"format")==0) { (*idx)++; ret= Xorriso_option_blank(xorriso, arg1, 1); diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index a3e8a03a..fd4e8f99 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -65,6 +65,12 @@ struct SectorbitmaP; /* Distiniction between valid and invalid sectors */ #define Xorriso_rc_nuM 4 +/* Default setting for the size limit of single data files: + 100 extents with 4 GB - 2 kB each = 400 GB - 800 kB */ +#define Xorriso_default_file_size_limiT \ + (((off_t) 400) * ((off_t) 1024*1024*1024) - (off_t) 819200) + + struct XorrisO { /* the global context of xorriso */ int libs_are_started; @@ -215,6 +221,8 @@ struct XorrisO { /* the global context of xorriso */ int temp_mem_limit; + off_t file_size_limit; + struct ExclusionS *disk_exclusions; int disk_excl_mode; /* bit0= on (else off) bit1= parameter too (else rekursion only) diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 9b8446ed..ff86c62c 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.08.26.163254" +#define Xorriso_timestamP "2008.08.27.121211" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index a4121954..84de0417 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -1659,14 +1659,12 @@ int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, struct stat stbuf; char sfe[5*SfileadrL]; off_t size= 0; - /* At most: 100 extents with 4 GB - 2 kB each = 400 GB - 800 kB */ - static off_t limit= ((off_t) 400) * ((off_t) 1024*1024*1024) - (off_t) 819200; if(flag&8) { - if(cut_size > limit) { + if(cut_size > xorriso->file_size_limit && xorriso->file_size_limit > 0) { sprintf(xorriso->info_text, "File piece exceeds size limit of %.f bytes: %.f from %s\n", - (double) limit, (double) cut_size, + (double) xorriso->file_size_limit, (double) cut_size, Text_shellsafe(disk_path, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); @@ -1687,10 +1685,11 @@ int Xorriso_tree_graft_node(struct XorrisO *xorriso, IsoImage *volume, if(ret<=0) goto ex; return(1); - } else if(size > limit) { + } else if(size > xorriso->file_size_limit && xorriso->file_size_limit > 0) { sprintf(xorriso->info_text, "File exceeds size limit of %.f bytes: %s\n", - (double) limit, Text_shellsafe(disk_path, sfe, 0)); + (double) xorriso->file_size_limit, + Text_shellsafe(disk_path, sfe, 0)); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); return(0); }