Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys Pull up revision 1.10 (requested by elad in ticket #3...
details: https://anonhg.NetBSD.org/src/rev/26c8278e49bc
branches: netbsd-3
changeset: 576147:26c8278e49bc
user: tron <tron%NetBSD.org@localhost>
date: Fri Jun 10 15:15:57 2005 +0000
description:
Pull up revision 1.10 (requested by elad in ticket #389):
Add indication for number of fingerprinted files on each device.
When a table is created for a new device, a new variable is created
under the kern.veriexec.count node named "dev_<id>". For example,
dev_0, dev_3, etc.
diffstat:
sys/dev/verified_exec.c | 18 +++++++++++++++---
sys/sys/verified_exec.h | 10 ++++++++--
2 files changed, 23 insertions(+), 5 deletions(-)
diffs (102 lines):
diff -r ff07a30c6438 -r 26c8278e49bc sys/dev/verified_exec.c
--- a/sys/dev/verified_exec.c Fri Jun 10 15:15:16 2005 +0000
+++ b/sys/dev/verified_exec.c Fri Jun 10 15:15:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: verified_exec.c,v 1.5.2.3 2005/06/10 15:12:11 tron Exp $ */
+/* $NetBSD: verified_exec.c,v 1.5.2.4 2005/06/10 15:15:57 tron 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.5.2.3 2005/06/10 15:12:11 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.5.2.4 2005/06/10 15:15:57 tron Exp $");
#else
-__RCSID("$Id: verified_exec.c,v 1.5.2.3 2005/06/10 15:12:11 tron Exp $\n$NetBSD: verified_exec.c,v 1.5.2.3 2005/06/10 15:12:11 tron Exp $");
+__RCSID("$Id: verified_exec.c,v 1.5.2.4 2005/06/10 15:15:57 tron Exp $\n$NetBSD: verified_exec.c,v 1.5.2.4 2005/06/10 15:15:57 tron Exp $");
#endif
#include <sys/param.h>
@@ -59,6 +59,8 @@
#include <sys/vnode.h>
#include <sys/fcntl.h>
#include <sys/namei.h>
+#include <sys/sysctl.h>
+#define VERIEXEC_NEED_NODE
#include <sys/verified_exec.h>
/* count of number of times device is open (we really only allow one open) */
@@ -167,6 +169,7 @@
case VERIEXEC_TABLESIZE: {
struct veriexec_sizing_params *params =
(struct veriexec_sizing_params *) data;
+ u_char node_name[16];
/* Allocate and initialize a Veriexec hash table. */
tbl = malloc(sizeof(struct veriexec_hashtbl), M_TEMP,
@@ -175,9 +178,18 @@
tbl->hash_dev = params->dev;
tbl->hash_tbl = hashinit(params->hash_size, HASH_LIST, M_TEMP,
M_WAITOK, &hashmask);
+ tbl->hash_count = 0;
LIST_INSERT_HEAD(&veriexec_tables, tbl, hash_list);
+ snprintf(node_name, sizeof(node_name), "dev_%u",
+ tbl->hash_dev);
+
+ sysctl_createv(NULL, 0, &veriexec_count_node, NULL,
+ CTLFLAG_READONLY, CTLTYPE_QUAD, node_name,
+ NULL, NULL, 0, &tbl->hash_count, 0,
+ tbl->hash_dev, CTL_EOL);
+
break;
}
diff -r ff07a30c6438 -r 26c8278e49bc sys/sys/verified_exec.h
--- a/sys/sys/verified_exec.h Fri Jun 10 15:15:16 2005 +0000
+++ b/sys/sys/verified_exec.h Fri Jun 10 15:15:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: verified_exec.h,v 1.6.2.2 2005/06/10 15:12:11 tron Exp $ */
+/* $NetBSD: verified_exec.h,v 1.6.2.3 2005/06/10 15:15:57 tron Exp $ */
/*-
* Copyright 2005 Elad Efrat <elad%bsd.org.il@localhost>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: verified_exec.h,v 1.6.2.2 2005/06/10 15:12:11 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: verified_exec.h,v 1.6.2.3 2005/06/10 15:15:57 tron Exp $");
/*
*
@@ -74,6 +74,7 @@
#define VERIEXEC_VERBOSE 1 /* Verbosity level. */
#define VERIEXEC_STRICT 2 /* Strict mode level. */
#define VERIEXEC_ALGORITHMS 3 /* Supported hashing algorithms. */
+#define VERIEXEC_COUNT 4 /* # of fingerprinted files on device. */
#ifdef _KERNEL
void veriexecattach(struct device *, struct device *, void *);
@@ -85,6 +86,10 @@
extern char *veriexec_fp_names;
extern int veriexec_verbose;
extern int veriexec_strict;
+/* this one requires sysctl.h to be included before verified_exec.h */
+#ifdef VERIEXEC_NEED_NODE
+extern struct sysctlnode *veriexec_count_node;
+#endif /* VERIEXEC_NEED_NODE */
/*
* Operations vector for verified exec, this defines the characteristics
@@ -126,6 +131,7 @@
struct veriexec_hashhead *hash_tbl;
size_t hash_size; /* Number of slots in the table. */
dev_t hash_dev; /* Device ID the hash table refers to. */
+ uint64_t hash_count; /* # of fingerprinted files in table. */
LIST_ENTRY(veriexec_hashtbl) hash_list;
};
Home |
Main Index |
Thread Index |
Old Index