rpm  4.15.1
Macros | Enumerations | Functions
rpmarchive.h File Reference

File archive (aka payload) API. More...

Go to the source code of this file.

Macros

#define RPMERR_CHECK_ERRNO   -32768
 

Enumerations

enum  rpmfilesErrorCodes {
  RPMERR_ITER_END = -1, RPMERR_BAD_MAGIC = -2, RPMERR_BAD_HEADER = -3, RPMERR_HDR_SIZE = -4,
  RPMERR_UNKNOWN_FILETYPE = -5, RPMERR_MISSING_FILE = -6, RPMERR_DIGEST_MISMATCH = -7, RPMERR_INTERNAL = -8,
  RPMERR_UNMAPPED_FILE = -9, RPMERR_ENOENT = -10, RPMERR_ENOTEMPTY = -11, RPMERR_FILE_SIZE = -12,
  RPMERR_ITER_SKIP = -13, RPMERR_EXIST_AS_DIR = -14, RPMERR_OPEN_FAILED = -32768, RPMERR_CHMOD_FAILED = -32769,
  RPMERR_CHOWN_FAILED = -32770, RPMERR_WRITE_FAILED = -32771, RPMERR_UTIME_FAILED = -32772, RPMERR_UNLINK_FAILED = -32773,
  RPMERR_RENAME_FAILED = -32774, RPMERR_SYMLINK_FAILED = -32775, RPMERR_STAT_FAILED = -32776, RPMERR_LSTAT_FAILED = -32777,
  RPMERR_MKDIR_FAILED = -32778, RPMERR_RMDIR_FAILED = -32779, RPMERR_MKNOD_FAILED = -32780, RPMERR_MKFIFO_FAILED = -32781,
  RPMERR_LINK_FAILED = -32782, RPMERR_READLINK_FAILED = -32783, RPMERR_READ_FAILED = -32784, RPMERR_COPY_FAILED = -32785,
  RPMERR_LSETFCON_FAILED = -32786, RPMERR_SETCAP_FAILED = -32787
}
 Error codes for archive and file handling. More...
 

Functions

char * rpmfileStrerror (int rc)
 Return formatted error message on payload handling failure. More...
 
rpmfi rpmfiNewArchiveWriter (FD_t fd, rpmfiles files)
 Get new file iterator for writing the archive content. More...
 
rpmfi rpmfiNewArchiveReader (FD_t fd, rpmfiles files, int itype)
 Get new file iterator for looping over the archive content. More...
 
int rpmfiArchiveClose (rpmfi fi)
 Close payload archive. More...
 
rpm_loff_t rpmfiArchiveTell (rpmfi fi)
 Return current position in payload archive. More...
 
size_t rpmfiArchiveWrite (rpmfi fi, const void *buf, size_t size)
 Write content into current file in archive. More...
 
int rpmfiArchiveWriteFile (rpmfi fi, FD_t fd)
 Write content from given file into current file in archive. More...
 
size_t rpmfiArchiveRead (rpmfi fi, void *buf, size_t size)
 Read content from current file in archive. More...
 
int rpmfiArchiveHasContent (rpmfi fi)
 Has current file content stored in the archive. More...
 
int rpmfiArchiveReadToFile (rpmfi fi, FD_t fd, int nodigest)
 Write content from current file in archive to a file. More...
 

Detailed Description

File archive (aka payload) API.

Definition in file rpmarchive.h.

Macro Definition Documentation

◆ RPMERR_CHECK_ERRNO

#define RPMERR_CHECK_ERRNO   -32768

Definition at line 9 of file rpmarchive.h.

Enumeration Type Documentation

◆ rpmfilesErrorCodes

Error codes for archive and file handling.

Enumerator
RPMERR_ITER_END 
RPMERR_BAD_MAGIC 
RPMERR_BAD_HEADER 
RPMERR_HDR_SIZE 
RPMERR_UNKNOWN_FILETYPE 
RPMERR_MISSING_FILE 
RPMERR_DIGEST_MISMATCH 
RPMERR_INTERNAL 
RPMERR_UNMAPPED_FILE 
RPMERR_ENOENT 
RPMERR_ENOTEMPTY 
RPMERR_FILE_SIZE 
RPMERR_ITER_SKIP 
RPMERR_EXIST_AS_DIR 
RPMERR_OPEN_FAILED 
RPMERR_CHMOD_FAILED 
RPMERR_CHOWN_FAILED 
RPMERR_WRITE_FAILED 
RPMERR_UTIME_FAILED 
RPMERR_UNLINK_FAILED 
RPMERR_RENAME_FAILED 
RPMERR_SYMLINK_FAILED 
RPMERR_STAT_FAILED 
RPMERR_LSTAT_FAILED 
RPMERR_MKDIR_FAILED 
RPMERR_RMDIR_FAILED 
RPMERR_MKNOD_FAILED 
RPMERR_MKFIFO_FAILED 
RPMERR_LINK_FAILED 
RPMERR_READLINK_FAILED 
RPMERR_READ_FAILED 
RPMERR_COPY_FAILED 
RPMERR_LSETFCON_FAILED 
RPMERR_SETCAP_FAILED 

Definition at line 14 of file rpmarchive.h.

Function Documentation

◆ rpmfiArchiveClose()

int rpmfiArchiveClose ( rpmfi  fi)

Close payload archive.

Parameters
fifile info
Returns
> 0 on error

◆ rpmfiArchiveHasContent()

int rpmfiArchiveHasContent ( rpmfi  fi)

Has current file content stored in the archive.

Parameters
fifile info @ return 1 for regular files but 0 for hardlinks without content

◆ rpmfiArchiveRead()

size_t rpmfiArchiveRead ( rpmfi  fi,
void *  buf,
size_t  size 
)

Read content from current file in archive.

Parameters
fifile info
bufpointer to buffer
sizenumber of bytes to read
Returns
bytes actually read

◆ rpmfiArchiveReadToFile()

int rpmfiArchiveReadToFile ( rpmfi  fi,
FD_t  fd,
int  nodigest 
)

Write content from current file in archive to a file.

Parameters
fifile info
fdfile descriptor of file to write to
nodigestomit checksum check if 1
Returns
> 0 on error

◆ rpmfiArchiveTell()

rpm_loff_t rpmfiArchiveTell ( rpmfi  fi)

Return current position in payload archive.

Parameters
fifile info
Returns
position

◆ rpmfiArchiveWrite()

size_t rpmfiArchiveWrite ( rpmfi  fi,
const void *  buf,
size_t  size 
)

Write content into current file in archive.

Parameters
fifile info
bufpointer to content
sizenumber of bytes to write
Returns
bytes actually written

◆ rpmfiArchiveWriteFile()

int rpmfiArchiveWriteFile ( rpmfi  fi,
FD_t  fd 
)

Write content from given file into current file in archive.

Parameters
fifile info
fdfile descriptor of file to read
Returns
> 0 on error

◆ rpmfileStrerror()

char* rpmfileStrerror ( int  rc)

Return formatted error message on payload handling failure.

Parameters
rcerror code
Returns
formatted error string (malloced)

◆ rpmfiNewArchiveReader()

rpmfi rpmfiNewArchiveReader ( FD_t  fd,
rpmfiles  files,
int  itype 
)

Get new file iterator for looping over the archive content.

Returned rpmfi visites files in the order they are read from the payload. Content of the regular files can be retrieved with rpmfiArchiveRead() or rpmfiArchiveReadToFile() when they are visited with rpmfiNext(). rpmfiSetFX() is not supported for this type of iterator.

Parameters
fdfile
filesfile info
itypehow to handle hard links. See rpmFileIter.
Returns
new rpmfi

◆ rpmfiNewArchiveWriter()

rpmfi rpmfiNewArchiveWriter ( FD_t  fd,
rpmfiles  files 
)

Get new file iterator for writing the archive content.

The returned rpmfi will only visit the files needing some content. You need to provide the content using rpmfiArchiveWrite() or rpmfiArchiveWriteFile(). Make sure to close the rpmfi with rpmfiArchiveClose() to get the trailer written. rpmfiSetFX() is not supported for this type of iterator.

Parameters
fdfile
filesfile info
Returns
new rpmfi