diff options
author | Michael Brown | 2007-04-29 04:08:39 +0200 |
---|---|---|
committer | Michael Brown | 2007-04-29 04:08:39 +0200 |
commit | 36bfb6edbb3f89fc1807df5538bfd2a932149ed6 (patch) | |
tree | 03b85f99f063b1ba22dd5eccf1aa5d691ddc38f9 /src/core/job.c | |
parent | Add seek() (diff) | |
download | ipxe-36bfb6edbb3f89fc1807df5538bfd2a932149ed6.tar.gz ipxe-36bfb6edbb3f89fc1807df5538bfd2a932149ed6.tar.xz ipxe-36bfb6edbb3f89fc1807df5538bfd2a932149ed6.zip |
Skeleton job control interface
Diffstat (limited to 'src/core/job.c')
-rw-r--r-- | src/core/job.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/core/job.c b/src/core/job.c new file mode 100644 index 00000000..fc60f4ec --- /dev/null +++ b/src/core/job.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <string.h> +#include <errno.h> +#include <gpxe/job.h> + +/** @file + * + * Job control interfaces + * + */ + +void done ( struct job_interface *job, int rc ) { + struct job_interface *dest = job_dest ( job ); + + dest->op->done ( dest, rc ); +} + +/**************************************************************************** + * + * Helper methods + * + * These functions are designed to be used as methods in the + * job_interface_operations table. + * + */ + +void ignore_done ( struct job_interface *job __unused, int rc __unused ) { + /* Nothing to do */ +} + +void ignore_kill ( struct job_interface *job __unused ) { + /* Nothing to do */ +} + +void ignore_progress ( struct job_interface *job __unused, + struct job_progress *progress ) { + memset ( progress, 0, sizeof ( *progress ) ); +} + +/** Null job control interface operations */ +struct job_interface_operations null_job_ops = { + .done = ignore_done, + .kill = ignore_kill, + .progress = ignore_progress, +}; + +/** + * Null job control interface + * + * This is the interface to which job control interfaces are connected + * when unplugged. It will never generate messages, and will silently + * absorb all received messages. + */ +struct job_interface null_job = { + .intf = { + .dest = &null_job.intf, + .refcnt = null_refcnt, + }, + .op = &null_job_ops, +}; |