New commands -lfa_flags, -lsattr, -lsattrd, -chattr, -chattr_r, -find test -has_lfa_flags, -find actions lsattrd, chattr

This commit is contained in:
2024-07-20 23:12:16 +02:00
parent dfd0a8cc81
commit 0802689b11
26 changed files with 1222 additions and 165 deletions

View File

@ -835,8 +835,9 @@ static int Xorriso_truncate_const_find_name(struct XorrisO *xorriso,
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int ret, i, end_idx, type= 0, action, deleter= 0, count;
int ret, i, end_idx, type= 0, action, deleter= 0, count, operator;
off_t start_lba, block_count;
uint64_t lfa_flags;
int list_extattr_head= 0, bsl_mem, disk_path, name_space, prefix_code;
struct FindjoB *job, *first_job= NULL, *new_job;
char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt;
@ -946,6 +947,14 @@ off_t_overflow:;
Findjob_set_aaip_filter(job, 1, 0);
} else if(strcmp(argv[i], "-has_no_aaip")==0) {
Findjob_set_aaip_filter(job, -1, 0);
} else if(strcmp(argv[i], "-has_lfa_flags")==0) {
if(i + 1 >= end_idx)
goto not_enough_arguments;
i++;
ret= Xorriso_decode_lfa_flags(xorriso, argv[i], &lfa_flags, 0);
if(ret <= 0)
goto sorry_ex;
Findjob_set_uint64_filter(job, 28, lfa_flags, 0);
} else if(strcmp(argv[i], "-has_filter")==0) {
Findjob_set_filter_filter(job, 1, 0);
} else if(strcmp(argv[i], "-has_no_filter")==0) {
@ -1471,6 +1480,17 @@ not_enough_exec_arguments:;
Findjob_set_action_target(job, 51, NULL, 0);
} else if(strcmp(cpt, "show_stream_id") == 0) {
Findjob_set_action_target(job, 52, NULL, 0);
} else if(strcmp(cpt, "lsattrd") == 0) {
Findjob_set_action_target(job, 60, NULL, 0);
} else if(strcmp(cpt, "chattr") == 0) {
if(i + 1 >= end_idx)
goto not_enough_exec_arguments;
i++;
ret= Xorriso_decode_chattr_arg(xorriso, argv[i], &lfa_flags, &operator,
0);
if(ret <= 0)
goto sorry_ex;
Findjob_set_action_chattr(job, 61, lfa_flags, operator, 0);
} else {
sprintf(xorriso->info_text, "-find -exec: unknown action ");
Text_shellsafe(argv[i], xorriso->info_text, 1);
@ -1919,10 +1939,14 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Enable or disable reading and writing of ACLs.",
" -xattr \"on\"|\"user\"|\"any\"|\"off\"",
" Enable or disable reading and writing of xattr.",
" -lfa_flags mode[:mode ...]",
" Enable or disable reading and restoring of Linux chattr",
" flags.",
" -md5 \"on\"|\"all\"|\"off\"",
" Enable or disable processing of MD5 checksums.",
" -for_backup",
" Shortcut for: -hardlinks on -acl on -xattr any -md5 on",
" -lfa_flags default:on:restore_mask=aAcCdDijmPsStTux",
" -ecma119_map \"unmapped\"|\"stripped\"|\"uppercase\"|\"lowercase\"",
" Choose conversion of file names if neither Rock Ridge",
" nor Joliet is present in the loaded ISO session.",
@ -2192,6 +2216,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -setfattr_list disk_path",
" Read output of getfattr from file disk_path. Replace the",
" xattr of the iso_rr_path given by line \"# file:\".",
" -chattr \"+\"|\"-\"|\"=\"|\".\"mode iso_rr_path [***]",
" Set or unset Linux chattr flags of the given files.",
" -alter_date type timestring iso_rr_path [***]",
" Alter the date entries of a file in the ISO image. type is",
" one of \"a\", \"m\", \"b\" for:",
@ -2221,7 +2247,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" list_extattr, get_md5, check_md5, make_md5,",
" set_hfs_crtp, get_hfs_crtp, set_hfs_bless, get_hfs_bless,",
" set_filter, show_stream, show_stream_id, mkisofs_r,",
" hide, print_outname, estimate_size, find",
" hide, print_outname, estimate_size, in_iso, not_in_iso",
" add_missing, empty_iso_dir, is_full_in_iso, sort_weight",
" update_merge, rm_merge, clear_merge, lsattrd, chattr, find",
" params are their parameters except iso_rr_path.",
" -mkdir iso_rr_path [...]",
" Create empty directories if they do not exist yet.",
@ -2375,6 +2403,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -lsdx pattern [***] like -lsx but listing directories as single items.",
" -lslx pattern [***] like -lsx but also telling some file attributes.",
" -lsdlx pattern [***] like -lsdx but also telling some file attributes.",
" -lsattr pattern [***] lists Linux chattr flags of the given files.",
" -lsattrd pattern [***] like -lsattr but listing directories as single items.",
" -getfacl pattern [***] list eventual ACLs of the given files.",
" -getfacl_r pattern [***] like -getfacl but listing whole file trees.",
" -getfattr pattern [***] list eventual xattr of the given files.",