2007-12-15 15:55:44 +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_ECMA119_TREE_H_
|
|
|
|
#define LIBISO_ECMA119_TREE_H_
|
|
|
|
|
|
|
|
#include "libisofs.h"
|
|
|
|
#include "ecma119.h"
|
|
|
|
|
|
|
|
enum ecma119_node_type {
|
|
|
|
ECMA119_FILE,
|
2007-12-23 15:16:26 +00:00
|
|
|
ECMA119_DIR,
|
|
|
|
ECMA119_SYMLINK,
|
|
|
|
ECMA119_SPECIAL,
|
|
|
|
ECMA119_PLACEHOLDER
|
2007-12-15 15:55:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2008-01-06 16:38:31 +00:00
|
|
|
* Struct with info about a node representing a directory
|
2007-12-15 15:55:44 +00:00
|
|
|
*/
|
2007-12-28 21:10:17 +00:00
|
|
|
struct ecma119_dir_info
|
|
|
|
{
|
2007-12-15 15:55:44 +00:00
|
|
|
/* Block where the directory entries will be written on image */
|
|
|
|
size_t block;
|
|
|
|
|
|
|
|
size_t nchildren;
|
|
|
|
Ecma119Node **children;
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-24 13:24:09 +00:00
|
|
|
/*
|
|
|
|
* Size of the dir, i.e., sum of the lengths of all directory records.
|
|
|
|
* It is computed by calc_dir_size() [ecma119.c].
|
|
|
|
* Note that this don't include the length of any SUSP Continuation
|
|
|
|
* Area needed by the dir, but it includes the size of the SUSP entries
|
|
|
|
* than fit in the directory records System Use Field.
|
2007-12-28 21:10:17 +00:00
|
|
|
*/
|
2007-12-24 13:24:09 +00:00
|
|
|
size_t len;
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-23 16:41:21 +00:00
|
|
|
/**
|
|
|
|
* Real parent if the dir has been reallocated. NULL otherwise.
|
|
|
|
*/
|
|
|
|
Ecma119Node *real_parent;
|
2007-12-15 15:55:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A node for a tree containing all the information necessary for writing
|
|
|
|
* an ISO9660 volume.
|
|
|
|
*/
|
|
|
|
struct ecma119_node
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Name in ASCII, conforming to selected ISO level.
|
|
|
|
* Version number is not include, it is added on the fly
|
|
|
|
*/
|
|
|
|
char *iso_name;
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-15 15:55:44 +00:00
|
|
|
Ecma119Node *parent;
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-15 15:55:44 +00:00
|
|
|
IsoNode *node; /*< reference to the iso node */
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2008-01-19 15:12:08 +00:00
|
|
|
/* TODO #00009 : add true support for harlinks and inode numbers */
|
2007-12-25 17:51:00 +00:00
|
|
|
ino_t ino;
|
|
|
|
nlink_t nlink;
|
2007-12-28 21:10:17 +00:00
|
|
|
|
2007-12-23 16:11:32 +00:00
|
|
|
/**< file, symlink, special, directory or placeholder */
|
2007-12-28 21:10:17 +00:00
|
|
|
enum ecma119_node_type type;
|
|
|
|
union
|
|
|
|
{
|
2007-12-15 15:55:44 +00:00
|
|
|
IsoFileSrc *file;
|
2007-12-29 17:30:59 +00:00
|
|
|
struct ecma119_dir_info *dir;
|
2007-12-23 16:11:32 +00:00
|
|
|
/** this field points to the relocated directory. */
|
2007-12-28 21:10:17 +00:00
|
|
|
Ecma119Node *real_me;
|
2007-12-15 15:55:44 +00:00
|
|
|
} info;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2007-12-17 22:22:19 +00:00
|
|
|
int ecma119_tree_create(Ecma119Image *img);
|
2007-12-15 15:55:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free an Ecma119Node, and its children if node is a dir
|
|
|
|
*/
|
|
|
|
void ecma119_node_free(Ecma119Node *node);
|
|
|
|
|
|
|
|
#endif /*LIBISO_ECMA119_TREE_H_*/
|