david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/include/gpxe/hotplug.h
Michael Brown 0063725d28 Minimal hotplug support: provide a facility for notifying persistent
reference holders that their reference is about to become invalid.
2007-01-04 03:08:16 +00:00

59 lines
1.3 KiB
C

#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 */