libisofs-legacy/libisofs/ecma119_tree.h

104 lines
2.6 KiB
C
Raw Normal View History

2006-08-24 19:24:38 +00:00
/* vim: set noet ts=8 sts=8 sw=8 : */
/**
* \file ecma119_tree.h
*
* Declarations for creating, modifying and printing filesystem trees that
* are compatible with ecma119.
*/
#ifndef LIBISO_ECMA119_TREE_H
#define LIBISO_ECMA119_TREE_H
#include <sys/stat.h>
#include "file.h"
2006-08-24 19:24:38 +00:00
struct ecma119_write_target;
struct iso_tree_node;
2006-08-24 19:24:38 +00:00
2007-06-05 22:01:26 +00:00
enum ecma119_node_type {
2006-08-24 19:24:38 +00:00
ECMA119_FILE,
ECMA119_SYMLINK,
ECMA119_DIR,
ECMA119_PLACEHOLDER, /**< placeholder for a relocated dir. */
ECMA119_BOOT
2006-08-24 19:24:38 +00:00
};
struct ecma119_dir_info {
struct susp_info self_susp; /**< susp entries for "." */
struct susp_info parent_susp; /**< susp entries for ".." */
size_t len; /**< sum of the lengths of children's
* Directory Records (including SU) */
size_t CE_len; /**< sum of the lengths of children's
* SUSP CE areas */
size_t block;
2006-08-24 19:24:38 +00:00
int depth;
size_t path_len; /**< The length of a path up to, and
* including, this directory. This
* cannot exceed 255. */
size_t nchildren;
struct ecma119_tree_node **children;
struct ecma119_tree_node *real_parent;
/**< The parent before relocation */
};
/**
* A node for a tree containing all the information necessary for writing
* an ISO9660 volume.
*/
struct ecma119_tree_node
{
char *iso_name; /**< in ASCII, conforming to the
* current ISO level. */
char *full_name; /**< full name, in current locale */
2006-08-24 19:24:38 +00:00
size_t dirent_len; /**< Length of the directory record,
* not including SU. */
2006-08-24 19:24:38 +00:00
struct ecma119_tree_node *parent;
struct ecma119_write_target *target;
struct stat attrib;
2006-08-24 19:24:38 +00:00
struct susp_info susp;
2007-06-05 22:01:26 +00:00
enum ecma119_node_type type; /**< file, symlink, directory or placeholder */
union {
struct iso_file *file;
char *dest;
2006-08-24 19:24:38 +00:00
struct ecma119_dir_info dir;
struct ecma119_tree_node *real_me; /**< this field points to
* the relocated directory.
*/
unsigned int boot_img:1; /** For boot nodes, it identifies if this
* corresponds to image(1) or catalog(0).
* The block is stored in ecma119_write_target
*/
} info;
2006-08-24 19:24:38 +00:00
};
/**
* Create a new ecma119_tree that corresponds to the tree represented by
* \p iso_root.
*/
struct ecma119_tree_node*
ecma119_tree_create(struct ecma119_write_target *target,
struct iso_tree_node *iso_root);
/**
* Free an ecma119 tree.
*/
void
ecma119_tree_free(struct ecma119_tree_node *root);
/**
* Print an ecma119 tree.
*/
void
ecma119_tree_print(struct ecma119_tree_node *root, int spaces);
#endif /* LIBISO_ECMA119_TREE_H */