diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/dhcp.h | 6 | ||||
| -rw-r--r-- | src/include/ipxe/downloader.h | 4 | ||||
| -rw-r--r-- | src/include/ipxe/job.h | 137 | ||||
| -rw-r--r-- | src/include/ipxe/monojob.h | 5 |
4 files changed, 11 insertions, 141 deletions
diff --git a/src/include/ipxe/dhcp.h b/src/include/ipxe/dhcp.h index bbbe73d2c..d07da3782 100644 --- a/src/include/ipxe/dhcp.h +++ b/src/include/ipxe/dhcp.h @@ -18,7 +18,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/netdevice.h> #include <ipxe/uaccess.h> -struct job_interface; +struct interface; struct dhcp_options; struct dhcp_packet; @@ -622,8 +622,8 @@ extern int dhcp_create_request ( struct dhcp_packet *dhcppkt, struct net_device *netdev, unsigned int msgtype, struct in_addr ciaddr, void *data, size_t max_len ); -extern int start_dhcp ( struct job_interface *job, struct net_device *netdev ); -extern int start_pxebs ( struct job_interface *job, struct net_device *netdev, +extern int start_dhcp ( struct interface *job, struct net_device *netdev ); +extern int start_pxebs ( struct interface *job, struct net_device *netdev, unsigned int pxe_type ); /* In environments that can provide cached DHCP packets, this function diff --git a/src/include/ipxe/downloader.h b/src/include/ipxe/downloader.h index 023bf94fb..3b6a9d666 100644 --- a/src/include/ipxe/downloader.h +++ b/src/include/ipxe/downloader.h @@ -9,10 +9,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); -struct job_interface; +struct interface; struct image; -extern int create_downloader ( struct job_interface *job, struct image *image, +extern int create_downloader ( struct interface *job, struct image *image, int ( * register_image ) ( struct image *image ), int type, ... ); diff --git a/src/include/ipxe/job.h b/src/include/ipxe/job.h index 870b2e83d..c2232fc17 100644 --- a/src/include/ipxe/job.h +++ b/src/include/ipxe/job.h @@ -9,7 +9,6 @@ FILE_LICENCE ( GPL2_OR_LATER ); -#include <stddef.h> #include <ipxe/interface.h> /** Job progress */ @@ -31,139 +30,9 @@ struct job_progress { unsigned long total; }; -struct job_interface; - -/** Job control interface operations */ -struct job_interface_operations { - /** Job completed - * - * @v job Job control interface - * @v rc Overall job status code - */ - void ( * done ) ( struct job_interface *job, int rc ); - /** Abort job - * - * @v job Job control interface - */ - void ( * kill ) ( struct job_interface *job ); - /** Get job progress - * - * @v job Job control interface - * @v progress Progress data to fill in - */ - void ( * progress ) ( struct job_interface *job, - struct job_progress *progress ); -}; - -/** A job control interface */ -struct job_interface { - /** Generic object communication interface */ - struct interface intf; - /** Operations for received messages */ - struct job_interface_operations *op; -}; - -extern struct job_interface null_job; -extern struct job_interface_operations null_job_ops; - -extern void job_done ( struct job_interface *job, int rc ); -extern void job_kill ( struct job_interface *job ); -extern void job_progress ( struct job_interface *job, +extern void job_progress ( struct interface *intf, struct job_progress *progress ); - -extern void ignore_job_done ( struct job_interface *job, int rc ); -extern void ignore_job_kill ( struct job_interface *job ); -extern void ignore_job_progress ( struct job_interface *job, - struct job_progress *progress ); - -/** - * Initialise a job control interface - * - * @v job Job control interface - * @v op Job control interface operations - * @v refcnt Containing object reference counter, or NULL - */ -static inline void job_init ( struct job_interface *job, - struct job_interface_operations *op, - struct refcnt *refcnt ) { - job->intf.dest = &null_job.intf; - job->intf.refcnt = refcnt; - job->op = op; -} - -/** - * Get job control interface from generic object communication interface - * - * @v intf Generic object communication interface - * @ret job Job control interface - */ -static inline __attribute__ (( always_inline )) struct job_interface * -intf_to_job ( struct interface *intf ) { - return container_of ( intf, struct job_interface, intf ); -} - -/** - * Get reference to destination job control interface - * - * @v job Job control interface - * @ret dest Destination interface - */ -static inline __attribute__ (( always_inline )) struct job_interface * -job_get_dest ( struct job_interface *job ) { - return intf_to_job ( intf_get ( job->intf.dest ) ); -} - -/** - * Drop reference to job control interface - * - * @v job Job control interface - */ -static inline __attribute__ (( always_inline )) void -job_put ( struct job_interface *job ) { - intf_put ( &job->intf ); -} - -/** - * Plug a job control interface into a new destination interface - * - * @v job Job control interface - * @v dest New destination interface - */ -static inline void job_plug ( struct job_interface *job, - struct job_interface *dest ) { - intf_plug ( &job->intf, &dest->intf ); -} - -/** - * Plug two job control interfaces together - * - * @v a Job control interface A - * @v b Job control interface B - */ -static inline void job_plug_plug ( struct job_interface *a, - struct job_interface *b ) { - intf_plug_plug ( &a->intf, &b->intf ); -} - -/** - * Unplug a job control interface - * - * @v job Job control interface - */ -static inline void job_unplug ( struct job_interface *job ) { - intf_plug ( &job->intf, &null_job.intf ); -} - -/** - * Stop using a job control interface - * - * @v job Job control interface - * - * After calling this method, no further messages will be received via - * the interface. - */ -static inline void job_nullify ( struct job_interface *job ) { - job->op = &null_job_ops; -}; +#define job_progress_TYPE( object_type ) \ + typeof ( void ( object_type, struct job_progress *progress ) ) #endif /* _IPXE_JOB_H */ diff --git a/src/include/ipxe/monojob.h b/src/include/ipxe/monojob.h index b2f3dfde9..3d8b31c0e 100644 --- a/src/include/ipxe/monojob.h +++ b/src/include/ipxe/monojob.h @@ -9,9 +9,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); -struct job_interface; +struct interface; + +extern struct interface monojob; -extern struct job_interface monojob; extern int monojob_wait ( const char *string ); #endif /* _IPXE_MONOJOB_H */ |
