summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe
diff options
context:
space:
mode:
authorMichael Brown2007-05-01 02:11:34 +0200
committerMichael Brown2007-05-01 02:11:34 +0200
commit123a98db26041d7c6a3ff3c8d7b6140a068be482 (patch)
tree1bc3141504df82d5a885c32d227fa711a7e19ec1 /src/include/gpxe
parentInitial sketch for a downloader object (diff)
downloadipxe-123a98db26041d7c6a3ff3c8d7b6140a068be482.tar.gz
ipxe-123a98db26041d7c6a3ff3c8d7b6140a068be482.tar.xz
ipxe-123a98db26041d7c6a3ff3c8d7b6140a068be482.zip
Added (non-functional) reference count to struct image
Diffstat (limited to 'src/include/gpxe')
-rw-r--r--src/include/gpxe/image.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/gpxe/image.h b/src/include/gpxe/image.h
index 6875a2040..08a1dd905 100644
--- a/src/include/gpxe/image.h
+++ b/src/include/gpxe/image.h
@@ -11,6 +11,7 @@
#include <gpxe/tables.h>
#include <gpxe/list.h>
#include <gpxe/uaccess.h>
+#include <gpxe/refcnt.h>
struct image_type;
@@ -19,6 +20,9 @@ struct image_type;
/** An executable or loadable image */
struct image {
+ /** Reference count */
+ struct refcnt refcnt;
+
/** Name */
char name[16];
/** List of registered images */
@@ -117,4 +121,24 @@ extern int image_load ( struct image *image );
extern int image_autoload ( struct image *image );
extern int image_exec ( struct image *image );
+/**
+ * Increment reference count on an image
+ *
+ * @v image Image
+ * @ret image Image
+ */
+static inline struct image * image_get ( struct image *image ) {
+ ref_get ( &image->refcnt );
+ return image;
+}
+
+/**
+ * Decrement reference count on an image
+ *
+ * @v image Image
+ */
+static inline void image_put ( struct image *image ) {
+ ref_put ( &image->refcnt );
+}
+
#endif /* _GPXE_IMAGE_H */