]> git.ipfire.org Git - people/pmueller/ipfire-3.x.git/blame - multipath-tools/patches/0001-RH-remove_callout.patch
multipath-tools: Update to latest development snapshot (120613).
[people/pmueller/ipfire-3.x.git] / multipath-tools / patches / 0001-RH-remove_callout.patch
CommitLineData
d8602e2a
SS
1---
2 libmultipath/Makefile | 2
3 libmultipath/callout.c | 217 -----------------------------------------------
4 libmultipath/callout.h | 7 -
5 libmultipath/discovery.c | 1
6 multipathd/main.c | 1
7 5 files changed, 1 insertion(+), 227 deletions(-)
8
9Index: multipath-tools-120518/libmultipath/Makefile
10===================================================================
11--- multipath-tools-120518.orig/libmultipath/Makefile
12+++ multipath-tools-120518/libmultipath/Makefile
13@@ -9,7 +9,7 @@ DEVLIB = libmultipath.so
14 LIBS = $(DEVLIB).$(SONAME)
15 LIBDEPS = -lpthread -ldl -ldevmapper -ludev
16
17-OBJS = memory.o parser.o vector.o devmapper.o callout.o \
18+OBJS = memory.o parser.o vector.o devmapper.o \
19 hwtable.o blacklist.o util.o dmparser.o config.o \
20 structs.o discovery.o propsel.o dict.o \
21 pgpolicies.o debug.o regex.o defaults.o uevent.o \
22Index: multipath-tools-120518/libmultipath/callout.c
23===================================================================
24--- multipath-tools-120518.orig/libmultipath/callout.c
25+++ /dev/null
26@@ -1,217 +0,0 @@
27-/*
28- * Source: copy of the udev package source file
29- *
30- * Copyrights of the source file apply
31- * Copyright (c) 2004 Christophe Varoqui
32- */
33-#include <stdio.h>
34-#include <sys/stat.h>
35-#include <string.h>
36-#include <unistd.h>
37-#include <sys/types.h>
38-#include <stdlib.h>
39-#include <fcntl.h>
40-#include <sys/wait.h>
41-#include <errno.h>
42-
43-#include "checkers.h"
44-#include "vector.h"
45-#include "structs.h"
46-#include "util.h"
47-#include "debug.h"
48-
49-int execute_program(char *path, char *value, int len)
50-{
51- int retval;
52- int count;
53- int status;
54- int fds[2], null_fd;
55- pid_t pid;
56- char *pos;
57- char arg[CALLOUT_MAX_SIZE];
58- int argc = sizeof(arg) / 2;
59- char *argv[argc + 1];
60- int i;
61-
62- i = 0;
63-
64- if (strchr(path, ' ')) {
65- strlcpy(arg, path, sizeof(arg));
66- pos = arg;
67- while (pos != NULL && i < argc) {
68- if (pos[0] == '\'') {
69- /* don't separate if in apostrophes */
70- pos++;
71- argv[i] = strsep(&pos, "\'");
72- while (pos[0] == ' ')
73- pos++;
74- } else {
75- argv[i] = strsep(&pos, " ");
76- }
77- i++;
78- }
79- } else {
80- argv[i++] = path;
81- }
82- argv[i] = NULL;
83-
84- retval = pipe(fds);
85-
86- if (retval != 0) {
87- condlog(0, "error creating pipe for callout: %s", strerror(errno));
88- return -1;
89- }
90-
91- pid = fork();
92-
93- switch(pid) {
94- case 0:
95- /* child */
96- close(STDOUT_FILENO);
97-
98- /* dup write side of pipe to STDOUT */
99- if (dup(fds[1]) < 0)
100- return -1;
101-
102- /* Ignore writes to stderr */
103- null_fd = open("/dev/null", O_WRONLY);
104- if (null_fd > 0) {
105- close(STDERR_FILENO);
106- dup(null_fd);
107- close(null_fd);
108- }
109-
110- retval = execv(argv[0], argv);
111- condlog(0, "error execing %s : %s", argv[0], strerror(errno));
112- exit(-1);
113- case -1:
114- condlog(0, "fork failed: %s", strerror(errno));
115- close(fds[0]);
116- close(fds[1]);
117- return -1;
118- default:
119- /* parent reads from fds[0] */
120- close(fds[1]);
121- retval = 0;
122- i = 0;
123- while (1) {
124- count = read(fds[0], value + i, len - i-1);
125- if (count <= 0)
126- break;
127-
128- i += count;
129- if (i >= len-1) {
130- condlog(0, "not enough space for response from %s", argv[0]);
131- retval = -1;
132- break;
133- }
134- }
135-
136- if (count < 0) {
137- condlog(0, "no response from %s", argv[0]);
138- retval = -1;
139- }
140-
141- if (i > 0 && value[i-1] == '\n')
142- i--;
143- value[i] = '\0';
144-
145- wait(&status);
146- close(fds[0]);
147-
148- retval = -1;
149- if (WIFEXITED(status)) {
150- status = WEXITSTATUS(status);
151- if (status == 0)
152- retval = 0;
153- else
154- condlog(0, "%s exitted with %d", argv[0], status);
155- }
156- else if (WIFSIGNALED(status))
157- condlog(0, "%s was terminated by signal %d", argv[0], WTERMSIG(status));
158- else
159- condlog(0, "%s terminated abnormally", argv[0]);
160- }
161- return retval;
162-}
163-
164-extern int
165-apply_format (char * string, char * cmd, struct path * pp)
166-{
167- char * pos;
168- char * dst;
169- char * p;
170- char * q;
171- int len;
172- int myfree;
173-
174- if (!string)
175- return 1;
176-
177- if (!cmd)
178- return 1;
179-
180- dst = cmd;
181- p = dst;
182- pos = strchr(string, '%');
183- myfree = CALLOUT_MAX_SIZE;
184-
185- if (!pos) {
186- strcpy(dst, string);
187- return 0;
188- }
189-
190- len = (int) (pos - string) + 1;
191- myfree -= len;
192-
193- if (myfree < 2)
194- return 1;
195-
196- snprintf(p, len, "%s", string);
197- p += len - 1;
198- pos++;
199-
200- switch (*pos) {
201- case 'n':
202- len = strlen(pp->dev) + 1;
203- myfree -= len;
204-
205- if (myfree < 2)
206- return 1;
207-
208- snprintf(p, len, "%s", pp->dev);
209- for (q = p; q < p + len; q++) {
210- if (q && *q == '!')
211- *q = '/';
212- }
213- p += len - 1;
214- break;
215- case 'd':
216- len = strlen(pp->dev_t) + 1;
217- myfree -= len;
218-
219- if (myfree < 2)
220- return 1;
221-
222- snprintf(p, len, "%s", pp->dev_t);
223- p += len - 1;
224- break;
225- default:
226- break;
227- }
228- pos++;
229-
230- if (!*pos)
231- return 0;
232-
233- len = strlen(pos) + 1;
234- myfree -= len;
235-
236- if (myfree < 2)
237- return 1;
238-
239- snprintf(p, len, "%s", pos);
240- condlog(3, "reformated callout = %s", dst);
241- return 0;
242-}
243-
244Index: multipath-tools-120518/libmultipath/callout.h
245===================================================================
246--- multipath-tools-120518.orig/libmultipath/callout.h
247+++ /dev/null
248@@ -1,7 +0,0 @@
249-#ifndef _CALLOUT_H
250-#define _CALLOUT_H
251-
252-int execute_program(char *, char *, int);
253-int apply_format (char *, char *, struct path *);
254-
255-#endif /* _CALLOUT_H */
256Index: multipath-tools-120518/libmultipath/discovery.c
257===================================================================
258--- multipath-tools-120518.orig/libmultipath/discovery.c
259+++ multipath-tools-120518/libmultipath/discovery.c
260@@ -20,7 +20,6 @@
261 #include "structs.h"
262 #include "config.h"
263 #include "blacklist.h"
264-#include "callout.h"
265 #include "debug.h"
266 #include "propsel.h"
267 #include "sg_include.h"
268Index: multipath-tools-120518/multipathd/main.c
269===================================================================
270--- multipath-tools-120518.orig/multipathd/main.c
271+++ multipath-tools-120518/multipathd/main.c
272@@ -35,7 +35,6 @@
273 #include <hwtable.h>
274 #include <defaults.h>
275 #include <structs.h>
276-#include <callout.h>
277 #include <blacklist.h>
278 #include <structs_vec.h>
279 #include <dmparser.h>