projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce bt_plugin and bt_component_class
[babeltrace.git]
/
plugins
/
component.c
diff --git
a/plugins/component.c
b/plugins/component.c
index 7dbdaaae0c04e3467fa52c47e0412bb79c84e21e..86e86ade9ad8f69934f2a540850e90d44313d96b 100644
(file)
--- a/
plugins/component.c
+++ b/
plugins/component.c
@@
-31,7
+31,7
@@
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler.h>
-static void bt_component_destroy(struct bt_
ctf_
ref *ref);
+static void bt_component_destroy(struct bt_ref *ref);
const char *bt_component_get_name(struct bt_component *component)
{
const char *bt_component_get_name(struct bt_component *component)
{
@@
-69,7
+69,7
@@
enum bt_component_type bt_component_get_type(struct bt_component *component)
goto end;
}
goto end;
}
- type = component->type;
+ type = component->
class->
type;
end:
return type;
}
end:
return type;
}
@@
-95,7
+95,7
@@
void bt_component_get(struct bt_component *component)
return;
}
return;
}
- bt_
ctf_ref_get(&component->ref_count
);
+ bt_
ref_get(&component->ref
);
}
void bt_component_put(struct bt_component *component)
}
void bt_component_put(struct bt_component *component)
@@
-104,23
+104,24
@@
void bt_component_put(struct bt_component *component)
return;
}
return;
}
- bt_
ctf_ref_put(&component->ref_count, bt_component_destroy
);
+ bt_
ref_put(&component->ref
);
}
BT_HIDDEN
enum bt_component_status bt_component_init(struct bt_component *component,
}
BT_HIDDEN
enum bt_component_status bt_component_init(struct bt_component *component,
-
const char *name, enum bt_component_type component_typ
e,
+
struct bt_component_class *class, const char *nam
e,
bt_component_destroy_cb destroy)
{
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
bt_component_destroy_cb destroy)
{
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
- if (!component || !name || name[0] == '\0' || destroy) {
+ if (!component || !
class || !
name || name[0] == '\0' || destroy) {
ret = BT_COMPONENT_STATUS_INVAL;
goto end;
}
ret = BT_COMPONENT_STATUS_INVAL;
goto end;
}
- bt_ctf_ref_init(&component->ref_count);
- component->type = component_type;
+ bt_ref_init(&component->ref, bt_component_destroy);
+ bt_component_class_get(class);
+ component->class = class;
component->name = g_string_new(name);
if (!component->name) {
ret = BT_COMPONENT_STATUS_NOMEM;
component->name = g_string_new(name);
if (!component->name) {
ret = BT_COMPONENT_STATUS_NOMEM;
@@
-161,7
+162,7
@@
end:
}
static
}
static
-void bt_component_destroy(struct bt_
ctf_
ref *ref)
+void bt_component_destroy(struct bt_ref *ref)
{
struct bt_component *component = NULL;
{
struct bt_component *component = NULL;
@@
-169,7
+170,7
@@
void bt_component_destroy(struct bt_ctf_ref *ref)
return;
}
return;
}
- component = container_of(ref, struct bt_component, ref
_count
);
+ component = container_of(ref, struct bt_component, ref);
/**
* User data is destroyed first, followed by the concrete component
/**
* User data is destroyed first, followed by the concrete component
@@
-182,4
+183,5
@@
void bt_component_destroy(struct bt_ctf_ref *ref)
assert(component->destroy);
component->destroy(component);
assert(component->destroy);
component->destroy(component);
+ bt_component_class_put(component->class);
}
}
This page took
0.023778 seconds
and
4
git commands to generate.