PERFORCE change 27482 for review

Robert Watson rwatson at freebsd.org
Thu Mar 27 23:20:00 GMT 2003


http://perforce.freebsd.org/chv.cgi?CH=27482

Change 27482 by rwatson at rwatson_tislabs on 2003/03/27 15:19:42

	       Integ the TrustedBSD base branch -- primarily to loop back
	       removal of "trustedbsd_" from the front of policy short names,
	       but also to pick up O_DIRECT, better low memory handling.

Affected files ...

.. //depot/projects/trustedbsd/mac/lib/libgeom/geom_ctl.c#2 integrate
.. //depot/projects/trustedbsd/mac/lib/libgeom/libgeom.h#3 integrate
.. //depot/projects/trustedbsd/mac/share/man/man4/wi.4#10 integrate
.. //depot/projects/trustedbsd/mac/sys/alpha/linux/linux_sysvec.c#9 integrate
.. //depot/projects/trustedbsd/mac/sys/coda/coda_fbsd.c#6 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/ata/ata-disk.c#17 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/ie/if_ie.c#7 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/md/md.c#22 integrate
.. //depot/projects/trustedbsd/mac/sys/dev/syscons/apm/apm_saver.c#5 integrate
.. //depot/projects/trustedbsd/mac/sys/geom/geom.h#22 integrate
.. //depot/projects/trustedbsd/mac/sys/geom/geom_ctl.c#6 integrate
.. //depot/projects/trustedbsd/mac/sys/geom/geom_ctl.h#2 integrate
.. //depot/projects/trustedbsd/mac/sys/geom/geom_disk.c#22 integrate
.. //depot/projects/trustedbsd/mac/sys/geom/geom_ext.h#2 integrate
.. //depot/projects/trustedbsd/mac/sys/i386/linux/linux_sysvec.c#18 integrate
.. //depot/projects/trustedbsd/mac/sys/ia64/include/float.h#3 integrate
.. //depot/projects/trustedbsd/mac/sys/net/if_ppp.c#18 integrate
.. //depot/projects/trustedbsd/mac/sys/netinet/ip_dummynet.c#14 integrate
.. //depot/projects/trustedbsd/mac/sys/netinet/ip_dummynet.h#7 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#202 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#71 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_ifoff/mac_ifoff.c#20 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_mls/mac_mls.c#161 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_none/mac_none.c#120 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_partition/mac_partition.c#24 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_seeotheruids/mac_seeotheruids.c#21 integrate
.. //depot/projects/trustedbsd/mac/sys/security/mac_test/mac_test.c#97 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/proc.h#40 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/ucred.h#19 integrate
.. //depot/projects/trustedbsd/mac/sys/ufs/ffs/ffs_rawread.c#2 integrate
.. //depot/projects/trustedbsd/mac/tools/regression/lib/libc/gen/test-fpclassify.c#2 integrate
.. //depot/projects/trustedbsd/mac/usr.sbin/jail/Makefile#2 integrate
.. //depot/projects/trustedbsd/mac/usr.sbin/jail/jail.8#10 integrate
.. //depot/projects/trustedbsd/mac/usr.sbin/jail/jail.c#3 integrate
.. //depot/projects/trustedbsd/mac/usr.sbin/lpr/common_source/lp.local.h#2 integrate
.. //depot/projects/trustedbsd/mac/usr.sbin/lpr/lpr/printcap.5#4 integrate

Differences ...

==== //depot/projects/trustedbsd/mac/lib/libgeom/geom_ctl.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libgeom/geom_ctl.c,v 1.1 2003/03/23 10:15:02 phk Exp $
+ * $FreeBSD: src/lib/libgeom/geom_ctl.c,v 1.2 2003/03/27 14:35:00 phk Exp $
  */
 
 #include <stdio.h>
@@ -35,29 +35,30 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include <stdarg.h>
+#include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 #include <paths.h>
 
 #include <sys/queue.h>
 
-#define GEOM_CTL_TABLE 1
+#define GCTL_TABLE 1
 #include <libgeom.h>
 
 #include <geom/geom_ext.h>
 
 void
-geom_ctl_dump(struct geom_ctl_req *req, FILE *f)
+gctl_dump(struct gctl_req *req, FILE *f)
 {
 	u_int i;
 	int j;
-	struct geom_ctl_req_arg *ap;
+	struct gctl_req_arg *ap;
 
 	if (req == NULL) {
-		fprintf(f, "Dump of geom_ctl request at NULL\n");
+		fprintf(f, "Dump of gctl request at NULL\n");
 		return;
 	}
-	fprintf(f, "Dump of geom_ctl %s request at %p:\n", req->reqt->name, req);
+	fprintf(f, "Dump of gctl %s request at %p:\n", req->reqt->name, req);
 	if (req->error != NULL)
 		fprintf(f, "  error:\t\"%s\"\n", req->error);
 	else
@@ -68,24 +69,30 @@
 			fprintf(f, "  param:\t\"%s\"", ap->name);
 		else
 			fprintf(f, "  meta:\t@%jd", (intmax_t)ap->offset);
+		fprintf(f, " [%s%s",
+		    ap->flag & GCTL_PARAM_RD ? "R" : "",
+		    ap->flag & GCTL_PARAM_WR ? "W" : "");
 		fflush(f);
-		if (ap->len < 0)
-			fprintf(f, " = [%d] \"%s\"", -ap->len, (char *)ap->value);
+		if (ap->flag & GCTL_PARAM_ASCII)
+			fprintf(f, "%d] = \"%s\"", ap->len, (char *)ap->value);
 		else if (ap->len > 0) {
-			fprintf(f, " = [%d]", ap->len);
+			fprintf(f, "%d] = ", ap->len);
 			fflush(f);
 			for (j = 0; j < ap->len; j++) {
 				fprintf(f, " %02x", ((u_char *)ap->value)[j]);
 			}
 		} else {
-			fprintf(f, " = [0] %p", ap->value);
+			fprintf(f, "0] = %p", ap->value);
 		}
 		fprintf(f, "\n");
 	}
 }
 
+/*
+ * Set an error message, if one does not already exist.
+ */
 static void
-geom_ctl_set_error(struct geom_ctl_req *req, const char *error, ...)
+gctl_set_error(struct gctl_req *req, const char *error, ...)
 {
 	va_list ap;
 
@@ -93,107 +100,145 @@
 		return;
 	va_start(ap, error);
 	vasprintf(&req->error, error, ap);
+	va_end(ap);
 }
 
+/*
+ * Check that a malloc operation succeeded, and set a consistent error
+ * message if not.
+ */
 static void
-geom_ctl_check_alloc(struct geom_ctl_req *req, void *ptr)
+gctl_check_alloc(struct gctl_req *req, void *ptr)
 {
 	if (ptr != NULL)
 		return;
-	geom_ctl_set_error(req, "Could not allocate memory");
+	gctl_set_error(req, "Could not allocate memory");
+	if (req->error == NULL)
+		req->error = "Could not allocate memory";
 }
 
-struct geom_ctl_req *
-geom_ctl_get_handle(enum geom_ctl_request req)
+/*
+ * Allocate a new request handle of the specified type.
+ * XXX: Why bother checking the type ?
+ */
+struct gctl_req *
+gctl_get_handle(enum gctl_request req)
 {
-	struct geom_ctl_req_table *gtp;
-	struct geom_ctl_req *rp;
+	struct gctl_req_table *gtp;
+	struct gctl_req *rp;
 
 	rp = calloc(1, sizeof *rp);
 	if (rp == NULL)
 		return (NULL);
 	for (gtp = gcrt; gtp->request != req; gtp++)
-		if (gtp->request == GEOM_INVALID_REQUEST)
+		if (gtp->request == GCTL_INVALID_REQUEST)
 			break;
 
 	rp->request = req;
 	rp->reqt = gtp;
-	if (rp->reqt->request == GEOM_INVALID_REQUEST)
-		geom_ctl_set_error(rp, "Invalid request");
+	if (rp->reqt->request == GCTL_INVALID_REQUEST)
+		gctl_set_error(rp, "Invalid request");
 	return (rp);
 }
 
+/*
+ * Allocate space for another argument.
+ */
+static struct gctl_req_arg *
+gctl_new_arg(struct gctl_req *req)
+{
+	struct gctl_req_arg *ap;
+
+	req->narg++;
+	req->arg = realloc(req->arg, sizeof *ap * req->narg);
+	gctl_check_alloc(req, req->arg);
+	if (req->arg == NULL) {
+		req->narg = 0;
+		return (NULL);
+	}
+	ap = req->arg + (req->narg - 1);
+	memset(ap, 0, sizeof *ap);
+	return (ap);
+}
+
 void
-geom_ctl_set_param(struct geom_ctl_req *req, const char *name, int len, void* value)
+gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* value)
 {
-	struct geom_ctl_req_arg *ap;
+	struct gctl_req_arg *ap;
 
 	if (req == NULL || req->error != NULL)
 		return;
-	if (req->reqt->params == 0)
-		geom_ctl_set_error(req, "Request takes no parameters");
-	req->narg++;
-	req->arg = realloc(req->arg, sizeof *ap * req->narg);
-	geom_ctl_check_alloc(req, req->arg);
-	if (req->arg != NULL) {
-		ap = req->arg + (req->narg - 1);
-		memset(ap, 0, sizeof *ap);
-		ap->name = strdup(name);
-		geom_ctl_check_alloc(req, ap->name);
-		ap->nlen = strlen(ap->name);
+	ap = gctl_new_arg(req);
+	if (ap == NULL)
+		return;
+	ap->name = strdup(name);
+	gctl_check_alloc(req, ap->name);
+	ap->nlen = strlen(ap->name) + 1;
+	ap->value = __DECONST(void *, value);
+	ap->flag = GCTL_PARAM_RD;
+	if (len >= 0)
 		ap->len = len;
-		if (len > 0) {
-			ap->value = value;
-		} else if (len < 0) {
-			ap->len = -strlen(value);	
-			ap->value = strdup(value);
-		} else {
-			ap->value = value;
-		}
-		if (len != 0)
-			geom_ctl_check_alloc(req, ap->value);
-	} else {
-		req->narg = 0;
+	else if (len < 0) {
+		ap->flag |= GCTL_PARAM_ASCII;
+		ap->len = strlen(value) + 1;	
 	}
 }
 
 void
-geom_ctl_set_meta(struct geom_ctl_req *req, off_t offset, u_int len, void* value)
+gctl_rw_param(struct gctl_req *req, const char *name, int len, void* value)
 {
-	struct geom_ctl_req_arg *ap;
-	u_int i;
+	struct gctl_req_arg *ap;
 
 	if (req == NULL || req->error != NULL)
 		return;
-	if (req->reqt->meta == 0)
-		geom_ctl_set_error(req, "Request takes no meta data");
-	for (i = 0; i < req->narg; i++) {
-		ap = &req->arg[i];
-		if (ap->name != NULL)
-			continue;
-		if (ap->offset >= offset + len)
-			continue;
-		if (ap->offset + ap->len <= offset)
-			continue;
-		geom_ctl_set_error(req, "Overlapping meta data");
+	ap = gctl_new_arg(req);
+	if (ap == NULL)
 		return;
-	}
-	req->narg++;
-	req->arg = realloc(req->arg, sizeof *ap * req->narg);
-	geom_ctl_check_alloc(req, req->arg);
-	if (req->arg != NULL) {
-		ap = req->arg + (req->narg - 1);
-		memset(ap, 0, sizeof *ap);
-		ap->value = value;
-		ap->offset = offset;
+	ap->name = strdup(name);
+	gctl_check_alloc(req, ap->name);
+	ap->nlen = strlen(ap->name) + 1;
+	ap->value = value;
+	ap->flag = GCTL_PARAM_RW;
+	if (len >= 0)
 		ap->len = len;
-	} else {
-		req->narg = 0;
-	}
+	else if (len < 0)
+		ap->len = strlen(value) + 1;	
+}
+
+void
+gctl_ro_meta(struct gctl_req *req, off_t offset, u_int len, const void* value)
+{
+	struct gctl_req_arg *ap;
+
+	if (req == NULL || req->error != NULL)
+		return;
+	ap = gctl_new_arg(req);
+	if (ap == NULL)
+		return;
+	ap->value = __DECONST(void *, value);
+	ap->flag = GCTL_PARAM_RD;
+	ap->offset = offset;
+	ap->len = len;
+}
+
+void
+gctl_rw_meta(struct gctl_req *req, off_t offset, u_int len, void* value)
+{
+	struct gctl_req_arg *ap;
+
+	if (req == NULL || req->error != NULL)
+		return;
+	ap = gctl_new_arg(req);
+	if (ap == NULL)
+		return;
+	ap->value = value;
+	ap->flag = GCTL_PARAM_RW;
+	ap->offset = offset;
+	ap->len = len;
 }
 
 const char *
-geom_ctl_issue(struct geom_ctl_req *req)
+gctl_issue(struct gctl_req *req)
 {
 	int fd, error;
 
@@ -202,16 +247,21 @@
 	if (req->error != NULL)
 		return (req->error);
 
-	req->version = GEOM_CTL_VERSION;
+	req->version = GCTL_VERSION;
 	req->lerror = BUFSIZ;		/* XXX: arbitrary number */
 	req->error = malloc(req->lerror);
+	if (req->error == NULL) {
+		gctl_check_alloc(req, req->error);
+		return (req->error);
+	}
 	memset(req->error, 0, req->lerror);
 	req->lerror--;
 	fd = open(_PATH_DEV PATH_GEOM_CTL, O_RDONLY);
 	if (fd < 0)
 		return(strerror(errno));
 	error = ioctl(fd, GEOM_CTL, req);
-	if (error && errno == EINVAL && req->error[0] != '\0')
+	close(fd);
+	if (req->error[0] != '\0')
 		return (req->error);
 	if (error != 0)
 		return(strerror(errno));
@@ -219,19 +269,18 @@
 }
 
 void
-geom_ctl_free(struct geom_ctl_req *req)
+gctl_free(struct gctl_req *req)
 {
 	u_int i;
 
+	if (req == NULL)
+		return;
 	for (i = 0; i < req->narg; i++) {
 		if (req->arg[i].name != NULL)
 			free(req->arg[i].name);
-		if (req->arg[i].len < 0)
-			free(req->arg[i].value);
 	}
+	free(req->arg);
 	if (req->error != NULL)
 		free(req->error);
-	free(req->arg);
 	free(req);
 }
-

==== //depot/projects/trustedbsd/mac/lib/libgeom/libgeom.h#3 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libgeom/libgeom.h,v 1.6 2003/03/23 10:15:02 phk Exp $
+ * $FreeBSD: src/lib/libgeom/libgeom.h,v 1.7 2003/03/27 14:35:00 phk Exp $
  */
 #ifndef _LIBGEOM_H_
 #define _LIBGEOM_H_
@@ -129,23 +129,17 @@
 
 /* geom_ctl.c */
 
-struct geom_ctl_req;
+struct gctl_req;
 
 #ifdef _STDIO_H_			/* limit #include pollution */
-void geom_ctl_dump(struct geom_ctl_req *req, FILE *f);
+void gctl_dump(struct gctl_req *req, FILE *f);
 #endif
-void geom_ctl_free(struct geom_ctl_req *req);
-struct geom_ctl_req *geom_ctl_get_handle(enum geom_ctl_request req);
-const char *geom_ctl_issue(struct geom_ctl_req *req);
-void geom_ctl_set_class_by_id(struct geom_ctl_req *req, void *id);
-void geom_ctl_set_class_by_name(struct geom_ctl_req *req, const char *name);
-void geom_ctl_set_consumer_by_id(struct geom_ctl_req *req, void *id);
-void geom_ctl_set_consumer_by_name(struct geom_ctl_req *req, const char *name);
-void geom_ctl_set_geom_by_id(struct geom_ctl_req *req, void *id);
-void geom_ctl_set_geom_by_name(struct geom_ctl_req *req, const char *name);
-void geom_ctl_set_meta(struct geom_ctl_req *req, off_t offset, u_int len, void* val);
-void geom_ctl_set_param(struct geom_ctl_req *req, const char *name, int len, void* val);
-void geom_ctl_set_provider_by_id(struct geom_ctl_req *req, void *id);
-void geom_ctl_set_provider_by_name(struct geom_ctl_req *req, const char *name);
+void gctl_free(struct gctl_req *req);
+struct gctl_req *gctl_get_handle(enum gctl_request req);
+const char *gctl_issue(struct gctl_req *req);
+void gctl_ro_meta(struct gctl_req *req, off_t offset, u_int len, const void* val);
+void gctl_rw_meta(struct gctl_req *req, off_t offset, u_int len, void* val);
+void gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* val);
+void gctl_rw_param(struct gctl_req *req, const char *name, int len, void* val);
 
 #endif /* _LIBGEOM_H_ */

==== //depot/projects/trustedbsd/mac/share/man/man4/wi.4#10 (text+ko) ====

@@ -28,7 +28,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/wi.4,v 1.38 2003/03/05 02:37:20 imp Exp $
+.\" $FreeBSD: src/share/man/man4/wi.4,v 1.39 2003/03/27 19:33:22 shiba Exp $
 .\"	$OpenBSD: wi.4tbl,v 1.14 2002/04/29 19:53:50 jsyn Exp $
 .\"
 .Dd February 17, 2003
@@ -144,7 +144,7 @@
 Addtron AWP-100	Prism-II	PCMCIA
 Adtec Adlink/340C	Prism-II	PCMCIA
 Agere Orinoco	Hermes	PCMCIA
-Allied Telesis WR211PCM	Prism?	PCMCIA
+Allied Telesis WR211PCM	Prism-II	PCMCIA
 ArTem OnAir	Prism?	PCMCIA
 Avaya Wireless	Prism-II	PCMCIA
 Bay eMobility 11B	Prism-2.5?	PCMCIA
@@ -208,7 +208,7 @@
 TDK LAK-CD011WL	Prism-II	PCMCIA
 Toshiba Wireless LAN Card	Prism-II	PCMCIA
 U.S. Robotics Wireless Card 2410	Prism-II	PCMCIA
-YIS TWL-11B	Prism-II	PCMCIA
+YIS YWL-11B	Prism-II	PCMCIA
 .El
 .Pp
 Several vendors sell PCI adapters built around the PLX Technology 9050

==== //depot/projects/trustedbsd/mac/sys/alpha/linux/linux_sysvec.c#9 (text+ko) ====

@@ -25,7 +25,7 @@
  * (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: src/sys/alpha/linux/linux_sysvec.c,v 1.86 2003/03/26 18:29:44 jhb Exp $
+ * $FreeBSD: src/sys/alpha/linux/linux_sysvec.c,v 1.87 2003/03/27 18:18:35 jhb Exp $
  */
 
 /* XXX we use functions that might not exist. */
@@ -60,6 +60,7 @@
 
 #include <alpha/linux/linux.h>
 #include <alpha/linux/linux_proto.h>
+#include <compat/linux/linux_mib.h>
 #include <compat/linux/linux_util.h>
 #undef szsigcode
 

==== //depot/projects/trustedbsd/mac/sys/coda/coda_fbsd.c#6 (text+ko) ====

@@ -27,7 +27,7 @@
  * Mellon the rights to redistribute these changes without encumbrance.
  * 
  * 	@(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD: src/sys/coda/coda_fbsd.c,v 1.28 2003/03/03 12:15:40 phk Exp $
+ * $FreeBSD: src/sys/coda/coda_fbsd.c,v 1.29 2003/03/27 12:47:53 tjr Exp $
  * 
  */
 
@@ -173,6 +173,8 @@
 static void coda_fbsd_drvuninit(void *unused);
 static void coda_fbsd_clone(void *arg, char *name, int namelen, dev_t *dev);
 
+static eventhandler_tag clonetag;
+
 static void coda_fbsd_clone(arg, name, namelen, dev)
     void *arg;
     char *name;
@@ -196,7 +198,7 @@
 {
     int i;
 
-    EVENTHANDLER_REGISTER(dev_clone,coda_fbsd_clone,0,1000);
+    clonetag = EVENTHANDLER_REGISTER(dev_clone,coda_fbsd_clone,0,1000);
     for(i=0;i<NVCODA;i++)
 	coda_mnttbl[i].dev = NULL; 
 }
@@ -206,7 +208,7 @@
 {
     int i;
 
-    EVENTHANDLER_DEREGISTER(dev_clone,NULL);
+    EVENTHANDLER_DEREGISTER(dev_clone,clonetag);
     for(i=0;i<NVCODA;i++)
 	if(coda_mnttbl[i].dev)
 	    destroy_dev(coda_mnttbl[i].dev);

==== //depot/projects/trustedbsd/mac/sys/dev/ata/ata-disk.c#17 (text+ko) ====

@@ -25,7 +25,7 @@
  * (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: src/sys/dev/ata/ata-disk.c,v 1.147 2003/03/08 08:01:27 phk Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.148 2003/03/27 10:48:21 sos Exp $
  */
 
 #include "opt_ata.h"
@@ -356,8 +356,12 @@
 	    return;
     }
 
+    /* remove request from drive queue */
+    bioq_remove(&adp->queue, bp); 
+
     if (!(request = malloc(sizeof(struct ad_request), M_AD, M_NOWAIT|M_ZERO))) {
 	ata_prtdev(atadev, "out of memory in start\n");
+	biofinish(bp, NULL, ENOMEM);
 	return;
     }
 
@@ -377,9 +381,6 @@
     /* insert in tag array */
     adp->tags[tag] = request;
 
-    /* remove from drive queue */
-    bioq_remove(&adp->queue, bp); 
-
     /* link onto controller queue */
     TAILQ_INSERT_TAIL(&atadev->channel->ata_queue, request, chain);
 }

==== //depot/projects/trustedbsd/mac/sys/dev/ie/if_ie.c#7 (text+ko) ====

@@ -47,7 +47,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/ie/if_ie.c,v 1.87 2003/02/19 05:47:06 imp Exp $
+ * $FreeBSD: src/sys/dev/ie/if_ie.c,v 1.89 2003/03/27 20:38:00 mdodd Exp $
  *
  * MAINTAINER: Matthew N. Dodd <winter at jurai.net>
  */
@@ -222,6 +222,7 @@
 	INTR_TYPE_NET,
 	ieprobe, ieattach, "ie"
 };
+COMPAT_ISA_DRIVER(ie, iedriver);
 
 enum ie_hardware {
 	IE_STARLAN10,
@@ -783,13 +784,10 @@
 	       ie->arpcom.ac_enaddr, ":");
 
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-	ifp->if_output = ether_output;
 	ifp->if_start = iestart;
 	ifp->if_ioctl = ieioctl;
 	ifp->if_init = ieinit;
-	ifp->if_type = IFT_ETHER;
-	ifp->if_addrlen = 6;
-	ifp->if_hdrlen = 14;
+	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 
 	if (ie->hard_type == IE_EE16)
 		EVENTHANDLER_REGISTER(shutdown_post_sync, ee16_shutdown,
@@ -1123,6 +1121,7 @@
 static __inline int
 ieget(int unit, struct ie_softc *ie, struct mbuf **mp)
 {
+	struct	ether_header eh;
 	struct	mbuf *m, *top, **mymp;
 	int	offset;
 	int	totlen, resid;
@@ -1133,18 +1132,10 @@
 	if (totlen <= 0)
 		return (-1);
 
-	MGETHDR(m, M_DONTWAIT, MT_DATA);
-	if (!m) {
-		ie_drop_packet_buffer(unit, ie);
-		/* XXXX if_ierrors++; */
-		return (-1);
-	}
-
 	/*
 	 * Snarf the Ethernet header.
 	 */
-	bcopy((v_caddr_t) ie->cbuffs[ie->rbhead], mtod(m, caddr_t),
-		sizeof (struct ether_header));
+	bcopy((caddr_t)ie->cbuffs[ie->rbhead], &eh, sizeof(struct ether_header));
 	/* ignore cast-qual warning here */
 
 	/*
@@ -1153,7 +1144,7 @@
 	 * This is only a consideration when FILTER is defined; i.e., when
 	 * we are either running BPF or doing multicasting.
 	 */
-	if (!check_eh(ie, mtod(m, struct ether_header *))) {
+	if (!check_eh(ie, &eh)) {
 		m_free(m);
 		ie_drop_packet_buffer(unit, ie);
 		ie->arpcom.ac_if.if_ierrors--;	/* just this case, it's not an
@@ -1162,16 +1153,19 @@
 		return (-1);
 	}
 
-	/* XXX way too complicated, check carefully XXXX */
+	MGETHDR(m, M_DONTWAIT, MT_DATA);
+	if (!m) {
+		ie_drop_packet_buffer(unit, ie);
+		/* XXXX if_ierrors++; */
+		return (-1);
+	}
 
 	*mp = m;
 	m->m_pkthdr.rcvif = &ie->arpcom.ac_if;
-	/* deduct header just copied; m_len must reflect space avail below */
-	m->m_len = MHLEN - sizeof (struct ether_header);
-	m->m_pkthdr.len = totlen;
+	m->m_len = MHLEN;
+	resid = m->m_pkthdr.len = totlen;
+	top = 0;
 
-	resid = totlen - sizeof (struct ether_header);	/* remaining data */
-	top = NULL;
 	mymp = &top;
 
 	/*
@@ -1212,10 +1206,11 @@
 		mymp = &m->m_next;
 	} while (resid > 0);
 
-	resid = totlen - sizeof (struct ether_header);	/* remaining data */
-	offset = sizeof (struct ether_header);		/* packet offset */
+	resid = totlen;					/* remaining data */
+	offset = 0;					/* packet offset */
+	thismboff = 0;					/* offset in m */
+
 	m = top;					/* current mbuf */
-	thismboff = sizeof (struct ether_header);	/* offset in m */
 	head = ie->rbhead;				/* current rx buffer */
 
 	/*

==== //depot/projects/trustedbsd/mac/sys/dev/md/md.c#22 (text+ko) ====

@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/dev/md/md.c,v 1.91 2003/03/24 19:46:26 phk Exp $
+ * $FreeBSD: src/sys/dev/md/md.c,v 1.92 2003/03/27 10:14:36 phk Exp $
  *
  */
 
@@ -240,9 +240,13 @@
 
 	/*
 	 * XXX: the top layer is probably not fully populated, so we allocate
-	 * too much space for ip->array in new_indir() here.
+	 * too much space for ip->array in here.
 	 */
-	ip = new_indir(layer * nshift);
+	ip = malloc(sizeof *ip, M_MD, M_WAITOK | M_ZERO);
+	ip->array = malloc(sizeof(uintptr_t) * NINDIR,
+	    M_MDSECT, M_WAITOK | M_ZERO);
+	ip->total = NINDIR;
+	ip->shift = layer * nshift;
 	return (ip);
 }
 

==== //depot/projects/trustedbsd/mac/sys/dev/syscons/apm/apm_saver.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  * (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: src/sys/dev/syscons/apm/apm_saver.c,v 1.8 2003/03/24 19:14:45 mdodd Exp $
+ * $FreeBSD: src/sys/dev/syscons/apm/apm_saver.c,v 1.9 2003/03/27 07:37:02 mdodd Exp $
  */
 
 #include <sys/param.h>
@@ -44,10 +44,8 @@
 #include <machine/pc/bios.h>
 #ifdef PC98
 #include <machine/bus.h>
-#include <pc98/apm/apm.h>
-#else
+#endif
 #include <i386/bios/apm.h>
-#endif
 
 extern int apm_display(int newstate);
 

==== //depot/projects/trustedbsd/mac/sys/geom/geom.h#22 (text+ko) ====

@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/geom/geom.h,v 1.49 2003/03/25 09:07:35 phk Exp $
+ * $FreeBSD: src/sys/geom/geom.h,v 1.50 2003/03/27 14:34:59 phk Exp $
  */
 
 #ifndef _GEOM_GEOM_H_
@@ -62,9 +62,12 @@
 struct thread;
 struct bio;
 struct sbuf;
+struct gctl_req;
 struct g_configargs;
 
 typedef int g_config_t (struct g_configargs *ca);
+typedef int g_ctl_create_geom_t (struct gctl_req *, struct g_class *cp, struct g_provider *pp);
+typedef int g_ctl_destroy_geom_t (struct gctl_req *, struct g_class *cp, struct g_geom *gp);
 typedef struct g_geom * g_taste_t (struct g_class *, struct g_provider *,
     int flags);
 #define G_TF_NORMAL		0
@@ -90,6 +93,8 @@
 	const char		*name;
 	g_taste_t		*taste;
 	g_config_t		*config;
+	g_ctl_create_geom_t	*create_geom;
+	g_ctl_destroy_geom_t	*destroy_geom;
 	/*
 	 * The remaning elements are private and classes should use
 	 * the G_CLASS_INITIALIZER macro to initialize them.
@@ -426,6 +431,10 @@
 	 */
 
 
+/* geom_ctl.c */
+void *gctl_get_param(struct gctl_req *req, const char *param, int *len);
+int gctl_error(struct gctl_req *req, const char *errtxt);
+
 /* geom_enc.c */
 uint16_t g_dec_be2(const u_char *p);
 uint32_t g_dec_be4(const u_char *p);

==== //depot/projects/trustedbsd/mac/sys/geom/geom_ctl.c#6 (text+ko) ====

@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/geom/geom_ctl.c,v 1.10 2003/03/24 13:37:15 phk Exp $
+ * $FreeBSD: src/sys/geom/geom_ctl.c,v 1.11 2003/03/27 14:34:59 phk Exp $
  */
 
 #include "opt_geom.h"
@@ -55,7 +55,7 @@
 
 #include <geom/geom.h>
 #include <geom/geom_int.h>
-#define GEOM_CTL_TABLE 1
+#define GCTL_TABLE 1
 #include <geom/geom_ctl.h>
 #include <geom/geom_ext.h>
 
@@ -74,6 +74,10 @@
 
 	make_dev(&g_ctl_cdevsw, 0,
 	    UID_ROOT, GID_OPERATOR, 0640, PATH_GEOM_CTL);
+	KASSERT(GCTL_PARAM_RD == VM_PROT_READ,
+		("GCTL_PARAM_RD != VM_PROT_READ"));
+	KASSERT(GCTL_PARAM_WR == VM_PROT_WRITE,
+		("GCTL_PARAM_WR != VM_PROT_WRITE"));
 }
 
 static int
@@ -125,8 +129,8 @@
  * XXX: should not be static.
  * XXX: should take printf like args.
  */
-static int
-g_ctl_seterror(struct geom_ctl_req *req, const char *errtxt)
+int
+gctl_error(struct gctl_req *req, const char *errtxt)
 {
 	int error;
 
@@ -142,7 +146,7 @@
  * XXX: this should really be a standard function in the kernel.
  */
 static void *
-geom_alloc_copyin(void *uaddr, size_t len, int *errp)
+geom_alloc_copyin(struct gctl_req *req, void *uaddr, size_t len, int *errp)
 {
 	int error;
 	void *ptr;
@@ -154,6 +158,7 @@
 		error = copyin(uaddr, ptr, len);
 	if (!error)
 		return (ptr);
+	gctl_error(req, "no access to argument");
 	*errp = error;
 	if (ptr != NULL)
 		g_free(ptr);
@@ -169,45 +174,46 @@
  */
 
 static int
-geom_ctl_copyin(struct geom_ctl_req *req)
+gctl_copyin(struct gctl_req *req)
 {
 	int error, i, j;
-	struct geom_ctl_req_arg *ap;
+	struct gctl_req_arg *ap;
 	char *p;
 
 	error = 0;
-	if (!useracc(req->error, req->lerror, VM_PROT_WRITE))
-		return (g_ctl_seterror(req, "No access to error field"));
-	ap = geom_alloc_copyin(req->arg, req->narg * sizeof(*ap), &error);
-	if (ap == NULL)
+	ap = geom_alloc_copyin(req, req->arg, req->narg * sizeof(*ap), &error);
+	if (ap == NULL) {
+		gctl_error(req, "copyin() of arguments failed");
 		return (error);
+	}
+
 	for (i = 0; !error && i < req->narg; i++) {
-		if (ap[i].len < 0 &&
-		    !useracc(ap[i].value, 1 + -ap[i].len, VM_PROT_READ))
-			error = g_ctl_seterror(req, "No access to param data");
-		else if (ap[i].len > 0 &&
-		    !useracc(ap[i].value, ap[i].len,
-			   VM_PROT_READ | VM_PROT_WRITE))
-			error = g_ctl_seterror(req, "No access to param data");
-		if (ap[i].name == NULL)
-			continue;
+		if (ap[i].len > 0 &&
+		    !useracc(ap[i].value, ap[i].len, 
+		    ap[i].flag & GCTL_PARAM_RW))
+			error = gctl_error(req, "no access to param data");
+		if (ap[i].name == NULL) {
+			if (req->reqt->meta)
+				continue;
+			error = gctl_error(req,
+			    "request does not take metadata arguments");
+			break;
+		}
 		p = NULL;
-		if (ap[i].nlen < 1 || ap[i].nlen > SPECNAMELEN)
-			error = EINVAL;
-		if (error)
+		if (ap[i].nlen < 1 || ap[i].nlen > SPECNAMELEN) {
+			error = gctl_error(req, "wrong param name length");
 			break;
-		p = geom_alloc_copyin(ap[i].name, ap[i].nlen + 1, &error);
-		if (error)
+		}
+		p = geom_alloc_copyin(req, ap[i].name, ap[i].nlen, &error);
+		if (p == NULL)
 			break;
-		if (p[ap[i].nlen] != '\0')
-			error = EINVAL;
-		if (!error) {
-			ap[i].name = p;
-			ap[i].nlen = 0;
-		} else {
+		if (p[ap[i].nlen - 1] != '\0') {
+			error = gctl_error(req, "unterminated param name");
 			g_free(p);
 			break;
 		}
+		ap[i].name = p;
+		ap[i].nlen = 0;
 	}
 	if (!error) {
 		req->arg = ap;
@@ -221,17 +227,17 @@
 }
 
 static void
-geom_ctl_dump(struct geom_ctl_req *req)
+gctl_dump(struct gctl_req *req)
 {
 	u_int i;
 	int j, error;
-	struct geom_ctl_req_arg *ap;
+	struct gctl_req_arg *ap;
 	void *p;
 	
 
-	printf("Dump of geom_ctl %s request at %p:\n", req->reqt->name, req);
+	printf("Dump of gctl %s request at %p:\n", req->reqt->name, req);
 	if (req->lerror > 0) {
-		p = geom_alloc_copyin(req->error, req->lerror, &error);
+		p = geom_alloc_copyin(req, req->error, req->lerror, &error);
 		if (p != NULL) {
 			((char *)p)[req->lerror - 1] = '\0';
 			printf("  error:\t\"%s\"\n", (char *)p);
@@ -244,15 +250,19 @@
 			printf("  param:\t\"%s\"", ap->name);
 		else
 			printf("  meta:\t@%jd", (intmax_t)ap->offset);
-		printf(" [%d] = ", ap->len);
-		if (ap->len < 0) {
-			p = geom_alloc_copyin(ap->value, 1 + -ap->len, &error);
-			((char *)p)[-ap->len] = '\0';
-			if (p != NULL)
+		printf(" [%s%s%d] = ",
+		    ap->flag & GCTL_PARAM_RD ? "R" : "",
+		    ap->flag & GCTL_PARAM_WR ? "W" : "",
+		    ap->len);
+		if (ap->flag & GCTL_PARAM_ASCII) {
+			p = geom_alloc_copyin(req, ap->value, ap->len, &error);
+			if (p != NULL) {
+				((char *)p)[ap->len - 1] = '\0';
 				printf("\"%s\"", (char *)p);
+			}
 			g_free(p);
 		} else if (ap->len > 0) {
-			p = geom_alloc_copyin(ap->value, ap->len, &error);
+			p = geom_alloc_copyin(req, ap->value, ap->len, &error);
 			for (j = 0; j < ap->len; j++)
 				printf(" %02x", ((u_char *)p)[j]);
 			g_free(p);
@@ -263,6 +273,171 @@
 	}
 }
 
+void *
+gctl_get_param(struct gctl_req *req, const char *param, int *len)
+{
+	int i, error, j;
+	void *p;
+	struct gctl_req_arg *ap;
+
+	for (i = 0; i < req->narg; i++) {
+		ap = &req->arg[i];
+		if (strcmp(param, ap->name))
+			continue;
+		if (!(ap->flag & GCTL_PARAM_RD))
+			continue;
+		if (ap->len > 0)
+			j = ap->len;
+		else
+			j = 0;
+		if (j != 0)
+			p = geom_alloc_copyin(req, ap->value, j, &error);
+			/* XXX: should not fail, tested prviously */
+		else
+			p = ap->value;
+		if (len != NULL)
+			*len = j;
+		return (p);
+	}
+	return (NULL);
+}
+
+static struct g_class*
+gctl_get_class(struct gctl_req *req)
+{
+	char *p;
+	int len;
+	struct g_class *cp;
+
+	p = gctl_get_param(req, "class", &len);
+	if (p == NULL)
+		return (NULL);
+	if (p[len - 1] != '\0') {
+		gctl_error(req, "Unterminated class name");
+		g_free(p);
+		return (NULL);
+	}
+	LIST_FOREACH(cp, &g_classes, class) {
+		if (!strcmp(p, cp->name)) {
+			g_free(p);
+			return (cp);
+		}
+	}
+	gctl_error(req, "Class not found");

>>> TRUNCATED FOR MAIL (1000 lines) <<<
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list