#summary ARCHIVE_ENTRY 3 manual page
== NAME ==
*archive_entry_stat*,
*archive_entry_copy_stat*,
*archive_entry_filetype*,
*archive_entry_set_filetype*,
*archive_entry_mode*,
*archive_entry_set_mode*,
*archive_entry_size*,
*archive_entry_size_is_set*,
*archive_entry_set_size*,
*archive_entry_unset_size*,
*archive_entry_dev*,
*archive_entry_set_dev*,
*archive_entry_dev_is_set*,
*archive_entry_devmajor*,
*archive_entry_set_devmajor*,
*archive_entry_devminor*,
*archive_entry_set_devminor*,
*archive_entry_ino*,
*archive_entry_set_ino*,
*archive_entry_ino_is_set*,
*archive_entry_ino64*,
*archive_entry_set_ino64*,
*archive_entry_nlink*,
*archive_entry_rdev*,
*archive_entry_set_rdev*,
*archive_entry_rdevmajor*,
*archive_entry_set_rdevmajor*,
*archive_entry_rdevminor*,
*archive_entry_set_rdevminor*,
- accessor functions for manipulating archive entry descriptions
== SYNOPSIS ==
*#include <archive_entry.h>*
<br>
*const struct stat `*`*
<br>
*archive_entry_stat*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_copy_stat*(_struct archive_entry `*`a_, _const struct stat `*`sb_);
<br>
*mode_t*
<br>
*archive_entry_filetype*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_filetype*(_struct archive_entry `*`a_, _unsigned int type_);
<br>
*mode_t*
<br>
*archive_entry_mode*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_mode*(_struct archive_entry `*`a_, _mode_t mode_);
<br>
*int64_t*
<br>
*archive_entry_size*(_struct archive_entry `*`a_);
<br>
*int*
<br>
*archive_entry_size_is_set*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_size*(_struct archive_entry `*`a_, _int64_t size_);
<br>
*void*
<br>
*archive_entry_unset_size*(_struct archive_entry `*`a_);
<br>
*dev_t*
<br>
*archive_entry_dev*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_dev*(_struct archive_entry `*`a_, _dev_t dev_);
<br>
*int*
<br>
*archive_entry_dev_is_set*(_struct archive_entry `*`a_);
<br>
*dev_t*
<br>
*archive_entry_devmajor*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_devmajor*(_struct archive_entry `*`a_, _dev_t major_);
<br>
*dev_t*
<br>
*archive_entry_devminor*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_devminor*(_struct archive_entry `*`a_, _dev_t minor_);
<br>
*ino_t*
<br>
*archive_entry_ino*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_ino*(_struct archive_entry `*`a_, _unsigned long ino_);
<br>
*int*
<br>
*archive_entry_ino_is_set*(_struct archive_entry `*`a_);
<br>
*int64_t*
<br>
*archive_entry_ino64*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_ino64*(_struct archive_entry `*`a_, _int64_t ino_);
<br>
*unsigned int*
<br>
*archive_entry_nlink*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_nlink*(_struct archive_entry `*`a_, _unsigned int count_);
<br>
*dev_t*
<br>
*archive_entry_rdev*(_struct archive_entry `*`a_);
<br>
*dev_t*
<br>
*archive_entry_rdevmajor*(_struct archive_entry `*`a_);
<br>
*dev_t*
<br>
*archive_entry_rdevminor*(_struct archive_entry `*`a_);
<br>
*void*
<br>
*archive_entry_set_rdev*(_struct archive_entry `*`a_, _dev_t dev_);
<br>
*void*
<br>
*archive_entry_set_rdevmajor*(_struct archive_entry `*`a_, _dev_t major_);
<br>
*void*
<br>
*archive_entry_set_rdevminor*(_struct archive_entry `*`a_, _dev_t minor_);
== DESCRIPTION ==
=== Copying to and from _struct_ stat===
The function
*archive_entry_stat*()
converts the various fields stored in the archive entry to the format
used by
*stat*(2).
The return value remains valid until either
*archive_entry_clear*()
or
*archive_entry_free*()
is called.
It is not affected by calls to the set accessor functions.
It currently sets the following values in
_struct_ stat:
_st_atime_,
_st_ctime_,
_st_dev_,
_st_gid_,
_st_ino_,
_st_mode_,
_st_mtime_,
_st_nlink_,
_st_rdev_,
_st_size_,
_st_uid_.
In addition,
_st_birthtime_
and high-precision information for time-related fields
will be included on platforms that support it.

The function
*archive_entry_copy_stat*()
copies fields from the platform's
_struct_ stat.
Fields not provided by
_struct_ stat
are unchanged.
=== General accessor functions===
The functions
*archive_entry_filetype*()
and
*archive_entry_set_filetype*()
get respectively set the filetype.
The file type is one of the following constants:
<dl>
<dt>AE_IFREG</dt><dd>
Regular file
</dd><dt>AE_IFLNK</dt><dd>
Symbolic link
</dd><dt>AE_IFSOCK</dt><dd>
Socket
</dd><dt>AE_IFCHR</dt><dd>
Character device
</dd><dt>AE_IFBLK</dt><dd>
Block device
</dd><dt>AE_IFDIR</dt><dd>
Directory
</dd><dt>AE_IFIFO</dt><dd>
Named pipe (fifo)
</dd></dl>
Not all file types are supported by all platforms.
The constants used by
*stat*(2)
may have different numeric values from the
corresponding constants above.

The functions
*archive_entry_mode*()
and
*archive_entry_set_mode*()
get/set a combination of file type and permissions and provide the
equivalent of
_st_mode_.
Use of
*archive_entry_filetype*()
and
*archive_entry_perm*()
for getting and
*archive_entry_set_filetype*()
and
*archive_entry_set_perm*()
for setting is recommended.

The function
*archive_entry_size*()
returns the file size, if it has been set, and 0 otherwise.
*archive_entry_size*()
can be used to query that status.
*archive_entry_set_size*()
and
*archive_entry_unset_size*()
set and unset the size, respectively.

The number of references (hardlinks) can be obtained by calling
*archive_entry_nlinks*()
and set with
*archive_entry_set_nlinks*().
=== Identifying unique files===
The functions
*archive_entry_dev*()
and
*archive_entry_ino64*()
are used by
*archive_entry_linkify*(3)
to find hardlinks.
The pair of device and inode is suppossed to identify hardlinked files.

The device major and minor number can be obtained independently using
*archive_entry_devmajor*()
and
*archive_entry_devminor*().
The device can be set either via
*archive_entry_set_dev*()
or by the combination of major and minor number using
*archive_entry_set_devmajor*()
and
*archive_entry_set_devminor*().

The inode number can be obtained using
*archive_entry_ino*().
This is a legacy interface that uses the platform
_ino_t_,
which may be very small.
To set the inode number,
*archive_entry_set_ino64*()
is the preferred interface.
=== Accessor functions for block and character devices===
Block and character devices are characterised either using a device number
or a pair of major and minor number.
The combined device number can be obtained with
*archive_device_rdev*()
and set with
*archive_device_set_rdev*().
The major and minor numbers are accessed by
*archive_device_rdevmajor*(),
*archive_device_rdevminor*()
*archive_device_set_rdevmajor*()
and
*archive_device_set_rdevminor*().

The process of splitting the combined device number into major and
minor number and the reverse process of combing them differs between
platforms.
Some archive formats use the combined form, while other formats use
the split form.
== SEE ALSO ==
*archive*(3),
*archive_entry_acl*(3),
*archive_entry_perms*(3),
*archive_entry_time*(3),
*stat*(2)
