summaryrefslogtreecommitdiffstats
path: root/src/core/job.c
diff options
context:
space:
mode:
authorMichael Brown2013-11-01 16:05:16 +0100
committerMichael Brown2013-11-01 17:17:28 +0100
commit5674a3c087bf1bde65b61b6b0ca26035dd47baa3 (patch)
treee30dd88a260b22c9bf3919432e645544d1867294 /src/core/job.c
parent[interface] Default to calling intf_restart() in response to intf_close() (diff)
downloadipxe-5674a3c087bf1bde65b61b6b0ca26035dd47baa3.tar.gz
ipxe-5674a3c087bf1bde65b61b6b0ca26035dd47baa3.tar.xz
ipxe-5674a3c087bf1bde65b61b6b0ca26035dd47baa3.zip
[job] Allow job_progress() to return an ongoing job status code, if known
Some background jobs have a meaningful ongoing status code (e.g. the current link status for a job waiting for a network link to come up). Allow this to be exposed via the job_progress() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/job.c')
-rw-r--r--src/core/job.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/job.c b/src/core/job.c
index 64d184ec..674bec8b 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -34,22 +34,30 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
* @v intf Object interface
* @v progress Progress data to fill in
+ * @ret ongoing_rc Ongoing job status code (if known)
*/
-void job_progress ( struct interface *intf, struct job_progress *progress ) {
+int job_progress ( struct interface *intf, struct job_progress *progress ) {
struct interface *dest;
job_progress_TYPE ( void * ) *op =
intf_get_dest_op ( intf, job_progress, &dest );
void *object = intf_object ( dest );
+ int ongoing_rc;
DBGC ( INTF_COL ( intf ), "INTF " INTF_INTF_FMT " job_progress\n",
INTF_INTF_DBG ( intf, dest ) );
+ /* Initialise progress to zero */
+ memset ( progress, 0, sizeof ( *progress ) );
+
if ( op ) {
- op ( object, progress );
+ ongoing_rc = op ( object, progress );
} else {
- /* Default is to mark progress as zero */
- memset ( progress, 0, sizeof ( *progress ) );
+ /* Default is to leave progress as zero and have no
+ * known return status code.
+ */
+ ongoing_rc = 0;
}
intf_put ( dest );
+ return ongoing_rc;
}