Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Don't create duplicate tables for the same device.



details:   https://anonhg.NetBSD.org/src/rev/f4cc0b8fc422
branches:  trunk
changeset: 581646:f4cc0b8fc422
user:      elad <elad%NetBSD.org@localhost>
date:      Fri Jun 03 13:21:35 2005 +0000

description:
Don't create duplicate tables for the same device.

diffstat:

 sbin/veriexecctl/veriexecctl.c |  13 ++++++++-----
 sys/dev/verified_exec.c        |  10 +++++++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r 72f105e82600 -r f4cc0b8fc422 sbin/veriexecctl/veriexecctl.c
--- a/sbin/veriexecctl/veriexecctl.c    Fri Jun 03 13:16:02 2005 +0000
+++ b/sbin/veriexecctl/veriexecctl.c    Fri Jun 03 13:21:35 2005 +0000
@@ -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@localhost>
@@ -109,13 +109,16 @@
 
        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 "
diff -r 72f105e82600 -r f4cc0b8fc422 sys/dev/verified_exec.c
--- a/sys/dev/verified_exec.c   Fri Jun 03 13:16:02 2005 +0000
+++ b/sys/dev/verified_exec.c   Fri Jun 03 13:21:35 2005 +0000
@@ -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@localhost>
@@ -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 @@
                        (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);



Home | Main Index | Thread Index | Old Index