Browse Source

Added (non-functional) reference count to struct image

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
123a98db26
1 changed files with 24 additions and 0 deletions
  1. 24
    0
      src/include/gpxe/image.h

+ 24
- 0
src/include/gpxe/image.h View File

11
 #include <gpxe/tables.h>
11
 #include <gpxe/tables.h>
12
 #include <gpxe/list.h>
12
 #include <gpxe/list.h>
13
 #include <gpxe/uaccess.h>
13
 #include <gpxe/uaccess.h>
14
+#include <gpxe/refcnt.h>
14
 
15
 
15
 struct image_type;
16
 struct image_type;
16
 
17
 
19
 
20
 
20
 /** An executable or loadable image */
21
 /** An executable or loadable image */
21
 struct image {
22
 struct image {
23
+	/** Reference count */
24
+	struct refcnt refcnt;
25
+
22
 	/** Name */
26
 	/** Name */
23
 	char name[16];
27
 	char name[16];
24
 	/** List of registered images */
28
 	/** List of registered images */
117
 extern int image_autoload ( struct image *image );
121
 extern int image_autoload ( struct image *image );
118
 extern int image_exec ( struct image *image );
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
 #endif /* _GPXE_IMAGE_H */
144
 #endif /* _GPXE_IMAGE_H */

Loading…
Cancel
Save