Sat Nov 28 03:40:43 2015 UTC ()
fix the build


(christos)
diff -r1.46 -r1.47 src/sys/opencrypto/crypto.c

cvs diff -r1.46 -r1.47 src/sys/opencrypto/crypto.c (expand / switch to unified diff)

--- src/sys/opencrypto/crypto.c 2015/11/28 03:06:45 1.46
+++ src/sys/opencrypto/crypto.c 2015/11/28 03:40:43 1.47
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: crypto.c,v 1.46 2015/11/28 03:06:45 pgoyette Exp $ */ 1/* $NetBSD: crypto.c,v 1.47 2015/11/28 03:40:43 christos Exp $ */
2/* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */ 2/* $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $ */
3/* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */ 3/* $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */
4 4
5/*- 5/*-
6 * Copyright (c) 2008 The NetBSD Foundation, Inc. 6 * Copyright (c) 2008 The NetBSD Foundation, Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * This code is derived from software contributed to The NetBSD Foundation 9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Coyote Point Systems, Inc. 10 * by Coyote Point Systems, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -43,27 +43,27 @@ @@ -43,27 +43,27 @@
43 * Permission to use, copy, and modify this software with or without fee 43 * Permission to use, copy, and modify this software with or without fee
44 * is hereby granted, provided that this entire notice is included in 44 * is hereby granted, provided that this entire notice is included in
45 * all source code copies of any software which is or includes a copy or 45 * all source code copies of any software which is or includes a copy or
46 * modification of this software. 46 * modification of this software.
47 * 47 *
48 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 48 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
49 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 49 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
50 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 50 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
51 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 51 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
52 * PURPOSE. 52 * PURPOSE.
53 */ 53 */
54 54
55#include <sys/cdefs.h> 55#include <sys/cdefs.h>
56__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.46 2015/11/28 03:06:45 pgoyette Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.47 2015/11/28 03:40:43 christos Exp $");
57 57
58#include <sys/param.h> 58#include <sys/param.h>
59#include <sys/reboot.h> 59#include <sys/reboot.h>
60#include <sys/systm.h> 60#include <sys/systm.h>
61#include <sys/malloc.h> 61#include <sys/malloc.h>
62#include <sys/proc.h> 62#include <sys/proc.h>
63#include <sys/pool.h> 63#include <sys/pool.h>
64#include <sys/kthread.h> 64#include <sys/kthread.h>
65#include <sys/once.h> 65#include <sys/once.h>
66#include <sys/sysctl.h> 66#include <sys/sysctl.h>
67#include <sys/intr.h> 67#include <sys/intr.h>
68#include <sys/errno.h> 68#include <sys/errno.h>
69#include <sys/module.h> 69#include <sys/module.h>
@@ -237,27 +237,27 @@ MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", " @@ -237,27 +237,27 @@ MALLOC_DEFINE(M_CRYPTO_DATA, "crypto", "
237static void cryptointr(void); /* swi thread to dispatch ops */ 237static void cryptointr(void); /* swi thread to dispatch ops */
238static void cryptoret(void); /* kernel thread for callbacks*/ 238static void cryptoret(void); /* kernel thread for callbacks*/
239static struct lwp *cryptothread; 239static struct lwp *cryptothread;
240static int crypto_destroy(bool); 240static int crypto_destroy(bool);
241static int crypto_invoke(struct cryptop *crp, int hint); 241static int crypto_invoke(struct cryptop *crp, int hint);
242static int crypto_kinvoke(struct cryptkop *krp, int hint); 242static int crypto_kinvoke(struct cryptkop *krp, int hint);
243 243
244static struct cryptostats cryptostats; 244static struct cryptostats cryptostats;
245#ifdef CRYPTO_TIMING 245#ifdef CRYPTO_TIMING
246static int crypto_timing = 0; 246static int crypto_timing = 0;
247#endif 247#endif
248 248
249#ifdef _MODULE 249#ifdef _MODULE
250 static struct sysctllog *sysctl_opencrypto_clog; 250static struct sysctllog *sysctl_opencrypto_clog;
251#endif 251#endif
252 252
253static int 253static int
254crypto_init0(void) 254crypto_init0(void)
255{ 255{
256 int error; 256 int error;
257 257
258 mutex_init(&crypto_mtx, MUTEX_DEFAULT, IPL_NONE); 258 mutex_init(&crypto_mtx, MUTEX_DEFAULT, IPL_NONE);
259 mutex_init(&crypto_q_mtx, MUTEX_DEFAULT, IPL_NET); 259 mutex_init(&crypto_q_mtx, MUTEX_DEFAULT, IPL_NET);
260 mutex_init(&crypto_ret_q_mtx, MUTEX_DEFAULT, IPL_NET); 260 mutex_init(&crypto_ret_q_mtx, MUTEX_DEFAULT, IPL_NET);
261 cv_init(&cryptoret_cv, "crypto_w"); 261 cv_init(&cryptoret_cv, "crypto_w");
262 pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0,  262 pool_init(&cryptop_pool, sizeof(struct cryptop), 0, 0,
263 0, "cryptop", NULL, IPL_NET);  263 0, "cryptop", NULL, IPL_NET);
@@ -314,28 +314,30 @@ crypto_destroy(bool exit_kthread) @@ -314,28 +314,30 @@ crypto_destroy(bool exit_kthread)
314 break; 314 break;
315 if (i < crypto_drivers_num) 315 if (i < crypto_drivers_num)
316 return EBUSY; 316 return EBUSY;
317 317
318 /* kick the cryptoret thread and wait for it to exit */ 318 /* kick the cryptoret thread and wait for it to exit */
319 crypto_exit_flag = 1; 319 crypto_exit_flag = 1;
320 cv_signal(&cryptoret_cv); 320 cv_signal(&cryptoret_cv);
321 321
322 while (crypto_exit_flag != 0) 322 while (crypto_exit_flag != 0)
323 cv_wait(&cryptoret_cv, &crypto_ret_q_mtx); 323 cv_wait(&cryptoret_cv, &crypto_ret_q_mtx);
324 mutex_spin_exit(&crypto_ret_q_mtx); 324 mutex_spin_exit(&crypto_ret_q_mtx);
325 } 325 }
326 326
 327#ifdef _MODULE
327 if (sysctl_opencrypto_clog != NULL) 328 if (sysctl_opencrypto_clog != NULL)
328 sysctl_teardown(&sysctl_opencrypto_clog); 329 sysctl_teardown(&sysctl_opencrypto_clog);
 330#endif
329 331
330 unregister_swi(SWI_CRYPTO, cryptointr); 332 unregister_swi(SWI_CRYPTO, cryptointr);
331 333
332 if (crypto_drivers != NULL) 334 if (crypto_drivers != NULL)
333 free(crypto_drivers, M_CRYPTO_DATA); 335 free(crypto_drivers, M_CRYPTO_DATA);
334 336
335 pool_destroy(&cryptop_pool); 337 pool_destroy(&cryptop_pool);
336 pool_destroy(&cryptodesc_pool); 338 pool_destroy(&cryptodesc_pool);
337 pool_destroy(&cryptkop_pool); 339 pool_destroy(&cryptkop_pool);
338 340
339 cv_destroy(&cryptoret_cv); 341 cv_destroy(&cryptoret_cv);
340 342
341 mutex_destroy(&crypto_ret_q_mtx); 343 mutex_destroy(&crypto_ret_q_mtx);