-disk_dev_ino mode ino_only

This commit is contained in:
2009-02-25 14:40:47 +00:00
parent b6a998318c
commit c8122f4659
5 changed files with 103 additions and 23 deletions

View File

@ -120,6 +120,12 @@ int Xorriso_path_from_node(struct XorrisO *xorriso, IsoNode *node, int lba,
isoburn_igopt_always_gmt)
/* <<< Whether to allow xattr and ACL with the root node.
(It is supposed to work since libisofs-ng resision 479)
*/
#define Xorriso_root_with_aaiP yes
/* ------------------------------------------------------------------------ */
@ -1694,6 +1700,35 @@ int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
return(*volume != NULL);
}
/*
@param flag bit0= do not issue warning
*/
int Xorriso_aaip_warn_of_root(struct XorrisO *xorriso, IsoNode *node, int flag)
{
#ifndef Xorriso_root_with_aaiP
int ret;
IsoDir *root= NULL;
IsoImage *volume;
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
root= iso_image_get_root(volume);
if(node == (IsoNode *) root) {
sprintf(xorriso->info_text,
"Cannot attach ACL or xattr to ISO root directory");
if(!(flag & 1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
return(0);
}
#endif /* ! Xorriso_root_with_aaiP */
return(1);
}
/* @param flag bit0=do not complain about non existent node */
int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume,
@ -8838,7 +8873,7 @@ int Xorriso_getfname(struct XorrisO *xorriso, char *path, int flag)
strlen(path + path_offset), 8);
if(ret <= 0)
return(-1);
sprintf(xorriso->result_line, "# file: %s\n", bsl_path);
sprintf(xorriso->result_line, "# file: %s\n", bsl_path[0] ? bsl_path : ".");
free(bsl_path);
bsl_path= NULL;
/* temporarily disable -backslash_codes with result output */
@ -9032,7 +9067,7 @@ int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag)
@param path is used as address if node is NULL.
@param access_text "access" ACL in long text form
@param default_text "default" ACL in long text form
@param flag Unused yet, submit 0
@param flag bit0= do not warn of root directory if not capable of AAIP
@return >0 success , <=0 failure
*/
int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
@ -9048,6 +9083,12 @@ int Xorriso_setfacl(struct XorrisO *xorriso, void *in_node, char *path,
goto ex;
}
ret= Xorriso_aaip_warn_of_root(xorriso, node, flag & 1);
if (ret < 0)
goto ex;
if (ret == 0)
{ret= 1; goto ex;}
#ifdef Xorriso_with_aaiP
ret= iso_node_set_acl_text(node, access_text, default_text, 0);
#else
@ -9169,6 +9210,7 @@ ex:;
bit1= Do not clear the existing attribute list
bit2= Delete the attributes with the given names
bit3= Allow non-user attributes.
bit4= do not warn of root if incapable of AAIP
@return >0 success , <=0 failure
*/
int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path,
@ -9185,6 +9227,12 @@ int Xorriso_setfattr(struct XorrisO *xorriso, void *in_node, char *path,
goto ex;
}
ret= Xorriso_aaip_warn_of_root(xorriso, node, !!(flag & 16));
if (ret < 0)
goto ex;
if (ret == 0)
{ret= 1; goto ex;}
#ifdef Xorriso_with_aaiP
ret= iso_node_set_attrs(node, num_attrs, names, value_lengths, values,
flag & (1 | 2 | 4 | 8));
@ -9423,6 +9471,7 @@ ex:
-1=error
bit5= if not bit0:
transfer dev,inode from eventual link target
bit7= omit dev check mit bit1
*/
int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path,
dev_t dev, ino_t ino,
@ -9474,11 +9523,21 @@ int Xorriso_record_dev_inode(struct XorrisO *xorriso, char *disk_path,
goto ex;
if(ret == 0)
{ret= 2; goto ex;}
if(l != di_l)
{ret= 1; goto ex;}
for(i= 0; i < l; i++)
if(di[i] != buf[i])
if(flag & 128) {
if(di_l <= 0)
{ret= 1; goto ex;}
hino= 0;
for(i= di[0] + 2; i < di_l && i - di[0] - 2 < di[(int) di[0] + 1]; i++)
hino= (hino << 8) | ((unsigned char *) di)[i];
if(hino != ino)
{ret= 1; goto ex;}
} else {
if(l != di_l)
{ret= 1; goto ex;}
for(i= 0; i < l; i++)
if(di[i] != buf[i])
{ret= 1; goto ex;}
}
ret= 0;
} else {
ret= Xorriso_setfattr(xorriso, in_node, iso_path,