"Fossies" - the Fresh Open Source Software Archive

Member "libisofs-1.5.4/libisofs/filesrc.h" (8 Jul 2020, 4492 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 "filesrc.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (c) 2007 Vreixo Formoso
    3  *               2012 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_FILESRC_H_
   11 #define LIBISO_FILESRC_H_
   12 
   13 #include "libisofs.h"
   14 #include "stream.h"
   15 #include "ecma119.h"
   16 
   17 #ifdef HAVE_STDINT_H
   18 #include <stdint.h>
   19 #else
   20 #ifdef HAVE_INTTYPES_H
   21 #include <inttypes.h>
   22 #endif
   23 #endif
   24 
   25 
   26 /* Abstraction of data file content in the emerging image.
   27 */
   28 struct Iso_File_Src
   29 {
   30     /* This marks an IsoFileSrc which shall only expose its extent addresses
   31        and sizes but shall not be counted or written by filesrc_writer.
   32     */
   33     unsigned int no_write :1;
   34 
   35     /* Is 1 if the object was already put into the filelist array.
   36     */
   37     unsigned int taken :1;
   38 
   39     unsigned int checksum_index :31;
   40 
   41     /** File Sections of the file in the image */
   42     /* Special sections[0].block values while they are relative
   43        before filesrc_writer_compute_data_blocks().
   44        Valid only with .no_write == 0:
   45        0xfffffffe  This Iso_File_Src is claimed as external partition.
   46                    Others will take care of the content data.
   47                    filesrc_writer shall neither count nor write it.
   48                    At write_data time it is already converted to
   49                    a fileadress between  Ecma119Image.ms_block  and
   50                    Ecma119Image.filesrc_start - 1.
   51        0xffffffff  This is the block to which empty files shall point.
   52        Normal data files have relative addresses from 0 to 0xffffffdf.
   53        They cannot be higher, because mspad_writer forces the absolute
   54        filesrc addresses to start at least at 0x20.
   55     */
   56     struct iso_file_section *sections;
   57     int nsections;
   58 
   59     int sort_weight;
   60     IsoStream *stream;
   61 };
   62 
   63 int iso_file_src_cmp(const void *n1, const void *n2);
   64 
   65 /**
   66  * Create a new IsoFileSrc to get data from a specific IsoFile.
   67  *
   68  * The IsoFileSrc will be cached in a tree to prevent the same file for
   69  * being written several times to image. If you call again this function
   70  * with a node that refers to the same source file, the previously
   71  * created one will be returned. No new IsoFileSrc is created in that case.
   72  *
   73  * @param img
   74  *      The image where this file is to be written
   75  * @param file
   76  *      The IsoNode we want to write
   77  * @param src
   78  *      Will be filled with a pointer to the IsoFileSrc
   79  * @return
   80  *      1 if new object was created, 0 if object existed, < 0 on error
   81  */
   82 int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src);
   83 
   84 /**
   85  * Add a given IsoFileSrc to the given image target.
   86  *
   87  * The IsoFileSrc will be cached in a tree to prevent the same file for
   88  * being written several times to image. If you call again this function
   89  * with a node that refers to the same source file, the previously
   90  * created one will be returned.
   91  *
   92  * @param img
   93  *      The image where this file is to be written
   94  * @param new
   95  *      The IsoFileSrc to add
   96  * @param src
   97  *      Will be filled with a pointer to the IsoFileSrc really present in
   98  *      the tree. It could be different than new if the same file already
   99  *      exists in the tree.
  100  * @return
  101  *      1 on success, 0 if file already exists on tree, < 0 error
  102  */
  103 int iso_file_src_add(Ecma119Image *img, IsoFileSrc *new, IsoFileSrc **src);
  104 
  105 /**
  106  * Free the IsoFileSrc especific data
  107  */
  108 void iso_file_src_free(void *node);
  109 
  110 /**
  111  * Get the size of the file this IsoFileSrc represents
  112  */
  113 off_t iso_file_src_get_size(IsoFileSrc *file);
  114 
  115 /**
  116  * Create a Writer for file contents.
  117  *
  118  * It takes care of written the files in the correct order.
  119  */
  120 int iso_file_src_writer_create(Ecma119Image *target);
  121 
  122 /**
  123  * Determine number of filesrc blocks in the image and compute extent addresses
  124  * relative to start of the file source writer area.
  125  * filesrc_writer_compute_data_blocks() later makes them absolute.
  126  */
  127 int filesrc_writer_pre_compute(IsoImageWriter *writer);
  128 
  129 /**
  130  * Write the content of file into the output stream of t.
  131  * name must be NULL or offer at least PATH_MAX characters of storage.
  132  * buffer must be NULL or offer at least BLOCK_SIZE characters of storage.
  133  * flag is not used yet, submit 0.
  134  */
  135 int iso_filesrc_write_data(Ecma119Image *t, IsoFileSrc *file,
  136                            char *name, char *buffer, int flag);
  137 
  138 
  139 #endif /*LIBISO_FILESRC_H_*/