diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/image.h | 19 | ||||
| -rw-r--r-- | src/include/ipxe/parseopt.h | 2 | ||||
| -rw-r--r-- | src/include/usr/imgmgmt.h | 38 |
3 files changed, 13 insertions, 46 deletions
diff --git a/src/include/ipxe/image.h b/src/include/ipxe/image.h index 500b216ed..ac97137bd 100644 --- a/src/include/ipxe/image.h +++ b/src/include/ipxe/image.h @@ -29,7 +29,7 @@ struct image { /** URI of image */ struct uri *uri; /** Name */ - char name[16]; + char *name; /** Flags */ unsigned int flags; @@ -122,6 +122,10 @@ extern struct image *current_image; #define for_each_image( image ) \ list_for_each_entry ( (image), &images, list ) +/** Iterate over all registered images, safe against deletion */ +#define for_each_image_safe( image, tmp ) \ + list_for_each_entry_safe ( (image), (tmp), &images, list ) + /** * Test for existence of images * @@ -140,8 +144,8 @@ static inline struct image * first_image ( void ) { return list_first_entry ( &images, struct image, list ); } -extern struct image * alloc_image ( void ); -extern void image_set_uri ( struct image *image, struct uri *uri ); +extern struct image * alloc_image ( struct uri *uri ); +extern int image_set_name ( struct image *image, const char *name ); extern int image_set_cmdline ( struct image *image, const char *cmdline ); extern int register_image ( struct image *image ); extern void unregister_image ( struct image *image ); @@ -174,15 +178,12 @@ static inline void image_put ( struct image *image ) { } /** - * Set image name + * Clear image command line * * @v image Image - * @v name New image name - * @ret rc Return status code */ -static inline int image_set_name ( struct image *image, const char *name ) { - strncpy ( image->name, name, ( sizeof ( image->name ) - 1 ) ); - return 0; +static inline void image_clear_cmdline ( struct image *image ) { + image_set_cmdline ( image, NULL ); } /** diff --git a/src/include/ipxe/parseopt.h b/src/include/ipxe/parseopt.h index 8c456a647..e54dac66e 100644 --- a/src/include/ipxe/parseopt.h +++ b/src/include/ipxe/parseopt.h @@ -13,7 +13,6 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <stddef.h> struct net_device; -struct image; /** A command-line option descriptor */ struct option_descriptor { @@ -117,7 +116,6 @@ struct command_descriptor { extern int parse_string ( const char *text, const char **value ); extern int parse_integer ( const char *text, unsigned int *value ); extern int parse_netdev ( const char *text, struct net_device **netdev ); -extern int parse_image ( const char *text, struct image **image ); extern int parse_flag ( const char *text __unused, int *flag ); extern void print_usage ( struct command_descriptor *cmd, char **argv ); extern int reparse_options ( int argc, char **argv, diff --git a/src/include/usr/imgmgmt.h b/src/include/usr/imgmgmt.h index 71d587ba4..8db5c9780 100644 --- a/src/include/usr/imgmgmt.h +++ b/src/include/usr/imgmgmt.h @@ -11,41 +11,9 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/image.h> -extern int imgdownload ( struct uri *uri, const char *name, const char *cmdline, - int ( * action ) ( struct image *image ) ); -extern int imgdownload_string ( const char *uri_string, const char *name, - const char *cmdline, - int ( * action ) ( struct image *image ) ); +extern int imgdownload ( struct uri *uri, struct image **image ); +extern int imgdownload_string ( const char *uri_string, struct image **image ); +extern int imgacquire ( const char *name, struct image **image ); extern void imgstat ( struct image *image ); -extern void imgfree ( struct image *image ); - -/** - * Select an image for execution - * - * @v image Image - * @ret rc Return status code - */ -static inline int imgselect ( struct image *image ) { - return image_select ( image ); -} - -/** - * Find the previously-selected image - * - * @ret image Image, or NULL - */ -static inline struct image * imgautoselect ( void ) { - return image_find_selected(); -} - -/** - * Execute an image - * - * @v image Image - * @ret rc Return status code - */ -static inline int imgexec ( struct image *image ) { - return image_exec ( image ); -} #endif /* _USR_IMGMGMT_H */ |
