2007-12-02 16:59:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Vreixo Formoso
|
|
|
|
*
|
|
|
|
* This file is part of the libisofs project; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation. See COPYING file for details.
|
|
|
|
*/
|
|
|
|
#ifndef LIBISO_FILESRC_H_
|
|
|
|
#define LIBISO_FILESRC_H_
|
|
|
|
|
2007-12-15 12:13:49 +00:00
|
|
|
#include "libisofs.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "ecma119.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2007-12-28 21:10:17 +00:00
|
|
|
struct Iso_File_Src
|
|
|
|
{
|
|
|
|
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
2007-12-15 12:13:49 +00:00
|
|
|
uint32_t block; /**< Block where this file will be written on image */
|
|
|
|
int sort_weight;
|
|
|
|
IsoStream *stream;
|
|
|
|
};
|
|
|
|
|
2007-12-19 23:25:25 +00:00
|
|
|
int iso_file_src_cmp(const void *n1, const void *n2);
|
|
|
|
|
2007-12-15 12:13:49 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
2007-12-02 16:59:36 +00:00
|
|
|
*
|
2007-12-15 12:13:49 +00:00
|
|
|
* @param img
|
|
|
|
* The image where this file is to be written
|
|
|
|
* @param file
|
|
|
|
* The IsoNode we want to write
|
|
|
|
* @param src
|
|
|
|
* Will be filled with a pointer to the IsoFileSrc
|
|
|
|
* @return
|
|
|
|
* 1 on success, < 0 on error
|
2007-12-02 16:59:36 +00:00
|
|
|
*/
|
2007-12-15 12:13:49 +00:00
|
|
|
int iso_file_src_create(Ecma119Image *img, IsoFile *file, IsoFileSrc **src);
|
2007-12-02 16:59:36 +00:00
|
|
|
|
2007-12-16 18:10:47 +00:00
|
|
|
/**
|
|
|
|
* Free the IsoFileSrc especific data
|
|
|
|
*/
|
2007-12-19 23:25:25 +00:00
|
|
|
void iso_file_src_free(void *node);
|
2007-12-16 18:10:47 +00:00
|
|
|
|
2007-12-18 19:46:28 +00:00
|
|
|
/**
|
|
|
|
* Get the size of the file this IsoFileSrc represents
|
|
|
|
*/
|
|
|
|
off_t iso_file_src_get_size(IsoFileSrc *file);
|
|
|
|
|
2007-12-15 12:13:49 +00:00
|
|
|
/**
|
2007-12-20 21:17:18 +00:00
|
|
|
* Create a Writer for file contents.
|
2007-12-15 12:13:49 +00:00
|
|
|
*
|
2007-12-20 21:17:18 +00:00
|
|
|
* It takes care of written the files in the correct order.
|
2007-12-02 16:59:36 +00:00
|
|
|
*/
|
2007-12-20 21:17:18 +00:00
|
|
|
int iso_file_src_writer_create(Ecma119Image *target);
|
2007-12-02 16:59:36 +00:00
|
|
|
|
|
|
|
#endif /*LIBISO_FILESRC_H_*/
|