|
@@ -11,6 +11,7 @@
|
11
|
11
|
#include <gpxe/tables.h>
|
12
|
12
|
#include <gpxe/list.h>
|
13
|
13
|
#include <gpxe/uaccess.h>
|
|
14
|
+#include <gpxe/refcnt.h>
|
14
|
15
|
|
15
|
16
|
struct image_type;
|
16
|
17
|
|
|
@@ -19,6 +20,9 @@ struct image_type;
|
19
|
20
|
|
20
|
21
|
/** An executable or loadable image */
|
21
|
22
|
struct image {
|
|
23
|
+ /** Reference count */
|
|
24
|
+ struct refcnt refcnt;
|
|
25
|
+
|
22
|
26
|
/** Name */
|
23
|
27
|
char name[16];
|
24
|
28
|
/** List of registered images */
|
|
@@ -117,4 +121,24 @@ extern int image_load ( struct image *image );
|
117
|
121
|
extern int image_autoload ( struct image *image );
|
118
|
122
|
extern int image_exec ( struct image *image );
|
119
|
123
|
|
|
124
|
+/**
|
|
125
|
+ * Increment reference count on an image
|
|
126
|
+ *
|
|
127
|
+ * @v image Image
|
|
128
|
+ * @ret image Image
|
|
129
|
+ */
|
|
130
|
+static inline struct image * image_get ( struct image *image ) {
|
|
131
|
+ ref_get ( &image->refcnt );
|
|
132
|
+ return image;
|
|
133
|
+}
|
|
134
|
+
|
|
135
|
+/**
|
|
136
|
+ * Decrement reference count on an image
|
|
137
|
+ *
|
|
138
|
+ * @v image Image
|
|
139
|
+ */
|
|
140
|
+static inline void image_put ( struct image *image ) {
|
|
141
|
+ ref_put ( &image->refcnt );
|
|
142
|
+}
|
|
143
|
+
|
120
|
144
|
#endif /* _GPXE_IMAGE_H */
|