File: 0006-dm-event-api.patch

package info (click to toggle)
lvm2 2.02.168-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,500 kB
  • ctags: 15,264
  • sloc: ansic: 142,688; sh: 22,776; python: 6,500; makefile: 2,288; ruby: 332; awk: 20; cpp: 10
file content (175 lines) | stat: -rw-r--r-- 5,842 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
From e4009bd1efcd6a8eca9d6546c5eb674f2ad17f10 Mon Sep 17 00:00:00 2001
From: Bastian Blank <waldi@debian.org>
Date: Tue, 30 Jun 2015 11:46:10 +0200
Subject: dm-event-api

---
 daemons/dmeventd/.exported_symbols    |  6 +++---
 daemons/dmeventd/dmeventd.c           | 22 +++++++++++-----------
 daemons/dmeventd/libdevmapper-event.c | 16 ++++++++--------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/daemons/dmeventd/.exported_symbols b/daemons/dmeventd/.exported_symbols
index fab74dc1d..46c14fb5a 100644
--- a/daemons/dmeventd/.exported_symbols
+++ b/daemons/dmeventd/.exported_symbols
@@ -1,4 +1,4 @@
-init_fifos
-fini_fifos
-daemon_talk
+dm_event_daemon_init_fifos
+dm_event_daemon_fini_fifos
+dm_event_daemon_talk
 dm_event_get_version
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 58922ac84..1565b8063 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1967,7 +1967,7 @@ static int _reinstate_registrations(struct dm_event_fifos *fifos)
 	unsigned long mask_value, timeout_value;
 	int i, ret;
 
-	ret = daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0);
+	ret = dm_event_daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0);
 	dm_free(msg.data);
 	msg.data = NULL;
 
@@ -2000,7 +2000,7 @@ static int _reinstate_registrations(struct dm_event_fifos *fifos)
 			continue;
 		}
 
-		if (daemon_talk(fifos, &msg, DM_EVENT_CMD_REGISTER_FOR_EVENT,
+		if (dm_event_daemon_talk(fifos, &msg, DM_EVENT_CMD_REGISTER_FOR_EVENT,
 				dso_name,
 				dev_name,
 				(enum dm_event_mask) mask_value,
@@ -2027,7 +2027,7 @@ static void _restart_dmeventd(void)
 	const char *e;
 
 	/* Get the list of registrations from the running daemon. */
-	if (!init_fifos(&fifos)) {
+	if (!dm_event_daemon_init_fifos(&fifos)) {
 		fprintf(stderr, "WARNING: Could not initiate communication with existing dmeventd.\n");
 		exit(EXIT_FAILURE);
 	}
@@ -2044,7 +2044,7 @@ static void _restart_dmeventd(void)
 		goto bad;
 	}
 
-	if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_STATUS, "-", "-", 0, 0))
+	if (dm_event_daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_STATUS, "-", "-", 0, 0))
 		goto bad;
 
 	message = strchr(msg.data, ' ') + 1;
@@ -2069,7 +2069,7 @@ static void _restart_dmeventd(void)
 	_initial_registrations[count] = NULL;
 
 	if (version >= 2) {
-		if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_PARAMETERS, "-", "-", 0, 0)) {
+		if (dm_event_daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_PARAMETERS, "-", "-", 0, 0)) {
 			fprintf(stderr, "Failed to acquire parameters from old dmeventd.\n");
 			goto bad;
 		}
@@ -2089,7 +2089,7 @@ static void _restart_dmeventd(void)
 	}
 #endif
 
-	if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_DIE, "-", "-", 0, 0)) {
+	if (dm_event_daemon_talk(&fifos, &msg, DM_EVENT_CMD_DIE, "-", "-", 0, 0)) {
 		fprintf(stderr, "Old dmeventd refused to die.\n");
 		goto bad;
 	}
@@ -2105,13 +2105,13 @@ static void _restart_dmeventd(void)
 	}
 
 	if (!_systemd_activation) {
-		fini_fifos(&fifos);
+		dm_event_daemon_fini_fifos(&fifos);
 		return;
 	}
 
 	/* Reopen fifos. */
-	fini_fifos(&fifos);
-	if (!init_fifos(&fifos)) {
+	dm_event_daemon_fini_fifos(&fifos);
+	if (!dm_event_daemon_init_fifos(&fifos)) {
 		fprintf(stderr, "Could not initiate communication with new instance of dmeventd.\n");
 		exit(EXIT_FAILURE);
 	}
@@ -2121,10 +2121,10 @@ static void _restart_dmeventd(void)
 		goto bad;
 	}
 
-	fini_fifos(&fifos);
+	dm_event_daemon_fini_fifos(&fifos);
 	exit(EXIT_SUCCESS);
 bad:
-	fini_fifos(&fifos);
+	dm_event_daemon_fini_fifos(&fifos);
 	exit(EXIT_FAILURE);
 }
 
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index b23b6c152..6f7af9e15 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -341,7 +341,7 @@ static int _daemon_write(struct dm_event_fifos *fifos,
 	return bytes == size;
 }
 
-int daemon_talk(struct dm_event_fifos *fifos,
+int dm_event_daemon_talk(struct dm_event_fifos *fifos,
 		struct dm_event_daemon_message *msg, int cmd,
 		const char *dso_name, const char *dev_name,
 		enum dm_event_mask evmask, uint32_t timeout)
@@ -490,7 +490,7 @@ start_server:
 	return ret;
 }
 
-int init_fifos(struct dm_event_fifos *fifos)
+int dm_event_daemon_init_fifos(struct dm_event_fifos *fifos)
 {
 	/* FIXME? Is fifo the most suitable method? Why not share
 	   comms/daemon code with something else e.g. multipath? */
@@ -528,10 +528,10 @@ static int _init_client(char *dmeventd_path, struct dm_event_fifos *fifos)
 	if (!_start_daemon(dmeventd_path, fifos))
 		return_0;
 
-	return init_fifos(fifos);
+	return dm_event_daemon_init_fifos(fifos);
 }
 
-void fini_fifos(struct dm_event_fifos *fifos)
+void dm_event_daemon_fini_fifos(struct dm_event_fifos *fifos)
 {
 	if (fifos->client >= 0 && close(fifos->client))
 		log_sys_debug("close", fifos->client_path);
@@ -618,16 +618,16 @@ static int _do_event(int cmd, char *dmeventd_path, struct dm_event_daemon_messag
 		goto_out;
 	}
 
-	ret = daemon_talk(&fifos, msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0);
+	ret = dm_event_daemon_talk(&fifos, msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0);
 
 	dm_free(msg->data);
 	msg->data = 0;
 
 	if (!ret)
-		ret = daemon_talk(&fifos, msg, cmd, dso_name, dev_name, evmask, timeout);
+		ret = dm_event_daemon_talk(&fifos, msg, cmd, dso_name, dev_name, evmask, timeout);
 out:
 	/* what is the opposite of init? */
-	fini_fifos(&fifos);
+	dm_event_daemon_fini_fifos(&fifos);
 
 	return ret;
 }
@@ -840,7 +840,7 @@ int dm_event_get_version(struct dm_event_fifos *fifos, int *version) {
 	char *p;
 	struct dm_event_daemon_message msg = { 0 };
 
-	if (daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0))
+	if (dm_event_daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0))
 		return 0;
 	p = msg.data;
 	*version = 0;