Blame libarchive/archive_entry_private.h

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