|ARCHIVE_ENTRY_LINKIFY(3)||Library Functions Manual||ARCHIVE_ENTRY_LINKIFY(3)|
struct archive_entry_linkresolver *
archive_entry_linkresolver *resolver, int
archive_entry_linkresolver *resolver, struct
archive_entry **entry, struct archive_entry
help by providing a unified interface and handling the complexity behind the
assume that archive_entry instances have valid nlinks,
inode and device values. The inode and device value is used to match
entries. The nlinks value is used to determined if all references have been
found and if the internal references can be recycled.
function allocates a new link resolver. The instance can be freed using
archive_entry_linkresolver_free(). All deferred
entries are flushed and the internal storage is freed.
selects the optimal hardlink strategy for the given format. The format code
can be obtained from archive_format(3). The function can
be called more than once, but it is recommended to flush all deferred
archive_entry_linkify() function is
the core of
entry() argument points to the
archive_entry that should be written. Depending on the
strategy one of the following actions is taken:
NULL. If *entry is
NULL, no action is taken. If the hardlink count of *entry is larger than 1 and the file type is a regular file or symbolic link, the internal list is searched for a matching inode. If such an inode is found, the link count is decremented and the file size of *entry is set to 0 to notify that no body should be written. If no such inode is found, a copy of the entry is added to the internal cache with a link count reduced by one.
NULLis used to flush deferred entries. In that case *entry is set to an arbitrary deferred entry and the entry itself is removed from the internal list. If the internal list is empty, *entry is set to
NULL. In either case, *sparse is set to
NULLand the function returns. If the hardlink count of *entry is one or the file type is a directory or device, *sparse is set to
NULLand no further action is taken. Otherwise, the internal list is searched for a matching inode. If such an inode is not found, the entry is added to the internal list, both *entry and *sparse are set to
NULLand the function returns. If such an inode is found, the link count is decremented. If it remains larger than one, the existing entry on the internal list is swapped with *entry after retaining the link count. The existing entry is returned in *entry. If the link count reached one, the new entry is also removed from the internal list and returned in *sparse. Otherwise *sparse is set to
The general usage is therefore:
NULL, archive it.
NULL, archive it.
archive_entry_linkify() with *entry set to
NULLand archive the returned entry as long as it is not
NULLon malloc(3) failures.
|February 2, 2012||Mac OS X 10.13|