}
lte->file_on_disk = file_on_disk;
lte->resource_location = RESOURCE_IN_FILE_ON_DISK;
- lte->resource_entry.original_size = size;
+ lte->size = size;
lookup_table_insert_unhashed(lookup_table, lte, inode, 0);
inode->i_lte = lte;
}
struct add_image_params *params)
{
struct wim_dentry *root = NULL;
- int ret = 0;
+ int ret;
struct wim_inode *inode;
+ params->progress.scan.cur_path = path;
+
if (exclude_path(path, path_len, params->config, true)) {
- if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE)
- && params->progress_func)
- {
- union wimlib_progress_info info;
- info.scan.cur_path = path;
- info.scan.status = WIMLIB_SCAN_DENTRY_EXCLUDED;
- params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
- }
+ do_capture_progress(params, WIMLIB_SCAN_DENTRY_EXCLUDED);
+ ret = 0;
goto out;
}
- if ((params->add_flags & WIMLIB_ADD_FLAG_VERBOSE)
- && params->progress_func)
- {
- union wimlib_progress_info info;
- info.scan.cur_path = path;
- info.scan.status = WIMLIB_SCAN_DENTRY_OK;
- params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
- }
-
struct stat stbuf;
int (*stat_fn)(const char *restrict, struct stat *restrict);
if ((params->add_flags & WIMLIB_ADD_FLAG_DEREFERENCE) ||
}
if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)
&& !S_ISLNK(stbuf.st_mode)) {
- if ((params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE)
- && params->progress_func)
+ if (params->add_flags & WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE)
{
- union wimlib_progress_info info;
- info.scan.cur_path = path;
- info.scan.status = WIMLIB_SCAN_DENTRY_UNSUPPORTED;
- params->progress_func(WIMLIB_PROGRESS_MSG_SCAN_DENTRY, &info);
+ ERROR("Can't archive unsupported file \"%s\"", path);
+ ret = WIMLIB_ERR_UNSUPPORTED_FILE;
+ goto out;
}
+ do_capture_progress(params, WIMLIB_SCAN_DENTRY_UNSUPPORTED);
+ ret = 0;
goto out;
}
+ do_capture_progress(params, WIMLIB_SCAN_DENTRY_OK);
+
ret = inode_table_new_dentry(¶ms->inode_table,
path_basename_with_len(path, path_len),
stbuf.st_ino, stbuf.st_dev, false, &root);
inode = root->d_inode;
- if (inode->i_nlink > 1) /* Already captured this inode? */
+ if (inode->i_nlink > 1) {
+ /* Already captured this inode? */
+ ret = 0;
goto out;
+ }
#ifdef HAVE_STAT_NANOSECOND_PRECISION
inode->i_creation_time = timespec_to_wim_timestamp(stbuf.st_mtim);
ret = unix_capture_directory(root, path, path_len, params);
else
ret = unix_capture_symlink(&root, path, inode, params);
+
+ if (ret)
+ goto out;
+
out:
- if (ret == 0)
- *root_ret = root;
- else
+ if (ret)
free_dentry_tree(root, params->lookup_table);
+ else
+ *root_ret = root;
return ret;
}