aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2022-09-26 05:32:14 -0400
committerKevin Wolf <kwolf@redhat.com>2022-10-07 12:11:41 +0200
commit9bd4d3c2e3d2e1df979e818ff0a5c05ca455721a (patch)
tree81fae12a51f7c72ea040728599b797ce3091c230 /job.c
parentba6a91005270c8e199d739c2e2afb49372ba0f7f (diff)
downloadqemu-9bd4d3c2e3d2e1df979e818ff0a5c05ca455721a.zip
qemu-9bd4d3c2e3d2e1df979e818ff0a5c05ca455721a.tar.gz
qemu-9bd4d3c2e3d2e1df979e818ff0a5c05ca455721a.tar.bz2
job: remove unused functions
These public functions are not used anywhere, thus can be dropped. Also, since this is the final job API that doesn't use AioContext lock and replaces it with job_lock, adjust all remaining function documentation to clearly specify if the job lock is taken or not. Also document the locking requirements for a few functions where the second version is not removed. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20220926093214.506243-22-eesposit@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'job.c')
-rw-r--r--job.c107
1 files changed, 6 insertions, 101 deletions
diff --git a/job.c b/job.c
index 76c6d7f..78feae0 100644
--- a/job.c
+++ b/job.c
@@ -233,12 +233,6 @@ int job_apply_verb_locked(Job *job, JobVerb verb, Error **errp)
return -EPERM;
}
-int job_apply_verb(Job *job, JobVerb verb, Error **errp)
-{
- JOB_LOCK_GUARD();
- return job_apply_verb_locked(job, verb, errp);
-}
-
JobType job_type(const Job *job)
{
return job->driver->job_type;
@@ -324,7 +318,7 @@ bool job_is_completed_locked(Job *job)
return false;
}
-bool job_is_completed(Job *job)
+static bool job_is_completed(Job *job)
{
JOB_LOCK_GUARD();
return job_is_completed_locked(job);
@@ -368,12 +362,6 @@ Job *job_get_locked(const char *id)
return NULL;
}
-Job *job_get(const char *id)
-{
- JOB_LOCK_GUARD();
- return job_get_locked(id);
-}
-
void job_set_aio_context(Job *job, AioContext *ctx)
{
/* protect against read in job_finish_sync_locked and job_start */
@@ -465,12 +453,6 @@ void job_ref_locked(Job *job)
++job->refcnt;
}
-void job_ref(Job *job)
-{
- JOB_LOCK_GUARD();
- job_ref_locked(job);
-}
-
void job_unref_locked(Job *job)
{
GLOBAL_STATE_CODE();
@@ -499,12 +481,6 @@ void job_unref_locked(Job *job)
}
}
-void job_unref(Job *job)
-{
- JOB_LOCK_GUARD();
- job_unref_locked(job);
-}
-
void job_progress_update(Job *job, uint64_t done)
{
progress_work_done(&job->progress, done);
@@ -581,12 +557,6 @@ void job_enter_cond_locked(Job *job, bool(*fn)(Job *job))
job_lock();
}
-void job_enter_cond(Job *job, bool(*fn)(Job *job))
-{
- JOB_LOCK_GUARD();
- job_enter_cond_locked(job, fn);
-}
-
void job_enter(Job *job)
{
JOB_LOCK_GUARD();
@@ -674,8 +644,9 @@ void coroutine_fn job_pause_point(Job *job)
job_pause_point_locked(job);
}
-static void coroutine_fn job_yield_locked(Job *job)
+void coroutine_fn job_yield(Job *job)
{
+ JOB_LOCK_GUARD();
assert(job->busy);
/* Check cancellation *before* setting busy = false, too! */
@@ -690,12 +661,6 @@ static void coroutine_fn job_yield_locked(Job *job)
job_pause_point_locked(job);
}
-void coroutine_fn job_yield(Job *job)
-{
- JOB_LOCK_GUARD();
- job_yield_locked(job);
-}
-
void coroutine_fn job_sleep_ns(Job *job, int64_t ns)
{
JOB_LOCK_GUARD();
@@ -764,23 +729,11 @@ void job_user_pause_locked(Job *job, Error **errp)
job_pause_locked(job);
}
-void job_user_pause(Job *job, Error **errp)
-{
- JOB_LOCK_GUARD();
- job_user_pause_locked(job, errp);
-}
-
bool job_user_paused_locked(Job *job)
{
return job->user_paused;
}
-bool job_user_paused(Job *job)
-{
- JOB_LOCK_GUARD();
- return job_user_paused_locked(job);
-}
-
void job_user_resume_locked(Job *job, Error **errp)
{
assert(job);
@@ -801,12 +754,6 @@ void job_user_resume_locked(Job *job, Error **errp)
job_resume_locked(job);
}
-void job_user_resume(Job *job, Error **errp)
-{
- JOB_LOCK_GUARD();
- job_user_resume_locked(job, errp);
-}
-
/* Called with job_mutex held, but releases it temporarily. */
static void job_do_dismiss_locked(Job *job)
{
@@ -834,12 +781,6 @@ void job_dismiss_locked(Job **jobptr, Error **errp)
*jobptr = NULL;
}
-void job_dismiss(Job **jobptr, Error **errp)
-{
- JOB_LOCK_GUARD();
- job_dismiss_locked(jobptr, errp);
-}
-
void job_early_fail(Job *job)
{
JOB_LOCK_GUARD();
@@ -1084,12 +1025,6 @@ void job_finalize_locked(Job *job, Error **errp)
job_do_finalize_locked(job);
}
-void job_finalize(Job *job, Error **errp)
-{
- JOB_LOCK_GUARD();
- job_finalize_locked(job, errp);
-}
-
/* Called with job_mutex held. */
static int job_transition_to_pending_locked(Job *job)
{
@@ -1236,12 +1171,6 @@ void job_cancel_locked(Job *job, bool force)
}
}
-void job_cancel(Job *job, bool force)
-{
- JOB_LOCK_GUARD();
- job_cancel_locked(job, force);
-}
-
void job_user_cancel_locked(Job *job, bool force, Error **errp)
{
if (job_apply_verb_locked(job, JOB_VERB_CANCEL, errp)) {
@@ -1250,15 +1179,9 @@ void job_user_cancel_locked(Job *job, bool force, Error **errp)
job_cancel_locked(job, force);
}
-void job_user_cancel(Job *job, bool force, Error **errp)
-{
- JOB_LOCK_GUARD();
- job_user_cancel_locked(job, force, errp);
-}
-
-/* A wrapper around job_cancel() taking an Error ** parameter so it may be
- * used with job_finish_sync() without the need for (rather nasty) function
- * pointer casts there.
+/* A wrapper around job_cancel_locked() taking an Error ** parameter so it may
+ * be used with job_finish_sync_locked() without the need for (rather nasty)
+ * function pointer casts there.
*
* Called with job_mutex held.
*/
@@ -1306,12 +1229,6 @@ int job_complete_sync_locked(Job *job, Error **errp)
return job_finish_sync_locked(job, job_complete_locked, errp);
}
-int job_complete_sync(Job *job, Error **errp)
-{
- JOB_LOCK_GUARD();
- return job_complete_sync_locked(job, errp);
-}
-
void job_complete_locked(Job *job, Error **errp)
{
/* Should not be reachable via external interface for internal jobs */
@@ -1331,12 +1248,6 @@ void job_complete_locked(Job *job, Error **errp)
job_lock();
}
-void job_complete(Job *job, Error **errp)
-{
- JOB_LOCK_GUARD();
- job_complete_locked(job, errp);
-}
-
int job_finish_sync_locked(Job *job,
void (*finish)(Job *, Error **errp),
Error **errp)
@@ -1366,9 +1277,3 @@ int job_finish_sync_locked(Job *job,
job_unref_locked(job);
return ret;
}
-
-int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
-{
- JOB_LOCK_GUARD();
- return job_finish_sync_locked(job, finish, errp);
-}