+extern int
+wimlib_unmount_image(const wimlib_tchar *dir,
+ int unmount_flags,
+ wimlib_progress_func_t progress_func);
+
+/**
+ * Update a WIM image by adding, deleting, and/or renaming files or directories.
+ *
+ * @param wim
+ * Pointer to the ::WIMStruct for the WIM file to update.
+ * @param image
+ * The 1-based index of the image in the WIM to update. It cannot be
+ * ::WIMLIB_ALL_IMAGES.
+ * @param cmds
+ * An array of ::wimlib_update_command's that specify the update operations
+ * to perform.
+ * @param num_cmds
+ * Number of commands in @a cmds.
+ * @param update_flags
+ * Reserved; must be 0.
+ * @param progress_func
+ * If non-NULL, a function that will be called periodically with the
+ * progress of the current operation.
+ *
+ * @return 0 on success; nonzero on error. On failure, some but not all of the
+ * update commands may have been executed. No individual update command will
+ * have been partially executed. Possible error codes include:
+ *
+ * @retval ::WIMLIB_ERR_DECOMPRESSION
+ * Failed to decompress the metadata resource from @a image in @a wim.
+ * @retval ::WIMLIB_ERR_INVALID_CAPTURE_CONFIG
+ * The capture configuration structure specified for an add command was
+ * invalid.
+ * @retval ::WIMLIB_ERR_INVALID_DENTRY
+ * A directory entry for @a image in @a wim is invalid.
+ * @retval ::WIMLIB_ERR_INVALID_IMAGE
+ * @a image did not specify a single, existing image in @a wim.
+ * @retval ::WIMLIB_ERR_INVALID_OVERLAY
+ * Attempted to perform an add command that conflicted with previously
+ * existing files in the WIM when an overlay was attempted.
+ * @retval ::WIMLIB_ERR_INVALID_PARAM
+ * Attempted to perform an add command with ::WIMLIB_ADD_FLAG_NTFS set, but
+ * the same image had previously already been added from a NTFS volume.
+ * @retval ::WIMLIB_ERR_INVALID_REPARSE_DATA
+ * (Windows only): While executing an add command, tried to capture a
+ * reparse point with invalid data.
+ * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
+ * The metadata resource for @a image in @a wim is invalid.
+ * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA
+ * The security data for image @a image in @a wim is invalid.
+ * @retval ::WIMLIB_ERR_IS_DIRECTORY
+ * A delete command without ::WIMLIB_DELETE_FLAG_RECURSIVE specified was
+ * for a WIM path that corresponded to a directory; or, a rename command
+ * attempted to rename a directory to a non-directory.
+ * @retval ::WIMLIB_ERR_NOMEM
+ * Failed to allocate needed memory.
+ * @retval ::WIMLIB_ERR_NOTDIR
+ * A rename command attempted to rename a directory to a non-directory; or,
+ * an add command was executed that attempted to set the root of the WIM
+ * image as a non-directory.
+ * @retval ::WIMLIB_ERR_NOTEMPTY
+ * A rename command attempted to rename a directory to a non-empty
+ * directory.
+ * @retval ::WIMLIB_ERR_NTFS_3G
+ * While executing an add command with ::WIMLIB_ADD_FLAG_NTFS specified, an
+ * error occurred while reading data from the NTFS volume using libntfs-3g.
+ * @retval ::WIMLIB_ERR_OPEN
+ * Failed to open a file to be captured while executing an add command.
+ * @retval ::WIMLIB_ERR_OPENDIR
+ * Failed to open a file to be captured while executing an add command.
+ * @retval ::WIMLIB_ERR_PATH_DOES_NOT_EXIST
+ * A delete command without ::WIMLIB_DELETE_FLAG_FORCE specified was for a
+ * WIM path that did not exist; or, a component of the path of the source
+ * or destination of a rename command was used as a directory but was not,
+ * in fact, a directory.
+ * @retval ::WIMLIB_ERR_READ
+ * Failed to read the metadata resource for @a image in @a wim; or, while
+ * executing an add command, failed to read data from a file or directory
+ * to be captured.
+ * @retval ::WIMLIB_ERR_READLINK
+ * While executing an add command, failed to read the target of a symbolic
+ * link or junction point.
+ * @retval ::WIMLIB_ERR_REPARSE_POINT_FIXUP_FAILED
+ * (Windows only) Failed to perform a reparse point fixup because of
+ * problems with the data of a reparse point.
+ * @retval ::WIMLIB_ERR_SPECIAL_FILE
+ * While executing an add command, attempted to capture a file that was not
+ * a supported file type, such as a regular file, directory, symbolic link,
+ * or (on Windows) a reparse point.
+ * @retval ::WIMLIB_ERR_SPLIT_UNSUPPORTED
+ * @a wim is part of a split WIM. Updating a split WIM is unsupported.
+ * @retval ::WIMLIB_ERR_STAT
+ * While executing an add command, failed to get attributes for a file or
+ * directory.
+ * @retval ::WIMLIB_ERR_UNSUPPORTED
+ * ::WIMLIB_ADD_FLAG_NTFS was specified in the @a add_flags for an update
+ * command, but wimlib was configured with the @c --without-ntfs-3g flag.
+ */
+extern int
+wimlib_update_image(WIMStruct *wim,
+ int image,
+ const struct wimlib_update_command *cmds,
+ size_t num_cmds,
+ int update_flags,
+ wimlib_progress_func_t progress_func);