New option -hide

This commit is contained in:
Thomas Schmitt 2010-06-20 16:48:28 +00:00
parent 5a6024a1cc
commit c54b5bc6a2
11 changed files with 203 additions and 67 deletions

View File

@ -607,10 +607,11 @@ int Xorriso__mode_to_perms(mode_t st_mode, char perms[11], int flag)
/* @param flag bit0= recognize Xorriso_IFBOOT as file type
bit1= add '+' to perms
bit2-3: hidden_state : 0=off, 1=iso_rr, 2=joliet= 3=on
*/
int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
{
int show_major_minor= 0, high_shift= 0, high_mask= 0;
int show_major_minor= 0, high_shift= 0, high_mask= 0, hidden_state;
char *rpt, perms[11], mm_text[80];
mode_t st_mode;
dev_t dev, major, minor;
@ -621,9 +622,17 @@ int Xorriso_format_ls_l(struct XorrisO *xorriso, struct stat *stbuf, int flag)
if(S_ISDIR(st_mode))
strcat(rpt, "d");
else if(S_ISREG(st_mode))
strcat(rpt, "-");
else if(S_ISLNK(st_mode))
else if(S_ISREG(st_mode)) {
hidden_state= (flag >> 2) & 3;
if(hidden_state == 1)
strcat(rpt, "R");
else if(hidden_state == 2)
strcat(rpt, "J");
else if(hidden_state == 3)
strcat(rpt, "H");
else
strcat(rpt, "-");
} else if(S_ISLNK(st_mode))
strcat(rpt, "l");
else if(S_ISBLK(st_mode)) {
strcat(rpt, "b");

View File

@ -1613,6 +1613,30 @@ int Xorriso_widen_hardlink(struct XorrisO *xorriso, void * boss_iter,
}
int Xorriso_set_hidden(struct XorrisO *xorriso, void *in_node, char *path,
int hide_state, int flag)
{
int ret, hide_attrs= 0;
IsoNode *node;
node= (IsoNode *) in_node;
if(node == NULL) {
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
if(ret<=0)
return(ret);
}
if(hide_state) {
hide_attrs|= LIBISO_HIDE_BUT_WRITE;
if(hide_state & 1)
hide_attrs|= LIBISO_HIDE_ON_RR;
if(hide_state & 2)
hide_attrs|= LIBISO_HIDE_ON_JOLIET;
}
iso_node_set_hidden(node, hide_attrs);
return(1);
}
int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error,int flag)
{
Xorriso_process_msg_queues(xorriso,0);
@ -1743,7 +1767,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
char *abs_path, char *show_path,
IsoNode *node, int depth, int flag)
{
int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0, hide_attrs;
int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0;
uid_t user= 0;
gid_t group= 0;
time_t date= 0;
@ -1861,15 +1885,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
} else if(action == 38) { /* sort_weight */
iso_node_set_sort_weight(node, type);
} else if(action == 39) { /* hide */
hide_attrs= 0;
if(type) {
hide_attrs|= LIBISO_HIDE_BUT_WRITE;
if(type & 1)
hide_attrs|= LIBISO_HIDE_ON_RR;
if(type & 2)
hide_attrs|= LIBISO_HIDE_ON_JOLIET;
}
iso_node_set_hidden(node, hide_attrs);
Xorriso_set_hidden(xorriso, node, NULL, type, 0);
} else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);

View File

@ -1321,7 +1321,7 @@ ex:;
int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
int filec, char **filev, off_t boss_mem, int flag)
{
int i, ret, was_error= 0, dfilec= 0, pass, passes;
int i, ret, was_error= 0, dfilec= 0, pass, passes, hidden_state= 0;
IsoNode *node;
IsoImage *volume;
char sfe[5*SfileadrL], sfe2[5*SfileadrL], path[SfileadrL];
@ -1404,8 +1404,15 @@ int Xorriso_ls_filev(struct XorrisO *xorriso, char *wd,
link_target[0]= 0;
if((flag&5)==1) { /* -ls_l */
iso_node_get_acl_text(node, &a_text, &d_text, 16);
hidden_state= 0;
ret= iso_node_get_hidden(node);
if(ret & LIBISO_HIDE_ON_RR)
hidden_state|= 1;
if(ret & LIBISO_HIDE_ON_JOLIET)
hidden_state|= 2;
ret= Xorriso_format_ls_l(xorriso, &stbuf,
1 | ((a_text != NULL || d_text != NULL) << 1));
1 | ((a_text != NULL || d_text != NULL) << 1) |
(hidden_state << 2));
iso_node_get_acl_text(node, &a_text, &d_text, 1 << 15);
if(ret<=0)
continue;

View File

@ -1374,7 +1374,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Allow more or less harmless deviations from strict standards",
" compliance.",
" -boot_image \"any\"|\"isolinux\"|\"grub\"",
" \"discard\"|\"keep\"|\"patch\"|\"dir=\"|\"bin_path=\"|\"cat_path=\"",
" |\"discard\"|\"keep\"|\"patch\"|\"dir=\"|\"bin_path=\"",
" |\"cat_path=\"|\"cat_hidden=on|iso_rr|joliet|off\"",
" |\"load_size=\"|\"system_area=\"|\"partition_table=on|off\"",
" Whether to discard or keep an exiting El Torito boot image.",
" ISOLINUX can be made bootable by dir=/ or dir=/isolinux",
@ -1504,13 +1505,17 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" access time, modification time, both times.",
" -alter_date_r type timestring iso_rr_path [***]",
" Like -alter_date but affecting all files below directories.",
" -hide on|iso_rr|joliet|off iso_rr_path [***]",
" Keep names of files out of directory tree, but store their",
" data content in the image.",
" -find iso_rr_path [test [op] [test ...]] [-exec action [params]]",
" performs an action on files below the given directory in",
" the ISO image. Tests:",
" -name pattern, -wholename pattern, -type b|c|d|p|f|l|s|e,",
" -pending_data, -lba_range start count, -damaged,",
" -has_acl, -has_xattr, -has_aaip, -has_filter, -has_md5",
" -has_any_xattr, -prune, -decision yes|no, -true, -false",
" -name pattern, -wholename pattern, -disk_name pattern,",
" -type b|c|d|p|f|l|s|e, -pending_data, -hidden,",
" -lba_range start count, -damaged, -has_acl, -has_xattr,",
" -has_aaip, -has_filter, -has_md5, -has_any_xattr,",
" -prune, -decision yes|no, -true, -false",
" Operators: -not, -or, -and, -sub, (, -subend, ),",
" -if, -then, -elseif, -else, -endif",
" Action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
@ -1518,7 +1523,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" rm, rm_r, compare, update, report_damage, report_lba,",
" getfacl, setfacl, getfattr, setfattr, get_any_xattr,",
" get_md5, check_md5, make_md5, set_filter, show_stream,",
" mkisofs_r, find.",
" mkisofs_r, hide, find.",
" params are their arguments except iso_rr_path.",
" -mkdir iso_rr_path [...]",
" Create empty directories if they do not exist yet.",
@ -1865,6 +1870,46 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
}
/* Option -hide */
int Xorriso_option_hide(struct XorrisO *xorriso, char *hide_state,
int argc, char **argv, int *idx, int flag)
{
int i, ret, end_idx, optc= 0, was_failure= 0, fret, hide_mode;
char **optv= NULL;
ret= Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc,
&optv, 0);
if(ret<=0)
goto ex;
hide_mode= Xorriso__hide_mode(hide_state, 0);
if(hide_mode < 0) {
sprintf(xorriso->info_text, "-hide : unknown hide state ");
Text_shellsafe(hide_state, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
goto ex;
}
for(i= 0; i<optc; i++) {
ret= Xorriso_set_hidden(xorriso, NULL, optv[i], hide_mode, 0);
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
ret= 0; goto ex;
}
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc, &optv,
256);
if(ret<=0)
return(ret);
return(!was_failure);
}
/* Option -history */
int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag)
{

View File

@ -492,7 +492,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"du","dui","dus","dusi","dux","dusx","external_filter","extract_l",
"file_size_limit","find","findi","finds","findx",
"getfacl","getfacli","getfacl_r","getfacl_ri",
"getfattr","getfattri","getfattr_r","getfattr_ri",
"getfattr","getfattri","getfattr_r","getfattr_ri","hide",
"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",
@ -911,6 +911,10 @@ next_command:;
} else if(strcmp(cmd,"help")==0) {
Xorriso_option_help(xorriso,0);
} else if(strcmp(cmd,"hide")==0) {
(*idx)+= 1;
ret= Xorriso_option_hide(xorriso, arg1, argc, argv, idx, 1);
} else if(strcmp(cmd,"history")==0) {
/* add to readline history */
(*idx)++;

View File

@ -9,7 +9,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 "Jun 10, 2010"
.TH XORRISO 1 "Jun 20, 2010"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -1422,6 +1422,20 @@ where "A0" is year 2000, "B0" is 2010, etc.
\fB\-alter_date_r\fR type timestring iso_rr_path [***]
Like -alter_date but affecting all files below eventual directories.
.TP
\fB\-hide\fR hide_state iso_rr_path [***]
Prevent the names of the given files from showing up in the directory trees
of ISO 9660 and/or Joliet when the image gets written.
The eventual data content of such hidden files will be included in the
resulting image, even if they do not show up in any directory.
But you will need own means to find nameless data in the image.
.br
Possible values of hide_state are: "iso_rr" for hiding from ISO 9660 tree,
"joliet" for Joliet tree, "on" for both trees. "off" means visibility in
both directory trees.
.br
This command does not apply to the boot catalog.
Rather use: -boot_image "any" "cat_hidden=on"
.TP
.B Tree traversal command -find:
.PP
.TP
@ -1490,8 +1504,8 @@ Matches files which are filtered by -set_filter.
.br
\fB\-hidden\fR hide_state :
Matches files which are hidden in "iso_rr" tree, in "joliet" tree,
in both ("on"), or not hidden in any tree ("off"). Those who are hidden
in some tree match -not -hidden "off".
in both trees ("on"), or not hidden in any tree ("off").
Those which are hidden in some tree match -not -hidden "off".
.br
\fB\-prune\fR :
If this test is reached and the tested file is a directory then -find will not

View File

@ -827,6 +827,10 @@ int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag);
/* Option -help and part of -prog_help */
int Xorriso_option_help(struct XorrisO *xorriso, int flag);
/* Option -hide */
int Xorriso_option_hide(struct XorrisO *xorriso, char *hide_state,
int argc, char **argv, int *idx, int flag);
/* Option -history */
int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag);

View File

@ -1299,6 +1299,19 @@ whether they stem from the loaded image or were newly inserted.
Like -alter_date but affecting all files below eventual
directories.
-hide hide_state iso_rr_path [***]
Prevent the names of the given files from showing up in the
directory trees of ISO 9660 and/or Joliet when the image gets
written. The eventual data content of such hidden files will be
included in the resulting image, even if they do not show up in
any directory. But you will need own means to find nameless data
in the image.
Possible values of hide_state are: "iso_rr" for hiding from ISO
9660 tree, "joliet" for Joliet tree, "on" for both trees. "off"
means visibility in both directory trees.
This command does not apply to the boot catalog. Rather use:
-boot_image "any" "cat_hidden=on"

File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options
@ -1358,8 +1371,8 @@ File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options
Matches files which are filtered by -set_filter.
-hidden hide_state :
Matches files which are hidden in "iso_rr" tree, in "joliet"
tree, in both ("on"), or not hidden in any tree ("off").
Those who are hidden in some tree match -not -hidden "off".
tree, in both trees ("on"), or not hidden in any tree ("off").
Those which are hidden in some tree match -not -hidden "off".
-prune :
If this test is reached and the tested file is a directory
then -find will not dive into that directory. This test
@ -3732,6 +3745,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
* -grow_blindly overides next writeable address: AqDrive. (line 44)
* -hardlinks controls handling of hard links: Loading. (line 91)
* -help prints help text: Scripting. (line 16)
* -hide excludes file names from directory trees: Manip. (line 170)
* -history brings text into readline history: Scripting. (line 22)
* -in_charset sets input character set: Loading. (line 73)
* -indev aquires a drive for input: AqDrive. (line 22)
@ -3911,6 +3925,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
* Group, in ISO image, -chgrp_r: Manip. (line 55)
* Growing, _definition: Methods. (line 19)
* Hard links, control handling, -hardlinks: Loading. (line 91)
* hidden, set in ISO image, -hide: Manip. (line 170)
* Image, _definition: Model. (line 9)
* Image, demand volume id, -assert_volid: Loading. (line 65)
* Image, discard pending changes, -rollback: Writing. (line 9)
@ -4083,42 +4098,42 @@ Node: Loading27397
Node: Insert39576
Node: SetInsert47933
Node: Manip56500
Node: CmdFind64376
Node: Filter74319
Node: Writing78668
Node: SetWrite84957
Node: Bootable95241
Node: Charset103193
Node: Exception105947
Node: DialogCtl110462
Node: Inquiry112807
Node: Navigate116947
Node: Verify124301
Node: Restore132721
Node: Emulation139377
Node: Scripting146250
Node: Frontend151812
Node: Examples153013
Node: ExDevices154182
Node: ExCreate154816
Node: ExDialog156090
Node: ExGrowing157352
Node: ExModifying158154
Node: ExBootable158655
Node: ExCharset159202
Node: ExPseudo160030
Node: ExCdrecord160924
Node: ExMkisofs161239
Node: ExGrowisofs162242
Node: ExException163366
Node: ExTime163820
Node: ExIncBackup164279
Node: ExRestore167751
Node: ExRecovery168720
Node: Files169286
Node: Seealso170324
Node: Legal170848
Node: CommandIdx171770
Node: ConceptIdx185071
Node: CmdFind65064
Node: Filter75015
Node: Writing79364
Node: SetWrite85653
Node: Bootable95937
Node: Charset103889
Node: Exception106643
Node: DialogCtl111158
Node: Inquiry113503
Node: Navigate117643
Node: Verify124997
Node: Restore133417
Node: Emulation140073
Node: Scripting146946
Node: Frontend152508
Node: Examples153709
Node: ExDevices154878
Node: ExCreate155512
Node: ExDialog156786
Node: ExGrowing158048
Node: ExModifying158850
Node: ExBootable159351
Node: ExCharset159898
Node: ExPseudo160726
Node: ExCdrecord161620
Node: ExMkisofs161935
Node: ExGrowisofs162938
Node: ExException164062
Node: ExTime164516
Node: ExIncBackup164975
Node: ExRestore168447
Node: ExRecovery169416
Node: Files169982
Node: Seealso171020
Node: Legal171544
Node: CommandIdx172466
Node: ConceptIdx185840

End Tag Table

View File

@ -44,7 +44,7 @@
@c man .\" First parameter, NAME, should be all caps
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
@c man .\" other parameters are allowed: see man(7), man(1)
@c man .TH XORRISO 1 "Jun 10, 2010"
@c man .TH XORRISO 1 "Jun 20, 2010"
@c man .\" Please adjust this date whenever revising the manpage.
@c man .\"
@c man .\" Some roff macros, for reference:
@ -1755,6 +1755,22 @@ where "A0" is year 2000, "B0" is 2010, etc.
@kindex -alter_date_r sets timestamps in ISO image
@cindex Timestamps, set in ISO image, -alter_date_r
Like -alter_date but affecting all files below eventual directories.
@c man .TP
@item -hide hide_state iso_rr_path [***]
@kindex -hide excludes file names from directory trees
@cindex hidden, set in ISO image, -hide
Prevent the names of the given files from showing up in the directory trees
of ISO 9660 and/or Joliet when the image gets written.
The eventual data content of such hidden files will be included in the
resulting image, even if they do not show up in any directory.
But you will need own means to find nameless data in the image.
@*
Possible values of hide_state are: "iso_rr" for hiding from ISO 9660 tree,
"joliet" for Joliet tree, "on" for both trees. "off" means visibility in
both directory trees.
@*
This command does not apply to the boot catalog.
Rather use: -boot_image "any" "cat_hidden=on"
@end table
@c man .TP
@c man .B Tree traversal command -find:
@ -3219,6 +3235,9 @@ This resembles shell command ls -d.
@cindex Navigate, list ISO files, -lsl
Like -ls but also list some of the file attributes.
The output format resembles shell command ls -ln.
@*
Particular types of regular files: "R" hidden in ISO/Rock Ridge, "J" hidden in
Joliet, "H" hidden in both trees.
@c man .TP
@item -lsdl iso_rr_pattern [***]
@kindex -lsdl lists files in ISO image

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.06.20.141555"
#define Xorriso_timestamP "2010.06.20.164738"

View File

@ -531,5 +531,8 @@ int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag);
int Xorriso_set_system_area_path(struct XorrisO *xorriso, char *path,
int flag);
int Xorriso_set_hidden(struct XorrisO *xorriso, void *in_node, char *path,
int hide_state, int flag);
#endif /* Xorrisoburn_includeD */