summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/image.h
diff options
context:
space:
mode:
authorMichael Brown2007-08-02 21:18:32 +0200
committerMichael Brown2007-08-02 21:18:32 +0200
commitd4947c05b27449b4320179d57028a0542fd1394f (patch)
treedc9732c85f3904d04c2d7addf511c01c99dfb7fd /src/include/gpxe/image.h
parentAllowed zero-cost enforced ordering of features in startup banner (diff)
downloadipxe-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/image.h')
-rw-r--r--src/include/gpxe/image.h29
1 files changed, 23 insertions, 6 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 */