Don't create duplicate tables for the same device.

This commit is contained in:
elad 2005-06-03 13:21:35 +00:00
parent b8d51f1d4b
commit 055b86e224
2 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: veriexecctl.c,v 1.13 2005/06/01 18:29:16 elad Exp $ */
/* $NetBSD: veriexecctl.c,v 1.14 2005/06/03 13:21:35 elad Exp $ */
/*-
* Copyright 2005 Elad Efrat <elad@bsd.org.il>
@ -109,13 +109,16 @@ phase1_preload(void)
while (!CIRCLEQ_EMPTY(&params_list)) {
struct veriexec_up *vup;
extern int errno;
vup = CIRCLEQ_FIRST(&params_list);
if (ioctl(gfd, VERIEXEC_TABLESIZE, &(vup->vu_param)) == -1)
err(1, "Error in phase 1: Can't "
"set hash table size for device %d",
vup->vu_param.dev);
if (ioctl(gfd, VERIEXEC_TABLESIZE, &(vup->vu_param)) == -1) {
if (errno != EEXIST)
err(1, "Error in phase 1: Can't "
"set hash table size for device %d",
vup->vu_param.dev);
}
if (verbose) {
printf(" => Hash table sizing successful for device "

View File

@ -1,4 +1,4 @@
/* $NetBSD: verified_exec.c,v 1.10 2005/05/22 22:34:01 elad Exp $ */
/* $NetBSD: verified_exec.c,v 1.11 2005/06/03 13:21:35 elad Exp $ */
/*-
* Copyright 2005 Elad Efrat <elad@bsd.org.il>
@ -31,9 +31,9 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.10 2005/05/22 22:34:01 elad Exp $");
__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.11 2005/06/03 13:21:35 elad Exp $");
#else
__RCSID("$Id: verified_exec.c,v 1.10 2005/05/22 22:34:01 elad Exp $\n$NetBSD: verified_exec.c,v 1.10 2005/05/22 22:34:01 elad Exp $");
__RCSID("$Id: verified_exec.c,v 1.11 2005/06/03 13:21:35 elad Exp $\n$NetBSD: verified_exec.c,v 1.11 2005/06/03 13:21:35 elad Exp $");
#endif
#include <sys/param.h>
@ -171,6 +171,10 @@ veriexecioctl(dev_t dev __unused, u_long cmd, caddr_t data,
(struct veriexec_sizing_params *) data;
u_char node_name[16];
/* Check for existing table for device. */
if (veriexec_tblfind(params->dev) != NULL)
return (EEXIST);
/* Allocate and initialize a Veriexec hash table. */
tbl = malloc(sizeof(struct veriexec_hashtbl), M_TEMP,
M_WAITOK);