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_BUILDER_H_
|
|
|
|
#define LIBISO_BUILDER_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definitions for IsoNode builders.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some functions here will be moved to libisofs.h when we expose
|
|
|
|
* Builder.
|
|
|
|
*/
|
|
|
|
|
2007-12-04 21:33:40 +00:00
|
|
|
#include "libisofs.h"
|
|
|
|
#include "fsource.h"
|
2007-12-02 16:59:36 +00:00
|
|
|
|
|
|
|
typedef struct Iso_Node_Builder IsoNodeBuilder;
|
|
|
|
|
|
|
|
struct Iso_Node_Builder
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
2007-12-04 21:33:40 +00:00
|
|
|
* Create a new IsoFile from an IsoFileSource. Name, permissions
|
|
|
|
* and other attributes are taken from src, but a regular file will
|
|
|
|
* always be created, even if src is another kind of file.
|
|
|
|
*
|
|
|
|
* In that case, if the implementation can't do the conversion, it
|
|
|
|
* should fail propertly.
|
|
|
|
*
|
2008-03-08 20:45:19 +00:00
|
|
|
* Note that the src is never unref, so you need to free it.
|
2007-12-02 16:59:36 +00:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 on success, < 0 on error
|
|
|
|
*/
|
2007-12-28 21:10:17 +00:00
|
|
|
int (*create_file)(IsoNodeBuilder *builder, IsoImage *image,
|
2007-12-09 17:47:29 +00:00
|
|
|
IsoFileSource *src, IsoFile **file);
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-09 17:47:29 +00:00
|
|
|
/**
|
|
|
|
* Create a new IsoNode from a IsoFileSource. The type of the node to be
|
|
|
|
* created is determined from the type of the file source. Name,
|
|
|
|
* permissions and other attributes are taken from source file.
|
|
|
|
*
|
2007-12-11 21:47:04 +00:00
|
|
|
* Note that the src is never unref, so you need to free it.
|
2007-12-09 17:47:29 +00:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 on success, < 0 on error
|
|
|
|
*/
|
2007-12-28 21:10:17 +00:00
|
|
|
int (*create_node)(IsoNodeBuilder *builder, IsoImage *image,
|
2007-12-09 17:47:29 +00:00
|
|
|
IsoFileSource *src, IsoNode **node);
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-04 21:33:40 +00:00
|
|
|
/**
|
|
|
|
* Free implementation specific data. Should never be called by user.
|
|
|
|
* Use iso_node_builder_unref() instead.
|
|
|
|
*/
|
|
|
|
void (*free)(IsoNodeBuilder *builder);
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-02 16:59:36 +00:00
|
|
|
int refcount;
|
2007-12-09 17:47:29 +00:00
|
|
|
void *create_file_data;
|
|
|
|
void *create_node_data;
|
2007-12-02 16:59:36 +00:00
|
|
|
};
|
|
|
|
|
2007-12-04 21:33:40 +00:00
|
|
|
void iso_node_builder_ref(IsoNodeBuilder *builder);
|
|
|
|
void iso_node_builder_unref(IsoNodeBuilder *builder);
|
2007-12-02 16:59:36 +00:00
|
|
|
|
2007-12-04 21:33:40 +00:00
|
|
|
/**
|
|
|
|
* Create a new basic builder ...
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* 1 success, < 0 error
|
|
|
|
*/
|
|
|
|
int iso_node_basic_builder_new(IsoNodeBuilder **builder);
|
2007-12-02 16:59:36 +00:00
|
|
|
|
|
|
|
#endif /*LIBISO_BUILDER_H_*/
|