From owner-p4-projects@FreeBSD.ORG Thu Mar 27 15:12:54 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2638A37B404; Thu, 27 Mar 2003 15:12:54 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C582E37B401 for ; Thu, 27 Mar 2003 15:12:53 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EF0243F85 for ; Thu, 27 Mar 2003 15:12:51 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h2RNCp0U014715 for ; Thu, 27 Mar 2003 15:12:51 -0800 (PST) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h2RNCoYQ014712 for perforce@freebsd.org; Thu, 27 Mar 2003 15:12:50 -0800 (PST) Date: Thu, 27 Mar 2003 15:12:50 -0800 (PST) Message-Id: <200303272312.h2RNCoYQ014712@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews X-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,LARGE_COLLECTION,PATCH_UNIFIED_DIFF,X_AUTH_WARNING autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Subject: PERFORCE change 27481 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Mar 2003 23:12:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=27481 Change 27481 by rwatson@rwatson_tislabs on 2003/03/27 15:12:11 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/base/lib/libgeom/geom_ctl.c#2 integrate .. //depot/projects/trustedbsd/base/lib/libgeom/libgeom.h#3 integrate .. //depot/projects/trustedbsd/base/share/man/man4/wi.4#10 integrate .. //depot/projects/trustedbsd/base/sys/alpha/linux/linux_sysvec.c#9 integrate .. //depot/projects/trustedbsd/base/sys/coda/coda_fbsd.c#4 integrate .. //depot/projects/trustedbsd/base/sys/dev/ata/ata-disk.c#19 integrate .. //depot/projects/trustedbsd/base/sys/dev/ie/if_ie.c#5 integrate .. //depot/projects/trustedbsd/base/sys/dev/md/md.c#23 integrate .. //depot/projects/trustedbsd/base/sys/dev/syscons/apm/apm_saver.c#5 integrate .. //depot/projects/trustedbsd/base/sys/geom/geom.h#23 integrate .. //depot/projects/trustedbsd/base/sys/geom/geom_ctl.c#6 integrate .. //depot/projects/trustedbsd/base/sys/geom/geom_ctl.h#2 integrate .. //depot/projects/trustedbsd/base/sys/geom/geom_disk.c#24 integrate .. //depot/projects/trustedbsd/base/sys/geom/geom_ext.h#2 integrate .. //depot/projects/trustedbsd/base/sys/i386/linux/linux_sysvec.c#16 integrate .. //depot/projects/trustedbsd/base/sys/ia64/include/float.h#3 integrate .. //depot/projects/trustedbsd/base/sys/net/if_ppp.c#16 integrate .. //depot/projects/trustedbsd/base/sys/netinet/ip_dummynet.c#13 integrate .. //depot/projects/trustedbsd/base/sys/netinet/ip_dummynet.h#7 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_biba/mac_biba.c#27 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_bsdextended/mac_bsdextended.c#11 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_ifoff/mac_ifoff.c#5 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_mls/mac_mls.c#25 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_none/mac_none.c#18 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_partition/mac_partition.c#5 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_seeotheruids/mac_seeotheruids.c#5 integrate .. //depot/projects/trustedbsd/base/sys/security/mac_test/mac_test.c#18 integrate .. //depot/projects/trustedbsd/base/sys/sys/proc.h#38 integrate .. //depot/projects/trustedbsd/base/sys/sys/ucred.h#12 integrate .. //depot/projects/trustedbsd/base/sys/ufs/ffs/ffs_rawread.c#2 integrate .. //depot/projects/trustedbsd/base/tools/regression/lib/libc/gen/test-fpclassify.c#2 integrate .. //depot/projects/trustedbsd/base/usr.sbin/jail/Makefile#2 integrate .. //depot/projects/trustedbsd/base/usr.sbin/jail/jail.8#11 integrate .. //depot/projects/trustedbsd/base/usr.sbin/jail/jail.c#3 integrate .. //depot/projects/trustedbsd/base/usr.sbin/lpr/common_source/lp.local.h#2 integrate .. //depot/projects/trustedbsd/base/usr.sbin/lpr/lpr/printcap.5#4 integrate Differences ... ==== //depot/projects/trustedbsd/base/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 @@ -35,29 +35,30 @@ #include #include #include +#include #include #include #include #include -#define GEOM_CTL_TABLE 1 +#define GCTL_TABLE 1 #include #include 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/base/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/base/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/base/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 #include +#include #include #undef szsigcode ==== //depot/projects/trustedbsd/base/sys/coda/coda_fbsd.c#4 (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;iqueue, 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/base/sys/dev/ie/if_ie.c#5 (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 */ @@ -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 = ⊤ /* @@ -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/base/sys/dev/md/md.c#23 (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/base/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 @@ -44,10 +44,8 @@ #include #ifdef PC98 #include -#include -#else +#endif #include -#endif extern int apm_display(int newstate); ==== //depot/projects/trustedbsd/base/sys/geom/geom.h#23 (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/base/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 #include -#define GEOM_CTL_TABLE 1 +#define GCTL_TABLE 1 #include #include @@ -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) <<<