From 43ffc8f19f9855a5922018b8b2f6bf00e66d95fc Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 31 Oct 2007 10:34:52 +0000 Subject: [PATCH] Implemented new option -temp_mem_limit --- libisoburn/trunk/test/xorriso.1 | 10 +++++-- libisoburn/trunk/test/xorriso.c | 36 ++++++++++++++++++++++- libisoburn/trunk/test/xorriso.h | 11 +++---- libisoburn/trunk/test/xorriso_private.h | 2 +- libisoburn/trunk/test/xorriso_timestamp.h | 2 +- libisoburn/trunk/test/xorrisoburn.c | 2 +- 6 files changed, 52 insertions(+), 11 deletions(-) diff --git a/libisoburn/trunk/test/xorriso.1 b/libisoburn/trunk/test/xorriso.1 index 3d0982d1..2a1e6d07 100644 --- a/libisoburn/trunk/test/xorriso.1 +++ b/libisoburn/trunk/test/xorriso.1 @@ -543,12 +543,12 @@ Tell the current working directory on local filesystem. .TP \fB\-ls\fR pattern [...] List files from the current working directory in the ISO -image which match a shell pattern (i.e. wildcards '*' '?' '[a-z]'). +image which match shell patterns (i.e. with wildcards '*' '?' '[a-z]'). Note that this resembles rather shell command ls -d than command ls. .TP > \fB\-lsx\fR pattern [...] List files from the current working directory on local filesystem -which match a shell pattern. +which match shell patterns. .TP \fB\-ls_l\fR pattern [...] Like -ls but also list some of the file attributes. @@ -629,6 +629,12 @@ Copy output of a channel to the given file. If text is not empty it will get put out each time an action has been completed. .TP +\fB\-temp_mem_limit\fR number["k"|"m"] +Set the maximum size of temporary memory to be used for image dependent +buffering. Currently this applies to pattern expansion only. +.br +Default is 16m = 16 MiB, minimum 64k = 64 kiB, maximum 1024m = 1 GiB. +.TP \fB\-prog\fR text Use text as this program's name in subsequent messages .TP diff --git a/libisoburn/trunk/test/xorriso.c b/libisoburn/trunk/test/xorriso.c index f38a10a0..7e1d64c0 100644 --- a/libisoburn/trunk/test/xorriso.c +++ b/libisoburn/trunk/test/xorriso.c @@ -1787,7 +1787,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->dialog= 0; m->search_mode= 0; m->structured_search= 1; - m->temp_mem_limit= 16*1024.0*1024.0; + m->temp_mem_limit= 16*1024*1024; m->use_stdin= 0; m->result_page_length= 0; m->result_page_width= 80; @@ -2764,6 +2764,15 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->temp_mem_limit==16*1024*1024); + if((xorriso->temp_mem_limit/1024/1024)*1024*1024==xorriso->temp_mem_limit) + sprintf(line,"-temp_mem_limit %dm\n", xorriso->temp_mem_limit/1024/1024); + else + sprintf(line,"-fs %dk\n", xorriso->temp_mem_limit/1024); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + + sprintf(line,"-prog %s\n",Text_shellsafe(xorriso->progname,sfe,0)); Xorriso_status_result(xorriso,filter,fp,flag&2); @@ -3934,6 +3943,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " for the consolidated -pkt_output stream.", " -mark text If text is not empty it will get put out each time an", " option is completed.", +" -temp_mem_limit number[\"k\"|\"m\"]", +" Set the maximum size for pattern expansion. (Default is 16m)", " -prog text Use text as this program's name in subsequent messages", " -prog_help text Use text as this program's name and perform -help", " -status mode|filter Report the current settings of persistent options.", @@ -4713,6 +4724,25 @@ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag) } +/* Option -temp_mem_limit */ +int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size, + int flag) +{ + double num; + + num= Scanf_io_size(size, 0); + if(num < 64.0 * 1024.0 || num > 1024.0 * 1024.0 * 1024.0) { + sprintf(xorriso->info_text, + "-temp_mem_limit: wrong size %.f (allowed: %.f - %.f)", + num, 64.0 * 1024.0, 1024.0 * 1024.0 * 1024.0); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + xorriso->temp_mem_limit= num; + return(1); +} + + /* Option -toc */ int Xorriso_option_toc(struct XorrisO *xorriso, int flag) { @@ -5083,6 +5113,10 @@ next_command:; } else if(strcmp(cmd,"-tell_media_space")==0) { Xorriso_option_tell_media_space(xorriso, 0); + } else if(strcmp(cmd,"-temp_mem_limit")==0) { + (*idx)++; + ret= Xorriso_option_temp_mem_limit(xorriso, arg1, 0); + } else if(strcmp(cmd,"-test")==0) { /* This option does not exist. */ char line[4096],**hargv= NULL; int hargc, i; diff --git a/libisoburn/trunk/test/xorriso.h b/libisoburn/trunk/test/xorriso.h index 1ca26782..1f8fde4a 100644 --- a/libisoburn/trunk/test/xorriso.h +++ b/libisoburn/trunk/test/xorriso.h @@ -219,11 +219,8 @@ int Xorriso_option_j_capital(struct XorrisO *xorriso, int flag); /* Options -ls alias -lsi and ls_l alias ls_li */ /* @param flag bit0= long format (-ls_l) */ -int Xorriso_option_lsi(struct XorrisO *xorriso, char *pattern, int flag); - -/* Options -lsx and -ls_lx */ -/* @param flag bit0= long format (-ls_l) */ -int Xorriso_option_lsi(struct XorrisO *xorriso, char *pattern, int flag); +int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag); /* Option -logfile */ int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel, @@ -310,6 +307,10 @@ int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num1, /* Option -tell_media_space */ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag); +/* Option -temp_mem_limit */ +int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size, + int flag); + /* Option -toc */ int Xorriso_option_toc(struct XorrisO *xorriso, int flag); diff --git a/libisoburn/trunk/test/xorriso_private.h b/libisoburn/trunk/test/xorriso_private.h index fbd0220b..a2fcf3d2 100644 --- a/libisoburn/trunk/test/xorriso_private.h +++ b/libisoburn/trunk/test/xorriso_private.h @@ -115,7 +115,7 @@ struct XorrisO { /* the global context of xorriso */ ( 3= like 2 : but report first content level of matching directories ) 4= actually not structured but unique find mode (with search_mode 4) */ - double temp_mem_limit; + int temp_mem_limit; int use_stdin; /* use raw stdin even if readline support is compiled */ int result_page_length; diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index ab1aa4fd..9765251a 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.30.214242" +#define Xorriso_timestamP "2007.10.31.103338" diff --git a/libisoburn/trunk/test/xorrisoburn.c b/libisoburn/trunk/test/xorrisoburn.c index f6478082..cd663807 100644 --- a/libisoburn/trunk/test/xorrisoburn.c +++ b/libisoburn/trunk/test/xorrisoburn.c @@ -1784,7 +1784,7 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso, if(ret<=0) return(ret); root_dir= iso_volume_get_root(volume); - if(dir==NULL) { + if(root_dir==NULL) { Xorriso_process_msg_queues(xorriso,0); sprintf(xorriso->info_text, "While expanding pattern : Cannot obtain root node of ISO image");