summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/interface.h
diff options
context:
space:
mode:
authorMichael Brown2007-05-15 18:53:46 +0200
committerMichael Brown2007-05-15 18:53:46 +0200
commitb1755462ab344ff758c3a1e6ae0d10a729d96d1b (patch)
tree858bb7ba3d439be957f6b9530a0040b26c49f3f2 /src/include/gpxe/interface.h
parentData-transfer interface should now be functionally complete. (diff)
downloadipxe-b1755462ab344ff758c3a1e6ae0d10a729d96d1b.tar.gz
ipxe-b1755462ab344ff758c3a1e6ae0d10a729d96d1b.tar.xz
ipxe-b1755462ab344ff758c3a1e6ae0d10a729d96d1b.zip
Do not hold self-references. This then avoids the problem of having to
ensure that we only drop our self-reference exactly once. To maintain the guarantee that an object won't go out of scope unexpectedly while one of its event handlers is being called, the event-calling functions now automatically obtain and drop extra references.
Diffstat (limited to 'src/include/gpxe/interface.h')
-rw-r--r--src/include/gpxe/interface.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/include/gpxe/interface.h b/src/include/gpxe/interface.h
index d27ba6a53..94c711a99 100644
--- a/src/include/gpxe/interface.h
+++ b/src/include/gpxe/interface.h
@@ -34,7 +34,8 @@ struct interface {
* @v intf Interface
* @ret intf Interface
*/
-static inline struct interface * intf_get ( struct interface *intf ) {
+static inline __attribute__ (( always_inline )) struct interface *
+intf_get ( struct interface *intf ) {
ref_get ( intf->refcnt );
return intf;
}
@@ -44,7 +45,8 @@ static inline struct interface * intf_get ( struct interface *intf ) {
*
* @v intf Interface
*/
-static inline void intf_put ( struct interface *intf ) {
+static inline __attribute__ (( always_inline )) void
+intf_put ( struct interface *intf ) {
ref_put ( intf->refcnt );
}