job.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 FILE_LICENCE ( GPL2_OR_LATER );
00020
00021 #include <string.h>
00022 #include <errno.h>
00023 #include <gpxe/job.h>
00024
00025
00026
00027
00028
00029
00030
00031 void job_done ( struct job_interface *job, int rc ) {
00032 struct job_interface *dest = job_get_dest ( job );
00033
00034 job_unplug ( job );
00035 dest->op->done ( dest, rc );
00036 job_put ( dest );
00037 }
00038
00039 void job_kill ( struct job_interface *job ) {
00040 struct job_interface *dest = job_get_dest ( job );
00041
00042 job_unplug ( job );
00043 dest->op->kill ( dest );
00044 job_put ( dest );
00045 }
00046
00047 void job_progress ( struct job_interface *job,
00048 struct job_progress *progress ) {
00049 struct job_interface *dest = job_get_dest ( job );
00050
00051 dest->op->progress ( dest, progress );
00052 job_put ( dest );
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 void ignore_job_done ( struct job_interface *job __unused, int rc __unused ) {
00065
00066 }
00067
00068 void ignore_job_kill ( struct job_interface *job __unused ) {
00069
00070 }
00071
00072 void ignore_job_progress ( struct job_interface *job __unused,
00073 struct job_progress *progress ) {
00074 memset ( progress, 0, sizeof ( *progress ) );
00075 }
00076
00077
00078 struct job_interface_operations null_job_ops = {
00079 .done = ignore_job_done,
00080 .kill = ignore_job_kill,
00081 .progress = ignore_job_progress,
00082 };
00083
00084
00085
00086
00087
00088
00089
00090
00091 struct job_interface null_job = {
00092 .intf = {
00093 .dest = &null_job.intf,
00094 .refcnt = NULL,
00095 },
00096 .op = &null_job_ops,
00097 };