Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

job.c 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  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.
  8. *
  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.
  13. *
  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.
  17. */
  18. #include <string.h>
  19. #include <errno.h>
  20. #include <gpxe/job.h>
  21. /** @file
  22. *
  23. * Job control interfaces
  24. *
  25. */
  26. void job_done ( struct job_interface *job, int rc ) {
  27. struct job_interface *dest = job_get_dest ( job );
  28. job_unplug ( job );
  29. dest->op->done ( dest, rc );
  30. job_put ( dest );
  31. }
  32. void job_kill ( struct job_interface *job ) {
  33. struct job_interface *dest = job_get_dest ( job );
  34. job_unplug ( job );
  35. dest->op->kill ( dest );
  36. job_put ( dest );
  37. }
  38. /****************************************************************************
  39. *
  40. * Helper methods
  41. *
  42. * These functions are designed to be used as methods in the
  43. * job_interface_operations table.
  44. *
  45. */
  46. void ignore_job_done ( struct job_interface *job __unused, int rc __unused ) {
  47. /* Nothing to do */
  48. }
  49. void ignore_job_kill ( struct job_interface *job __unused ) {
  50. /* Nothing to do */
  51. }
  52. void ignore_job_progress ( struct job_interface *job __unused,
  53. struct job_progress *progress ) {
  54. memset ( progress, 0, sizeof ( *progress ) );
  55. }
  56. /** Null job control interface operations */
  57. struct job_interface_operations null_job_ops = {
  58. .done = ignore_job_done,
  59. .kill = ignore_job_kill,
  60. .progress = ignore_job_progress,
  61. };
  62. /**
  63. * Null job control interface
  64. *
  65. * This is the interface to which job control interfaces are connected
  66. * when unplugged. It will never generate messages, and will silently
  67. * absorb all received messages.
  68. */
  69. struct job_interface null_job = {
  70. .intf = {
  71. .dest = &null_job.intf,
  72. .refcnt = NULL,
  73. },
  74. .op = &null_job_ops,
  75. };