Implemented advanced unit tests and trivial fixes
This commit is contained in:
@ -88,6 +88,7 @@ iso_file_table_clear(struct iso_file_table *ft)
|
||||
node = next;
|
||||
} while (node);
|
||||
}
|
||||
ft->count = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,13 @@
|
||||
* \file file.h
|
||||
*
|
||||
* Declare the structs to keep track of the files to be written into image.
|
||||
*
|
||||
* These files are stored in a hash table. Two modes of operation are supported:
|
||||
* when cache inodes is enabled, the files are indexed into the table by the
|
||||
* device and inode id in the local filesystem. This way, two different files
|
||||
* with same inode and device id are treated as if they were a single file.
|
||||
* This is usually the correct behavior, as a different file with same inode
|
||||
* and device used to be a hard link.
|
||||
* When cache inode is disabled, indexing is done by path on local filesystem.
|
||||
*/
|
||||
|
||||
#ifndef FILE_H_
|
||||
@ -14,7 +20,7 @@
|
||||
#define FILE_HASH_NODES 2048
|
||||
|
||||
struct iso_file {
|
||||
char *path;
|
||||
char *path; /**< Path of the file on local filesystem */
|
||||
off_t size; /**< size of this file */
|
||||
ino_t ino; /**< This will be the inode number on CD of the file (RR) */
|
||||
nlink_t nlink; /**< Number of hard links of the file on CD (RR) */
|
||||
@ -37,6 +43,10 @@ struct iso_file_table {
|
||||
|
||||
struct iso_tree_node_file;
|
||||
|
||||
/**
|
||||
* Create a struct that represents the specified iso_tree_node_file,
|
||||
* suitable to be stored into the table,
|
||||
*/
|
||||
struct iso_file *iso_file_new(struct iso_tree_node_file*);
|
||||
|
||||
struct iso_file_table *iso_file_table_new(int cache_inodes);
|
||||
@ -47,6 +57,10 @@ struct iso_file_table *iso_file_table_new(int cache_inodes);
|
||||
*/
|
||||
void iso_file_table_clear(struct iso_file_table *ft);
|
||||
|
||||
/**
|
||||
* Add a new file to the table.
|
||||
* \return 1 if the file is added, 0 if the file already exist on table
|
||||
*/
|
||||
int iso_file_table_add_file(struct iso_file_table *ft, struct iso_file *f);
|
||||
|
||||
struct iso_file *iso_file_table_lookup(struct iso_file_table *ft,
|
||||
|
@ -187,7 +187,6 @@ iso_tree_node_set_sort_weight(struct iso_tree_node *node, int w)
|
||||
for (i=0; i < dir->nchildren; i++) {
|
||||
iso_tree_node_set_sort_weight(dir->children[i], w);
|
||||
}
|
||||
free(dir->children);
|
||||
} else if ( ISO_ISREG(node) ) {
|
||||
struct iso_tree_node_file *file;
|
||||
file = (struct iso_tree_node_file *) node;
|
||||
|
Reference in New Issue
Block a user