diff options
author | Michael Brown | 2007-01-11 17:04:36 +0100 |
---|---|---|
committer | Michael Brown | 2007-01-11 17:04:36 +0100 |
commit | 4fc9333159f3ad62bdc7e27103eac3139ba41e68 (patch) | |
tree | 0d5045cf6184c20be75958b51e2bac97445bb074 | |
parent | Had this file lying around for ages; may as well check it in. (diff) | |
download | ipxe-4fc9333159f3ad62bdc7e27103eac3139ba41e68.tar.gz ipxe-4fc9333159f3ad62bdc7e27103eac3139ba41e68.tar.xz ipxe-4fc9333159f3ad62bdc7e27103eac3139ba41e68.zip |
Move include/image.h to include/gpxe/image.h
-rw-r--r-- | src/arch/i386/image/nbi.c | 7 | ||||
-rw-r--r-- | src/core/config.c | 1 | ||||
-rw-r--r-- | src/core/image.c | 5 | ||||
-rw-r--r-- | src/core/main.c | 1 | ||||
-rw-r--r-- | src/include/gpxe/image.h | 60 | ||||
-rw-r--r-- | src/include/image.h | 26 |
6 files changed, 65 insertions, 35 deletions
diff --git a/src/arch/i386/image/nbi.c b/src/arch/i386/image/nbi.c index edaaedc9..6b00f5fb 100644 --- a/src/arch/i386/image/nbi.c +++ b/src/arch/i386/image/nbi.c @@ -1,13 +1,12 @@ -#include "image.h" +#warning "This file is obsolete" +#if 0 + #include "memsizes.h" #include "realmode.h" #include "gateA20.h" #include "etherboot.h" #include "errno.h" -#warning "This file is obsolete" -#if 0 - /** @file * * NBI image format. diff --git a/src/core/config.c b/src/core/config.c index 61ffca81..e2b1a362 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -8,7 +8,6 @@ #include "etherboot.h" #include "dev.h" #include "console.h" -#include "image.h" #include "config/general.h" diff --git a/src/core/image.c b/src/core/image.c index 965af5aa..80d3d5c5 100644 --- a/src/core/image.c +++ b/src/core/image.c @@ -1,8 +1,9 @@ #include "dev.h" #include <gpxe/buffer.h> -#include "image.h" #include <console.h> +#if 0 + static struct image images[0] __image_start; static struct image images_end[0] __image_end; @@ -18,8 +19,6 @@ void print_images ( void ) { } } -#if 0 - /* * Identify the image format * diff --git a/src/core/main.c b/src/core/main.c index a34eb889..3c0048d8 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -25,7 +25,6 @@ Literature dealing with the network protocols: #include "cmdline.h" #include "console.h" #include <gpxe/init.h> -#include "image.h" #include <stdarg.h> #include <gpxe/device.h> diff --git a/src/include/gpxe/image.h b/src/include/gpxe/image.h new file mode 100644 index 00000000..cf6b7a88 --- /dev/null +++ b/src/include/gpxe/image.h @@ -0,0 +1,60 @@ +#ifndef _GPXE_IMAGE_H +#define _GPXE_IMAGE_H + +/** + * @file + * + * Executable/loadable image formats + * + */ + +#include <gpxe/tables.h> + +/** An executable or loadable image */ +struct image { + /** Raw file image */ + userptr_t image; + /** Length of raw file image */ + size_t len; + + /** Execute method + * + * Filled in by the image loader. If NULL, then the image + * cannot be executed. + */ + int ( * execute ) ( struct image *image ); + /** Entry point */ + physaddr_t entry; +}; + +/** An executable or loadable image type */ +struct image_type { + /** Name of this image type */ + char *name; + /** Load image into memory + * + * @v image Executable/loadable image + * @ret rc Return status code + * + * Load the image into memory. The file image may be + * discarded after this call; the method must preserve any + * information it may require later (e.g. the execution + * address) within the @c image structure. + */ + int ( * load ) ( struct image *image ); +}; + +/** An executable or loadable image type */ +#define __image_type __table ( struct image_type, image_types, 01 ) + +/** + * An unverifiable executable or loadable image type + * + * This should be used to mark image types for which there are no + * signature or other checks that can be used to verify the validity + * of the image (such as PXE images). These will then be tried last + * in the list of image types. + */ +#define __default_image_type __table ( struct image_type, image_types, 02 ) + +#endif /* _GPXE_IMAGE_H */ diff --git a/src/include/image.h b/src/include/image.h deleted file mode 100644 index b86f324c..00000000 --- a/src/include/image.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef IMAGE_H -#define IMAGE_H - -#include "stdint.h" -#include "io.h" -#include <gpxe/tables.h> -#include "dev.h" - -struct image { - char *name; - int ( * probe ) ( physaddr_t data, off_t len, void **context ); - int ( * load ) ( physaddr_t data, off_t len, void *context ); - int ( * boot ) ( void *context ); -}; - -#define __image_start __table_start ( struct image, image ) -#define __image __table ( struct image, image, 01 ) -#define __default_image __table ( struct image, image, 02 ) -#define __image_end __table_end ( struct image, image ) - -/* Functions in image.c */ - -extern void print_images ( void ); -extern int autoload ( struct dev *dev, struct image **image, void **context ); - -#endif /* IMAGE_H */ |