Tighten up scope after the previous patch avoided using
internals. This will also make it easier to change
internal implementation without having to chase down quite
as many impacted callers or worrying about two files getting
implementations out of sync.
* src/conf/object_event_private.h
(virObjectEventCallbackListAddID, virObjectEventQueueClear)
(virObjectEventStateLock, virObjectEventStateUnlock)
(virObjectEventTimer): Drop prototype.
(_virObjectEventCallbackList, _virObjectEventState)
(_virObjectEventCallback): Move...
* src/conf/object_event.c: ...here.
(virObjectEventCallbackListAddID, virObjectEventQueueClear)
(virObjectEventStateLock, virObjectEventStateUnlock)
(virObjectEventTimer): Mark private.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/object_event.c | 42 +++++++++++++++++++++++++----
src/conf/object_event_private.h | 58 -----------------------------------------
2 files changed, 37 insertions(+), 63 deletions(-)
diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index 6c4d8b4..9293ab1 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -36,10 +36,42 @@
#define VIR_FROM_THIS VIR_FROM_NONE
+struct _virObjectEventCallbackList {
+ unsigned int nextID;
+ size_t count;
+ virObjectEventCallbackPtr *callbacks;
+};
+
struct _virObjectEventQueue {
size_t count;
virObjectEventPtr *events;
};
+typedef struct _virObjectEventQueue virObjectEventQueue;
+typedef virObjectEventQueue *virObjectEventQueuePtr;
+
+struct _virObjectEventState {
+ /* The list of domain event callbacks */
+ virObjectEventCallbackListPtr callbacks;
+ /* The queue of object events */
+ virObjectEventQueuePtr queue;
+ /* Timer for flushing events queue */
+ int timer;
+ /* Flag if we're in process of dispatching */
+ bool isDispatching;
+ virMutex lock;
+};
+
+struct _virObjectEventCallback {
+ int callbackID;
+ virClassPtr klass;
+ int eventID;
+ virConnectPtr conn;
+ virObjectMetaPtr meta;
+ virConnectObjectEventGenericCallback cb;
+ void *opaque;
+ virFreeCallback freecb;
+ bool deleted;
+};
static virClassPtr virObjectEventClass;
@@ -269,7 +301,7 @@ virObjectEventCallbackLookup(virConnectPtr conn,
*
* Internal function to add a callback from a virObjectEventCallbackListPtr
*/
-int
+static int
virObjectEventCallbackListAddID(virConnectPtr conn,
virObjectEventCallbackListPtr cbList,
unsigned char uuid[VIR_UUID_BUFLEN],
@@ -376,7 +408,7 @@ virObjectEventCallbackListEventID(virConnectPtr conn,
*
* Removes all elements from the queue
*/
-void
+static void
virObjectEventQueueClear(virObjectEventQueuePtr queue)
{
size_t i;
@@ -422,7 +454,7 @@ virObjectEventQueueNew(void)
*
* Lock event state before calling functions from object_event_private.h.
*/
-void
+static void
virObjectEventStateLock(virObjectEventStatePtr state)
{
virMutexLock(&state->lock);
@@ -435,7 +467,7 @@ virObjectEventStateLock(virObjectEventStatePtr state)
*
* Unlock event state after calling functions from object_event_private.h.
*/
-void
+static void
virObjectEventStateUnlock(virObjectEventStatePtr state)
{
virMutexUnlock(&state->lock);
@@ -477,7 +509,7 @@ static void virObjectEventStateFlush(virObjectEventStatePtr state);
* the callback of a periodic timer on the event loop, in order to
* flush the callback queue.
*/
-void
+static void
virObjectEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque)
{
virObjectEventStatePtr state = opaque;
diff --git a/src/conf/object_event_private.h b/src/conf/object_event_private.h
index f8063ff..51d4c44 100644
--- a/src/conf/object_event_private.h
+++ b/src/conf/object_event_private.h
@@ -35,41 +35,9 @@ struct _virObjectMeta {
typedef struct _virObjectMeta virObjectMeta;
typedef virObjectMeta *virObjectMetaPtr;
-struct _virObjectEventCallbackList {
- unsigned int nextID;
- size_t count;
- virObjectEventCallbackPtr *callbacks;
-};
typedef struct _virObjectEventCallbackList virObjectEventCallbackList;
typedef virObjectEventCallbackList *virObjectEventCallbackListPtr;
-typedef struct _virObjectEventQueue virObjectEventQueue;
-typedef virObjectEventQueue *virObjectEventQueuePtr;
-
-struct _virObjectEventState {
- /* The list of domain event callbacks */
- virObjectEventCallbackListPtr callbacks;
- /* The queue of object events */
- virObjectEventQueuePtr queue;
- /* Timer for flushing events queue */
- int timer;
- /* Flag if we're in process of dispatching */
- bool isDispatching;
- virMutex lock;
-};
-
-struct _virObjectEventCallback {
- int callbackID;
- virClassPtr klass;
- int eventID;
- virConnectPtr conn;
- virObjectMetaPtr meta;
- virConnectObjectEventGenericCallback cb;
- void *opaque;
- virFreeCallback freecb;
- bool deleted;
-};
-
typedef void
(*virObjectEventDispatchFunc)(virConnectPtr conn,
virObjectEventPtr event,
@@ -93,32 +61,6 @@ virObjectEventStateCallbackID(virConnectPtr conn,
int eventID,
virConnectObjectEventGenericCallback callback);
-int
-virObjectEventCallbackListAddID(virConnectPtr conn,
- virObjectEventCallbackListPtr cbList,
- unsigned char *uuid,
- const char *name,
- int id,
- virClassPtr klass,
- int eventID,
- virConnectObjectEventGenericCallback callback,
- void *opaque,
- virFreeCallback freecb,
- int *callbackID);
-
-void
-virObjectEventQueueClear(virObjectEventQueuePtr queue);
-
-void
-virObjectEventStateLock(virObjectEventStatePtr state);
-
-void
-virObjectEventStateUnlock(virObjectEventStatePtr state);
-
-void
-virObjectEventTimer(int timer,
- void *opaque);
-
void *
virObjectEventNew(virClassPtr klass,
virObjectEventDispatchFunc dispatcher,
--
1.8.4.2