2016-08-12 18:28:17 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2018-08-22 01:10:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file tar.h
|
|
|
|
* @brief Constants for reading/writing `.tar` files.
|
|
|
|
*/
|
2016-08-12 18:28:17 +02:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
|
2018-08-22 01:10:48 +02:00
|
|
|
/** `.tar` file magic. (Includes the NUL.) */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TMAGIC "ustar"
|
2018-08-22 01:10:48 +02:00
|
|
|
/** `.tar` file magic length in bytes. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TMAGLEN 6
|
2018-08-22 01:10:48 +02:00
|
|
|
/** `.tar` file version. (Does not include the NUL.) */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TVERSION "00"
|
2018-08-22 01:10:48 +02:00
|
|
|
/** `.tar` file version length in bytes. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TVERSLEN 2
|
|
|
|
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Regular file type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define REGTYPE '0'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Alternate regular file type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define AREGTYPE '\0'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Link type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define LNKTYPE '1'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Symbolic link type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define SYMTYPE '2'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Character special file type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define CHRTYPE '3'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Block special file type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define BLKTYPE '4'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Directory type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define DIRTYPE '5'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** FIFO special file type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define FIFOTYPE '6'
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Reserved type flag. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define CONTTYPE '7'
|
|
|
|
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Set-UID mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TSUID 04000
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Set-GID mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TSGID 02000
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Directory restricted deletion mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TSVTX 01000
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Readable by user mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TUREAD 00400
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Writable by user mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TUWRITE 00200
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Executable by user mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TUEXEC 00100
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Readable by group mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TGREAD 00040
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Writable by group mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TGWRITE 00020
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Executable by group mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TGEXEC 00010
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Readable by other mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TOREAD 00004
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Writable by other mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TOWRITE 00002
|
2018-08-22 01:10:48 +02:00
|
|
|
/** Executable by other mode field bit. */
|
2016-08-12 18:28:17 +02:00
|
|
|
#define TOEXEC 00001
|