summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2016-11-16 23:22:13 +0100
committerMichael Brown2016-11-16 23:22:13 +0100
commitdaa8ed9274d91a157dc049f00792f62c98b0a11a (patch)
tree7ce6edec2f46a6fcab3c0a1edc9c989e2b6c3885 /src/include
parent[build] Disable TIVOLI_VMM_WORKAROUND in the qemu configuration (diff)
downloadipxe-daa8ed9274d91a157dc049f00792f62c98b0a11a.tar.gz
ipxe-daa8ed9274d91a157dc049f00792f62c98b0a11a.tar.xz
ipxe-daa8ed9274d91a157dc049f00792f62c98b0a11a.zip
[interface] Provide intf_reinit() to reinitialise nullified interfaces
Provide an abstraction intf_reinit() to restore the descriptor of a previously nullified interface. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/interface.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/ipxe/interface.h b/src/include/ipxe/interface.h
index a8d82377..ebb1b691 100644
--- a/src/include/ipxe/interface.h
+++ b/src/include/ipxe/interface.h
@@ -123,6 +123,11 @@ struct interface {
struct refcnt *refcnt;
/** Interface descriptor */
struct interface_descriptor *desc;
+ /** Original interface descriptor
+ *
+ * Used by intf_reinit().
+ */
+ struct interface_descriptor *original;
};
extern void intf_plug ( struct interface *intf, struct interface *dest );
@@ -166,6 +171,7 @@ static inline void intf_init ( struct interface *intf,
intf->dest = &null_intf;
intf->refcnt = refcnt;
intf->desc = desc;
+ intf->original = desc;
}
/**
@@ -177,6 +183,7 @@ static inline void intf_init ( struct interface *intf,
.dest = &null_intf, \
.refcnt = NULL, \
.desc = &(descriptor), \
+ .original = &(descriptor), \
}
/**
@@ -236,4 +243,15 @@ static inline void intf_init ( struct interface *intf,
*/
#define INTF_INTF_DBG( intf, dest ) INTF_DBG ( intf ), INTF_DBG ( dest )
+/**
+ * Reinitialise an object interface
+ *
+ * @v intf Object interface
+ */
+static inline void intf_reinit ( struct interface *intf ) {
+
+ /* Restore original interface descriptor */
+ intf->desc = intf->original;
+}
+
#endif /* _IPXE_INTERFACE_H */