On Mon, Jun 13, 2016 at 18:38:39 +0200, Jovanka Gulicoska wrote:
Add storage event handling infrastructure to storage_event.[ch],
following
the network_event.[ch] pattern.
---
src/Makefile.am | 5 +
src/conf/storage_conf.h | 4 +
src/conf/storage_event.c | 237 +++++++++++++++++++++++++++++++++++++++++++++++
src/conf/storage_event.h | 60 ++++++++++++
src/libvirt_private.syms | 5 +
5 files changed, 311 insertions(+)
create mode 100644 src/conf/storage_event.c
create mode 100644 src/conf/storage_event.h
diff --git a/src/Makefile.am b/src/Makefile.am
index ee4a7bf..cb9bf9b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -342,6 +342,9 @@ DOMAIN_EVENT_SOURCES = \
NETWORK_EVENT_SOURCES = \
conf/network_event.c conf/network_event.h
+STORAGE_POOL_EVENT_SOURCES = \
Variable name contains "POOL"
+ conf/storage_event.c conf/storage_event.h
but files don't
+
# Network driver generic impl APIs
NETWORK_CONF_SOURCES = \
conf/network_conf.c conf/network_conf.h \
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 54116a6..185ae5e 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -31,6 +31,7 @@
# include "virthread.h"
# include "device_conf.h"
# include "node_device_conf.h"
+# include "object_event.h"
# include <libxml/tree.h>
@@ -296,6 +297,9 @@ struct _virStorageDriverState {
char *autostartDir;
char *stateDir;
bool privileged;
+
+ /* Immutable pointer, self-locking APIs */
+ virObjectEventStatePtr storageEventState;
This isn't used anywhere as of this patch.
};
typedef struct _virStoragePoolSourceList virStoragePoolSourceList;
diff --git a/src/conf/storage_event.c b/src/conf/storage_event.c
new file mode 100644
index 0000000..c5688be
--- /dev/null
+++ b/src/conf/storage_event.c
@@ -0,0 +1,237 @@
+/*
+ * storage_event.c: storage event queue processing helpers
+ *
+ * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2008 VirtualIron
+ * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
This copyright was copied somewhere but not updated/cleaned up.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+*/
[...]
diff --git a/src/conf/storage_event.h b/src/conf/storage_event.h
new file mode 100644
index 0000000..6f244be
--- /dev/null
+++ b/src/conf/storage_event.h
@@ -0,0 +1,60 @@
+/*
+ * storage_event.h: storage event queue processing helpers
+ *
+ * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2008 VirtualIron
+ * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
Same as above regarding copyright.
> + *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+*/
> +
> +#include "internal.h"
> +#include "object_event.h"
> +#include "object_event_private.h"
> +
> +#ifndef __STORAGE_POOL_EVENT_H__
Macro name contains POOL but file name doesn't
+# define __STORAGE_POOL_EVENT_H__
+