This source file includes following definitions.
- hwloc_fake_component_instantiate
- hwloc_fake_component_init
- hwloc_fake_component_finalize
1
2
3
4
5
6 #include <private/autogen/config.h>
7 #include <hwloc.h>
8 #include <private/private.h>
9
10 #include <stdlib.h>
11
12 static struct hwloc_backend *
13 hwloc_fake_component_instantiate(struct hwloc_disc_component *component __hwloc_attribute_unused,
14 const void *_data1 __hwloc_attribute_unused,
15 const void *_data2 __hwloc_attribute_unused,
16 const void *_data3 __hwloc_attribute_unused)
17 {
18 if (getenv("HWLOC_DEBUG_FAKE_COMPONENT"))
19 printf("fake component instantiated\n");
20 return NULL;
21 }
22
23 static struct hwloc_disc_component hwloc_fake_disc_component = {
24 HWLOC_DISC_COMPONENT_TYPE_MISC,
25 "fake",
26 0,
27 hwloc_fake_component_instantiate,
28 100,
29 1,
30 NULL
31 };
32
33 static int
34 hwloc_fake_component_init(unsigned long flags)
35 {
36 if (flags)
37 return -1;
38 if (hwloc_plugin_check_namespace("fake", "hwloc_backend_alloc") < 0)
39 return -1;
40 if (getenv("HWLOC_DEBUG_FAKE_COMPONENT"))
41 printf("fake component initialized\n");
42 return 0;
43 }
44
45 static void
46 hwloc_fake_component_finalize(unsigned long flags)
47 {
48 if (flags)
49 return;
50 if (getenv("HWLOC_DEBUG_FAKE_COMPONENT"))
51 printf("fake component finalized\n");
52 }
53
54 HWLOC_DECLSPEC extern const struct hwloc_component hwloc_fake_component;
55
56 const struct hwloc_component hwloc_fake_component = {
57 HWLOC_COMPONENT_ABI,
58 hwloc_fake_component_init, hwloc_fake_component_finalize,
59 HWLOC_COMPONENT_TYPE_DISC,
60 0,
61 &hwloc_fake_disc_component
62 };