#include "wimlib/capture.h"
#include "wimlib/dentry.h"
#include "wimlib/encoding.h"
+#include "wimlib/endianness.h"
#include "wimlib/error.h"
#include "wimlib/lookup_table.h"
#include "wimlib/metadata.h"
{
if (parent) {
/* Unlink @subject from its @parent. */
- wimlib_assert(subject->parent == parent);
+ wimlib_assert(subject->d_parent == parent);
unlink_dentry(subject);
} else {
/* Unset @subject as the root of the image. */
*root_p = NULL;
}
- subject->parent = subject;
+ subject->d_parent = subject;
}
static void
if (dentry_is_root(subject))
parent = NULL;
else
- parent = subject->parent;
+ parent = subject->d_parent;
prim.type = UNLINK_DENTRY;
prim.link.subject = subject;
/* Replace nondirectory file */
struct wim_dentry *parent;
int ret;
- union wimlib_progress_info info;
- parent = existing->parent;
+ parent = existing->d_parent;
ret = calculate_dentry_full_path(existing);
if (ret)
return ret;
- ret = journaled_unlink(j, existing);
- if (ret)
- return ret;
+ if (add_flags & WIMLIB_ADD_FLAG_VERBOSE) {
+ union wimlib_progress_info info;
+
+ info.replace.path_in_wim = existing->_full_path;
+ ret = call_progress(progfunc,
+ WIMLIB_PROGRESS_MSG_REPLACE_FILE_IN_WIM,
+ &info, progctx);
+ if (ret)
+ return ret;
+ }
- ret = journaled_link(j, branch, parent);
+ ret = journaled_unlink(j, existing);
if (ret)
return ret;
-
- info.replace.path_in_wim = existing->_full_path;
- return call_progress(progfunc,
- WIMLIB_PROGRESS_MSG_REPLACE_FILE_IN_WIM,
- &info, progctx);
+ return journaled_link(j, branch, parent);
}
}
#ifdef WITH_NTFS_3G
wim_get_current_image_metadata(wim)->ntfs_vol = ntfs_vol;
#endif
- if (add_flags & WIMLIB_ADD_FLAG_RPFIX)
- wim->hdr.flags |= WIM_HDR_FLAG_RP_FIX;
ret = 0;
goto out_destroy_config;
out_cleanup_after_capture:
return true;
if (dentry_is_root(d2))
return false;
- d2 = d2->parent;
+ d2 = d2->d_parent;
}
}
if (dentry_has_children(dst))
return -ENOTEMPTY;
}
- parent_of_dst = dst->parent;
+ parent_of_dst = dst->d_parent;
} else {
/* Destination does not exist */
parent_of_dst = get_parent_dentry(wim, to, case_type);
goto rollback;
}
- ret = WIMLIB_ERR_INVALID_PARAM;
switch (cmds[i].op) {
case WIMLIB_UPDATE_OP_ADD:
ret = execute_add_command(j, wim, &cmds[i], inode_table,
WIMLIB_ADD_FLAG_NO_UNSUPPORTED_EXCLUDE |
WIMLIB_ADD_FLAG_WINCONFIG |
WIMLIB_ADD_FLAG_WIMBOOT |
- WIMLIB_ADD_FLAG_NO_REPLACE))
+ WIMLIB_ADD_FLAG_NO_REPLACE |
+ WIMLIB_ADD_FLAG_TEST_FILE_EXCLUSION))
return WIMLIB_ERR_INVALID_PARAM;
bool is_entire_image = WIMLIB_IS_WIM_ROOT_PATH(cmd->add.wim_target_path);
* directories, may have changed. Call xml_update_image_info() to
* recalculate these statistics. */
xml_update_image_info(wim, image);
+
+ for (size_t i = 0; i < num_cmds; i++)
+ if (cmds_copy[i].op == WIMLIB_UPDATE_OP_ADD &&
+ cmds_copy[i].add.add_flags & WIMLIB_ADD_FLAG_RPFIX)
+ wim->hdr.flags |= WIM_HDR_FLAG_RP_FIX;
out_free_cmds_copy:
free_update_commands(cmds_copy, num_cmds);
out:
return ret;
}
-static int
-update1(WIMStruct *wim, int image, const struct wimlib_update_command *cmd)
-{
- return wimlib_update_image(wim, image, cmd, 1, 0);
-}
-
WIMLIBAPI int
wimlib_delete_path(WIMStruct *wim, int image,
const tchar *path, int delete_flags)
cmd.delete_.wim_path = (tchar *)path;
cmd.delete_.delete_flags = delete_flags;
- return update1(wim, image, &cmd);
+ return wimlib_update_image(wim, image, &cmd, 1, 0);
}
WIMLIBAPI int
cmd.rename.wim_target_path = (tchar *)dest_path;
cmd.rename.rename_flags = 0;
- return update1(wim, image, &cmd);
+ return wimlib_update_image(wim, image, &cmd, 1, 0);
}
WIMLIBAPI int
cmd.add.add_flags = add_flags;
cmd.add.config_file = NULL;
- return update1(wim, image, &cmd);
+ return wimlib_update_image(wim, image, &cmd, 1, 0);
}