On 28.02.26 01:41, Fabiano Rosas wrote:
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 3695afd483..15578b3e28 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -223,7 +223,15 @@ struct VMStateDescription {
      bool (*post_load_errp)(void *opaque, int version_id, Error **errp);
      int (*pre_save)(void *opaque);
      bool (*pre_save_errp)(void *opaque, Error **errp);
-    int (*post_save)(void *opaque);
+
+    /*
+     * post_save() rarely used to free some temporary resources.
+     * It's is called if .pre_save[_errp]() call was successful
+     * (or .pre_save[_errp] handler absent), regardless success
+     * or failure during fields and subsections save. If
+     * .pre_save[_errp]() fails, .post_save() is not called.
+     */
I would not mention usage directly and maybe also simplify the language
a bit. If there's doubt on the exact flow, people can read the code:

   /*
    * Unless .pre_save() fails, post_save() is called after saving
    * fields and subsections. It should not fail because at this point
    * the state has potentially already been transferred.
    */


Agree, sounds good.

--
Best regards,
Vladimir

Reply via email to