diff options
Diffstat (limited to 'src/include/ipxe')
| -rw-r--r-- | src/include/ipxe/image.h | 19 | ||||
| -rw-r--r-- | src/include/ipxe/parseopt.h | 2 |
2 files changed, 10 insertions, 11 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, |
