return 0;
}
-#if defined(ENABLE_ERROR_MESSAGES) || defined(ENABLE_DEBUG)
-static void
+static inline void
print_inode_dentries(const struct wim_inode *inode)
{
struct wim_dentry *dentry;
inode_for_each_dentry(dentry, inode)
tfprintf(stderr, T("%"TS"\n"), dentry_full_path(dentry));
}
-#endif
static void
inconsistent_inode(const struct wim_inode *inode)
{
-#ifdef ENABLE_ERROR_MESSAGES
- ERROR("An inconsistent hard link group that cannot be corrected has "
- "been detected");
- ERROR("The dentries are located at the following paths:");
- print_inode_dentries(inode);
-#endif
+ if (wimlib_print_errors) {
+ ERROR("An inconsistent hard link group that cannot be corrected has "
+ "been detected");
+ ERROR("The dentries are located at the following paths:");
+ print_inode_dentries(inode);
+ }
}
static bool
inode_table_prepare_inode_list(struct wim_inode_table *table,
struct list_head *head)
{
- struct wim_inode *inode;
+ struct wim_inode *inode, *tmp_inode;
struct hlist_node *cur, *tmp;
u64 cur_ino = 1;
/* Re-assign inode numbers in the existing list to avoid duplicates. */
- list_for_each_entry(inode, head, i_list) {
- if (inode->i_nlink > 1)
- inode->i_ino = cur_ino++;
- else
- inode->i_ino = 0;
- }
+ list_for_each_entry(inode, head, i_list)
+ inode->i_ino = cur_ino++;
/* Assign inode numbers to the new inodes and move them to the image's
* inode list. */
for (size_t i = 0; i < table->capacity; i++) {
hlist_for_each_entry_safe(inode, cur, tmp, &table->array[i], i_hlist)
{
- if (inode->i_nlink > 1)
- inode->i_ino = cur_ino++;
- else
- inode->i_ino = 0;
+ inode->i_ino = cur_ino++;
+ inode->i_devno = 0;
list_add_tail(&inode->i_list, head);
}
INIT_HLIST_HEAD(&table->array[i]);
}
- list_splice_tail(&table->extra_inodes, head);
+ list_for_each_entry_safe(inode, tmp_inode, &table->extra_inodes, i_list)
+ {
+ inode->i_ino = cur_ino++;
+ inode->i_devno = 0;
+ list_add_tail(&inode->i_list, head);
+ }
+ INIT_LIST_HEAD(&table->extra_inodes);
table->num_entries = 0;
}