|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* Copyright © 2012-2017 Inria. All rights reserved.
|
|
Packit Service |
c5cf8c |
* See COPYING in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include <private/autogen/config.h>
|
|
Packit Service |
c5cf8c |
#include <hwloc.h>
|
|
Packit Service |
c5cf8c |
#include <private/private.h>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include <stdlib.h>
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static struct hwloc_backend *
|
|
Packit Service |
c5cf8c |
hwloc_fake_component_instantiate(struct hwloc_disc_component *component __hwloc_attribute_unused,
|
|
Packit Service |
c5cf8c |
const void *_data1 __hwloc_attribute_unused,
|
|
Packit Service |
c5cf8c |
const void *_data2 __hwloc_attribute_unused,
|
|
Packit Service |
c5cf8c |
const void *_data3 __hwloc_attribute_unused)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
if (getenv("HWLOC_DEBUG_FAKE_COMPONENT"))
|
|
Packit Service |
c5cf8c |
printf("fake component instantiated\n");
|
|
Packit Service |
c5cf8c |
return NULL;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static struct hwloc_disc_component hwloc_fake_disc_component = {
|
|
Packit Service |
c5cf8c |
HWLOC_DISC_COMPONENT_TYPE_MISC, /* so that it's always enabled when using the OS discovery */
|
|
Packit Service |
c5cf8c |
"fake",
|
|
Packit Service |
c5cf8c |
0, /* nothing to exclude */
|
|
Packit Service |
c5cf8c |
hwloc_fake_component_instantiate,
|
|
Packit Service |
c5cf8c |
100, /* make sure it's loaded before anything conflicting excludes it */
|
|
Packit Service |
c5cf8c |
1,
|
|
Packit Service |
c5cf8c |
NULL
|
|
Packit Service |
c5cf8c |
};
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static int
|
|
Packit Service |
c5cf8c |
hwloc_fake_component_init(unsigned long flags)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
if (flags)
|
|
Packit Service |
c5cf8c |
return -1;
|
|
Packit Service |
c5cf8c |
if (hwloc_plugin_check_namespace("fake", "hwloc_backend_alloc") < 0)
|
|
Packit Service |
c5cf8c |
return -1;
|
|
Packit Service |
c5cf8c |
if (getenv("HWLOC_DEBUG_FAKE_COMPONENT"))
|
|
Packit Service |
c5cf8c |
printf("fake component initialized\n");
|
|
Packit Service |
c5cf8c |
return 0;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static void
|
|
Packit Service |
c5cf8c |
hwloc_fake_component_finalize(unsigned long flags)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
if (flags)
|
|
Packit Service |
c5cf8c |
return;
|
|
Packit Service |
c5cf8c |
if (getenv("HWLOC_DEBUG_FAKE_COMPONENT"))
|
|
Packit Service |
c5cf8c |
printf("fake component finalized\n");
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
HWLOC_DECLSPEC extern const struct hwloc_component hwloc_fake_component; /* never linked statically in the core */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
const struct hwloc_component hwloc_fake_component = {
|
|
Packit Service |
c5cf8c |
HWLOC_COMPONENT_ABI,
|
|
Packit Service |
c5cf8c |
hwloc_fake_component_init, hwloc_fake_component_finalize,
|
|
Packit Service |
c5cf8c |
HWLOC_COMPONENT_TYPE_DISC,
|
|
Packit Service |
c5cf8c |
0,
|
|
Packit Service |
c5cf8c |
&hwloc_fake_disc_component
|
|
Packit Service |
c5cf8c |
};
|