aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch
blob: d2784b1c23f5edfd9ed4d77d174cbf8c34894165 (plain)
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
From 1fff269afd1925f4e4c7e37cc8c52187c407bc56 Mon Sep 17 00:00:00 2001
From: Cristian Stoica <cristian.stoica@nxp.com>
Date: Tue, 29 Nov 2016 13:37:21 +0200
Subject: [PATCH 095/104] rename header file to clarify purpose

testhelper.h suggests a common repository of utility functions but
current content targets only async tests. If we include it in non-async
tests we are forced to include <poll.h> as well.

Rename this header file to clarify that it targets only async tests

Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
---
 tests/async_cipher.c |  2 +-
 tests/async_hmac.c   |  2 +-
 tests/asynchelper.h  | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/testhelper.h   | 57 ----------------------------------------------------
 4 files changed, 56 insertions(+), 59 deletions(-)
 create mode 100644 tests/asynchelper.h
 delete mode 100644 tests/testhelper.h

diff --git a/tests/async_cipher.c b/tests/async_cipher.c
index dd08403..db6fb06 100644
--- a/tests/async_cipher.c
+++ b/tests/async_cipher.c
@@ -13,7 +13,7 @@
 #include <sys/ioctl.h>
 #include <crypto/cryptodev.h>
 
-#include "testhelper.h"
+#include "asynchelper.h"
 
 #ifdef ENABLE_ASYNC
 
diff --git a/tests/async_hmac.c b/tests/async_hmac.c
index 85d19c6..1bdaad3 100644
--- a/tests/async_hmac.c
+++ b/tests/async_hmac.c
@@ -14,7 +14,7 @@
 #include <sys/ioctl.h>
 #include <crypto/cryptodev.h>
 
-#include "testhelper.h"
+#include "asynchelper.h"
 
 #ifdef ENABLE_ASYNC
 
diff --git a/tests/asynchelper.h b/tests/asynchelper.h
new file mode 100644
index 0000000..b5ab16c
--- /dev/null
+++ b/tests/asynchelper.h
@@ -0,0 +1,54 @@
+#ifndef __ASYNCHELPER_H
+#define __ASYNCHELPER_H
+
+/* poll until POLLOUT, then call CIOCASYNCCRYPT */
+inline int do_async_crypt(int cfd, struct crypt_op *cryp)
+{
+	struct pollfd pfd;
+
+	pfd.fd = cfd;
+	pfd.events = POLLOUT;
+
+	if (poll(&pfd, 1, -1) < 1) {
+		perror("poll()");
+		return 1;
+	}
+
+	if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) {
+		perror("ioctl(CIOCCRYPT)");
+		return 1;
+	}
+	return 0;
+}
+
+/* poll until POLLIN, then call CIOCASYNCFETCH */
+inline int do_async_fetch(int cfd, struct crypt_op *cryp)
+{
+	struct pollfd pfd;
+
+	pfd.fd = cfd;
+	pfd.events = POLLIN;
+
+	if (poll(&pfd, 1, -1) < 1) {
+		perror("poll()");
+		return 1;
+	}
+
+	if (ioctl(cfd, CIOCASYNCFETCH, cryp)) {
+		perror("ioctl(CIOCCRYPT)");
+		return 1;
+	}
+	return 0;
+}
+
+/* Check return value of stmt for identity with goodval. If they
+ * don't match, call return with the value of stmt. */
+#define DO_OR_DIE(stmt, goodval) {                           \
+	int __rc_val;                                        \
+	if ((__rc_val = stmt) != goodval) {                  \
+		perror("DO_OR_DIE(" #stmt "," #goodval ")"); \
+		return __rc_val;                             \
+	}                                                    \
+}
+
+#endif /* __ASYNCHELPER_H */
diff --git a/tests/testhelper.h b/tests/testhelper.h
deleted file mode 100644
index ea0b100..0000000
--- a/tests/testhelper.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Some helper stuff shared between the sample programs.
- */
-#ifndef _TESTHELPER_H
-#define _TESTHELPER_H
-
-/* poll until POLLOUT, then call CIOCASYNCCRYPT */
-inline int do_async_crypt(int cfd, struct crypt_op *cryp)
-{
-	struct pollfd pfd;
-
-	pfd.fd = cfd;
-	pfd.events = POLLOUT;
-
-	if (poll(&pfd, 1, -1) < 1) {
-		perror("poll()");
-		return 1;
-	}
-
-	if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) {
-		perror("ioctl(CIOCCRYPT)");
-		return 1;
-	}
-	return 0;
-}
-
-/* poll until POLLIN, then call CIOCASYNCFETCH */
-inline int do_async_fetch(int cfd, struct crypt_op *cryp)
-{
-	struct pollfd pfd;
-
-	pfd.fd = cfd;
-	pfd.events = POLLIN;
-
-	if (poll(&pfd, 1, -1) < 1) {
-		perror("poll()");
-		return 1;
-	}
-
-	if (ioctl(cfd, CIOCASYNCFETCH, cryp)) {
-		perror("ioctl(CIOCCRYPT)");
-		return 1;
-	}
-	return 0;
-}
-
-/* Check return value of stmt for identity with goodval. If they
- * don't match, call return with the value of stmt. */
-#define DO_OR_DIE(stmt, goodval) {                           \
-	int __rc_val;                                        \
-	if ((__rc_val = stmt) != goodval) {                  \
-		perror("DO_OR_DIE(" #stmt "," #goodval ")"); \
-		return __rc_val;                             \
-	}                                                    \
-}
-
-#endif /* _TESTHELPER_H */
-- 
2.10.2