New commands -projid, -get_projid, -get_projid_r, -set_projid, -set_projid_r, -find test -has_projid, -find actions get_projid, set_projid, get_projid_minmax
This commit is contained in:
@ -958,6 +958,22 @@ off_t_overflow:;
|
||||
Findjob_set_uint64_filter(job,
|
||||
28 + (strcmp(argv[i - 1], "-has_some_lfa_flags_of") == 0),
|
||||
lfa_flags, 0);
|
||||
|
||||
} else if(strcmp(argv[i], "-has_projid") == 0) {
|
||||
if(i + 1 >= end_idx)
|
||||
goto not_enough_arguments;
|
||||
i++;
|
||||
ret= Sfile_text_to_off_t(argv[i - 1], &start_lba, 0);
|
||||
if(ret <= 0) {
|
||||
bad_projid:;
|
||||
sprintf(xorriso->info_text,
|
||||
"-has_projid: project id number too large or too small");
|
||||
goto sorry_ex;
|
||||
}
|
||||
if(start_lba < 0 || start_lba > (off_t) 0xffffffff)
|
||||
goto bad_projid;
|
||||
Findjob_set_uint64_filter(job, 30, (uint64_t) start_lba, 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) {
|
||||
@ -1494,6 +1510,25 @@ not_enough_exec_arguments:;
|
||||
if(ret <= 0)
|
||||
goto sorry_ex;
|
||||
Findjob_set_action_chattr(job, 61, lfa_flags, operator, 0);
|
||||
} else if(strcmp(cpt, "get_projid") == 0) {
|
||||
Findjob_set_action_target(job, 63, NULL, 0);
|
||||
} else if(strcmp(cpt, "set_projid") == 0) {
|
||||
if(i + 1 >= end_idx)
|
||||
goto not_enough_exec_arguments;
|
||||
i++;
|
||||
ret= Sfile_text_to_off_t(argv[i], &start_lba, 0);
|
||||
if(ret <= 0) {
|
||||
bad_set_projid:;
|
||||
sprintf(xorriso->info_text,
|
||||
"set_projid: project id number too large or too small");
|
||||
goto sorry_ex;
|
||||
}
|
||||
if(start_lba < 0 || start_lba > (off_t) 0xffffffff)
|
||||
goto bad_set_projid;
|
||||
operator= 0;
|
||||
Findjob_set_action_chattr(job, 64, start_lba, operator, 0);
|
||||
} else if(strcmp(cpt, "get_projid_minmax") == 0) {
|
||||
Findjob_set_action_target(job, 65, NULL, 0);
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "-find -exec: unknown action ");
|
||||
Text_shellsafe(argv[i], xorriso->info_text, 1);
|
||||
@ -1564,6 +1599,17 @@ ex:;
|
||||
!!(first_job->estim_upper_size % 2048)));
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
if(first_job != NULL && first_job->action == 65) {
|
||||
if(first_job->projid_low >= 0 && first_job->projid_high >= 0) {
|
||||
sprintf(xorriso->result_line, "projid minmax: %lu %lu\n",
|
||||
(unsigned long) first_job->projid_low,
|
||||
(unsigned long) first_job->projid_high);
|
||||
} else {
|
||||
sprintf(xorriso->result_line, "projid minmax: -1 -1\n");
|
||||
}
|
||||
Xorriso_result(xorriso,0);
|
||||
}
|
||||
|
||||
if(access_acl_text != NULL)
|
||||
free(access_acl_text);
|
||||
if(default_acl_text != NULL)
|
||||
@ -1671,6 +1717,7 @@ int Xorriso_option_for_backup(struct XorrisO *xorriso, int flag)
|
||||
if(xorriso->lfa_flags_default & 8)
|
||||
Xorriso_option_lfa_flags(xorriso,
|
||||
"default:on:import_only_settable:restore_mask=aAcdDijmPsStTux", 0);
|
||||
Xorriso_option_projid(xorriso, "on", 0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -1713,6 +1760,61 @@ int Xorriso_option_genisoimage_completion(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
/* Commands -get_projid alias get_projidi
|
||||
-get_projid_r alias -get_projid_ri */
|
||||
/* @param flag bit0=recursive -get_projid_r
|
||||
*/
|
||||
int Xorriso_option_get_projid(struct XorrisO *xorriso,
|
||||
int argc, char **argv, int *idx, int flag)
|
||||
{
|
||||
int i, ret, was_failure= 0, end_idx, fret;
|
||||
int optc= 0;
|
||||
uint32_t projid= 0;
|
||||
char **optv= NULL;
|
||||
struct FindjoB *job= NULL;
|
||||
struct stat dir_stbuf;
|
||||
|
||||
ret= Xorriso_opt_args(xorriso, "-get_projid", argc, argv, *idx,
|
||||
&end_idx, &optc, &optv, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
|
||||
for(i= 0; i < optc; i++) {
|
||||
if(flag & 1) {
|
||||
ret= Findjob_new(&job, optv[i], 0);
|
||||
if(ret <= 0) {
|
||||
Xorriso_no_findjob(xorriso, "-get_projid_r", 0);
|
||||
{ret= -1; goto ex;}
|
||||
}
|
||||
Findjob_set_action_target(job, 63, NULL, 0);
|
||||
ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
|
||||
NULL, optv[i], &dir_stbuf, 0, 0);
|
||||
Findjob_destroy(&job, 0);
|
||||
} else {
|
||||
ret= Xorriso_get_projid(xorriso, NULL, optv[i], &projid, 0);
|
||||
if(ret > 0)
|
||||
Xorriso_show_projid(xorriso, optv[i], projid, 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, "-get_projid", argc, argv, *idx, &end_idx,
|
||||
&optc, &optv, 256);
|
||||
Findjob_destroy(&job, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
return(!was_failure);
|
||||
}
|
||||
|
||||
|
||||
/* Commands -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri
|
||||
-getfattr alias getfattri
|
||||
*/
|
||||
@ -1978,10 +2080,14 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" -lfa_flags mode[:mode ...]",
|
||||
" Enable or disable reading and restoring of Linux chattr",
|
||||
" flags.",
|
||||
" -projid \"on\"|\"off\"|\"restore_0\"|\"map+\"low,high=low,high",
|
||||
" Enable or disable reading and restoring of XFS-style",
|
||||
" project ids. Define mapping of ids at restore time.",
|
||||
" -md5 \"on\"|\"all\"|\"off\"",
|
||||
" Enable or disable processing of MD5 checksums.",
|
||||
" -for_backup",
|
||||
" Shortcut for: -hardlinks on -acl on -xattr any -md5 on",
|
||||
" -projid on",
|
||||
" possibly: -lfa_flags default:on:restore_mask=aAcCdDijmPsStTux",
|
||||
" -ecma119_map \"unmapped\"|\"stripped\"|\"uppercase\"|\"lowercase\"",
|
||||
" Choose conversion of file names if neither Rock Ridge",
|
||||
@ -2254,6 +2360,12 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" 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.",
|
||||
" -chattr_r \"+\"|\"-\"|\"=\"|\".\"mode iso_rr_path [***]",
|
||||
" Like -chattr but affecting all files below directories.",
|
||||
" -set_projid number iso_rr_path [***]",
|
||||
" Set XFS-style project id number of the given files.",
|
||||
" -set_projid_r number iso_rr_path [***]",
|
||||
" Like -set_projid but affecting all files below directories.",
|
||||
" -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:",
|
||||
@ -2273,6 +2385,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
||||
" -lba_range start count, -damaged, -has_acl, -has_xattr,",
|
||||
" -has_aaip, -has_filter, -has_md5, -has_any_xattr,",
|
||||
" -has_lfa_flags letters, -has_some_lfa_flags_of letters,",
|
||||
" -has_projid number,",
|
||||
" -has_hfs_crtp, -has_hfs_bless, -bad_outname,",
|
||||
" -name_limit_blocker, -maxdepth, -mindepth, -size,",
|
||||
" -prune, -decision yes|no, -true, -false",
|
||||
@ -2286,9 +2399,10 @@ 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, 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",
|
||||
" 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,",
|
||||
" get_projid, set_projid, get_projid_minmax, find",
|
||||
" params are their parameters except iso_rr_path.",
|
||||
" -mkdir iso_rr_path [...]",
|
||||
" Create empty directories if they do not exist yet.",
|
||||
@ -2442,12 +2556,14 @@ 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.",
|
||||
" -getfxattr_r pattern [***] like -getfxattr but listing whole file trees.",
|
||||
" -getfattr_r pattern [***] like -getfattr but listing whole file trees.",
|
||||
" -lsattr pattern [***] lists Linux chattr flags of the given files.",
|
||||
" -lsattrd pattern [***] like -lsattr but listing directories as single items.",
|
||||
" -get_projid pattern [***] lists XFS-style project ids of the given files.",
|
||||
" -get_projid_r pattern [***] like -get_projid but listing whole file trees.",
|
||||
"",
|
||||
" -du pattern [***] recursively lists sizes of files or directories in the",
|
||||
" ISO image which match one of the shell parser patterns.",
|
||||
|
Reference in New Issue
Block a user