# lib/tar.h File Reference

Structures used to handle tar payloads within rpm packages. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | tarHeader_s
| Tar archive header information. More...

## Defines

#define | TAR_MAGIC "ustar"
#define | TAR_VERSION " "
#define | TAR_BLOCK_SIZE 512
#define | TAR_MAGIC_LEN 6
#define | TAR_VERSION_LEN 2
#define | TAR_NAME_SIZE 100

## Typedefs

typedef struct tarHeader_s * | tarHeader

## Functions

int | tarTrailerWrite (FSM_t fsm)
| Write cpio trailer to payload.
int | tarHeaderWrite (FSM_t fsm, struct stat *st)
| Write tar header to payload.
int | tarHeaderRead (FSM_t fsm, struct stat *st)
| Read tar header from payload.

## Variables

int | _tar_debug

## Detailed Description

Structures used to handle tar payloads within rpm packages.

Definition in file tar.h.

## Define Documentation

#define TAR_BLOCK_SIZE 512

Definition at line 15 of file tar.h.

Referenced by fsmSetup(), tarHeaderRead(), tarHeaderReadName(), tarHeaderWriteBlock(), and tarHeaderWriteName().

#define TAR_MAGIC "ustar"

Definition at line 12 of file tar.h.

Referenced by tarHeaderRead(), and tarHeaderWriteBlock().

#define TAR_MAGIC_LEN 6

Definition at line 16 of file tar.h.

#define TAR_NAME_SIZE 100

Definition at line 20 of file tar.h.

#define TAR_VERSION " "

Definition at line 13 of file tar.h.

Referenced by tarHeaderWriteBlock().

#define TAR_VERSION_LEN 2

Definition at line 17 of file tar.h.

## Typedef Documentation

typedef struct tarHeader_s* tarHeader

Definition at line 9 of file tar.h.

## Function Documentation

int tarHeaderRead | ( | FSM_t | fsm,
|  | struct stat * | st |
| ) |  |  |

Read tar header from payload.

Return values:

  | fsm | file path and stat info
  | st |

Returns:
  0 on success

Definition at line 92 of file tar.c.

References _tar_debug, tarHeader_s::checksum, CPIOERR_BAD_HEADER, CPIOERR_BAD_MAGIC, CPIOERR_HDR_TRAILER, CPIOERR_READ_FAILED, tarHeader_s::devMajor, tarHeader_s::devMinor, tarHeader_s::filesize, FSM_DREAD, fsmNext(), tarHeader_s::gid, tarHeader_s::linkname, fsm_s::lpath, tarHeader_s::magic, major, Makedev, minor, tarHeader_s::mode, tarHeader_s::mtime, tarHeader_s::name, nochksum, fsm_s::path, fsm_s::rdnb, strntoul(), TAR_BLOCK_SIZE, TAR_MAGIC, tarHeaderReadName(), tarHeader_s::typeflag, tarHeader_s::uid, fsm_s::wrbuf, fsm_s::wrlen, and xmalloc().

Referenced by fsmSetup().

int tarHeaderWrite | ( | FSM_t | fsm,
|  | struct stat * | st |
| ) |  |  |

Write tar header to payload.

Return values:

  | fsm | file path and stat info

Parameters:

  | st |

Returns:
  0 on success

Definition at line 342 of file tar.c.

References _tar_debug, tarHeader_s::devMajor, tarHeader_s::devMinor, tarHeader_s::filesize, FSM_PAD, fsmNext(), tarHeader_s::gid, gidToGname(), tarHeader_s::gname, tarHeader_s::linkname, fsm_s::lpath, major, minor, tarHeader_s::mode, tarHeader_s::mtime, tarHeader_s::name, fsm_s::path, fsm_s::rdbuf, S_ISLNK, S_ISSOCK, tarHeaderWriteBlock(), tarHeaderWriteName(), tarHeader_s::typeflag, tarHeader_s::uid, uidToUname(), and tarHeader_s::uname.

Referenced by fsmSetup(), and writeLinkedFile().

int tarTrailerWrite | ( | FSM_t | fsm | ) |

Write cpio trailer to payload.

Return values:

  | fsm | file path and stat info

Returns:
  0 on success

Definition at line 448 of file tar.c.

References _tar_debug, fsm_s::blksize, FSM_PAD, and fsmNext().

Referenced by fsmSetup().

## Variable Documentation

int _tar_debug

Definition at line 20 of file tar.c.