Commit | Line | Data |
---|---|---|
22133895 MD |
1 | /* |
2 | * BabelTrace - Dummy Output | |
3 | * | |
4 | * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation | |
5 | * | |
6 | * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
9 | * of this software and associated documentation files (the "Software"), to deal | |
10 | * in the Software without restriction, including without limitation the rights | |
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
12 | * copies of the Software, and to permit persons to whom the Software is | |
13 | * furnished to do so, subject to the following conditions: | |
14 | * | |
15 | * The above copyright notice and this permission notice shall be included in | |
16 | * all copies or substantial portions of the Software. | |
17 | */ | |
18 | ||
19 | #include <babeltrace/ctf-text/types.h> | |
20 | #include <babeltrace/format.h> | |
70bd0a12 | 21 | #include <babeltrace/babeltrace-internal.h> |
22133895 MD |
22 | #include <inttypes.h> |
23 | #include <uuid/uuid.h> | |
24 | #include <sys/mman.h> | |
25 | #include <errno.h> | |
26 | #include <sys/types.h> | |
27 | #include <sys/stat.h> | |
28 | #include <fcntl.h> | |
29 | #include <dirent.h> | |
30 | #include <glib.h> | |
31 | #include <unistd.h> | |
32 | #include <stdlib.h> | |
33 | ||
34 | static | |
35 | int bt_dummy_write_event(struct stream_pos *ppos, | |
36 | struct ctf_stream *stream) | |
37 | { | |
38 | return 0; | |
39 | } | |
40 | ||
41 | static | |
8c250d87 MD |
42 | struct trace_descriptor *bt_dummy_open_trace(const char *collection_path, |
43 | const char *path, int flags, | |
b086c01a | 44 | void (*move_pos_slow)(struct ctf_stream_pos *pos, size_t offset, |
ae23d232 | 45 | int whence), FILE *metadata_fp) |
22133895 MD |
46 | { |
47 | struct ctf_text_stream_pos *pos; | |
48 | ||
49 | pos = g_new0(struct ctf_text_stream_pos, 1); | |
50 | pos->parent.rw_table = NULL; | |
51 | pos->parent.event_cb = bt_dummy_write_event; | |
52 | return &pos->trace_descriptor; | |
53 | } | |
54 | ||
55 | static | |
56 | void bt_dummy_close_trace(struct trace_descriptor *td) | |
57 | { | |
58 | struct ctf_text_stream_pos *pos = | |
59 | container_of(td, struct ctf_text_stream_pos, | |
60 | trace_descriptor); | |
61 | free(pos); | |
62 | } | |
63 | ||
64 | static | |
65 | struct format bt_dummy_format = { | |
66 | .open_trace = bt_dummy_open_trace, | |
67 | .close_trace = bt_dummy_close_trace, | |
68 | }; | |
69 | ||
70 | static | |
71 | void __attribute__((constructor)) bt_dummy_init(void) | |
72 | { | |
73 | int ret; | |
74 | ||
75 | bt_dummy_format.name = g_quark_from_static_string("dummy"); | |
76 | ret = bt_register_format(&bt_dummy_format); | |
77 | assert(!ret); | |
78 | } | |
79 | ||
80 | /* TODO: finalize */ |