diff options
| author | Michael Brown | 2007-08-02 21:18:32 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-08-02 21:18:32 +0200 |
| commit | d4947c05b27449b4320179d57028a0542fd1394f (patch) | |
| tree | dc9732c85f3904d04c2d7addf511c01c99dfb7fd /src/include/gpxe | |
| parent | Allowed zero-cost enforced ordering of features in startup banner (diff) | |
| download | ipxe-d4947c05b27449b4320179d57028a0542fd1394f.tar.gz ipxe-d4947c05b27449b4320179d57028a0542fd1394f.tar.xz ipxe-d4947c05b27449b4320179d57028a0542fd1394f.zip | |
Allow images to hold references to the originating URI.
Some shuffling around of the image management code; this needs tidying up.
Diffstat (limited to 'src/include/gpxe')
| -rw-r--r-- | src/include/gpxe/image.h | 29 | ||||
| -rw-r--r-- | src/include/gpxe/uri.h | 4 |
2 files changed, 25 insertions, 8 deletions
diff --git a/src/include/gpxe/image.h b/src/include/gpxe/image.h index 7f09d9c6e..76dc3b8f9 100644 --- a/src/include/gpxe/image.h +++ b/src/include/gpxe/image.h @@ -13,25 +13,26 @@ #include <gpxe/uaccess.h> #include <gpxe/refcnt.h> +struct uri; struct image_type; -/** Maximum length of a command line */ -#define CMDLINE_MAX 128 - /** An executable or loadable image */ struct image { /** Reference count */ struct refcnt refcnt; - /** Name */ - char name[16]; /** List of registered images */ struct list_head list; + + /** URI of image */ + struct uri *uri; + /** Name */ + char name[16]; /** Flags */ unsigned int flags; /** Command line to pass to image */ - char cmdline[CMDLINE_MAX]; + char *cmdline; /** Raw file image */ userptr_t data; /** Length of raw file image */ @@ -114,6 +115,8 @@ extern struct list_head images; list_for_each_entry ( (image), &images, list ) extern struct image * alloc_image ( void ); +extern int image_set_uri ( struct image *image, struct uri *uri ); +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 ); extern void promote_image ( struct image *image ); @@ -121,6 +124,8 @@ struct image * find_image ( const char *name ); extern int image_load ( struct image *image ); extern int image_autoload ( struct image *image ); extern int image_exec ( struct image *image ); +extern int register_and_autoload_image ( struct image *image ); +extern int register_and_autoexec_image ( struct image *image ); /** * Increment reference count on an image @@ -142,4 +147,16 @@ static inline void image_put ( struct image *image ) { ref_put ( &image->refcnt ); } +/** + * Set image name + * + * @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; +} + #endif /* _GPXE_IMAGE_H */ diff --git a/src/include/gpxe/uri.h b/src/include/gpxe/uri.h index b13893164..2cf358324 100644 --- a/src/include/gpxe/uri.h +++ b/src/include/gpxe/uri.h @@ -94,7 +94,7 @@ static inline int uri_has_absolute_path ( struct uri *uri ) { * @v uri URI * @ret has_relative_path URI has a relative path * - * An relative path begins with something other than a '/'. Note that + * A relative path begins with something other than a '/'. Note that * this is a separate concept from a relative URI. Note also that a * URI may not have a path at all. */ @@ -117,7 +117,7 @@ uri_get ( struct uri *uri ) { /** * Decrement URI reference count * - * @v uri URI + * @v uri URI, or NULL */ static inline __attribute__ (( always_inline )) void uri_put ( struct uri *uri ) { |
