"Fossies" - the Fresh Open Source Software Archive

Member "libisofs-1.5.4/libisofs/stream.h" (14 Oct 2020, 4204 Bytes) of package /linux/misc/libisofs-1.5.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "stream.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.5.2_vs_1.5.4.

    1 /*
    2  * Copyright (c) 2007 Vreixo Formoso
    3  * Copyright (c) 2009 - 2016 Thomas Schmitt
    4  *
    5  * This file is part of the libisofs project; you can redistribute it and/or
    6  * modify it under the terms of the GNU General Public License version 2 
    7  * or later as published by the Free Software Foundation. 
    8  * See COPYING file for details.
    9  */
   10 #ifndef LIBISO_STREAM_H_
   11 #define LIBISO_STREAM_H_
   12 
   13 /*
   14  * Definitions of streams.
   15  */
   16 #include "fsource.h"
   17 
   18 /* IMPORTANT: Any change must be reflected by fsrc_clone_stream */
   19 typedef struct
   20 {
   21     IsoFileSource *src;
   22 
   23     /* key for file identification inside filesystem */
   24     dev_t dev_id;
   25     ino_t ino_id;
   26     off_t size; /**< size of this file */
   27 } FSrcStreamData;
   28 
   29 /**
   30  * Get an identifier for the file of the source, for debug purposes
   31  * @param name
   32  *      Must provide at least PATH_MAX bytes. If no PATH_MAX is defined
   33  *      then assume PATH_MAX = Libisofs_default_path_maX from libisofs.h
   34  */
   35 void iso_stream_get_file_name(IsoStream *stream, char *name);
   36 
   37 /**
   38  * Create a stream to read from a IsoFileSource.
   39  * The stream will take the ref. to the IsoFileSource, so after a successfully
   40  * execution of this function, you must not unref() the source, unless you
   41  * take an extra ref.
   42  *
   43  * @return
   44  *      1 success, < 0 error
   45  *      Possible errors:
   46  *
   47  */
   48 int iso_file_source_stream_new(IsoFileSource *src, IsoStream **stream);
   49 
   50 /**
   51  * Create a new stream to read a chunk of an IsoFileSource..
   52  * The stream will add a ref. to the IsoFileSource.
   53  *
   54  * @return
   55  *      1 success, < 0 error
   56  */
   57 int iso_cut_out_stream_new(IsoFileSource *src, off_t offset, off_t size,
   58                            IsoStream **stream);
   59 
   60 /**
   61  * Obtain eventual zisofs ZF field entry parameters from a file source out
   62  * of a loaded ISO image.
   63  * To make hope for non-zero reply the stream has to be the original stream
   64  * of an IsoFile with .from_old_session==1. The call is safe with any stream
   65  * type, though, unless fsrc_stream_class would be used without FSrcStreamData.
   66  * @return  1= returned parameters are valid, 0=no ZF info found , <0 error
   67  */
   68 int iso_stream_get_src_zf(IsoStream *stream, uint8_t zisofs_algo[2],
   69                           int *header_size_div4, int *block_size_log2,
   70                           uint64_t *uncompressed_size, int flag);
   71 
   72 /**
   73  * Set the inode number of a stream that is based on FSrcStreamData, i.e.
   74  * stems from the imported ISO image.
   75  * @return 1 = ok , 0 = not an ISO image stream , <0 = error
   76  */
   77 int iso_stream_set_image_ino(IsoStream *stream, ino_t ino, int flag);
   78 
   79 
   80 /**
   81  * Read the full required amount of data unless error or EOF occurs.
   82  * Fill missing bytes by 0s.
   83  * @param count   Required amount
   84  * @param got     Returns number of actually read bytes
   85  * @return
   86  *     1 no problem encountered, 0 EOF encountered, < 0 error
   87  */
   88 int iso_stream_read_buffer(IsoStream *stream, char *buf, size_t count,
   89                            size_t *got);
   90 
   91 /**
   92  * @return 1=ok, md5 is valid,
   93  *        0= not ok
   94  *       <0 fatal error, abort 
   95  */
   96 int iso_stream_make_md5(IsoStream *stream, char md5[16], int flag);
   97 
   98 
   99 /**
  100  * Create a clone of the input stream of old_stream and a roughly initialized
  101  * clone of old_stream which has the same class and refcount 1. Its data
  102  * pointer will be NULL and needs to be filled by an expert which knows how
  103  * to clone the data of old_stream.
  104  * @param old_stream  The existing stream which is in process of cloning
  105  * @param new_stream  Will return the uninitialized memory object which shall
  106  *                    later become the clone of old_stream.
  107  * @param new_input   The clone of the input stream of old stream.
  108  * @param flag        Submit 0 for now.
  109  * @return            ISO_SUCCESS or an error code <0 
  110  */
  111 int iso_stream_clone_filter_common(IsoStream *old_stream, 
  112                                    IsoStream **new_stream, 
  113                                    IsoStream **new_input, int flag);
  114 
  115 
  116 /**
  117  * Dispose the internal list of stream class cmp_ino() functions. It is
  118  * a static global of stream.c, created and used by iso_stream_cmp_ino().
  119  * This function is supposed to be called by iso_finish() only.
  120  */
  121 int iso_stream_destroy_cmpranks(int flag);
  122 
  123 
  124 #endif /*STREAM_H_*/