xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

filesrc.c File Reference
#include "libisofs.h"
#include "filesrc.h"
#include "node.h"
#include "util.h"
#include "writer.h"
#include "messages.h"
#include "image.h"
#include "stream.h"
#include "md5.h"
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
Include dependency graph for filesrc.c:

Go to the source code of this file.

Macros

#define PATH_MAX   Libisofs_default_path_maX
 

Functions

int iso_file_src_cmp (const void *n1, const void *n2)
 
int iso_file_src_create (Ecma119Image *img, IsoFile *file, IsoFileSrc **src)
 
int iso_file_src_add (Ecma119Image *img, IsoFileSrc *new, IsoFileSrc **src)
 
void iso_file_src_free (void *node)
 
off_t iso_file_src_get_size (IsoFileSrc *file)
 
static int cmp_by_weight (const void *f1, const void *f2)
 
static int shall_be_written (void *arg)
 
static int shall_be_written_if_not_taken (void *arg)
 
int filesrc_writer_pre_compute (IsoImageWriter *writer)
 
static int filesrc_writer_compute_data_blocks (IsoImageWriter *writer)
 
static int filesrc_writer_write_vol_desc (IsoImageWriter *writer)
 
static int filesrc_open (IsoFileSrc *file)
 
static int filesrc_close (IsoFileSrc *file)
 
static int filesrc_read (IsoFileSrc *file, char *buf, size_t count)
 
static int filesrc_make_md5 (Ecma119Image *t, IsoFileSrc *file, char md5[16], int flag)
 
int iso_filesrc_write_data (Ecma119Image *t, IsoFileSrc *file, char *name, char *buffer, int flag)
 
static int filesrc_writer_write_data (IsoImageWriter *writer)
 
static int filesrc_writer_free_data (IsoImageWriter *writer)
 
int iso_file_src_writer_create (Ecma119Image *target)
 

Macro Definition Documentation

◆ PATH_MAX

#define PATH_MAX   Libisofs_default_path_maX

Definition at line 48 of file filesrc.c.

Function Documentation

◆ cmp_by_weight()

static int cmp_by_weight ( const void *  f1,
const void *  f2 
)
static

Definition at line 217 of file filesrc.c.

References Iso_File_Src::sort_weight.

Referenced by filesrc_writer_pre_compute().

◆ filesrc_close()

static int filesrc_close ( IsoFileSrc file)
inlinestatic

Definition at line 400 of file filesrc.c.

References iso_stream_close(), and Iso_File_Src::stream.

Referenced by iso_filesrc_write_data().

◆ filesrc_make_md5()

static int filesrc_make_md5 ( Ecma119Image t,
IsoFileSrc file,
char  md5[16],
int  flag 
)
static

Definition at line 422 of file filesrc.c.

References iso_stream_make_md5(), and Iso_File_Src::stream.

Referenced by iso_filesrc_write_data().

◆ filesrc_open()

static int filesrc_open ( IsoFileSrc file)
inlinestatic

Definition at line 394 of file filesrc.c.

References iso_stream_open(), and Iso_File_Src::stream.

Referenced by iso_filesrc_write_data().

◆ filesrc_read()

static int filesrc_read ( IsoFileSrc file,
char *  buf,
size_t  count 
)
static
Returns
1 ok, 0 EOF, < 0 error

Definition at line 410 of file filesrc.c.

References iso_stream_read_buffer(), and Iso_File_Src::stream.

Referenced by iso_filesrc_write_data().

◆ filesrc_writer_compute_data_blocks()

◆ filesrc_writer_free_data()

static int filesrc_writer_free_data ( IsoImageWriter writer)
static

Definition at line 714 of file filesrc.c.

References Iso_Image_Writer::data, and ISO_SUCCESS.

Referenced by iso_file_src_writer_create().

◆ filesrc_writer_pre_compute()

◆ filesrc_writer_write_data()

◆ filesrc_writer_write_vol_desc()

static int filesrc_writer_write_vol_desc ( IsoImageWriter writer)
static

Definition at line 386 of file filesrc.c.

References ISO_SUCCESS.

Referenced by iso_file_src_writer_create().

◆ iso_file_src_add()

int iso_file_src_add ( Ecma119Image img,
IsoFileSrc new,
IsoFileSrc **  src 
)

Add a given IsoFileSrc to the given image target.

The IsoFileSrc will be cached in a tree to prevent the same file for being written several times to image. If you call again this function with a node that refers to the same source file, the previously created one will be returned.

Parameters
imgThe image where this file is to be written
newThe IsoFileSrc to add
srcWill be filled with a pointer to the IsoFileSrc really present in the tree. It could be different than new if the same file already exists in the tree.
Returns
1 on success, 0 if file already exists on tree, < 0 error

Definition at line 192 of file filesrc.c.

References ecma119_image::files, ISO_NULL_POINTER, and iso_rbtree_insert().

Referenced by el_torito_catalog_file_src_create().

◆ iso_file_src_cmp()

int iso_file_src_cmp ( const void *  n1,
const void *  n2 
)

Definition at line 52 of file filesrc.c.

References iso_stream_cmp_ino(), and Iso_File_Src::stream.

Referenced by ecma119_image_new().

◆ iso_file_src_create()

int iso_file_src_create ( Ecma119Image img,
IsoFile file,
IsoFileSrc **  src 
)

Create a new IsoFileSrc to get data from a specific IsoFile.

The IsoFileSrc will be cached in a tree to prevent the same file for being written several times to image. If you call again this function with a node that refers to the same source file, the previously created one will be returned. No new IsoFileSrc is created in that case.

Parameters
imgThe image where this file is to be written
fileThe IsoNode we want to write
srcWill be filled with a pointer to the IsoFileSrc
Returns
1 if new object was created, 0 if object existed, < 0 on error

Definition at line 69 of file filesrc.c.

References iso_write_opts::appendable, iso_file_section::block, checksum_cx_xinfo_func(), ecma119_image::checksum_idx_counter, Iso_File_Src::checksum_index, checksum_md5_xinfo_func(), DIV_UP, ecma119_image::files, Iso_File::from_old_session, ISO_EXTENT_SIZE, iso_file_get_old_image_sections(), iso_file_set_isofscx(), iso_node_get_xinfo(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, iso_rbtree_insert(), iso_stream_get_id(), iso_stream_get_size(), iso_stream_ref(), ISO_SUCCESS, MAX_ISO_FILE_SECTION_SIZE, iso_write_opts::md5_file_checksums, Iso_File_Src::no_write, Iso_File_Src::nsections, ecma119_image::opts, Iso_File_Src::sections, Iso_File_Src::sort_weight, Iso_File::sort_weight, Iso_File_Src::stream, Iso_File::stream, and iso_write_opts::will_cancel.

Referenced by create_file_src(), create_node(), create_tree(), ecma119_writer_create(), and eltorito_writer_create().

◆ iso_file_src_free()

void iso_file_src_free ( void *  node)

Free the IsoFileSrc especific data

Definition at line 205 of file filesrc.c.

References iso_stream_unref().

Referenced by ecma119_image_free().

◆ iso_file_src_get_size()

off_t iso_file_src_get_size ( IsoFileSrc file)

Get the size of the file this IsoFileSrc represents

Definition at line 212 of file filesrc.c.

References iso_stream_get_size(), and Iso_File_Src::stream.

Referenced by filesrc_writer_pre_compute(), and iso_filesrc_write_data().

◆ iso_file_src_writer_create()

◆ iso_filesrc_write_data()

◆ shall_be_written()

static int shall_be_written ( void *  arg)
static

Definition at line 226 of file filesrc.c.

References Iso_File_Src::no_write.

Referenced by filesrc_writer_pre_compute().

◆ shall_be_written_if_not_taken()

static int shall_be_written_if_not_taken ( void *  arg)
static

Definition at line 233 of file filesrc.c.

References Iso_File_Src::no_write, and Iso_File_Src::taken.

Referenced by filesrc_writer_pre_compute().