summaryrefslogtreecommitdiffstats
path: root/sys/sys/khelp.h
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2010-12-21 13:45:29 +0000
committerlstewart <lstewart@FreeBSD.org>2010-12-21 13:45:29 +0000
commitdedc1118c91f6a1864ac68ba3afb27deff664992 (patch)
treed1795b16494a34c32c9b508a6fcfbf4c65150d2d /sys/sys/khelp.h
parent0fe57d1c6f569202d830abf45ec5ac8d44e7dcd8 (diff)
downloadFreeBSD-src-dedc1118c91f6a1864ac68ba3afb27deff664992.zip
FreeBSD-src-dedc1118c91f6a1864ac68ba3afb27deff664992.tar.gz
- Introduce the Hhook (Helper Hook) KPI. The KPI is closely modelled on pfil(9),
and in many respects can be thought of as a more generic superset of pfil. Hhook provides a way for kernel subsystems to export hook points that Khelp modules can hook to provide enhanced or new functionality to the kernel. The KPI has been designed to ensure hook points pose no noticeable overhead when no hook functions are registered. - Introduce the Khelp (Kernel Helpers) KPI. Khelp provides a framework for managing Khelp modules, which indirectly use the Hhook KPI to register their hook functions with hook points of interest within the kernel. Khelp modules aim to provide a structured way to dynamically extend the kernel at runtime in an ABI preserving manner. Depending on the subsystem providing hook points, a Khelp module may be able to associate per-object data for maintaining relevant state between hook calls. - pjd's Object Specific Data (OSD) KPI is used to manage the per-object data allocated to Khelp modules. Create a new "OSD_KHELP" OSD type for use by the Khelp framework. - Bump __FreeBSD_version to 900028 to mark the introduction of the new KPIs. In collaboration with: David Hayes <dahayes at swin edu au> and Grenville Armitage <garmitage at swin edu au> Sponsored by: FreeBSD Foundation Reviewed by: bz, others along the way MFC after: 3 months
Diffstat (limited to 'sys/sys/khelp.h')
-rw-r--r--sys/sys/khelp.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/sys/sys/khelp.h b/sys/sys/khelp.h
new file mode 100644
index 0000000..9b3ae1d
--- /dev/null
+++ b/sys/sys/khelp.h
@@ -0,0 +1,76 @@
+/*-
+ * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>
+ * Copyright (c) 2010 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Lawrence Stewart while studying at the Centre
+ * for Advanced Internet Architectures, Swinburne University, made possible in
+ * part by grants from the FreeBSD Foundation and Cisco University Research
+ * Program Fund at Community Foundation Silicon Valley.
+ *
+ * Portions of this software were developed at the Centre for Advanced
+ * Internet Architectures, Swinburne University of Technology, Melbourne,
+ * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * A KPI for managing kernel helper modules which perform useful functionality
+ * within the kernel. Originally released as part of the NewTCP research
+ * project at Swinburne University's Centre for Advanced Internet Architectures,
+ * Melbourne, Australia, which was made possible in part by a grant from the
+ * Cisco University Research Program Fund at Community Foundation Silicon
+ * Valley. More details are available at:
+ * http://caia.swin.edu.au/urp/newtcp/
+ */
+
+#ifndef _SYS_KHELP_H_
+#define _SYS_KHELP_H_
+
+struct helper;
+struct hookinfo;
+struct osd;
+
+/* Helper classes. */
+#define HELPER_CLASS_TCP 0x00000001
+
+/* Public KPI functions. */
+int khelp_register_helper(struct helper *h);
+
+int khelp_deregister_helper(struct helper *h);
+
+int khelp_init_osd(uint32_t classes, struct osd *hosd);
+
+int khelp_destroy_osd(struct osd *hosd);
+
+void * khelp_get_osd(struct osd *hosd, int32_t id);
+
+int32_t khelp_get_id(char *hname);
+
+int khelp_add_hhook(struct hookinfo *hki, uint32_t flags);
+
+int khelp_remove_hhook(struct hookinfo *hki);
+
+#endif /* _SYS_KHELP_H_ */
OpenPOWER on IntegriCloud