aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-05-06 13:11:31 +0100
committerMichael Brown <mcb30@ipxe.org>2021-05-08 15:34:19 +0100
commit5c9c8d2b9b78cf4e1f256fe6874855c1aee458f2 (patch)
tree7990da7da1556de7ecd8dadbbb474dced6a67415 /src/include
parentde4f31cdcad7c4734c68da828351eeb7afd0360e (diff)
downloadipxe-5c9c8d2b9b78cf4e1f256fe6874855c1aee458f2.zip
ipxe-5c9c8d2b9b78cf4e1f256fe6874855c1aee458f2.tar.gz
ipxe-5c9c8d2b9b78cf4e1f256fe6874855c1aee458f2.tar.bz2
[image] Add "imgextract" command for extracting archive images
Add the concept of extracting an image from an archive (which could be a single-file archive such as a gzip-compressed file), along with an "imgextract" command to expose this functionality to scripts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/errfile.h1
-rw-r--r--src/include/ipxe/image.h10
-rw-r--r--src/include/usr/imgarchive.h16
3 files changed, 27 insertions, 0 deletions
diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h
index e3bf9f5..162e6b7 100644
--- a/src/include/ipxe/errfile.h
+++ b/src/include/ipxe/errfile.h
@@ -301,6 +301,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_png ( ERRFILE_IMAGE | 0x00070000 )
#define ERRFILE_der ( ERRFILE_IMAGE | 0x00080000 )
#define ERRFILE_pem ( ERRFILE_IMAGE | 0x00090000 )
+#define ERRFILE_archive ( ERRFILE_IMAGE | 0x000a0000 )
#define ERRFILE_asn1 ( ERRFILE_OTHER | 0x00000000 )
#define ERRFILE_chap ( ERRFILE_OTHER | 0x00010000 )
diff --git a/src/include/ipxe/image.h b/src/include/ipxe/image.h
index 046edf9..c6e723d 100644
--- a/src/include/ipxe/image.h
+++ b/src/include/ipxe/image.h
@@ -113,6 +113,14 @@ struct image_type {
*/
int ( * asn1 ) ( struct image *image, size_t offset,
struct asn1_cursor **cursor );
+ /**
+ * Extract archive image
+ *
+ * @v image Image
+ * @v extracted Extracted image
+ * @ret rc Return status code
+ */
+ int ( * extract ) ( struct image *image, struct image *extracted );
};
/**
@@ -190,6 +198,8 @@ extern struct image * image_memory ( const char *name, userptr_t data,
extern int image_pixbuf ( struct image *image, struct pixel_buffer **pixbuf );
extern int image_asn1 ( struct image *image, size_t offset,
struct asn1_cursor **cursor );
+extern int image_extract ( struct image *image, const char *name,
+ struct image **extracted );
/**
* Increment reference count on an image
diff --git a/src/include/usr/imgarchive.h b/src/include/usr/imgarchive.h
new file mode 100644
index 0000000..bf0c18f
--- /dev/null
+++ b/src/include/usr/imgarchive.h
@@ -0,0 +1,16 @@
+#ifndef _USR_IMGARCHIVE_H
+#define _USR_IMGARCHIVE_H
+
+/** @file
+ *
+ * Archive image management
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#include <ipxe/image.h>
+
+extern int imgextract ( struct image *image, const char *name );
+
+#endif /* _USR_IMGARCHIVE_H */