diff options
| author | Michael Brown | 2007-05-15 18:53:46 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-05-15 18:53:46 +0200 |
| commit | b1755462ab344ff758c3a1e6ae0d10a729d96d1b (patch) | |
| tree | 858bb7ba3d439be957f6b9530a0040b26c49f3f2 /src/include/gpxe/xfer.h | |
| parent | Data-transfer interface should now be functionally complete. (diff) | |
| download | ipxe-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/xfer.h')
| -rw-r--r-- | src/include/gpxe/xfer.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/include/gpxe/xfer.h b/src/include/gpxe/xfer.h index 4fb3a5196..71b69dc51 100644 --- a/src/include/gpxe/xfer.h +++ b/src/include/gpxe/xfer.h @@ -173,14 +173,24 @@ intf_to_xfer ( struct interface *intf ) { } /** - * Get destination data transfer interface + * Get reference to destination data transfer interface * * @v xfer Data transfer interface * @ret dest Destination interface */ static inline __attribute__ (( always_inline )) struct xfer_interface * -xfer_dest ( struct xfer_interface *xfer ) { - return intf_to_xfer ( xfer->intf.dest ); +xfer_get_dest ( struct xfer_interface *xfer ) { + return intf_to_xfer ( intf_get ( xfer->intf.dest ) ); +} + +/** + * Drop reference to data transfer interface + * + * @v xfer Data transfer interface + */ +static inline __attribute__ (( always_inline )) void +xfer_put ( struct xfer_interface *xfer ) { + intf_put ( &xfer->intf ); } /** @@ -189,8 +199,8 @@ xfer_dest ( struct xfer_interface *xfer ) { * @v xfer Data transfer interface * @v dest New destination interface */ -static inline void xfer_plug ( struct xfer_interface *xfer, - struct xfer_interface *dest ) { +static inline __attribute__ (( always_inline )) void +xfer_plug ( struct xfer_interface *xfer, struct xfer_interface *dest ) { plug ( &xfer->intf, &dest->intf ); } @@ -200,8 +210,8 @@ static inline void xfer_plug ( struct xfer_interface *xfer, * @v a Data transfer interface A * @v b Data transfer interface B */ -static inline void xfer_plug_plug ( struct xfer_interface *a, - struct xfer_interface *b ) { +static inline __attribute__ (( always_inline )) void +xfer_plug_plug ( struct xfer_interface *a, struct xfer_interface *b ) { plug_plug ( &a->intf, &b->intf ); } @@ -210,7 +220,8 @@ static inline void xfer_plug_plug ( struct xfer_interface *a, * * @v xfer Data transfer interface */ -static inline void xfer_unplug ( struct xfer_interface *xfer ) { +static inline __attribute__ (( always_inline )) void +xfer_unplug ( struct xfer_interface *xfer ) { plug ( &xfer->intf, &null_xfer.intf ); } |
