Blame libarchive/archive_entry_private.h

Packit Service 1d0348
/*-
Packit Service 1d0348
 * Copyright (c) 2003-2007 Tim Kientzle
Packit Service 1d0348
 * All rights reserved.
Packit Service 1d0348
 *
Packit Service 1d0348
 * Redistribution and use in source and binary forms, with or without
Packit Service 1d0348
 * modification, are permitted provided that the following conditions
Packit Service 1d0348
 * are met:
Packit Service 1d0348
 * 1. Redistributions of source code must retain the above copyright
Packit Service 1d0348
 *    notice, this list of conditions and the following disclaimer.
Packit Service 1d0348
 * 2. Redistributions in binary form must reproduce the above copyright
Packit Service 1d0348
 *    notice, this list of conditions and the following disclaimer in the
Packit Service 1d0348
 *    documentation and/or other materials provided with the distribution.
Packit Service 1d0348
 *
Packit Service 1d0348
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
Packit Service 1d0348
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Packit Service 1d0348
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Packit Service 1d0348
 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit Service 1d0348
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
Packit Service 1d0348
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 1d0348
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 1d0348
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 1d0348
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
Packit Service 1d0348
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 1d0348
 *
Packit Service 1d0348
 * $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $
Packit Service 1d0348
 */
Packit Service 1d0348
Packit Service 1d0348
#ifndef __LIBARCHIVE_BUILD
Packit Service 1d0348
#error This header is only to be used internally to libarchive.
Packit Service 1d0348
#endif
Packit Service 1d0348
Packit Service 1d0348
#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
Packit Service 1d0348
#define	ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
Packit Service 1d0348
Packit Service 1d0348
#include "archive_acl_private.h"
Packit Service 1d0348
#include "archive_string.h"
Packit Service 1d0348
Packit Service 1d0348
struct ae_xattr {
Packit Service 1d0348
	struct ae_xattr *next;
Packit Service 1d0348
Packit Service 1d0348
	char	*name;
Packit Service 1d0348
	void	*value;
Packit Service 1d0348
	size_t	size;
Packit Service 1d0348
};
Packit Service 1d0348
Packit Service 1d0348
struct ae_sparse {
Packit Service 1d0348
	struct ae_sparse *next;
Packit Service 1d0348
Packit Service 1d0348
	int64_t	 offset;
Packit Service 1d0348
	int64_t	 length;
Packit Service 1d0348
};
Packit Service 1d0348
Packit Service 1d0348
/*
Packit Service 1d0348
 * Description of an archive entry.
Packit Service 1d0348
 *
Packit Service 1d0348
 * Basically, this is a "struct stat" with a few text fields added in.
Packit Service 1d0348
 *
Packit Service 1d0348
 * TODO: Add "comment", "charset", and possibly other entries
Packit Service 1d0348
 * that are supported by "pax interchange" format.  However, GNU, ustar,
Packit Service 1d0348
 * cpio, and other variants don't support these features, so they're not an
Packit Service 1d0348
 * excruciatingly high priority right now.
Packit Service 1d0348
 *
Packit Service 1d0348
 * TODO: "pax interchange" format allows essentially arbitrary
Packit Service 1d0348
 * key/value attributes to be attached to any entry.  Supporting
Packit Service 1d0348
 * such extensions may make this library useful for special
Packit Service 1d0348
 * applications (e.g., a package manager could attach special
Packit Service 1d0348
 * package-management attributes to each entry).  There are tricky
Packit Service 1d0348
 * API issues involved, so this is not going to happen until
Packit Service 1d0348
 * there's a real demand for it.
Packit Service 1d0348
 *
Packit Service 1d0348
 * TODO: Design a good API for handling sparse files.
Packit Service 1d0348
 */
Packit Service 1d0348
struct archive_entry {
Packit Service 1d0348
	struct archive *archive;
Packit Service 1d0348
Packit Service 1d0348
	/*
Packit Service 1d0348
	 * Note that ae_stat.st_mode & AE_IFMT  can be  0!
Packit Service 1d0348
	 *
Packit Service 1d0348
	 * This occurs when the actual file type of the object is not
Packit Service 1d0348
	 * in the archive.  For example, 'tar' archives store
Packit Service 1d0348
	 * hardlinks without marking the type of the underlying
Packit Service 1d0348
	 * object.
Packit Service 1d0348
	 */
Packit Service 1d0348
Packit Service 1d0348
	/*
Packit Service 1d0348
	 * We have a "struct aest" for holding file metadata rather than just
Packit Service 1d0348
	 * a "struct stat" because on some platforms the "struct stat" has
Packit Service 1d0348
	 * fields which are too narrow to hold the range of possible values;
Packit Service 1d0348
	 * we don't want to lose information if we read an archive and write
Packit Service 1d0348
	 * out another (e.g., in "tar -cf new.tar @old.tar").
Packit Service 1d0348
	 *
Packit Service 1d0348
	 * The "stat" pointer points to some form of platform-specific struct
Packit Service 1d0348
	 * stat; it is declared as a void * rather than a struct stat * as
Packit Service 1d0348
	 * some platforms have multiple varieties of stat structures.
Packit Service 1d0348
	 */
Packit Service 1d0348
	void *stat;
Packit Service 1d0348
	int  stat_valid; /* Set to 0 whenever a field in aest changes. */
Packit Service 1d0348
Packit Service 1d0348
	struct aest {
Packit Service 1d0348
		int64_t		aest_atime;
Packit Service 1d0348
		uint32_t	aest_atime_nsec;
Packit Service 1d0348
		int64_t		aest_ctime;
Packit Service 1d0348
		uint32_t	aest_ctime_nsec;
Packit Service 1d0348
		int64_t		aest_mtime;
Packit Service 1d0348
		uint32_t	aest_mtime_nsec;
Packit Service 1d0348
		int64_t		aest_birthtime;
Packit Service 1d0348
		uint32_t	aest_birthtime_nsec;
Packit Service 1d0348
		int64_t		aest_gid;
Packit Service 1d0348
		int64_t		aest_ino;
Packit Service 1d0348
		uint32_t	aest_nlink;
Packit Service 1d0348
		uint64_t	aest_size;
Packit Service 1d0348
		int64_t		aest_uid;
Packit Service 1d0348
		/*
Packit Service 1d0348
		 * Because converting between device codes and
Packit Service 1d0348
		 * major/minor values is platform-specific and
Packit Service 1d0348
		 * inherently a bit risky, we only do that conversion
Packit Service 1d0348
		 * lazily.  That way, we will do a better job of
Packit Service 1d0348
		 * preserving information in those cases where no
Packit Service 1d0348
		 * conversion is actually required.
Packit Service 1d0348
		 */
Packit Service 1d0348
		int		aest_dev_is_broken_down;
Packit Service 1d0348
		dev_t		aest_dev;
Packit Service 1d0348
		dev_t		aest_devmajor;
Packit Service 1d0348
		dev_t		aest_devminor;
Packit Service 1d0348
		int		aest_rdev_is_broken_down;
Packit Service 1d0348
		dev_t		aest_rdev;
Packit Service 1d0348
		dev_t		aest_rdevmajor;
Packit Service 1d0348
		dev_t		aest_rdevminor;
Packit Service 1d0348
	} ae_stat;
Packit Service 1d0348
Packit Service 1d0348
	int ae_set; /* bitmap of fields that are currently set */
Packit Service 1d0348
#define	AE_SET_HARDLINK	1
Packit Service 1d0348
#define	AE_SET_SYMLINK	2
Packit Service 1d0348
#define	AE_SET_ATIME	4
Packit Service 1d0348
#define	AE_SET_CTIME	8
Packit Service 1d0348
#define	AE_SET_MTIME	16
Packit Service 1d0348
#define	AE_SET_BIRTHTIME 32
Packit Service 1d0348
#define	AE_SET_SIZE	64
Packit Service 1d0348
#define	AE_SET_INO	128
Packit Service 1d0348
#define	AE_SET_DEV	256
Packit Service 1d0348
Packit Service 1d0348
	/*
Packit Service 1d0348
	 * Use aes here so that we get transparent mbs<->wcs conversions.
Packit Service 1d0348
	 */
Packit Service 1d0348
	struct archive_mstring ae_fflags_text;	/* Text fflags per fflagstostr(3) */
Packit Service 1d0348
	unsigned long ae_fflags_set;		/* Bitmap fflags */
Packit Service 1d0348
	unsigned long ae_fflags_clear;
Packit Service 1d0348
	struct archive_mstring ae_gname;		/* Name of owning group */
Packit Service 1d0348
	struct archive_mstring ae_hardlink;	/* Name of target for hardlink */
Packit Service 1d0348
	struct archive_mstring ae_pathname;	/* Name of entry */
Packit Service 1d0348
	struct archive_mstring ae_symlink;		/* symlink contents */
Packit Service 1d0348
	struct archive_mstring ae_uname;		/* Name of owner */
Packit Service 1d0348
Packit Service 1d0348
	/* Not used within libarchive; useful for some clients. */
Packit Service 1d0348
	struct archive_mstring ae_sourcepath;	/* Path this entry is sourced from. */
Packit Service 1d0348
Packit Service 1d0348
#define AE_ENCRYPTION_NONE 0
Packit Service 1d0348
#define AE_ENCRYPTION_DATA 1
Packit Service 1d0348
#define AE_ENCRYPTION_METADATA 2
Packit Service 1d0348
	char encryption;
Packit Service 1d0348
	
Packit Service 1d0348
	void *mac_metadata;
Packit Service 1d0348
	size_t mac_metadata_size;
Packit Service 1d0348
Packit Service 1d0348
	/* ACL support. */
Packit Service 1d0348
	struct archive_acl    acl;
Packit Service 1d0348
Packit Service 1d0348
	/* extattr support. */
Packit Service 1d0348
	struct ae_xattr *xattr_head;
Packit Service 1d0348
	struct ae_xattr *xattr_p;
Packit Service 1d0348
Packit Service 1d0348
	/* sparse support. */
Packit Service 1d0348
	struct ae_sparse *sparse_head;
Packit Service 1d0348
	struct ae_sparse *sparse_tail;
Packit Service 1d0348
	struct ae_sparse *sparse_p;
Packit Service 1d0348
Packit Service 1d0348
	/* Miscellaneous. */
Packit Service 1d0348
	char		 strmode[12];
Packit Service 1d0348
};
Packit Service 1d0348
Packit Service 1d0348
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */