Changeset 1a8fe67a in rtems for cpukit/libmisc/untar/untar.h


Ignore:
Timestamp:
Jul 13, 2016, 7:22:35 AM (4 years ago)
Author:
Alexander Krutwig <alexander.krutwig@…>
Branches:
master
Children:
6a174c02
Parents:
c1b815ab
git-author:
Alexander Krutwig <alexander.krutwig@…> (07/13/16 07:22:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/26/16 08:00:04)
Message:

Add Untar_FromChunk_Print() + Test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/untar/untar.h

    rc1b815ab r1a8fe67a  
    4545int Untar_FromFile_Print(const char *tar_name, const rtems_printer* printer);
    4646
     47typedef struct {
     48  /**
     49   * @brief Current context state.
     50   */
     51  enum {
     52    UNTAR_CHUNK_HEADER,
     53    UNTAR_CHUNK_SKIP,
     54    UNTAR_CHUNK_WRITE,
     55    UNTAR_CHUNK_ERROR
     56  } state;
     57
     58  /**
     59   * @brief Header buffer.
     60   */
     61  char header[512];
     62
     63  /**
     64   * @brief Name buffer.
     65   */
     66  char fname[100];
     67
     68  /**
     69   * @brief Number of bytes of overall length are already processed.
     70   */
     71  size_t done_bytes;
     72
     73  /**
     74   * @brief Overall amount of bytes to be processed.
     75   */
     76  long unsigned todo_bytes;
     77
     78  /**
     79   * @brief Overall amount of blocks to be processed.
     80   */
     81  unsigned long todo_blocks;
     82
     83  /**
     84   * @brief File descriptor of output file.
     85   */
     86  int out_fd;
     87} Untar_ChunkContext;
     88
     89typedef struct {
     90  /**
     91   * @brief Instance of Chunk Context needed for tar decompression.
     92   */
     93  Untar_ChunkContext base;
     94
     95  /**
     96   * @brief Current zlib context.
     97   */
     98  z_stream strm;
     99
     100  /**
     101   * @brief Buffer that contains the inflated data.
     102   */
     103  void *inflateBuffer;
     104
     105  /**
     106   * @brief Size of buffer that contains the inflated data.
     107   */
     108  size_t inflateBufferSize;
     109
     110} Untar_GzChunkContext;
     111
     112/**
     113 * @brief Initializes the Untar_ChunkContext files out of a part of a block of
     114 * memory.
     115 *
     116 * @param Untar_ChunkContext *context [in] Pointer to a context structure.
     117 */
     118void Untar_ChunkContext_Init(Untar_ChunkContext *context);
     119
     120/*
     121 * @brief Rips links, directories and files out of a part of a block of memory.
     122 *
     123 * @param Untar_ChunkContext *context [in] Pointer to a context structure.
     124 * @param void *chunk [in] Pointer to a chunk of a TAR buffer.
     125 * @param size_t chunk_size [in] Length of the chunk of a TAR buffer.
     126 *
     127 * @retval UNTAR_SUCCESSFUL (0)    on successful completion.
     128 * @retval UNTAR_FAIL              for a faulty step within the process.
     129 * @retval UNTAR_INVALID_CHECKSUM  for an invalid header checksum.
     130 * @retval UNTAR_INVALID_HEADER    for an invalid header.
     131 */
     132
     133int Untar_FromChunk_Print(
     134  Untar_ChunkContext *context,
     135  void *chunk,
     136  size_t chunk_size,
     137  const rtems_printer* printer
     138);
     139
    47140/**************************************************************************
    48141 * This converts octal ASCII number representations into an
Note: See TracChangeset for help on using the changeset viewer.