diff mbox series

[v5,03/20] job.c: API functions not used outside should be static

Message ID 20220208143513.1077229-4-eesposit@redhat.com (mailing list archive)
State New, archived
Headers show
Series job: replace AioContext lock with job_mutex | expand

Commit Message

Emanuele Giuseppe Esposito Feb. 8, 2022, 2:34 p.m. UTC
job_event_* functions can all be static, as they are not used
outside job.c.

Same applies for job_txn_add_job().

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 include/qemu/job.h | 18 ------------------
 job.c              | 12 +++++++++---
 2 files changed, 9 insertions(+), 21 deletions(-)

Comments

Stefan Hajnoczi Feb. 10, 2022, 3:43 p.m. UTC | #1
On Tue, Feb 08, 2022 at 09:34:56AM -0500, Emanuele Giuseppe Esposito wrote:
> job_event_* functions can all be static, as they are not used
> outside job.c.
> 
> Same applies for job_txn_add_job().
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  include/qemu/job.h | 18 ------------------
>  job.c              | 12 +++++++++---
>  2 files changed, 9 insertions(+), 21 deletions(-)
> 
> diff --git a/include/qemu/job.h b/include/qemu/job.h
> index 86ec46c09e..6000463126 100644
> --- a/include/qemu/job.h
> +++ b/include/qemu/job.h
> @@ -356,18 +356,6 @@ JobTxn *job_txn_new(void);
>   */
>  void job_txn_unref(JobTxn *txn);
>  
> -/**
> - * @txn: The transaction (may be NULL)
> - * @job: Job to add to the transaction
> - *
> - * Add @job to the transaction.  The @job must not already be in a transaction.
> - * The caller must call either job_txn_unref() or job_completed() to release
> - * the reference that is automatically grabbed here.
> - *
> - * If @txn is NULL, the function does nothing.
> - */
> -void job_txn_add_job(JobTxn *txn, Job *job);
...
> diff --git a/job.c b/job.c
> index d603f9ad1e..f13939d3c6 100644
> --- a/job.c
> +++ b/job.c
> @@ -125,7 +125,7 @@ void job_txn_unref(JobTxn *txn)
>      }
>  }
>  
> -void job_txn_add_job(JobTxn *txn, Job *job)
> +static void job_txn_add_job(JobTxn *txn, Job *job)

Please move the doc comments into the .c file too.
diff mbox series

Patch

diff --git a/include/qemu/job.h b/include/qemu/job.h
index 86ec46c09e..6000463126 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -356,18 +356,6 @@  JobTxn *job_txn_new(void);
  */
 void job_txn_unref(JobTxn *txn);
 
-/**
- * @txn: The transaction (may be NULL)
- * @job: Job to add to the transaction
- *
- * Add @job to the transaction.  The @job must not already be in a transaction.
- * The caller must call either job_txn_unref() or job_completed() to release
- * the reference that is automatically grabbed here.
- *
- * If @txn is NULL, the function does nothing.
- */
-void job_txn_add_job(JobTxn *txn, Job *job);
-
 /**
  * Create a new long-running job and return it.
  *
@@ -429,12 +417,6 @@  void job_progress_set_remaining(Job *job, uint64_t remaining);
  */
 void job_progress_increase_remaining(Job *job, uint64_t delta);
 
-/** To be called when a cancelled job is finalised. */
-void job_event_cancelled(Job *job);
-
-/** To be called when a successfully completed job is finalised. */
-void job_event_completed(Job *job);
-
 /**
  * Conditionally enter the job coroutine if the job is ready to run, not
  * already busy and fn() returns true. fn() is called while under the job_lock
diff --git a/job.c b/job.c
index d603f9ad1e..f13939d3c6 100644
--- a/job.c
+++ b/job.c
@@ -125,7 +125,7 @@  void job_txn_unref(JobTxn *txn)
     }
 }
 
-void job_txn_add_job(JobTxn *txn, Job *job)
+static void job_txn_add_job(JobTxn *txn, Job *job)
 {
     if (!txn) {
         return;
@@ -427,12 +427,18 @@  void job_progress_increase_remaining(Job *job, uint64_t delta)
     progress_increase_remaining(&job->progress, delta);
 }
 
-void job_event_cancelled(Job *job)
+/**
+ * To be called when a cancelled job is finalised.
+ */
+static void job_event_cancelled(Job *job)
 {
     notifier_list_notify(&job->on_finalize_cancelled, job);
 }
 
-void job_event_completed(Job *job)
+/**
+ * To be called when a successfully completed job is finalised.
+ */
+static void job_event_completed(Job *job)
 {
     notifier_list_notify(&job->on_finalize_completed, job);
 }