aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-11-25 00:10:54 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-11-25 00:10:54 +0000
commit688f8b822cea550753e7f3495339141cb6b565b7 (patch)
tree3cd4ee29d26786fc5cae6115ca6dd069672d5456 /tools
parent908dca3ef4695fe0abf4001ea2b3f73e9247a540 (diff)
Notes
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/crypto/cryptocheck.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c
index a61c3d2bae77..efb68f8966ef 100644
--- a/tools/tools/crypto/cryptocheck.c
+++ b/tools/tools/crypto/cryptocheck.c
@@ -352,23 +352,11 @@ crfind(int crid)
bzero(&find, sizeof(find));
find.crid = crid;
- if (ioctl(devcrypto(), CRIOFINDDEV, &find) == -1)
+ if (ioctl(devcrypto(), CIOCFINDDEV, &find) == -1)
err(1, "ioctl(CIOCFINDDEV): crid %d", crid);
return (find.name);
}
-static int
-crget(void)
-{
- int fd;
-
- if (ioctl(devcrypto(), CRIOGET, &fd) == -1)
- err(1, "ioctl(CRIOGET)");
- if (fcntl(fd, F_SETFD, 1) == -1)
- err(1, "fcntl(F_SETFD) (crget)");
- return fd;
-}
-
static char
rdigit(void)
{
@@ -436,11 +424,10 @@ ocf_init_session(struct session2_op *sop, const char *type, const char *name,
{
int fd;
- fd = crget();
+ fd = devcrypto();
if (ioctl(fd, CIOCGSESSION2, sop) < 0) {
warn("cryptodev %s %s not supported for device %s",
type, name, crfind(sop->crid));
- close(fd);
ses->fd = -1;
return (false);
}
@@ -458,8 +445,6 @@ ocf_destroy_session(struct ocf_session *ses)
if (ioctl(ses->fd, CIOCFSESSION, &ses->ses) < 0)
warn("ioctl(CIOCFSESSION)");
-
- close(ses->fd);
}
static void