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:
2024-11-03 20:04:54 +01:00
parent 923bfa0be9
commit 32bfa95973
25 changed files with 1168 additions and 214 deletions

View File

@ -2973,14 +2973,66 @@ from_disk:;
ret= iso_local_get_lfa_flags(path, lfa_flags, max_bit, &os_errno,
flag & ((1 << 5) | (1 << 7)));
if(ret < 0) {
Xorriso_process_msg_queues(xorriso, 0);
Xorriso_report_iso_error(xorriso, path, ret,
"Error when obtaining lsattr flags of disk file",
os_errno, "WARNING", 1);
return(-1);
if(ret != (int) ISO_LFA_NOT_ENABLED) {
Xorriso_process_msg_queues(xorriso, 0);
Xorriso_report_iso_error(xorriso, path, ret,
"Error when obtaining lsattr flags of disk file",
os_errno, "WARNING", 1);
return(-1);
}
}
if(ret == 1 || ret == 2)
return(1);
return(0);
}
/*
@param in_node if not NULL and not flag bit1: omit path resolution
@param flag bit1= path is disk_path
bit5= in case of symbolic link on disk: inquire link target
@return >0 = ok , *projid is valid
<0 = libisofs error
*/
int Xorriso_get_projid(struct XorrisO *xorriso, void *in_node, char *path,
uint32_t *projid, int flag)
{
int ret, os_errno;
IsoNode *node;
*projid= 0;
if(flag & 2)
goto from_disk;
node= (IsoNode *) in_node;
if(node == NULL) {
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
if(ret <= 0)
return(ret);
}
ret= iso_node_get_projid(node, projid, 0);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso, 0);
Xorriso_report_iso_error(xorriso, path, ret,
"Error when obtaining XFS-style project id of ISO node",
0, "WARNING", 1);
return(-1);
}
return(1);
from_disk:;
ret= iso_local_get_projid(path, projid, &os_errno, flag & (1 << 5));
if(ret < 0) {
if(ret != (int) ISO_PROJID_NOT_ENABLED) {
Xorriso_process_msg_queues(xorriso, 0);
Xorriso_report_iso_error(xorriso, path, ret,
"Error when obtaining XFS-style project id of disk file",
os_errno, "WARNING", 1);
return(-1);
}
}
return(1);
}