summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2007-01-04 04:08:16 +0100
committerMichael Brown2007-01-04 04:08:16 +0100
commit0063725d282616789af263d5dfccf1a107415a72 (patch)
treee59ac21c7e80cd09a3dcc1ecc9b945a3991df707 /src/include
parentSend RST packets when we get a non-matching connection, or receive an (diff)
downloadipxe-0063725d282616789af263d5dfccf1a107415a72.tar.gz
ipxe-0063725d282616789af263d5dfccf1a107415a72.tar.xz
ipxe-0063725d282616789af263d5dfccf1a107415a72.zip
Minimal hotplug support: provide a facility for notifying persistent
reference holders that their reference is about to become invalid.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/hotplug.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/include/gpxe/hotplug.h b/src/include/gpxe/hotplug.h
new file mode 100644
index 00000000..e6e132de
--- /dev/null
+++ b/src/include/gpxe/hotplug.h
@@ -0,0 +1,58 @@
+#ifndef _GPXE_HOTPLUG_H
+#define _GPXE_HOTPLUG_H
+
+/** @file
+ *
+ * Hotplug support
+ *
+ */
+
+#include <gpxe/list.h>
+
+/**
+ * A persistent reference to another data structure
+ *
+ * This data structure should be embedded within any data structure
+ * (the referrer) which holds a persistent reference to a separate,
+ * volatile data structure (the referee).
+ */
+struct reference {
+ /** List of persistent references */
+ struct list_head list;
+ /** Forget persistent reference
+ *
+ * @v ref Persistent reference
+ *
+ * This method is called immediately before the referred-to
+ * data structure is destroyed. The reference holder must
+ * forget all references to the referee before returning from
+ * this method.
+ *
+ * This method must also call ref_del() to remove the
+ * reference.
+ */
+ void ( * forget ) ( struct reference *ref );
+};
+
+/**
+ * Add persistent reference
+ *
+ * @v ref Persistent reference
+ * @v list List of persistent references
+ */
+static inline void ref_add ( struct reference *ref, struct list_head *list ) {
+ list_add ( &ref->list, list );
+}
+
+/**
+ * Remove persistent reference
+ *
+ * @v ref Persistent reference
+ */
+static inline void ref_del ( struct reference *ref ) {
+ list_del ( &ref->list );
+}
+
+extern void forget_references ( struct list_head *list );
+
+#endif /* _GPXE_HOTPLUG_H */