libisofs
1.5.4
About: libisofs is a library to create an ISO 9660 filesystem, supports extensions like RockRidge or Joliet, makes bootable ISO 9660, and records file attributes which are of interest for data backups.
![]() ![]() |
#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>
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) |
Create a new IsoFileSrc to get data from a specific IsoFile. More... | |
int | iso_file_src_add (Ecma119Image *img, IsoFileSrc *new, IsoFileSrc **src) |
Add a given IsoFileSrc to the given image target. More... | |
void | iso_file_src_free (void *node) |
Free the IsoFileSrc especific data. More... | |
off_t | iso_file_src_get_size (IsoFileSrc *file) |
Get the size of the file this IsoFileSrc represents. More... | |
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) |
Determine number of filesrc blocks in the image and compute extent addresses relative to start of the file source writer area. More... | |
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) |
Write the content of file into the output stream of t. More... | |
static int | filesrc_writer_write_data (IsoImageWriter *writer) |
static int | filesrc_writer_free_data (IsoImageWriter *writer) |
int | iso_file_src_writer_create (Ecma119Image *target) |
Create a Writer for file contents. More... | |
#define PATH_MAX Libisofs_default_path_maX |
|
static |
Definition at line 217 of file filesrc.c.
References Iso_File_Src::sort_weight.
Referenced by filesrc_writer_pre_compute().
|
inlinestatic |
Definition at line 400 of file filesrc.c.
References iso_stream_close(), and Iso_File_Src::stream.
Referenced by iso_filesrc_write_data().
|
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().
|
inlinestatic |
Definition at line 394 of file filesrc.c.
References iso_stream_open(), and Iso_File_Src::stream.
Referenced by iso_filesrc_write_data().
|
static |
Definition at line 410 of file filesrc.c.
References iso_stream_read_buffer(), and Iso_File_Src::stream.
Referenced by iso_filesrc_write_data().
|
static |
Definition at line 346 of file filesrc.c.
References iso_file_section::block, ecma119_image::curblock, Iso_Image_Writer::data, ecma119_image::empty_file_block, ecma119_image::filesrc_blocks, ecma119_image::filesrc_start, ISO_ASSERT_FAILURE, ISO_SUCCESS, Iso_File_Src::no_write, Iso_File_Src::nsections, Iso_File_Src::sections, and Iso_Image_Writer::target.
Referenced by iso_file_src_writer_create().
|
static |
Definition at line 714 of file filesrc.c.
References Iso_Image_Writer::data, and ISO_SUCCESS.
Referenced by iso_file_src_writer_create().
int filesrc_writer_pre_compute | ( | IsoImageWriter * | writer | ) |
Determine number of filesrc blocks in the image and compute extent addresses relative to start of the file source writer area.
filesrc_writer_compute_data_blocks() later makes them absolute.
Definition at line 239 of file filesrc.c.
References iso_write_opts::appendable, iso_file_section::block, BLOCK_SIZE, cmp_by_weight(), Iso_Image_Writer::data, DIV_UP, ecma119_image::files, ecma119_image::filesrc_blocks, Iso_Image::id, ecma119_image::image, ISO_ASSERT_FAILURE, iso_ecma119_to_filesrc_array(), ISO_EXTENT_SIZE, iso_file_src_get_size(), iso_msg_submit(), ISO_NOT_REPRODUCIBLE, ISO_OUT_OF_MEM, iso_rbtree_count_array(), iso_rbtree_to_array(), iso_stream_get_size(), ISO_SUCCESS, LIBISO_FREE_MEM, Iso_File_Src::no_write, Iso_File_Src::nsections, iso_write_opts::old_empty, ecma119_image::opts, Iso_File_Src::sections, shall_be_written(), shall_be_written_if_not_taken(), iso_file_section::size, iso_write_opts::sort_files, Iso_File_Src::stream, and Iso_Image_Writer::target.
Referenced by ecma119_image_new().
|
static |
Definition at line 658 of file filesrc.c.
References iso_file_section::block, BLOCK_SIZE, Iso_Image_Writer::data, Iso_Image::id, ecma119_image::image, ISO_ASSERT_FAILURE, iso_filesrc_write_data(), iso_msg_debug(), ISO_SUCCESS, iso_write(), LIBISO_ALLOC_MEM, LIBISO_FREE_MEM, Iso_File_Src::no_write, iso_write_opts::old_empty, ecma119_image::opts, PATH_MAX, Iso_File_Src::sections, iso_file_section::size, and Iso_Image_Writer::target.
Referenced by iso_file_src_writer_create().
|
static |
Definition at line 386 of file filesrc.c.
References ISO_SUCCESS.
Referenced by iso_file_src_writer_create().
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.
img | The image where this file is to be written |
new | The IsoFileSrc to add |
src | Will 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. |
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().
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().
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.
img | The image where this file is to be written |
file | The IsoNode we want to write |
src | Will be filled with a pointer to the IsoFileSrc |
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().
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().
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().
int iso_file_src_writer_create | ( | Ecma119Image * | target | ) |
Create a Writer for file contents.
It takes care of written the files in the correct order.
Definition at line 721 of file filesrc.c.
References Iso_Image_Writer::compute_data_blocks, Iso_Image_Writer::data, filesrc_writer_compute_data_blocks(), filesrc_writer_free_data(), filesrc_writer_write_data(), filesrc_writer_write_vol_desc(), Iso_Image_Writer::free_data, ISO_OUT_OF_MEM, ISO_SUCCESS, ecma119_image::nwriters, Iso_Image_Writer::target, Iso_Image_Writer::write_data, Iso_Image_Writer::write_vol_desc, and ecma119_image::writers.
Referenced by ecma119_image_new().
int iso_filesrc_write_data | ( | Ecma119Image * | t, |
IsoFileSrc * | file, | ||
char * | name, | ||
char * | buffer, | ||
int | flag | ||
) |
Write the content of file into the output stream of t.
name must be NULL or offer at least PATH_MAX characters of storage. buffer must be NULL or offer at least BLOCK_SIZE characters of storage. flag is not used yet, submit 0.
Definition at line 430 of file filesrc.c.
References BLOCK_SIZE, ecma119_image::checksum_buffer, ecma119_image::checksum_idx_counter, Iso_File_Src::checksum_index, DIV_UP, filesrc_close(), filesrc_make_md5(), filesrc_open(), filesrc_read(), Iso_Image::id, ecma119_image::image, ISO_FILE_CANT_WRITE, iso_file_src_get_size(), ISO_LIBJTE_END_FAILED, ISO_LIBJTE_FILE_FAILED, iso_libjte_forward_msgs(), iso_md5_compute(), iso_md5_end(), iso_md5_match(), iso_md5_start(), ISO_MD5_STREAM_CHANGE, iso_msg_debug(), iso_msg_submit(), iso_report_errfile(), iso_stream_get_file_name(), iso_stream_get_input_stream(), ISO_SUCCESS, iso_write(), LIBISO_ALLOC_MEM, LIBISO_FREE_MEM, iso_write_opts::md5_file_checksums, ecma119_image::opts, PATH_MAX, and Iso_File_Src::stream.
Referenced by filesrc_writer_write_data(), and partprepend_writer_write_data().
|
static |
Definition at line 226 of file filesrc.c.
References Iso_File_Src::no_write.
Referenced by filesrc_writer_pre_compute().
|
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().