blob: e6e132de11eb7c39af35f1c8bbfbbfa2c8d585bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#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 */
|