/*
* Copyright (C) 2012, 2013, 2014 Eric Biggers
*
- * This file is part of wimlib, a library for working with WIM files.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
*
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 3 of the License, or (at your option)
- * any later version.
- *
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
- * You should have received a copy of the GNU General Public License
- * along with wimlib; if not, see http://www.gnu.org/licenses/.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
*/
#ifdef HAVE_CONFIG_H
inode = dentry->d_inode;
if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
- if (dentry != inode_first_extraction_dentry(inode))
- continue;
- ret = ntfs_3g_create_nondirectory(inode, ctx);
- if (ret)
- return ret;
+ if (dentry == inode_first_extraction_dentry(inode)) {
+ ret = ntfs_3g_create_nondirectory(inode, ctx);
+ if (ret)
+ return ret;
+ }
ret = report_file_created(&ctx->common);
if (ret)
return ret;
return ret;
}
+static uint64_t
+ntfs_3g_count_dentries(const struct list_head *dentry_list)
+{
+ const struct wim_dentry *dentry;
+ uint64_t count = 0;
+
+ list_for_each_entry(dentry, dentry_list, d_extraction_list_node) {
+ count++;
+ if ((dentry->d_inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) &&
+ dentry_has_short_name(dentry))
+ {
+ count++;
+ }
+
+ }
+
+ return count;
+}
+
static int
ntfs_3g_extract(struct list_head *dentry_list, struct apply_ctx *_ctx)
{
/* Create all inodes and aliases, including short names, and set
* metadata (attributes, security descriptors, and timestamps). */
- reset_file_progress(&ctx->common);
+ ret = start_file_structure_phase(&ctx->common,
+ ntfs_3g_count_dentries(dentry_list));
+ if (ret)
+ goto out_unmount;
ret = ntfs_3g_create_directories(root, dentry_list, ctx);
if (ret)
if (ret)
goto out_unmount;
+ ret = end_file_structure_phase(&ctx->common);
+ if (ret)
+ goto out_unmount;
+
/* Extract streams. */
struct read_stream_list_callbacks cbs = {
.begin_stream = ntfs_3g_begin_extract_stream,