Added netdev_nullify to natsemi_remove()
[gpxe.git] / src / core / job.c
blob6c2faf30f4ff943e794df38b0b0e0837b87e4155
1 /*
2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <string.h>
20 #include <errno.h>
21 #include <gpxe/job.h>
23 /** @file
25 * Job control interfaces
29 void job_done ( struct job_interface *job, int rc ) {
30 struct job_interface *dest = job_get_dest ( job );
32 job_unplug ( job );
33 dest->op->done ( dest, rc );
34 job_put ( dest );
37 void job_kill ( struct job_interface *job ) {
38 struct job_interface *dest = job_get_dest ( job );
40 job_unplug ( job );
41 dest->op->kill ( dest );
42 job_put ( dest );
45 /****************************************************************************
47 * Helper methods
49 * These functions are designed to be used as methods in the
50 * job_interface_operations table.
54 void ignore_job_done ( struct job_interface *job __unused, int rc __unused ) {
55 /* Nothing to do */
58 void ignore_job_kill ( struct job_interface *job __unused ) {
59 /* Nothing to do */
62 void ignore_job_progress ( struct job_interface *job __unused,
63 struct job_progress *progress ) {
64 memset ( progress, 0, sizeof ( *progress ) );
67 /** Null job control interface operations */
68 struct job_interface_operations null_job_ops = {
69 .done = ignore_job_done,
70 .kill = ignore_job_kill,
71 .progress = ignore_job_progress,
74 /**
75 * Null job control interface
77 * This is the interface to which job control interfaces are connected
78 * when unplugged. It will never generate messages, and will silently
79 * absorb all received messages.
81 struct job_interface null_job = {
82 .intf = {
83 .dest = &null_job.intf,
84 .refcnt = NULL,
86 .op = &null_job_ops,