+/* Return true iff the specified image has been changed since being read from
+ * its backing file or has been created from scratch. */
+static inline bool
+is_image_dirty(const struct wim_image_metadata *imd)
+{
+ /* The only possible values here are BLOB_NONEXISTENT and BLOB_IN_WIM */
+ return imd->metadata_blob->blob_location == BLOB_NONEXISTENT;
+}
+
+/* Return true iff the specified image is unchanged since being read from the
+ * specified backing WIM file. */
+static inline bool
+is_image_unchanged_from_wim(const struct wim_image_metadata *imd,
+ const WIMStruct *wim)
+{
+ return !is_image_dirty(imd) && imd->metadata_blob->rdesc->wim == wim;
+}
+
+/* Mark the metadata for the specified WIM image "dirty" following changes to
+ * the image's directory tree. This records that the metadata no longer matches
+ * the version in the WIM file (if any) and that its stats are out of date. */
+static inline void
+mark_image_dirty(struct wim_image_metadata *imd)
+{
+ blob_release_location(imd->metadata_blob);
+ imd->stats_outdated = true;
+}
+