2 * Some helper stuff shared between the sample programs.
7 /* poll until POLLOUT, then call CIOCASYNCCRYPT */
8 inline int do_async_crypt(int cfd
, struct crypt_op
*cryp
)
15 if (poll(&pfd
, 1, -1) < 1) {
20 if (ioctl(cfd
, CIOCASYNCCRYPT
, cryp
)) {
21 perror("ioctl(CIOCCRYPT)");
27 /* poll until POLLIN, then call CIOCASYNCFETCH */
28 inline int do_async_fetch(int cfd
, struct crypt_op
*cryp
)
35 if (poll(&pfd
, 1, -1) < 1) {
40 if (ioctl(cfd
, CIOCASYNCFETCH
, cryp
)) {
41 perror("ioctl(CIOCCRYPT)");
47 /* Check return value of stmt for identity with goodval. If they
48 * don't match, call return with the value of stmt. */
49 #define DO_OR_DIE(stmt, goodval) { \
51 if ((__rc_val = stmt) != goodval) { \
52 perror("DO_OR_DIE(" #stmt "," #goodval ")"); \
57 #endif /* _TESTHELPER_H */