aboutsummaryrefslogtreecommitdiff
path: root/include/block/blockjob_int.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-13 18:50:05 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:49 +0200
commit80fa2c756b3241f24015a7503a01f7999d4a942d (patch)
treedb1b410af62162feb7d8b69651a9d671cf4cc030 /include/block/blockjob_int.h
parenta50c2ab858fe613fb805e53b4f6b970ab936706d (diff)
job: Add reference counting
This moves reference counting from BlockJob to Job. In order to keep calling the BlockJob cleanup code when the job is deleted via job_unref(), introduce a new JobDriver.free callback. Every block job must use block_job_free() for this callback, this is asserted in block_job_create(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'include/block/blockjob_int.h')
-rw-r--r--include/block/blockjob_int.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
index 1e62d6dd30..6f0fe3c48d 100644
--- a/include/block/blockjob_int.h
+++ b/include/block/blockjob_int.h
@@ -144,6 +144,13 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
BlockCompletionFunc *cb, void *opaque, Error **errp);
/**
+ * block_job_free:
+ * Callback to be used for JobDriver.free in all block jobs. Frees block job
+ * specific resources in @job.
+ */
+void block_job_free(Job *job);
+
+/**
* block_job_sleep_ns:
* @job: The job that calls the function.
* @ns: How many nanoseconds to stop for.