mirror of
https://github.com/ipxe/ipxe
synced 2026-02-28 03:11:18 +03:00
Clarify behaviour of plug() by using intf_put() and intf_get().
This commit is contained in:
@@ -38,9 +38,8 @@
|
|||||||
* interface into a null interface.
|
* interface into a null interface.
|
||||||
*/
|
*/
|
||||||
void plug ( struct interface *intf, struct interface *dest ) {
|
void plug ( struct interface *intf, struct interface *dest ) {
|
||||||
ref_put ( intf->dest->refcnt );
|
intf_put ( intf->dest );
|
||||||
intf->dest = dest;
|
intf->dest = intf_get ( dest );
|
||||||
ref_get ( intf->dest->refcnt );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,6 +28,26 @@ struct interface {
|
|||||||
struct refcnt *refcnt;
|
struct refcnt *refcnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment reference count on an interface
|
||||||
|
*
|
||||||
|
* @v intf Interface
|
||||||
|
* @ret intf Interface
|
||||||
|
*/
|
||||||
|
static inline struct interface * intf_get ( struct interface *intf ) {
|
||||||
|
ref_get ( intf->refcnt );
|
||||||
|
return intf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrement reference count on an interface
|
||||||
|
*
|
||||||
|
* @v intf Interface
|
||||||
|
*/
|
||||||
|
static inline void intf_put ( struct interface *intf ) {
|
||||||
|
ref_put ( intf->refcnt );
|
||||||
|
}
|
||||||
|
|
||||||
extern void plug ( struct interface *intf, struct interface *dest );
|
extern void plug ( struct interface *intf, struct interface *dest );
|
||||||
extern void plug_plug ( struct interface *a, struct interface *b );
|
extern void plug_plug ( struct interface *a, struct interface *b );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user