Code

store: Split private type definitions into a new header store-private.h.
authorSebastian Harl <sh@tokkee.org>
Wed, 19 Feb 2014 22:12:24 +0000 (23:12 +0100)
committerSebastian Harl <sh@tokkee.org>
Wed, 19 Feb 2014 22:12:24 +0000 (23:12 +0100)
src/Makefile.am
src/core/store-private.h [new file with mode: 0644]
src/core/store.c
src/frontend/connection-private.h

index 873694874bc06645af68624bb93bbdb23204d875..77ce39fba705e3dc96c57cc4b3568e2b9aad825e 100644 (file)
@@ -66,6 +66,7 @@ libsysdb_la_SOURCES = \
                core/object.c include/core/object.h \
                core/plugin.c include/core/plugin.h \
                core/store.c include/core/store.h \
+               core/store-private.h \
                core/data.c include/core/data.h \
                frontend/connection.c include/frontend/connection.h \
                frontend/connection-private.h \
diff --git a/src/core/store-private.h b/src/core/store-private.h
new file mode 100644 (file)
index 0000000..abd94c2
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * SysDB - src/core/store-private.h
+ * Copyright (C) 2012-2013 Sebastian 'tokkee' Harl <sh@tokkee.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * private data structures used by the store module
+ */
+
+#ifndef SDB_CORE_STORE_PRIVATE_H
+#define SDB_CORE_STORE_PRIVATE_H 1
+
+#include "core/store.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct sdb_store_base {
+       sdb_object_t super;
+
+       /* object type */
+       int type;
+
+       /* common meta information */
+       sdb_time_t last_update;
+       sdb_store_base_t *parent;
+};
+#define STORE_BASE(obj) ((sdb_store_base_t *)(obj))
+#define STORE_CONST_BASE(obj) ((const sdb_store_base_t *)(obj))
+
+typedef struct {
+       sdb_store_base_t super;
+
+       sdb_data_t value;
+} sdb_attribute_t;
+#define SDB_ATTR(obj) ((sdb_attribute_t *)(obj))
+#define SDB_CONST_ATTR(obj) ((const sdb_attribute_t *)(obj))
+
+typedef struct {
+       sdb_store_base_t super;
+
+       sdb_llist_t *children;
+       sdb_llist_t *attributes;
+} sdb_store_obj_t;
+#define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj))
+#define SDB_CONST_STORE_OBJ(obj) ((const sdb_store_obj_t *)(obj))
+
+enum {
+       SDB_HOST = 1,
+       SDB_SERVICE,
+       SDB_ATTRIBUTE,
+};
+#define TYPE_TO_NAME(t) \
+       (((t) == SDB_HOST) ? "host" \
+               : ((t) == SDB_SERVICE) ? "service" \
+               : ((t) == SDB_ATTRIBUTE) ? "attribute" : "unknown")
+
+/* shortcuts for accessing the sdb_store_obj_t attributes
+ * of inheriting objects */
+#define _last_update super.last_update
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* ! SDB_CORE_STORE_H */
+
+/* vim: set tw=78 sw=4 ts=4 noexpandtab : */
+
index 753b9815b0bd4b23be3bee71cfcfacb651060f28..d3448c20b08a678785d5decca96d2078f353cb8b 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include "sysdb.h"
-#include "core/store.h"
+#include "core/store-private.h"
 #include "core/plugin.h"
 #include "utils/error.h"
 #include "utils/llist.h"
@@ -55,50 +55,6 @@ static pthread_rwlock_t obj_lock = PTHREAD_RWLOCK_INITIALIZER;
 static sdb_type_t sdb_store_obj_type;
 static sdb_type_t sdb_attribute_type;
 
-struct sdb_store_base {
-       sdb_object_t super;
-
-       /* object type */
-       int type;
-
-       /* common meta information */
-       sdb_time_t last_update;
-       sdb_store_base_t *parent;
-};
-#define STORE_BASE(obj) ((sdb_store_base_t *)(obj))
-#define STORE_CONST_BASE(obj) ((const sdb_store_base_t *)(obj))
-
-typedef struct {
-       sdb_store_base_t super;
-
-       sdb_data_t value;
-} sdb_attribute_t;
-#define SDB_ATTR(obj) ((sdb_attribute_t *)(obj))
-#define SDB_CONST_ATTR(obj) ((const sdb_attribute_t *)(obj))
-
-typedef struct {
-       sdb_store_base_t super;
-
-       sdb_llist_t *children;
-       sdb_llist_t *attributes;
-} sdb_store_obj_t;
-#define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj))
-#define SDB_CONST_STORE_OBJ(obj) ((const sdb_store_obj_t *)(obj))
-
-enum {
-       SDB_HOST = 1,
-       SDB_SERVICE,
-       SDB_ATTRIBUTE,
-};
-#define TYPE_TO_NAME(t) \
-       (((t) == SDB_HOST) ? "host" \
-               : ((t) == SDB_SERVICE) ? "service" \
-               : ((t) == SDB_ATTRIBUTE) ? "attribute" : "unknown")
-
-/* shortcuts for accessing the sdb_store_obj_t attributes
- * of inheriting objects */
-#define _last_update super.last_update
-
 static int
 store_base_init(sdb_object_t *obj, va_list ap)
 {
index 6cf7395b7c122b0c5c329c622be47745f71f5bb3..39fc85240e7c637817f2495a1e9bea07f62737df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * SysDB - src/include/frontend/connection-private.h
+ * SysDB - src/frontend/connection-private.h
  * Copyright (C) 2013 Sebastian 'tokkee' Harl <sh@tokkee.org>
  * All rights reserved.
  *