Browse Source

New API call iso_node_cmp_ino()

and a bug fix about IsoSpecial and IsoSymlink in iso_node_cmp_flag()
release-1.5.4.branch
Thomas Schmitt 13 years ago
parent
commit
714ee67472
  1. 19
      libisofs/libisofs.h
  2. 13
      libisofs/node.c

19
libisofs/libisofs.h

@ -2232,7 +2232,7 @@ void el_torito_set_load_size(ElToritoBootImage *bootimg, short sectors);
void el_torito_set_no_bootable(ElToritoBootImage *bootimg);
/**
* Specifies that this image needs to be patched. This involves the writting
* Specifies that this image needs to be patched. This involves the writing
* of a 56 bytes boot information table at offset 8 of the boot image file.
* The original boot image file won't be modified.
* This is needed for isolinux boot images.
@ -2512,6 +2512,23 @@ time_t iso_node_get_ctime(const IsoNode *node);
*/
void iso_node_set_hidden(IsoNode *node, int hide_attrs);
/* ts A90516 */
/**
* Compare two nodes whether they are based on the same input and
* can be considered as hardlinks to the same file objects.
*
* @param n1
* The first node to compare.
* @param n2
* The second node to compare.
* @return
* -1 if s1 is smaller s2 , 0 if s1 matches s2 , 1 if s1 is larger s2
* @param flag
* Bitfield for control purposes, unused yet, submit 0
* @since 0.6.20
*/
int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag);
/**
* Add a new node to a dir. Note that this function don't add a new ref to
* the node, so you don't need to free it, it will be automatically freed

13
libisofs/node.c

@ -2313,6 +2313,7 @@ int iso_node_get_id(IsoNode *node, unsigned int *fs_id, dev_t *dev_id,
*fs_id = symlink->fs_id;
*dev_id = symlink->st_dev;
*ino_id = symlink->st_ino;
return 1;
} else if (node->type == LIBISO_SPECIAL) {
special = (IsoSpecial *) node;
@ -2323,12 +2324,12 @@ int iso_node_get_id(IsoNode *node, unsigned int *fs_id, dev_t *dev_id,
*fs_id = special->fs_id;
*dev_id = special->st_dev;
*ino_id = special->st_ino;
return 1;
#endif
}
ret = 0;
no_id:;
*fs_id = 0;
@ -2515,10 +2516,14 @@ inode_match:;
if (!(flag & 1))
return 0;
if (n1->type == LIBISO_SYMLINK) {
l1 = (IsoSymlink *) n1;
l2 = (IsoSymlink *) n2;
ret1 = strcmp(l1->dest, l2->dest);
if (ret1)
return ret1;
} else if (n1->type == LIBISO_SPECIAL) {
s1 = (IsoSpecial *) n1;
s2 = (IsoSpecial *) n2;
if (s1->dev != s2->dev)
return (s1->dev < s2->dev ? -1 : 1);
}
@ -2557,3 +2562,9 @@ inode_match:;
return 0;
}
/* ts A90516 */
/* API */
int iso_node_cmp_ino(IsoNode *n1, IsoNode *n2, int flag)
{
return iso_node_cmp_flag(n1, n2, 1 | 2);
}

Loading…
Cancel
Save