aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-23 13:50:17 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-23 13:50:17 +0000
commit8a05515078bc8fd3d642778fcae0d005a38ec7b0 (patch)
tree239d86bbbb5ba6bafdfa6aeaa41e848dcdc46079 /src/libstat/backends
parent8f5509c65dc6907a7581518246a200236088423c (diff)
downloadrspamd-8a05515078bc8fd3d642778fcae0d005a38ec7b0.tar.gz
rspamd-8a05515078bc8fd3d642778fcae0d005a38ec7b0.zip
Reorganize libstat API.
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/backends.h (renamed from src/libstat/backends/backends.c)35
-rw-r--r--src/libstat/backends/mmaped_file.c1
-rw-r--r--src/libstat/backends/mmaped_file.h20
3 files changed, 15 insertions, 41 deletions
diff --git a/src/libstat/backends/backends.c b/src/libstat/backends/backends.h
index 0701a2ff9..37a7560cd 100644
--- a/src/libstat/backends/backends.c
+++ b/src/libstat/backends/backends.h
@@ -22,29 +22,24 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef BACKENDS_H_
+#define BACKENDS_H_
-#include "main.h"
-#include "backends.h"
-#include "mmaped_file.h"
+#include "config.h"
-struct rspamd_stat_backend statfile_backends[] = {
- {
- .name = RSPAMD_DEFAULT_BACKEND,
- .init = rspamd_mmaped_file_init,
- }
-};
+#define RSPAMD_DEFAULT_BACKEND "mmap"
+/* Forwarded declarations */
+struct rspamd_classifier_config;
+struct rspamd_statfile_config;
+struct rspamd_config;
-struct rspamd_stat_backend *
-rspamd_stat_get_backend (const char *name)
-{
- guint i;
+struct rspamd_stat_backend {
+ const char *name;
+ gpointer (*init)(struct rspamd_statfile_config *cfg);
+ gpointer ctx;
+};
- for (i = 0; i < G_N_ELEMENTS (statfile_backends); i++) {
- if (strcmp (statfile_backends[i].name, name) == 0) {
- return &statfile_backends[i];
- }
- }
+gpointer rspamd_mmaped_file_init(struct rspamd_config *cfg);
- return NULL;
-}
+#endif /* BACKENDS_H_ */
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c
index 9ac725fe7..cef17f465 100644
--- a/src/libstat/backends/mmaped_file.c
+++ b/src/libstat/backends/mmaped_file.c
@@ -24,7 +24,6 @@
#include "config.h"
-#include "mmaped_file.h"
#include "main.h"
#define CHAIN_LENGTH 128
diff --git a/src/libstat/backends/mmaped_file.h b/src/libstat/backends/mmaped_file.h
deleted file mode 100644
index f3f25c8cb..000000000
--- a/src/libstat/backends/mmaped_file.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file statfile.h
- * Describes common methods for accessing statistics files and caching them in memory
- */
-
-#ifndef RSPAMD_STATFILE_H
-#define RSPAMD_STATFILE_H
-
-#include "config.h"
-
-
-/* Forwarded declarations */
-struct rspamd_classifier_config;
-struct rspamd_statfile_config;
-struct rspamd_config;
-
-gpointer
-rspamd_mmaped_file_init(struct rspamd_config *cfg);
-
-#endif