tar.h revision 1a62088b18e24a01c1dc85e13d60468e78bd649d
/* $Id$ */
/** @file
* IPRT - TAR Virtual Filesystem.
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef __common_zip_tar_h
#define __common_zip_tar_h
/** @name RTZIPTARHDRPOSIX::typeflag
* @{ */
#define RTZIPTAR_TF_SOLARIS_XHDR 'X'
#define RTZIPTAR_TF_GNU_DUMPDIR 'D'
#define RTZIPTAR_TF_GNU_MULTIVOL 'M'
#define RTZIPTAR_TF_GNU_SPARSE 'S'
#define RTZIPTAR_TF_GNU_VOLDHR 'V'
/** @} */
/**
* The ancient tar header.
*
* The posix and gnu headers are compatible with the members up to and including
* link name, from there on they differ.
*/
typedef struct RTZIPTARHDRANCIENT
{
char name[100];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char typeflag;
/** The uniform standard tape archive format magic value. */
#define RTZIPTAR_USTAR_MAGIC "ustar"
/** The ustar version string.
* @remarks The terminator character is not part of the field. */
#define RTZIPTAR_USTAR_VERSION "00"
/**
* The posix header (according to SuS).
*/
typedef struct RTZIPTARHDRPOSIX
{
char name[100];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char typeflag;
char linkname[100];
char magic[6];
char version[2];
char uname[32];
char gname[32];
char devmajor[8];
char devminor[8];
char prefix[155];
char unused[12];
/**
* The GNU header.
*/
typedef struct RTZIPTARHDRGNU
{
char name[100];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char typeflag;
char linkname[100];
char magic[8];
char uname[32];
char gname[32];
char devmajor[8];
char devminor[8];
char atime[12];
char ctime[12];
char offset[12];
char longnames[4];
char unused[1];
struct
{
char offset[12];
char numbytes[12];
} sparse[4];
char isextended;
char realsize[12];
char unused2[17];
/**
* The bits common to posix and GNU.
*/
typedef struct RTZIPTARHDRCOMMON
{
char name[100];
char mode[8];
char uid[8];
char gid[8];
char size[12];
char mtime[12];
char chksum[8];
char typeflag;
char linkname[100];
char magic[6];
char version[2];
char uname[32];
char gname[32];
char devmajor[8];
char devminor[8];
/**
* Tar header union.
*/
typedef union RTZIPTARHDR
{
/** Byte view. */
char ab[512];
/** The standard header. */
/** The standard header. */
/** The GNU header. */
/** The bits common to both GNU and the standard header. */
} RTZIPTARHDR;
/** Pointer to a tar file header. */
typedef RTZIPTARHDR *PRTZIPTARHDR;
/** Pointer to a const tar file header. */
typedef RTZIPTARHDR const *PCRTZIPTARHDR;
/**
* Tar header type.
*/
typedef enum RTZIPTARTYPE
{
/** Invalid type value. */
RTZIPTARTYPE_INVALID = 0,
/** Posix header. */
/** The old GNU header, has layout conflicting with posix. */
/** Ancient tar header which does not use anything beyond the magic. */
/** End of the valid type values (this is not valid). */
/** The usual type blow up. */
RTZIPTARTYPE_32BIT_HACK = 0x7fffffff
} RTZIPTARTYPE;
typedef RTZIPTARTYPE *PRTZIPTARTYPE;
#endif