From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 03:47:06 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 935B01065670; Sun, 6 Sep 2009 03:47:06 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [66.246.138.153]) by mx1.freebsd.org (Postfix) with ESMTP id 697168FC1D; Sun, 6 Sep 2009 03:47:06 +0000 (UTC) Received: from gluon.draftnet (87-194-158-129.bethere.co.uk [87.194.158.129]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA id 5CC468471; Sun, 6 Sep 2009 03:47:05 +0000 (UTC) Date: Sun, 6 Sep 2009 04:47:00 +0100 From: Bruce Cran To: Brooks Davis Message-ID: <20090906044700.5208ba62@gluon.draftnet> In-Reply-To: <20090904221432.GC82231@lor.one-eyed-alien.net> References: <200907241503.n6OF3ATP013228@svn.freebsd.org> <20090829201228.00005860@unknown> <20090904221432.GC82231@lor.one-eyed-alien.net> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.4; i386-portbld-freebsd7.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r195843 - in head: lib/libkvm sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 03:47:06 -0000 On Fri, 4 Sep 2009 17:14:32 -0500 Brooks Davis wrote: > On Sat, Aug 29, 2009 at 08:12:28PM +0100, Bruce Cran wrote: > > On Fri, 24 Jul 2009 15:03:10 +0000 (UTC) > > Brooks Davis wrote: > > > > > Author: brooks > > > Date: Fri Jul 24 15:03:10 2009 > > > New Revision: 195843 > > > URL: http://svn.freebsd.org/changeset/base/195843 > > > > > > Log: > > > Revert the changes to struct kinfo_proc in r194498. Instead, > > > fill in up to 16 (KI_NGROUPS) values and steal a bit from > > > ki_cr_flags (all bits currently unused) to indicate overflow with > > > the new flag KI_CRF_GRP_OVERFLOW. > > > > > > This fixes procstat -s. > > > > > > Approved by: re (kib) > > > > Hi Brooks, > > > > This checkin appears to have broken crash dump support: the bcopy in > > kvm_proc.c crashes when running "ps -ax -M /var/crash/vmcore.x > > -N /boot/kernel/kernel", apparently because ucred.cr_groups isn't > > valid. Does it need converted using KVM_READ first? > > Sorry for the delay, I believe you are correct we need to use kvm_read > here instead of the bcopy. Do you still have a core handy you can > test a patch against? The following should do it. The patch has fixed the crash, and data is now returned too. -- Bruce From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 06:05:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84A8A106566B; Sun, 6 Sep 2009 06:05:23 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73AA48FC14; Sun, 6 Sep 2009 06:05:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8665Nqg074681; Sun, 6 Sep 2009 06:05:23 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8665Npo074679; Sun, 6 Sep 2009 06:05:23 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200909060605.n8665Npo074679@svn.freebsd.org> From: Julian Elischer Date: Sun, 6 Sep 2009 06:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196876 - stable/8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 06:05:23 -0000 Author: julian Date: Sun Sep 6 06:05:23 2009 New Revision: 196876 URL: http://svn.freebsd.org/changeset/base/196876 Log: MFC of r196477 Don't delete copies of nthread_create(9) we find inthe filesystem. we now link it to kproc_create(9), it's new name. Approved by: re (kib) Modified: stable/8/ObsoleteFiles.inc Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Sun Sep 6 01:03:19 2009 (r196875) +++ stable/8/ObsoleteFiles.inc Sun Sep 6 06:05:23 2009 (r196876) @@ -803,8 +803,6 @@ OLD_FILES+=rescue/bsdlabel OLD_FILES+=rescue/fdisk OLD_FILES+=rescue/gpt .endif -# 20071026: kthread(9)/kproc(9) API changes -OLD_FILES+=usr/share/man/man9/kthread_create.9.gz # 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd OLD_FILES+=etc/rc.d/nfslocking # 20070930: rename of cached to nscd From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 06:48:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABB091065692; Sun, 6 Sep 2009 06:48:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AD448FC12; Sun, 6 Sep 2009 06:48:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n866moU6075522; Sun, 6 Sep 2009 06:48:50 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n866mooB075520; Sun, 6 Sep 2009 06:48:50 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060648.n866mooB075520@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 06:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196877 - head/sbin/geom/core X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 06:48:50 -0000 Author: pjd Date: Sun Sep 6 06:48:50 2009 New Revision: 196877 URL: http://svn.freebsd.org/changeset/base/196877 Log: For any given subcommand allow to specify multi-line usage (separated by \n). Submitted by: Mel Flynn Modified: head/sbin/geom/core/geom.c Modified: head/sbin/geom/core/geom.c ============================================================================== --- head/sbin/geom/core/geom.c Sun Sep 6 06:05:23 2009 (r196876) +++ head/sbin/geom/core/geom.c Sun Sep 6 06:48:50 2009 (r196877) @@ -98,11 +98,21 @@ usage_command(struct g_command *cmd, con struct g_option *opt; unsigned i; - fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name); if (cmd->gc_usage != NULL) { - fprintf(stderr, " %s\n", cmd->gc_usage); + char *pos, *ptr, *sptr; + + sptr = ptr = strdup(cmd->gc_usage); + while ((pos = strsep(&ptr, "\n")) != NULL) { + if (*pos == '\0') + continue; + fprintf(stderr, "%s %s %s %s\n", prefix, comm, + cmd->gc_name, pos); + } + free(sptr); return; } + + fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name); if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) fprintf(stderr, " [-v]"); for (i = 0; ; i++) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 06:49:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76D101065692; Sun, 6 Sep 2009 06:49:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 665648FC1D; Sun, 6 Sep 2009 06:49:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n866nxp5075588; Sun, 6 Sep 2009 06:49:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n866nxFC075586; Sun, 6 Sep 2009 06:49:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060649.n866nxFC075586@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 06:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196878 - head/sbin/geom/core X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 06:49:59 -0000 Author: pjd Date: Sun Sep 6 06:49:59 2009 New Revision: 196878 URL: http://svn.freebsd.org/changeset/base/196878 Log: Update copyright years. Modified: head/sbin/geom/core/geom.c Modified: head/sbin/geom/core/geom.c ============================================================================== --- head/sbin/geom/core/geom.c Sun Sep 6 06:48:50 2009 (r196877) +++ head/sbin/geom/core/geom.c Sun Sep 6 06:49:59 2009 (r196878) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 06:52:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 377DC106566B; Sun, 6 Sep 2009 06:52:07 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 252388FC0A; Sun, 6 Sep 2009 06:52:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n866q7XR075668; Sun, 6 Sep 2009 06:52:07 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n866q71p075664; Sun, 6 Sep 2009 06:52:07 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060652.n866q71p075664@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 06:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196879 - in head: sbin/geom/class/mirror sys/geom/mirror X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 06:52:07 -0000 Author: pjd Date: Sun Sep 6 06:52:06 2009 New Revision: 196879 URL: http://svn.freebsd.org/changeset/base/196879 Log: Add support for changing providers priority. Submitted by: Mel Flynn Modified: head/sbin/geom/class/mirror/geom_mirror.c head/sbin/geom/class/mirror/gmirror.8 head/sys/geom/mirror/g_mirror_ctl.c Modified: head/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- head/sbin/geom/class/mirror/geom_mirror.c Sun Sep 6 06:49:59 2009 (r196878) +++ head/sbin/geom/class/mirror/geom_mirror.c Sun Sep 6 06:52:06 2009 (r196879) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,13 +41,12 @@ __FBSDID("$FreeBSD$"); #include #include - uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_MIRROR_VERSION; static char label_balance[] = "split", configure_balance[] = "none"; static intmax_t label_slice = 4096, configure_slice = -1; -static intmax_t insert_priority = 0; +static intmax_t insert_priority = 0, configure_priority = -1; static void mirror_main(struct gctl_req *req, unsigned flags); static void mirror_activate(struct gctl_req *req); @@ -71,10 +70,12 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, + { 'p', "priority", &configure_priority, G_TYPE_NUMBER }, { 's', "slice", &configure_slice, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-adfFhnv] [-b balance] [-s slice] name" + NULL, "[-adfFhnv] [-b balance] [-s slice] name\n" + "[-v] -p priority name prov" }, { "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, "[-v] name prov ..." Modified: head/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- head/sbin/geom/class/mirror/gmirror.8 Sun Sep 6 06:49:59 2009 (r196878) +++ head/sbin/geom/class/mirror/gmirror.8 Sun Sep 6 06:52:06 2009 (r196879) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004-2005 Pawel Jakub Dawidek +.\" Copyright (c) 2004-2009 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2006 +.Dd August 1, 2009 .Dt GMIRROR 8 .Os .Sh NAME @@ -49,6 +49,12 @@ .Op Fl s Ar slice .Ar name .Nm +.Cm configure +.Op Fl v +.Fl p Ar priority +.Ar name +.Ar prov +.Nm .Cm rebuild .Op Fl v .Ar name @@ -115,8 +121,8 @@ indicates an action to be performed: .It Cm label Create a mirror. The order of components is important, because a component's priority is based on its position -(starting from 0). -The component with the biggest priority is used by the +(starting from 0 to 255). +The component with the biggest priority (the lowest number) is used by the .Cm prefer balance algorithm and is also used as a master component when resynchronization is needed, @@ -159,7 +165,7 @@ Clear metadata on the given providers. Configure the given device. .Pp Additional options include: -.Bl -tag -width ".Fl b Ar balance" +.Bl -tag -width ".Fl p Ar priority" .It Fl a Turn on autosynchronization of stale components. .It Fl b Ar balance @@ -175,6 +181,9 @@ Assumes device is in consistent state. Hardcode providers' names in metadata. .It Fl n Turn off autosynchronization of stale components. +.It Fl p Ar priority +Specifies priority for the given component +.Ar prov . .It Fl s Ar slice Specifies slice size for .Cm split Modified: head/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- head/sys/geom/mirror/g_mirror_ctl.c Sun Sep 6 06:49:59 2009 (r196878) +++ head/sys/geom/mirror/g_mirror_ctl.c Sun Sep 6 06:52:06 2009 (r196879) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2006 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,19 +93,19 @@ g_mirror_ctl_configure(struct gctl_req * { struct g_mirror_softc *sc; struct g_mirror_disk *disk; - const char *name, *balancep; - intmax_t *slicep; + const char *name, *balancep, *prov; + intmax_t *slicep, *priority; uint32_t slice; uint8_t balance; int *autosync, *noautosync, *failsync, *nofailsync, *hardcode, *dynamic; - int *nargs, do_sync = 0, dirty = 1; + int *nargs, do_sync = 0, dirty = 1, do_priority = 0; nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); if (nargs == NULL) { gctl_error(req, "No '%s' argument.", "nargs"); return; } - if (*nargs != 1) { + if (*nargs != 1 && *nargs != 2) { gctl_error(req, "Invalid number of arguments."); return; } @@ -149,6 +149,29 @@ g_mirror_ctl_configure(struct gctl_req * gctl_error(req, "No '%s' argument.", "dynamic"); return; } + priority = gctl_get_paraml(req, "priority", sizeof(*priority)); + if (priority == NULL) { + gctl_error(req, "No '%s' argument.", "priority"); + return; + } + if (*priority < -1 || *priority > 255) { + gctl_error(req, "Priority range is 0 to 255, %jd given", + *priority); + return; + } + /* + * Since we have a priority, we also need a provider now. + * Note: be WARNS safe, by always assigning prov and only throw an + * error if *priority != -1. + */ + prov = gctl_get_asciiparam(req, "arg1"); + if (*priority > -1) { + if (prov == NULL) { + gctl_error(req, "Priority needs a disk name"); + return; + } + do_priority = 1; + } if (*autosync && *noautosync) { gctl_error(req, "'%s' and '%s' specified.", "autosync", "noautosync"); @@ -189,19 +212,32 @@ g_mirror_ctl_configure(struct gctl_req * slice = sc->sc_slice; else slice = *slicep; - if (g_mirror_ndisks(sc, -1) < sc->sc_ndisks) { + /* Enforce usage() of -p not allowing any other options. */ + if (do_priority && (*autosync || *noautosync || *failsync || + *nofailsync || *hardcode || *dynamic || *slicep != -1 || + strcmp(balancep, "none") != 0)) { sx_xunlock(&sc->sc_lock); - gctl_error(req, "Not all disks connected. Try 'forget' command " - "first."); + gctl_error(req, "only -p accepted when setting priority"); return; } if (sc->sc_balance == balance && sc->sc_slice == slice && !*autosync && !*noautosync && !*failsync && !*nofailsync && !*hardcode && - !*dynamic) { + !*dynamic && !do_priority) { sx_xunlock(&sc->sc_lock); gctl_error(req, "Nothing has changed."); return; } + if ((!do_priority && *nargs != 1) || (do_priority && *nargs != 2)) { + sx_xunlock(&sc->sc_lock); + gctl_error(req, "Invalid number of arguments."); + return; + } + if (g_mirror_ndisks(sc, -1) < sc->sc_ndisks) { + sx_xunlock(&sc->sc_lock); + gctl_error(req, "Not all disks connected. Try 'forget' command " + "first."); + return; + } sc->sc_balance = balance; sc->sc_slice = slice; if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOAUTOSYNC) != 0) { @@ -223,6 +259,23 @@ g_mirror_ctl_configure(struct gctl_req * } } LIST_FOREACH(disk, &sc->sc_disks, d_next) { + /* + * Handle priority first, since we only need one disk, do one + * operation on it and then we're done. No need to check other + * flags, as usage doesn't allow it. + */ + if (do_priority) { + if (strcmp(disk->d_name, prov) == 0) { + if (disk->d_priority == *priority) + gctl_error(req, "Nothing has changed."); + else { + disk->d_priority = *priority; + g_mirror_update_metadata(disk); + } + break; + } + continue; + } if (do_sync) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) disk->d_flags &= ~G_MIRROR_DISK_FLAG_FORCE_SYNC; From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 07:22:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91D5B1065676; Sun, 6 Sep 2009 07:22:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80E548FC14; Sun, 6 Sep 2009 07:22:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n867MA5e076319; Sun, 6 Sep 2009 07:22:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n867MAWM076318; Sun, 6 Sep 2009 07:22:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060722.n867MAWM076318@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 07:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196880 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 07:22:10 -0000 Author: pjd Date: Sun Sep 6 07:22:09 2009 New Revision: 196880 URL: http://svn.freebsd.org/changeset/base/196880 Log: Synchornize description in manual page with strerror() output. Modified: head/lib/libc/sys/intro.2 Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Sun Sep 6 06:52:06 2009 (r196879) +++ head/lib/libc/sys/intro.2 Sun Sep 6 07:22:09 2009 (r196880) @@ -302,7 +302,7 @@ Internet protocols. .It Er 48 EADDRINUSE Em "Address already in use" . Only one usage of each address is normally permitted. .Pp -.It Er 49 EADDRNOTAVAIL Em "Cannot assign requested address" . +.It Er 49 EADDRNOTAVAIL Em "Can't assign requested address" . Normally results from an attempt to create a socket with an address not on this machine. .It Er 50 ENETDOWN Em "Network is down" . @@ -335,7 +335,7 @@ when already connected. An request to send or receive data was disallowed because the socket was not connected and (when sending on a datagram socket) no address was supplied. -.It Er 58 ESHUTDOWN Em "Cannot send after socket shutdown" . +.It Er 58 ESHUTDOWN Em "Can't send after socket shutdown" . A request to send data was disallowed because the socket had already been shut down with a previous .Xr shutdown 2 From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 07:29:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E519D106566B; Sun, 6 Sep 2009 07:29:23 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FE888FC12; Sun, 6 Sep 2009 07:29:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n867TNm0076479; Sun, 6 Sep 2009 07:29:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n867TNBa076478; Sun, 6 Sep 2009 07:29:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060729.n867TNBa076478@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 07:29:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196881 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 07:29:24 -0000 Author: pjd Date: Sun Sep 6 07:29:22 2009 New Revision: 196881 URL: http://svn.freebsd.org/changeset/base/196881 Log: Correct comment. Modified: head/sys/netinet/ip_fastfwd.c Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Sun Sep 6 07:22:09 2009 (r196880) +++ head/sys/netinet/ip_fastfwd.c Sun Sep 6 07:29:22 2009 (r196881) @@ -151,8 +151,8 @@ ip_findroute(struct route *ro, struct in /* * Try to forward a packet based on the destination address. * This is a fast path optimized for the plain forwarding case. - * If the packet is handled (and consumed) here then we return 1; - * otherwise 0 is returned and the packet should be delivered + * If the packet is handled (and consumed) here then we return NULL; + * otherwise mbuf is returned and the packet should be delivered * to ip_input for full processing. */ struct mbuf * From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 07:30:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0E0F1065672; Sun, 6 Sep 2009 07:30:21 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C06728FC21; Sun, 6 Sep 2009 07:30:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n867ULi7076541; Sun, 6 Sep 2009 07:30:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n867ULKm076539; Sun, 6 Sep 2009 07:30:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060730.n867ULKm076539@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 07:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196882 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 07:30:21 -0000 Author: pjd Date: Sun Sep 6 07:30:21 2009 New Revision: 196882 URL: http://svn.freebsd.org/changeset/base/196882 Log: Correct typo in comment. Modified: head/sys/netipsec/ipsec.h Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Sun Sep 6 07:29:22 2009 (r196881) +++ head/sys/netipsec/ipsec.h Sun Sep 6 07:30:21 2009 (r196882) @@ -61,7 +61,7 @@ * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code. */ struct secpolicyindex { - u_int8_t dir; /* direction of packet flow, see blow */ + u_int8_t dir; /* direction of packet flow, see below */ union sockaddr_union src; /* IP src address for SP */ union sockaddr_union dst; /* IP dst address for SP */ u_int8_t prefs; /* prefix length in bits for src */ From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 07:32:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCC2F106566C; Sun, 6 Sep 2009 07:32:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC3828FC08; Sun, 6 Sep 2009 07:32:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n867WGs7076610; Sun, 6 Sep 2009 07:32:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n867WGwc076608; Sun, 6 Sep 2009 07:32:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909060732.n867WGwc076608@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 07:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196883 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 07:32:17 -0000 Author: pjd Date: Sun Sep 6 07:32:16 2009 New Revision: 196883 URL: http://svn.freebsd.org/changeset/base/196883 Log: Improve code a bit by eliminating goto and having one unlock per lock. Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sun Sep 6 07:30:21 2009 (r196882) +++ head/sys/netipsec/key.c Sun Sep 6 07:32:16 2009 (r196883) @@ -918,15 +918,14 @@ key_allocsa_policy(const struct secasind state_valid = saorder_state_valid_prefer_new; arraysize = N(saorder_state_valid_prefer_new); } - SAHTREE_UNLOCK(); - goto found; + break; } } SAHTREE_UNLOCK(); - return NULL; + if (sah == NULL) + return NULL; - found: /* search valid state */ for (stateidx = 0; stateidx < arraysize; stateidx++) { sav = key_do_allocsa_policy(sah, state_valid[stateidx]); From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 09:39:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AEDD1065670; Sun, 6 Sep 2009 09:39:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 194328FC13; Sun, 6 Sep 2009 09:39:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n869deWX079088; Sun, 6 Sep 2009 09:39:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n869deVU079085; Sun, 6 Sep 2009 09:39:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200909060939.n869deVU079085@svn.freebsd.org> From: Ed Schouten Date: Sun, 6 Sep 2009 09:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196884 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 09:39:41 -0000 Author: ed Date: Sun Sep 6 09:39:40 2009 New Revision: 196884 URL: http://svn.freebsd.org/changeset/base/196884 Log: Perform cleanups to the TTY headers: - Properly sort the ioctls in ioctl_compat.h. Also perform some whitespace fixes. - Properly comment all the unused/compat ioctls in ttycom.h. Modified: head/sys/sys/ioctl_compat.h head/sys/sys/ttycom.h Modified: head/sys/sys/ioctl_compat.h ============================================================================== --- head/sys/sys/ioctl_compat.h Sun Sep 6 07:32:16 2009 (r196883) +++ head/sys/sys/ioctl_compat.h Sun Sep 6 09:39:40 2009 (r196884) @@ -73,12 +73,12 @@ struct sgttyb { #define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ #define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ -#define TIOCHPCL _IO('t', 2) /* hang up on last close */ -#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ -#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ -#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/ -#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ -#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ +#define TIOCHPCL _IO('t', 2) /* hang up on last close */ +#define TIOCGETP _IOR('t', 8, struct sgttyb) /* get parameters */ +#define TIOCSETP _IOW('t', 9, struct sgttyb) /* set parameters */ +#define TIOCSETN _IOW('t',10, struct sgttyb) /* as above, but no flush */ +#define TIOCSETC _IOW('t',17, struct tchars) /* set special characters */ +#define TIOCGETC _IOR('t',18, struct tchars) /* get special characters */ #define TANDEM 0x00000001 /* send stopc on out q full */ #define CBREAK 0x00000002 /* half-cooked mode */ #define LCASE 0x00000004 /* simulate lower case */ @@ -126,9 +126,9 @@ struct sgttyb { #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ #define NOFLSH 0x80000000 /* no output flush on signal */ -#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ -#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ -#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ +#define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ +#define TIOCGLTC _IOR('t', 116,struct ltchars) /* get special chars */ +#define TIOCSLTC _IOW('t', 117,struct ltchars) /* set special chars */ #define TIOCLGET _IOR('t', 124, int) /* get local modes */ #define LCRTBS (CRTBS>>16) #define LPRTERA (PRTERA>>16) @@ -145,8 +145,8 @@ struct sgttyb { #define LPENDIN (PENDIN>>16) #define LDECCTQ (DECCTQ>>16) #define LNOFLSH (NOFLSH>>16) -#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/ -#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/ -#define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ +#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ +#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ +#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ #endif /* !_SYS_IOCTL_COMPAT_H_ */ Modified: head/sys/sys/ttycom.h ============================================================================== --- head/sys/sys/ttycom.h Sun Sep 6 07:32:16 2009 (r196883) +++ head/sys/sys/ttycom.h Sun Sep 6 09:39:40 2009 (r196884) @@ -57,10 +57,9 @@ struct winsize { }; /* 0-2 compat */ - /* 3-4 obsolete */ - /* 5-7 obsolete or unused */ + /* 3-7 unused */ /* 8-10 compat */ - /* 11-12 obsolete or unused */ + /* 11-12 unused */ #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ #define TIOCGPTN _IOR('t', 15, int) /* Get pts number. */ @@ -70,34 +69,34 @@ struct winsize { #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ - /* 23-25 obsolete or unused */ + /* 23-25 unused */ #define TIOCGETD _IOR('t', 26, int) /* get line discipline */ #define TIOCSETD _IOW('t', 27, int) /* set line discipline */ #define TIOCPTMASTER _IO('t', 28) /* pts master validation */ - /* 29-69 free */ - /* 80-84 slip */ + /* 29-85 unused */ #define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ #define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ - /* 88 slip, ppp; conflicts */ + /* 88 unused */ + /* 89-91 conflicts: tun and tap */ #define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp * of last input event */ - /* 70-90 ppp; many conflicts */ #define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ #define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ - /* 90-92 tap; some conflicts */ + /* 92-93 tun and tap */ + /* 94-97 conflicts: tun and tap */ #define TIOCDRAIN _IO('t', 94) /* wait till output drained */ #define TIOCSIG _IOWINT('t', 95) /* pty: generate signal */ #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ - /* 90-97 tun; some conflicts */ #define TIOCSCTTY _IO('t', 97) /* become controlling tty */ #define TIOCCONS _IOW('t', 98, int) /* become virtual console */ #define TIOCGSID _IOR('t', 99, int) /* get session id */ - /* 100 see consio.h */ + /* 100 unused */ #define TIOCSTAT _IO('t', 101) /* simulate ^T status message */ #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ + /* 105 unused */ #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ #define TIOCM_LE 0001 /* line enable */ #define TIOCM_DTR 0002 /* data terminal ready */ From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 09:59:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60CFA106566B; Sun, 6 Sep 2009 09:59:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FE568FC16; Sun, 6 Sep 2009 09:59:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n869x2Qj079519; Sun, 6 Sep 2009 09:59:02 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n869x2Hu079517; Sun, 6 Sep 2009 09:59:02 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200909060959.n869x2Hu079517@svn.freebsd.org> From: Ed Schouten Date: Sun, 6 Sep 2009 09:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196885 - head/sys/dev/null X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 09:59:02 -0000 Author: ed Date: Sun Sep 6 09:59:02 2009 New Revision: 196885 URL: http://svn.freebsd.org/changeset/base/196885 Log: Remove unneeded minor numbers from /dev/null and /dev/zero. Modified: head/sys/dev/null/null.c Modified: head/sys/dev/null/null.c ============================================================================== --- head/sys/dev/null/null.c Sun Sep 6 09:39:40 2009 (r196884) +++ head/sys/dev/null/null.c Sun Sep 6 09:59:02 2009 (r196885) @@ -49,9 +49,6 @@ static d_write_t null_write; static d_ioctl_t null_ioctl; static d_read_t zero_read; -#define NULL_MINOR 2 -#define ZERO_MINOR 12 - static struct cdevsw null_cdevsw = { .d_version = D_VERSION, .d_read = (d_read_t *)nullop, @@ -115,10 +112,10 @@ null_modevent(module_t mod __unused, int if (bootverbose) printf("null: \n"); zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - null_dev = make_dev(&null_cdevsw, NULL_MINOR, UID_ROOT, - GID_WHEEL, 0666, "null"); - zero_dev = make_dev(&zero_cdevsw, ZERO_MINOR, UID_ROOT, - GID_WHEEL, 0666, "zero"); + null_dev = make_dev(&null_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0666, "null"); + zero_dev = make_dev(&zero_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0666, "zero"); break; case MOD_UNLOAD: From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 10:27:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B91C1065670; Sun, 6 Sep 2009 10:27:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0933A8FC12; Sun, 6 Sep 2009 10:27:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86ARjJl080194; Sun, 6 Sep 2009 10:27:45 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86ARjvr080188; Sun, 6 Sep 2009 10:27:45 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200909061027.n86ARjvr080188@svn.freebsd.org> From: Ed Schouten Date: Sun, 6 Sep 2009 10:27:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196886 - in head: share/man/man4 sys/dev/pty sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 10:27:46 -0000 Author: ed Date: Sun Sep 6 10:27:45 2009 New Revision: 196886 URL: http://svn.freebsd.org/changeset/base/196886 Log: Move ptmx into pty(4). Now that pty(4) is a loadable kernel module, I'd better move /dev/ptmx in there as well. This means that pty(4) now provides almost all pseudo-terminal compatibility code. This means it's very easy to test whether applications use the proper library interfaces when allocating pseudo-terminals (namely posix_openpt and openpty). Modified: head/share/man/man4/pts.4 head/share/man/man4/pty.4 head/sys/dev/pty/pty.c head/sys/kern/tty_pts.c head/sys/sys/tty.h Modified: head/share/man/man4/pts.4 ============================================================================== --- head/share/man/man4/pts.4 Sun Sep 6 09:59:02 2009 (r196885) +++ head/share/man/man4/pts.4 Sun Sep 6 10:27:45 2009 (r196886) @@ -147,15 +147,6 @@ The files used by this pseudo-terminals implementation are: .Pp .Bl -tag -width ".Pa /dev/pts/[num]" -.It Pa /dev/ptmx -Control device, returns a file descriptor to a new master -pseudo-terminal when opened. -This device should not be opened directly. -It's only available for binary compatibility. -New devices should only be allocated with -.Xr posix_openpt 2 -and -.Xr openpty 3 . .It Pa /dev/pts/[num] Pseudo-terminal slave devices. .El Modified: head/share/man/man4/pty.4 ============================================================================== --- head/share/man/man4/pty.4 Sun Sep 6 09:59:02 2009 (r196885) +++ head/share/man/man4/pty.4 Sun Sep 6 10:27:45 2009 (r196886) @@ -32,7 +32,7 @@ .Os .Sh NAME .Nm pty -.Nd BSD-style compatibility pseudo-terminal driver +.Nd BSD-style and System V-style compatibility pseudo-terminal driver .Sh SYNOPSIS .Cd "device pty" .Sh DESCRIPTION @@ -48,6 +48,12 @@ driver. A device node for this terminal shall be created, which has the name .Pa /dev/ttyXX . .Pp +The +.Nm +driver also provides a cloning System V +.Pa /dev/ptmx +device. +.Pp New code should not try to allocate pseudo-terminals using this interface. It is only provided for compatibility with older C libraries @@ -63,6 +69,9 @@ device names: Pseudo-terminal master devices. .It Pa /dev/tty[l-sL-S][0-9a-v] Pseudo-terminal slave devices. +.It Pa /dev/ptmx +Control device, returns a file descriptor to a new master +pseudo-terminal when opened. .El .Sh DIAGNOSTICS None. @@ -75,7 +84,7 @@ A pseudo-terminal driver appeared in .Bx 4.2 . .Sh BUGS -Unlike previous implementations, the master slave device nodes are +Unlike previous implementations, the master and slave device nodes are destroyed when the PTY becomes unused. A call to .Xr stat 2 Modified: head/sys/dev/pty/pty.c ============================================================================== --- head/sys/dev/pty/pty.c Sun Sep 6 09:59:02 2009 (r196885) +++ head/sys/dev/pty/pty.c Sun Sep 6 10:27:45 2009 (r196886) @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); * the pts(4) driver. We just call into pts(4) to create the actual PTY. * To make sure we don't use the same PTY multiple times, we abuse * si_drv1 inside the cdev to mark whether the PTY is in use. + * + * It also implements a /dev/ptmx device node, which is useful for Linux + * binary emulation. */ static unsigned int pty_warningcnt = 1; @@ -119,12 +122,27 @@ pty_clone(void *arg, struct ucred *cr, c } static int +ptmx_fdopen(struct cdev *dev __unused, int fflags, struct thread *td, + struct file *fp) +{ + + return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); +} + +static struct cdevsw ptmx_cdevsw = { + .d_version = D_VERSION, + .d_fdopen = ptmx_fdopen, + .d_name = "ptmx", +}; + +static int pty_modevent(module_t mod, int type, void *data) { switch(type) { case MOD_LOAD: EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); + make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); break; case MOD_SHUTDOWN: break; Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Sep 6 09:59:02 2009 (r196885) +++ head/sys/kern/tty_pts.c Sun Sep 6 10:27:45 2009 (r196886) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); /* Add compatibility bits for FreeBSD. */ #define PTS_COMPAT -/* Add /dev/ptyXX compat bits. */ +/* Add pty(4) compat bits. */ #define PTS_EXTERNAL /* Add bits to make Linux binaries work. */ #define PTS_LINUX @@ -694,7 +694,10 @@ static struct ttydevsw pts_class = { .tsw_free = ptsdrv_free, }; -static int +#ifndef PTS_EXTERNAL +static +#endif /* !PTS_EXTERNAL */ +int pts_alloc(int fflags, struct thread *td, struct file *fp) { int unit, ok; @@ -815,29 +818,11 @@ posix_openpt(struct thread *td, struct p return (0); } -#if defined(PTS_COMPAT) || defined(PTS_LINUX) -static int -ptmx_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) -{ - - return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); -} - -static struct cdevsw ptmx_cdevsw = { - .d_version = D_VERSION, - .d_fdopen = ptmx_fdopen, - .d_name = "ptmx", -}; -#endif /* PTS_COMPAT || PTS_LINUX */ - static void pts_init(void *unused) { pts_pool = new_unrhdr(0, INT_MAX, NULL); -#if defined(PTS_COMPAT) || defined(PTS_LINUX) - make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); -#endif /* PTS_COMPAT || PTS_LINUX */ } SYSINIT(pts, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pts_init, NULL); Modified: head/sys/sys/tty.h ============================================================================== --- head/sys/sys/tty.h Sun Sep 6 09:59:02 2009 (r196885) +++ head/sys/sys/tty.h Sun Sep 6 10:27:45 2009 (r196886) @@ -202,6 +202,7 @@ void tty_info(struct tty *tp); void ttyconsdev_select(const char *name); /* Pseudo-terminal hooks. */ +int pts_alloc(int fflags, struct thread *td, struct file *fp); int pts_alloc_external(int fd, struct thread *td, struct file *fp, struct cdev *dev, const char *name); From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 11:44:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFDCD1065672; Sun, 6 Sep 2009 11:44:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF0DD8FC0C; Sun, 6 Sep 2009 11:44:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86BikQA082918; Sun, 6 Sep 2009 11:44:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86BikcZ082916; Sun, 6 Sep 2009 11:44:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909061144.n86BikcZ082916@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Sep 2009 11:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196887 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 11:44:47 -0000 Author: kib Date: Sun Sep 6 11:44:46 2009 New Revision: 196887 URL: http://svn.freebsd.org/changeset/base/196887 Log: In fhopen, vfs_ref() the mount point while vnode is unlocked, to prevent vn_start_write(NULL, &mp) from operating on potentially freed or reused struct mount *. Remove unmatched vfs_rel() in cleanup. Noted and reviewed by: tegge Tested by: pho MFC after: 3 days Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Sep 6 10:27:45 2009 (r196886) +++ head/sys/kern/vfs_syscalls.c Sun Sep 6 11:44:46 2009 (r196887) @@ -4439,12 +4439,15 @@ fhopen(td, uap) goto bad; } if (fmode & O_TRUNC) { + vfs_ref(mp); VOP_UNLOCK(vp, 0); /* XXX */ if ((error = vn_start_write(NULL, &mp, V_WAIT | PCATCH)) != 0) { vrele(vp); + vfs_rel(mp); goto out; } vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* XXX */ + vfs_rel(mp); #ifdef MAC /* * We don't yet have fp->f_cred, so use td->td_ucred, which @@ -4516,7 +4519,6 @@ fhopen(td, uap) VOP_UNLOCK(vp, 0); fdrop(fp, td); - vfs_rel(mp); VFS_UNLOCK_GIANT(vfslocked); td->td_retval[0] = indx; return (0); From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 11:46:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A138106566B; Sun, 6 Sep 2009 11:46:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED6598FC19; Sun, 6 Sep 2009 11:46:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86BkpxU082997; Sun, 6 Sep 2009 11:46:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86BkpXK082995; Sun, 6 Sep 2009 11:46:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909061146.n86BkpXK082995@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Sep 2009 11:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196888 - head/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 11:46:52 -0000 Author: kib Date: Sun Sep 6 11:46:51 2009 New Revision: 196888 URL: http://svn.freebsd.org/changeset/base/196888 Log: The clear_remove() and clear_inodedeps() call vn_start_write(NULL, &mp, V_NOWAIT) on the non-busied mount point. Unmount might free ufs-specific mp data, causing ffs_vgetf() to access freed memory. Busy mountpoint before dropping softdep lk. Noted and reviewed by: tegge Tested by: pho MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sun Sep 6 11:44:46 2009 (r196887) +++ head/sys/ufs/ffs/ffs_softdep.c Sun Sep 6 11:46:51 2009 (r196888) @@ -5977,12 +5977,19 @@ clear_remove(td) if (vn_start_write(NULL, &mp, V_NOWAIT) != 0) continue; FREE_LOCK(&lk); - if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ))) { + + /* + * Let unmount clear deps + */ + error = vfs_busy(mp, MBF_NOWAIT); + if (error != 0) + goto finish_write; + error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, + FFSV_FORCEINSMQ); + vfs_unbusy(mp); + if (error != 0) { softdep_error("clear_remove: vget", error); - vn_finished_write(mp); - ACQUIRE_LOCK(&lk); - return; + goto finish_write; } if ((error = ffs_syncvnode(vp, MNT_NOWAIT))) softdep_error("clear_remove: fsync", error); @@ -5991,6 +5998,7 @@ clear_remove(td) drain_output(vp); BO_UNLOCK(bo); vput(vp); + finish_write: vn_finished_write(mp); ACQUIRE_LOCK(&lk); return; @@ -6050,13 +6058,21 @@ clear_inodedeps(td) if (vn_start_write(NULL, &mp, V_NOWAIT) != 0) continue; FREE_LOCK(&lk); + error = vfs_busy(mp, MBF_NOWAIT); /* Let unmount clear deps */ + if (error != 0) { + vn_finished_write(mp); + ACQUIRE_LOCK(&lk); + return; + } if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, FFSV_FORCEINSMQ)) != 0) { softdep_error("clear_inodedeps: vget", error); + vfs_unbusy(mp); vn_finished_write(mp); ACQUIRE_LOCK(&lk); return; } + vfs_unbusy(mp); if (ino == lastino) { if ((error = ffs_syncvnode(vp, MNT_WAIT))) softdep_error("clear_inodedeps: fsync1", error); From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 12:01:29 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2EFD1065679; Sun, 6 Sep 2009 12:01:29 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D21328FC2A; Sun, 6 Sep 2009 12:01:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86C1TRe083310; Sun, 6 Sep 2009 12:01:29 GMT (envelope-from nork@svn.freebsd.org) Received: (from nork@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86C1Tw5083308; Sun, 6 Sep 2009 12:01:29 GMT (envelope-from nork@svn.freebsd.org) Message-Id: <200909061201.n86C1Tw5083308@svn.freebsd.org> From: Norikatsu Shigemura Date: Sun, 6 Sep 2009 12:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196889 - head/sys/dev/coretemp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 12:01:30 -0000 Author: nork Date: Sun Sep 6 12:01:29 2009 New Revision: 196889 URL: http://svn.freebsd.org/changeset/base/196889 Log: Change 'dev.cpu.N.temperature', sysctl I (degC) to IK (Kelvin). Approved by: re (rwatson) Reviewed by: rpaulo Suggested by: ume MFC After: 3 days Modified: head/sys/dev/coretemp/coretemp.c Modified: head/sys/dev/coretemp/coretemp.c ============================================================================== --- head/sys/dev/coretemp/coretemp.c Sun Sep 6 11:46:51 2009 (r196888) +++ head/sys/dev/coretemp/coretemp.c Sun Sep 6 12:01:29 2009 (r196889) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define TZ_ZEROC 2732 + struct coretemp_softc { device_t sc_dev; int sc_tjmax; @@ -193,8 +195,8 @@ coretemp_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, - dev, 0, coretemp_get_temp_sysctl, "I", - "Current temperature in degC"); + dev, 0, coretemp_get_temp_sysctl, "IK", + "Current temperature"); return (0); } @@ -283,7 +285,7 @@ coretemp_get_temp_sysctl(SYSCTL_HANDLER_ device_t dev = (device_t) arg1; int temp; - temp = coretemp_get_temp(dev); + temp = coretemp_get_temp(dev) * 10 + TZ_ZEROC; return (sysctl_handle_int(oidp, &temp, 0, req)); } From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 13:26:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA7DB106568F; Sun, 6 Sep 2009 13:26:51 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9EB68FC19; Sun, 6 Sep 2009 13:26:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86DQp0h084994; Sun, 6 Sep 2009 13:26:51 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86DQpOt084992; Sun, 6 Sep 2009 13:26:51 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200909061326.n86DQpOt084992@svn.freebsd.org> From: Antoine Brodin Date: Sun, 6 Sep 2009 13:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196890 - head/etc/mtree X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 13:26:51 -0000 Author: antoine Date: Sun Sep 6 13:26:51 2009 New Revision: 196890 URL: http://svn.freebsd.org/changeset/base/196890 Log: Update etc/mtree/Makefile: There is no longer BSD.{local,x11-4,x11}.dist mtree files. There is a BSD.sendmail.dist mtree file. Modified: head/etc/mtree/Makefile Modified: head/etc/mtree/Makefile ============================================================================== --- head/etc/mtree/Makefile Sun Sep 6 12:01:29 2009 (r196889) +++ head/etc/mtree/Makefile Sun Sep 6 13:26:51 2009 (r196890) @@ -5,12 +5,10 @@ FILES= ${_BIND.chroot.dist} \ ${_BIND.include.dist} \ BSD.include.dist \ - BSD.local.dist \ BSD.root.dist \ + ${_BSD.sendmail.dist} \ BSD.usr.dist \ - BSD.var.dist \ - BSD.x11-4.dist \ - BSD.x11.dist + BSD.var.dist .if ${MK_BIND} != "no" _BIND.chroot.dist= BIND.chroot.dist @@ -18,6 +16,9 @@ _BIND.chroot.dist= BIND.chroot.dist _BIND.include.dist= BIND.include.dist .endif .endif +.if ${MK_SENDMAIL} != "no" +_BSD.sendmail.dist= BSD.sendmail.dist +.endif NO_OBJ= FILESDIR= /etc/mtree From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 13:31:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 685B3106566C; Sun, 6 Sep 2009 13:31:05 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 581248FC19; Sun, 6 Sep 2009 13:31:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86DV5Mr085112; Sun, 6 Sep 2009 13:31:05 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86DV5W2085110; Sun, 6 Sep 2009 13:31:05 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200909061331.n86DV5W2085110@svn.freebsd.org> From: Antoine Brodin Date: Sun, 6 Sep 2009 13:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196891 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 13:31:05 -0000 Author: antoine Date: Sun Sep 6 13:31:05 2009 New Revision: 196891 URL: http://svn.freebsd.org/changeset/base/196891 Log: Change w_notrunning and w_stillcold from pointer to array so that sizeof returns what is expected. PR: kern/138557 Discussed with: brucec@ MFC after: 1 month Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sun Sep 6 13:26:51 2009 (r196890) +++ head/sys/kern/subr_witness.c Sun Sep 6 13:31:05 2009 (r196891) @@ -469,8 +469,8 @@ static struct witness_lock_order_data *w static struct witness_lock_order_hash w_lohash; static int w_max_used_index = 0; static unsigned int w_generation = 0; -static const char *w_notrunning = "Witness not running\n"; -static const char *w_stillcold = "Witness is still cold\n"; +static const char w_notrunning[] = "Witness not running\n"; +static const char w_stillcold[] = "Witness is still cold\n"; static struct witness_order_list_entry order_lists[] = { From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 14:05:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96AD6106566B; Sun, 6 Sep 2009 14:05:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83BF18FC1C; Sun, 6 Sep 2009 14:05:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86E51aP085828; Sun, 6 Sep 2009 14:05:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86E51PV085825; Sun, 6 Sep 2009 14:05:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061405.n86E51PV085825@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 14:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196892 - stable/8/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 14:05:01 -0000 Author: mav Date: Sun Sep 6 14:05:01 2009 New Revision: 196892 URL: http://svn.freebsd.org/changeset/base/196892 Log: MFC r196831: Add to `camcontrol cmd` support for sending arbitrary ATA commands. It could be used for broad range of tasks, such as configuring drive power management, caching, security and any other features and tasks, not supported by existing drivers. Approved by: re (ATA-CAM blanket) Modified: stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/camcontrol/camcontrol.8 stable/8/sbin/camcontrol/camcontrol.c Modified: stable/8/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.8 Sun Sep 6 13:31:05 2009 (r196891) +++ stable/8/sbin/camcontrol/camcontrol.8 Sun Sep 6 14:05:01 2009 (r196892) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2009 +.Dd September 4, 2009 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -120,10 +120,12 @@ .Ic cmd .Op device id .Op generic args +.Aq Fl a Ar cmd Op args .Aq Fl c Ar cmd Op args .Op Fl i Ar len Ar fmt .Bk -words .Op Fl o Ar len Ar fmt Op args +.Op Fl r Ar fmt .Ek .Nm .Ic debug @@ -486,12 +488,14 @@ Saved values .El .El .It Ic cmd -Allows the user to send an arbitrary SCSI CDB to any device. +Allows the user to send an arbitrary ATA or SCSI CDB to any device. The .Ic cmd function requires the .Fl c -argument to specify the CDB. +argument to specify SCSI CDB or the +.Fl a +argument to specify ATA Command Block registers values. Other arguments are optional, depending on the command type. The command and data specification syntax is documented @@ -503,9 +507,13 @@ SCSI device in question, you MUST specif or .Fl o . .Bl -tag -width 17n +.It Fl a Ar cmd Op args +This specifies the content of 12 ATA Command Block registers (command, +features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp. +lba_high_exp, features_exp, sector_count, sector_count_exp). .It Fl c Ar cmd Op args This specifies the SCSI CDB. -CDBs may be 6, 10, 12 or 16 bytes. +SCSI CDBs may be 6, 10, 12 or 16 bytes. .It Fl i Ar len Ar fmt This specifies the amount of data to read, and how it should be displayed. If the format is @@ -519,6 +527,13 @@ If the format is .Sq - , .Ar len bytes of data will be read from standard input and written to the device. +.It Fl r Ar fmt +This specifies that 11 result ATA Command Block registers should be displayed +(status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp, +lba_high_exp, sector_count, sector_count_exp), and how. +If the format is +.Sq - , +11 result registers will be written to standard output in hex. .El .It Ic debug Turn on CAM debugging printfs in the kernel. Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Sun Sep 6 13:31:05 2009 (r196891) +++ stable/8/sbin/camcontrol/camcontrol.c Sun Sep 6 14:05:01 2009 (r196892) @@ -120,7 +120,7 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC -static const char scsicmd_opts[] = "c:i:o:"; +static const char scsicmd_opts[] = "a:c:i:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:O:qR:T:UW:"; #endif @@ -2078,12 +2078,15 @@ scsicmd(struct cam_device *device, int a u_int32_t flags = CAM_DIR_NONE; u_int8_t *data_ptr = NULL; u_int8_t cdb[20]; + u_int8_t atacmd[12]; struct get_hook hook; int c, data_bytes = 0; int cdb_len = 0; - char *datastr = NULL, *tstr; + int atacmd_len = 0; + int need_res = 0; + char *datastr = NULL, *tstr, *resstr = NULL; int error = 0; - int fd_data = 0; + int fd_data = 0, fd_res = 0; int retval; ccb = cam_getccb(device); @@ -2094,10 +2097,32 @@ scsicmd(struct cam_device *device, int a } bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + sizeof(union ccb) - sizeof(struct ccb_hdr)); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { + case 'a': + tstr = optarg; + while (isspace(*tstr) && (*tstr != '\0')) + tstr++; + hook.argc = argc - optind; + hook.argv = argv + optind; + hook.got = 0; + atacmd_len = buff_encode_visit(atacmd, sizeof(atacmd), tstr, + iget, &hook); + /* + * Increment optind by the number of arguments the + * encoding routine processed. After each call to + * getopt(3), optind points to the argument that + * getopt should process _next_. In this case, + * that means it points to the first command string + * argument, if there is one. Once we increment + * this, it should point to either the next command + * line argument, or it should be past the end of + * the list. + */ + optind += hook.got; + break; case 'c': tstr = optarg; while (isspace(*tstr) && (*tstr != '\0')) @@ -2194,6 +2219,16 @@ scsicmd(struct cam_device *device, int a iget, &hook); optind += hook.got; break; + case 'r': + need_res = 1; + hook.argc = argc - optind; + hook.argv = argv + optind; + hook.got = 0; + resstr = cget(&hook, NULL); + if ((resstr != NULL) && (resstr[0] == '-')) + fd_res = 1; + optind += hook.got; + break; default: break; } @@ -2226,50 +2261,51 @@ scsicmd(struct cam_device *device, int a /* Disable freezing the device queue */ flags |= CAM_DEV_QFRZDIS; - /* - * This is taken from the SCSI-3 draft spec. - * (T10/1157D revision 0.3) - * The top 3 bits of an opcode are the group code. The next 5 bits - * are the command code. - * Group 0: six byte commands - * Group 1: ten byte commands - * Group 2: ten byte commands - * Group 3: reserved - * Group 4: sixteen byte commands - * Group 5: twelve byte commands - * Group 6: vendor specific - * Group 7: vendor specific - */ - switch((cdb[0] >> 5) & 0x7) { - case 0: - cdb_len = 6; - break; - case 1: - case 2: - cdb_len = 10; - break; - case 3: - case 6: - case 7: - /* computed by buff_encode_visit */ - break; - case 4: - cdb_len = 16; - break; - case 5: - cdb_len = 12; - break; - } + if (cdb_len) { + /* + * This is taken from the SCSI-3 draft spec. + * (T10/1157D revision 0.3) + * The top 3 bits of an opcode are the group code. + * The next 5 bits are the command code. + * Group 0: six byte commands + * Group 1: ten byte commands + * Group 2: ten byte commands + * Group 3: reserved + * Group 4: sixteen byte commands + * Group 5: twelve byte commands + * Group 6: vendor specific + * Group 7: vendor specific + */ + switch((cdb[0] >> 5) & 0x7) { + case 0: + cdb_len = 6; + break; + case 1: + case 2: + cdb_len = 10; + break; + case 3: + case 6: + case 7: + /* computed by buff_encode_visit */ + break; + case 4: + cdb_len = 16; + break; + case 5: + cdb_len = 12; + break; + } - /* - * We should probably use csio_build_visit or something like that - * here, but it's easier to encode arguments as you go. The - * alternative would be skipping the CDB argument and then encoding - * it here, since we've got the data buffer argument by now. - */ - bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len); + /* + * We should probably use csio_build_visit or something like that + * here, but it's easier to encode arguments as you go. The + * alternative would be skipping the CDB argument and then encoding + * it here, since we've got the data buffer argument by now. + */ + bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len); - cam_fill_csio(&ccb->csio, + cam_fill_csio(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, /*flags*/ flags, @@ -2279,6 +2315,21 @@ scsicmd(struct cam_device *device, int a /*sense_len*/ SSD_FULL_SIZE, /*cdb_len*/ cdb_len, /*timeout*/ timeout ? timeout : 5000); + } else { + atacmd_len = 12; + bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len); + if (need_res) + ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; + + cam_fill_ataio(&ccb->ataio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*flags*/ flags, + /*tag_action*/ 0, + /*data_ptr*/ data_ptr, + /*dxfer_len*/ data_bytes, + /*timeout*/ timeout ? timeout : 5000); + } if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { @@ -2296,6 +2347,28 @@ scsicmd(struct cam_device *device, int a goto scsicmd_bailout; } + if (atacmd_len && need_res) { + if (fd_res == 0) { + buff_decode_visit(&ccb->ataio.res.status, 11, resstr, + arg_put, NULL); + fprintf(stdout, "\n"); + } else { + fprintf(stdout, + "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + ccb->ataio.res.status, + ccb->ataio.res.error, + ccb->ataio.res.lba_low, + ccb->ataio.res.lba_mid, + ccb->ataio.res.lba_high, + ccb->ataio.res.device, + ccb->ataio.res.lba_low_exp, + ccb->ataio.res.lba_mid_exp, + ccb->ataio.res.lba_high_exp, + ccb->ataio.res.sector_count, + ccb->ataio.res.sector_count_exp); + fflush(stdout); + } + } if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) && (arglist & CAM_ARG_CMD_IN) @@ -4029,8 +4102,9 @@ usage(int verbose) " camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n" " camcontrol modepage [dev_id][generic args] <-m page | -l>\n" " [-P pagectl][-e | -b][-d]\n" -" camcontrol cmd [dev_id][generic args] <-c cmd [args]>\n" -" [-i len fmt|-o len fmt [args]]\n" +" camcontrol cmd [dev_id][generic args]\n" +" <-a cmd [args] | -c cmd [args]>\n" +" [-i len fmt|-o len fmt [args]] [-r fmt]\n" " camcontrol debug [-I][-P][-T][-S][-X][-c]\n" " \n" " camcontrol tags [dev_id][generic args] [-N tags] [-q] [-v]\n" From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 14:23:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC041106566B; Sun, 6 Sep 2009 14:23:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB6CE8FC0C; Sun, 6 Sep 2009 14:23:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86ENQSD086195; Sun, 6 Sep 2009 14:23:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86ENQ0p086193; Sun, 6 Sep 2009 14:23:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061423.n86ENQ0p086193@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 14:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196893 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 14:23:27 -0000 Author: mav Date: Sun Sep 6 14:23:26 2009 New Revision: 196893 URL: http://svn.freebsd.org/changeset/base/196893 Log: Remove constraint, requiring request data to fulfill controller's alignment requirements. It is busdma task, to manage proper alignment by loading data to bounce buffers. PR: kern/127316 Reviewed by: current@ Tested by: Ryan Rogers Modified: head/sys/dev/ata/ata-dma.c Modified: head/sys/dev/ata/ata-dma.c ============================================================================== --- head/sys/dev/ata/ata-dma.c Sun Sep 6 14:05:01 2009 (r196892) +++ head/sys/dev/ata/ata-dma.c Sun Sep 6 14:23:26 2009 (r196893) @@ -272,10 +272,10 @@ ata_dmaload(struct ata_request *request, "FAILURE - zero length DMA transfer attempted\n"); return EIO; } - if (((uintptr_t)(request->data) & (ch->dma.alignment - 1)) || - (request->bytecount & (ch->dma.alignment - 1))) { + if (request->bytecount & (ch->dma.alignment - 1)) { device_printf(request->dev, - "FAILURE - non aligned DMA transfer attempted\n"); + "FAILURE - odd-sized DMA transfer attempt %d %% %d\n", + request->bytecount, ch->dma.alignment); return EIO; } if (request->bytecount > ch->dma.max_iosize) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 15:23:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA33E106566C; Sun, 6 Sep 2009 15:23:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8CDC8FC0A; Sun, 6 Sep 2009 15:23:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86FN3Ob087455; Sun, 6 Sep 2009 15:23:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86FN3QP087453; Sun, 6 Sep 2009 15:23:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909061523.n86FN3QP087453@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 6 Sep 2009 15:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196894 - stable/7/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 15:23:03 -0000 Author: kib Date: Sun Sep 6 15:23:03 2009 New Revision: 196894 URL: http://svn.freebsd.org/changeset/base/196894 Log: Partial MFC of r194459 by thompsa, without merge recording, to allow the vm_phys_paddr_to_vm_page(9) to return NULL instead of panicking when supplied physical address does not correspond to a vm page. This is needed for device pager (and not yet merged sg pager) to skip memattr checks on specific addresses. Reported by: Thierry Herbelot Modified: stable/7/sys/vm/vm_phys.c Modified: stable/7/sys/vm/vm_phys.c ============================================================================== --- stable/7/sys/vm/vm_phys.c Sun Sep 6 14:23:26 2009 (r196893) +++ stable/7/sys/vm/vm_phys.c Sun Sep 6 15:23:03 2009 (r196894) @@ -382,8 +382,7 @@ vm_phys_paddr_to_vm_page(vm_paddr_t pa) if (pa >= seg->start && pa < seg->end) return (&seg->first_page[atop(pa - seg->start)]); } - panic("vm_phys_paddr_to_vm_page: paddr %#jx is not in any segment", - (uintmax_t)pa); + return (NULL); } /* From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 16:25:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6869B106566B; Sun, 6 Sep 2009 16:25:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id CE4798FC16; Sun, 6 Sep 2009 16:25:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 8140941C6B4; Sun, 6 Sep 2009 18:25:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id iR1eR9GuW2BO; Sun, 6 Sep 2009 18:25:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id D5EB041C6A7; Sun, 6 Sep 2009 18:25:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id AB1024448E6; Sun, 6 Sep 2009 16:22:20 +0000 (UTC) Date: Sun, 6 Sep 2009 16:22:20 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Pawel Jakub Dawidek In-Reply-To: <200909060732.n867WGwc076608@svn.freebsd.org> Message-ID: <20090906162102.Q68375@maildrop.int.zabbadoz.net> References: <200909060732.n867WGwc076608@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196883 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 16:25:08 -0000 On Sun, 6 Sep 2009, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Sun Sep 6 07:32:16 2009 > New Revision: 196883 > URL: http://svn.freebsd.org/changeset/base/196883 > > Log: > Improve code a bit by eliminating goto and having one unlock per lock. This does not coompile anymore: HEAD.svn/sys/netipsec/key.c: In function 'key_checkrequest': HEAD.svn/sys/netipsec/key.c: warning: 'state_valid' may be used uninitialized in this function HEAD.svn/sys/netipsec/key.c: note: 'state_valid' was declared here > Modified: > head/sys/netipsec/key.c > > Modified: head/sys/netipsec/key.c > ============================================================================== > --- head/sys/netipsec/key.c Sun Sep 6 07:30:21 2009 (r196882) > +++ head/sys/netipsec/key.c Sun Sep 6 07:32:16 2009 (r196883) > @@ -918,15 +918,14 @@ key_allocsa_policy(const struct secasind > state_valid = saorder_state_valid_prefer_new; > arraysize = N(saorder_state_valid_prefer_new); > } > - SAHTREE_UNLOCK(); > - goto found; > + break; > } > } > SAHTREE_UNLOCK(); > > - return NULL; > + if (sah == NULL) > + return NULL; > > - found: > /* search valid state */ > for (stateidx = 0; stateidx < arraysize; stateidx++) { > sav = key_do_allocsa_policy(sah, state_valid[stateidx]); > -- Bjoern A. Zeeb What was I talking about and who are you again? From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 18:09:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 558881065679; Sun, 6 Sep 2009 18:09:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44D738FC0C; Sun, 6 Sep 2009 18:09:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86I9Q4m090685; Sun, 6 Sep 2009 18:09:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86I9Q3m090683; Sun, 6 Sep 2009 18:09:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909061809.n86I9Q3m090683@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 18:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196896 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 18:09:26 -0000 Author: pjd Date: Sun Sep 6 18:09:25 2009 New Revision: 196896 URL: http://svn.freebsd.org/changeset/base/196896 Log: Initialize state_valid and arraysize variable so gcc won't complain. Reported by: bz Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sun Sep 6 17:24:15 2009 (r196895) +++ head/sys/netipsec/key.c Sun Sep 6 18:09:25 2009 (r196896) @@ -906,6 +906,9 @@ key_allocsa_policy(const struct secasind u_int stateidx, arraysize; const u_int *state_valid; + state_valid = NULL; /* silent gcc */ + arraysize = 0; /* silent gcc */ + SAHTREE_LOCK(); LIST_FOREACH(sah, &V_sahtree, chain) { if (sah->state == SADB_SASTATE_DEAD) @@ -922,7 +925,6 @@ key_allocsa_policy(const struct secasind } } SAHTREE_UNLOCK(); - if (sah == NULL) return NULL; From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 18:40:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0A60106566C; Sun, 6 Sep 2009 18:40:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFE308FC08; Sun, 6 Sep 2009 18:40:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86Iemmu091298; Sun, 6 Sep 2009 18:40:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86IemhT091296; Sun, 6 Sep 2009 18:40:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061840.n86IemhT091296@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 18:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196897 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 18:40:49 -0000 Author: mav Date: Sun Sep 6 18:40:48 2009 New Revision: 196897 URL: http://svn.freebsd.org/changeset/base/196897 Log: Avoid extra swi_sched() call, if this SIM is already queued. It reduces overhead for coalesced command completions. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:09:25 2009 (r196896) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:40:48 2009 (r196897) @@ -4198,12 +4198,12 @@ xpt_done(union ccb *done_ccb) mtx_lock(&cam_simq_lock); TAILQ_INSERT_TAIL(&cam_simq, sim, links); - sim->flags |= CAM_SIM_ON_DONEQ; mtx_unlock(&cam_simq_lock); + sim->flags |= CAM_SIM_ON_DONEQ; + if ((done_ccb->ccb_h.path->periph->flags & + CAM_PERIPH_POLLED) == 0) + swi_sched(cambio_ih, 0); } - if ((done_ccb->ccb_h.path->periph->flags & - CAM_PERIPH_POLLED) == 0) - swi_sched(cambio_ih, 0); break; default: panic("unknown periph type %d", @@ -4889,16 +4889,20 @@ camisr(void *dummy) mtx_lock(&cam_simq_lock); TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, &cam_simq, links); - mtx_unlock(&cam_simq_lock); - - while ((sim = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, sim, links); - CAM_SIM_LOCK(sim); - sim->flags &= ~CAM_SIM_ON_DONEQ; - camisr_runqueue(&sim->sim_doneq); - CAM_SIM_UNLOCK(sim); + while (!TAILQ_EMPTY(&cam_simq)) { + TAILQ_CONCAT(&queue, &cam_simq, links); + mtx_unlock(&cam_simq_lock); + + while ((sim = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, sim, links); + CAM_SIM_LOCK(sim); + sim->flags &= ~CAM_SIM_ON_DONEQ; + camisr_runqueue(&sim->sim_doneq); + CAM_SIM_UNLOCK(sim); + } + mtx_lock(&cam_simq_lock); } + mtx_unlock(&cam_simq_lock); } static void From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 18:48:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F7E8106566B; Sun, 6 Sep 2009 18:48:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2D3A8FC19; Sun, 6 Sep 2009 18:48:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86ImIL7091539; Sun, 6 Sep 2009 18:48:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86ImI08091537; Sun, 6 Sep 2009 18:48:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061848.n86ImI08091537@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 18:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196898 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 18:48:20 -0000 Author: mav Date: Sun Sep 6 18:48:18 2009 New Revision: 196898 URL: http://svn.freebsd.org/changeset/base/196898 Log: MFp4: Report scbusX in xpt_announce_periph() to less confuse users by two different bus addressing schemes. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:40:48 2009 (r196897) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:48:18 2009 (r196898) @@ -1033,11 +1033,12 @@ xpt_announce_periph(struct cam_periph *p * To ensure that this is printed in one piece, * mask out CAM interrupts. */ - printf("%s%d at %s%d bus %d target %d lun %d\n", + printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, path->bus->sim->unit_number, path->bus->sim->bus_id, + path->bus->path_id, path->target->target_id, path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 18:56:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9589106568F; Sun, 6 Sep 2009 18:56:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B88C88FC13; Sun, 6 Sep 2009 18:56:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86Iu8sr091767; Sun, 6 Sep 2009 18:56:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86Iu86d091765; Sun, 6 Sep 2009 18:56:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061856.n86Iu86d091765@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 18:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196900 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 18:56:08 -0000 Author: mav Date: Sun Sep 6 18:56:08 2009 New Revision: 196900 URL: http://svn.freebsd.org/changeset/base/196900 Log: s/bus %d/scbus%d/ in some messages to correct terminology. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:49:45 2009 (r196899) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:56:08 2009 (r196900) @@ -4605,7 +4605,7 @@ xptconfigfunc(struct cam_eb *bus, void * CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD)) !=CAM_REQ_CMP){ printf("xptconfigfunc: xpt_create_path failed with " - "status %#x for bus %d\n", status, bus->path_id); + "status %#x for scbus%d\n", status, bus->path_id); printf("xptconfigfunc: halting bus configuration\n"); xpt_free_ccb(work_ccb); busses_to_config--; @@ -4616,7 +4616,7 @@ xptconfigfunc(struct cam_eb *bus, void * work_ccb->ccb_h.func_code = XPT_PATH_INQ; xpt_action(work_ccb); if (work_ccb->ccb_h.status != CAM_REQ_CMP) { - printf("xptconfigfunc: CPI failed on bus %d " + printf("xptconfigfunc: CPI failed on scbus%d " "with status %d\n", bus->path_id, work_ccb->ccb_h.status); xpt_finishconfig(xpt_periph, work_ccb); From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 18:59:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8553106566B; Sun, 6 Sep 2009 18:59:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7CF08FC16; Sun, 6 Sep 2009 18:59:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86IxkLG091863; Sun, 6 Sep 2009 18:59:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86IxkrW091861; Sun, 6 Sep 2009 18:59:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061859.n86IxkrW091861@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 18:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196901 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 18:59:46 -0000 Author: mav Date: Sun Sep 6 18:59:46 2009 New Revision: 196901 URL: http://svn.freebsd.org/changeset/base/196901 Log: Remove unneeded CAM_SIM_MPSAFE check. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:56:08 2009 (r196900) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:59:46 2009 (r196901) @@ -4407,10 +4407,7 @@ xpt_alloc_device(struct cam_eb *bus, str device->tag_delay_count = 0; device->tag_saved_openings = 0; device->refcount = 1; - if (bus->sim->flags & CAM_SIM_MPSAFE) - callout_init_mtx(&device->callout, bus->sim->mtx, 0); - else - callout_init_mtx(&device->callout, &Giant, 0); + callout_init_mtx(&device->callout, bus->sim->mtx, 0); /* * Hold a reference to our parent target so it From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 19:05:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB075106566C; Sun, 6 Sep 2009 19:05:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA2538FC1A; Sun, 6 Sep 2009 19:05:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86J53wP092013; Sun, 6 Sep 2009 19:05:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86J53wQ092011; Sun, 6 Sep 2009 19:05:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909061905.n86J53wQ092011@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 6 Sep 2009 19:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196902 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 19:05:04 -0000 Author: pjd Date: Sun Sep 6 19:05:03 2009 New Revision: 196902 URL: http://svn.freebsd.org/changeset/base/196902 Log: Silent gcc? Yeah, you wish. What I ment was to silence gcc. Spotted by: julian Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sun Sep 6 18:59:46 2009 (r196901) +++ head/sys/netipsec/key.c Sun Sep 6 19:05:03 2009 (r196902) @@ -906,8 +906,8 @@ key_allocsa_policy(const struct secasind u_int stateidx, arraysize; const u_int *state_valid; - state_valid = NULL; /* silent gcc */ - arraysize = 0; /* silent gcc */ + state_valid = NULL; /* silence gcc */ + arraysize = 0; /* silence gcc */ SAHTREE_LOCK(); LIST_FOREACH(sah, &V_sahtree, chain) { From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 19:06:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E085F106566C; Sun, 6 Sep 2009 19:06:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFBF48FC08; Sun, 6 Sep 2009 19:06:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86J6ot2092076; Sun, 6 Sep 2009 19:06:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86J6oKC092073; Sun, 6 Sep 2009 19:06:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061906.n86J6oKC092073@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 19:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196903 - head/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 19:06:51 -0000 Author: mav Date: Sun Sep 6 19:06:50 2009 New Revision: 196903 URL: http://svn.freebsd.org/changeset/base/196903 Log: MFp4: Remove duplicate qfrozen_cnt variable from struct cam_ed. ccbq.queue.qfrozen_cnt should be used instead. Modified: head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt_internal.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 19:05:03 2009 (r196902) +++ head/sys/cam/cam_xpt.c Sun Sep 6 19:06:50 2009 (r196903) @@ -2472,7 +2472,7 @@ xpt_action_default(union ccb *start_ccb) path = start_ccb->ccb_h.path; cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); - if (path->device->qfrozen_cnt == 0) + if (path->device->ccbq.queue.qfrozen_cnt == 0) runq = xpt_schedule_dev_sendq(path->bus, path->device); else runq = 0; @@ -2931,7 +2931,7 @@ xpt_action_default(union ccb *start_ccb) xpt_release_devq(crs->ccb_h.path, /*count*/1, /*run_queue*/TRUE); } - start_ccb->crs.qfrozen_cnt = dev->qfrozen_cnt; + start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt; start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -3227,7 +3227,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * If the device has been "frozen", don't attempt * to run it. */ - if (device->qfrozen_cnt > 0) { + if (device->ccbq.queue.qfrozen_cnt > 0) { continue; } @@ -3250,7 +3250,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * the device queue until we have a slot * available. */ - device->qfrozen_cnt++; + device->ccbq.queue.qfrozen_cnt++; STAILQ_INSERT_TAIL(&xsoftc.highpowerq, &work_ccb->ccb_h, xpt_links.stqe); @@ -3282,7 +3282,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * The client wants to freeze the queue * after this CCB is sent. */ - device->qfrozen_cnt++; + device->ccbq.queue.qfrozen_cnt++; } /* In Target mode, the peripheral driver knows best... */ @@ -4031,7 +4031,7 @@ xpt_freeze_devq(struct cam_path *path, u mtx_assert(path->bus->sim->mtx, MA_OWNED); - path->device->qfrozen_cnt += count; + path->device->ccbq.queue.qfrozen_cnt += count; /* * Mark the last CCB in the queue as needing @@ -4049,7 +4049,7 @@ xpt_freeze_devq(struct cam_path *path, u ccbh = TAILQ_LAST(&path->device->ccbq.active_ccbs, ccb_hdr_tailq); if (ccbh && ccbh->status == CAM_REQ_INPROG) ccbh->status = CAM_REQUEUE_REQ; - return (path->device->qfrozen_cnt); + return (path->device->ccbq.queue.qfrozen_cnt); } u_int32_t @@ -4093,11 +4093,12 @@ xpt_release_devq_device(struct cam_ed *d int rundevq; rundevq = 0; - if (dev->qfrozen_cnt > 0) { + if (dev->ccbq.queue.qfrozen_cnt > 0) { - count = (count > dev->qfrozen_cnt) ? dev->qfrozen_cnt : count; - dev->qfrozen_cnt -= count; - if (dev->qfrozen_cnt == 0) { + count = (count > dev->ccbq.queue.qfrozen_cnt) ? + dev->ccbq.queue.qfrozen_cnt : count; + dev->ccbq.queue.qfrozen_cnt -= count; + if (dev->ccbq.queue.qfrozen_cnt == 0) { /* * No longer need to wait for a successful @@ -4402,7 +4403,6 @@ xpt_alloc_device(struct cam_eb *bus, str SLIST_INIT(&device->periphs); device->generation = 0; device->owner = NULL; - device->qfrozen_cnt = 0; device->flags = CAM_DEV_UNCONFIGURED; device->tag_delay_count = 0; device->tag_saved_openings = 0; @@ -4971,7 +4971,7 @@ camisr_runqueue(void *V_queue) xpt_start_tags(ccb_h->path); if ((dev->ccbq.queue.entries > 0) - && (dev->qfrozen_cnt == 0) + && (dev->ccbq.queue.qfrozen_cnt == 0) && (device_is_send_queued(dev) == 0)) { runq = xpt_schedule_dev_sendq(ccb_h->path->bus, dev); Modified: head/sys/cam/cam_xpt_internal.h ============================================================================== --- head/sys/cam/cam_xpt_internal.h Sun Sep 6 19:05:03 2009 (r196902) +++ head/sys/cam/cam_xpt_internal.h Sun Sep 6 19:06:50 2009 (r196903) @@ -106,7 +106,6 @@ struct cam_ed { u_int8_t queue_flags; /* Queue flags from the control page */ u_int8_t serial_num_len; u_int8_t *serial_num; - u_int32_t qfrozen_cnt; u_int32_t flags; #define CAM_DEV_UNCONFIGURED 0x01 #define CAM_DEV_REL_TIMEOUT_PENDING 0x02 From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 19:33:13 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 998151065672; Sun, 6 Sep 2009 19:33:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88C2A8FC23; Sun, 6 Sep 2009 19:33:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86JXDYr092580; Sun, 6 Sep 2009 19:33:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86JXD97092578; Sun, 6 Sep 2009 19:33:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909061933.n86JXD97092578@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 19:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196904 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 19:33:13 -0000 Author: mav Date: Sun Sep 6 19:33:13 2009 New Revision: 196904 URL: http://svn.freebsd.org/changeset/base/196904 Log: MFp4: Remove msleep() timeout from g_io_schedule_up/down(). It works fine without it, saving few percents of CPU on high request rates without need to rearm callout twice per request. Modified: head/sys/geom/geom_io.c Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Sun Sep 6 19:06:50 2009 (r196903) +++ head/sys/geom/geom_io.c Sun Sep 6 19:33:13 2009 (r196904) @@ -567,7 +567,7 @@ g_io_schedule_down(struct thread *tp __u if (bp == NULL) { CTR0(KTR_GEOM, "g_down going to sleep"); msleep(&g_wait_down, &g_bio_run_down.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); continue; } CTR0(KTR_GEOM, "g_down has work to do"); @@ -672,7 +672,7 @@ g_io_schedule_up(struct thread *tp __unu } CTR0(KTR_GEOM, "g_up going to sleep"); msleep(&g_wait_up, &g_bio_run_up.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); } } From owner-svn-src-all@FreeBSD.ORG Sun Sep 6 21:22:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0878A1065672; Sun, 6 Sep 2009 21:22:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBDB88FC16; Sun, 6 Sep 2009 21:22:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n86LMO4x094810; Sun, 6 Sep 2009 21:22:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n86LMOvK094808; Sun, 6 Sep 2009 21:22:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909062122.n86LMOvK094808@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 Sep 2009 21:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196907 - head/sys/dev/ahci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Sep 2009 21:22:25 -0000 Author: mav Date: Sun Sep 6 21:22:24 2009 New Revision: 196907 URL: http://svn.freebsd.org/changeset/base/196907 Log: To save small bit of CPU time, hide part of SNTF register read latency behind other reads. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Sep 6 20:32:16 2009 (r196906) +++ head/sys/dev/ahci/ahci.c Sun Sep 6 21:22:24 2009 (r196907) @@ -891,16 +891,12 @@ ahci_phy_check_events(device_t dev) } static void -ahci_notify_events(device_t dev) +ahci_notify_events(device_t dev, u_int32_t status) { struct ahci_channel *ch = device_get_softc(dev); struct cam_path *dpath; - u_int32_t status; int i; - status = ATA_INL(ch->r_mem, AHCI_P_SNTF); - if (status == 0) - return; ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status); if (bootverbose) device_printf(dev, "SNTF 0x%04x\n", status); @@ -948,7 +944,7 @@ ahci_ch_intr(void *data) { device_t dev = (device_t)data; struct ahci_channel *ch = device_get_softc(dev); - uint32_t istatus, cstatus, sstatus, ok, err; + uint32_t istatus, sstatus, cstatus, sntf = 0, ok, err; enum ahci_err_type et; int i, ccs, ncq_err = 0; @@ -958,8 +954,10 @@ ahci_ch_intr(void *data) return; ATA_OUTL(ch->r_mem, AHCI_P_IS, istatus); /* Read command statuses. */ - cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); sstatus = ATA_INL(ch->r_mem, AHCI_P_SACT); + cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); + if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) + sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF); /* Process PHY events */ if (istatus & (AHCI_P_IX_PRC | AHCI_P_IX_PC)) ahci_phy_check_events(dev); @@ -1023,8 +1021,8 @@ ahci_ch_intr(void *data) ahci_issue_read_log(dev); } /* Process NOTIFY events */ - if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) - ahci_notify_events(dev); + if (sntf) + ahci_notify_events(dev, sntf); } /* Must be called with channel locked. */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 06:37:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DE41106566B; Mon, 7 Sep 2009 06:37:45 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D3A58FC1D; Mon, 7 Sep 2009 06:37:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n876biod005755; Mon, 7 Sep 2009 06:37:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n876bidG005754; Mon, 7 Sep 2009 06:37:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909070637.n876bidG005754@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 06:37:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196911 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 06:37:45 -0000 Author: pjd Date: Mon Sep 7 06:37:44 2009 New Revision: 196911 URL: http://svn.freebsd.org/changeset/base/196911 Log: Make sure to use up-to-date libarchive header files from source tree when compiling tar and not the ones from /usr/include/. Reviewed by: kientzle Approved by: kientzle Modified: head/usr.bin/tar/Makefile Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Mon Sep 7 00:49:00 2009 (r196910) +++ head/usr.bin/tar/Makefile Mon Sep 7 06:37:44 2009 (r196911) @@ -12,7 +12,7 @@ LDADD+= -lcrypto .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 DEBUG_FLAGS=-g From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 08:37:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85D73106566B; Mon, 7 Sep 2009 08:37:25 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A5D08FC0A; Mon, 7 Sep 2009 08:37:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n878bPNV008237; Mon, 7 Sep 2009 08:37:25 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n878bP79008232; Mon, 7 Sep 2009 08:37:25 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909070837.n878bP79008232@svn.freebsd.org> From: Attilio Rao Date: Mon, 7 Sep 2009 08:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196912 - in stable/7/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 08:37:25 -0000 Author: attilio Date: Mon Sep 7 08:37:25 2009 New Revision: 196912 URL: http://svn.freebsd.org/changeset/base/196912 Log: MFC r196334: Add the macro ASSERT_ATOMIC_LOAD_PTR(), enabled through INVARIANTS, which asserts for the correct alignment of datas which need to be read atomically without locks. Use that macro in locking primitives. Modified: stable/7/sys/kern/kern_mutex.c stable/7/sys/kern/kern_rwlock.c stable/7/sys/kern/kern_sx.c stable/7/sys/sys/systm.h Modified: stable/7/sys/kern/kern_mutex.c ============================================================================== --- stable/7/sys/kern/kern_mutex.c Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/kern/kern_mutex.c Mon Sep 7 08:37:25 2009 (r196912) @@ -724,6 +724,9 @@ mtx_init(struct mtx *m, const char *name MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); + ASSERT_ATOMIC_LOAD_PTR(m->mtx_lock, + ("%s: mtx_lock not aligned for %s:%p", __func__, name, + &m->mtx_lock)); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ Modified: stable/7/sys/kern/kern_rwlock.c ============================================================================== --- stable/7/sys/kern/kern_rwlock.c Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/kern/kern_rwlock.c Mon Sep 7 08:37:25 2009 (r196912) @@ -137,6 +137,9 @@ rw_init_flags(struct rwlock *rw, const c MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | RW_RECURSE)) == 0); + ASSERT_ATOMIC_LOAD_PTR(rw->rw_lock, + ("%s: rw_lock not aligned for %s:%p", __func__, name, + &rw->rw_lock)); flags = LO_UPGRADABLE | LO_RECURSABLE; if (opts & RW_DUPOK) Modified: stable/7/sys/kern/kern_sx.c ============================================================================== --- stable/7/sys/kern/kern_sx.c Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/kern/kern_sx.c Mon Sep 7 08:37:25 2009 (r196912) @@ -166,6 +166,9 @@ sx_init_flags(struct sx *sx, const char MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | SX_NOPROFILE | SX_ADAPTIVESPIN)) == 0); + ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, + ("%s: sx_lock not aligned for %s:%p", __func__, description, + &sx->sx_lock)); flags = LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE; if (opts & SX_DUPOK) Modified: stable/7/sys/sys/systm.h ============================================================================== --- stable/7/sys/sys/systm.h Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/sys/systm.h Mon Sep 7 08:37:25 2009 (r196912) @@ -96,6 +96,17 @@ extern int maxusers; /* system tune hin #endif /* + * Assert that a pointer can be loaded from memory atomically. + * + * This assertion enforces stronger alignment than necessary. For example, + * on some architectures, atomicity for unaligned loads will depend on + * whether or not the load spans multiple cache lines. + */ +#define ASSERT_ATOMIC_LOAD_PTR(var, msg) \ + KASSERT(sizeof(var) == sizeof(void *) && \ + ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) + +/* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used * in two files. From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 08:41:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3086106566C; Mon, 7 Sep 2009 08:41:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D200F8FC14; Mon, 7 Sep 2009 08:41:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n878fEHu008348; Mon, 7 Sep 2009 08:41:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n878fE6M008345; Mon, 7 Sep 2009 08:41:14 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909070841.n878fE6M008345@svn.freebsd.org> From: Attilio Rao Date: Mon, 7 Sep 2009 08:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196913 - stable/7/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 08:41:15 -0000 Author: attilio Date: Mon Sep 7 08:41:14 2009 New Revision: 196913 URL: http://svn.freebsd.org/changeset/base/196913 Log: MFC r195403: Fix a bug in read lock acquisition for rwlocks by bumping rdlock_count when a successfull rwlock_rdlock_common() take place. Modified: stable/7/lib/libthr/thread/thr_rtld.c stable/7/lib/libthr/thread/thr_rwlock.c Modified: stable/7/lib/libthr/thread/thr_rtld.c ============================================================================== --- stable/7/lib/libthr/thread/thr_rtld.c Mon Sep 7 08:37:25 2009 (r196912) +++ stable/7/lib/libthr/thread/thr_rtld.c Mon Sep 7 08:41:14 2009 (r196913) @@ -116,6 +116,7 @@ _thr_rtld_rlock_acquire(void *lock) THR_CRITICAL_ENTER(curthread); while (_thr_rwlock_rdlock(&l->lock, 0, NULL) != 0) ; + curthread->rdlock_count++; RESTORE_ERRNO(); } @@ -150,6 +151,7 @@ _thr_rtld_lock_release(void *lock) state = l->lock.rw_state; if (_thr_rwlock_unlock(&l->lock) == 0) { + curthread->rdlock_count--; if ((state & URWLOCK_WRITE_OWNER) == 0) { THR_CRITICAL_LEAVE(curthread); } else { Modified: stable/7/lib/libthr/thread/thr_rwlock.c ============================================================================== --- stable/7/lib/libthr/thread/thr_rwlock.c Mon Sep 7 08:37:25 2009 (r196912) +++ stable/7/lib/libthr/thread/thr_rwlock.c Mon Sep 7 08:41:14 2009 (r196913) @@ -177,10 +177,11 @@ rwlock_rdlock_common(pthread_rwlock_t *r /* if interrupted, try to lock it in userland again. */ if (_thr_rwlock_tryrdlock(&prwlock->lock, flags) == 0) { ret = 0; - curthread->rdlock_count++; break; } } + if (ret == 0) + curthread->rdlock_count++; return (ret); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 08:46:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03E69106566B; Mon, 7 Sep 2009 08:46:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1B0C8FC16; Mon, 7 Sep 2009 08:46:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n878kQAQ008511; Mon, 7 Sep 2009 08:46:26 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n878kQLe008508; Mon, 7 Sep 2009 08:46:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909070846.n878kQLe008508@svn.freebsd.org> From: Attilio Rao Date: Mon, 7 Sep 2009 08:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196914 - stable/7/usr.sbin/tzsetup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 08:46:27 -0000 Author: attilio Date: Mon Sep 7 08:46:26 2009 New Revision: 196914 URL: http://svn.freebsd.org/changeset/base/196914 Log: MFC r195339: Add a new option (-s) that, when specified, skips the question about adjusting the clock to UTC. Sponsored by: Sandvine Incorporated Modified: stable/7/usr.sbin/tzsetup/tzsetup.8 stable/7/usr.sbin/tzsetup/tzsetup.c Modified: stable/7/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- stable/7/usr.sbin/tzsetup/tzsetup.8 Mon Sep 7 08:41:14 2009 (r196913) +++ stable/7/usr.sbin/tzsetup/tzsetup.8 Mon Sep 7 08:46:26 2009 (r196914) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 24, 1996 +.Dd September 05, 2009 .Dt TZSETUP 8 .Os .Sh NAME @@ -31,7 +31,7 @@ .Nd set local timezone .Sh SYNOPSIS .Nm -.Op Fl n +.Op Fl ns .Op Ar default .Sh DESCRIPTION The @@ -51,6 +51,9 @@ The following option is available: .Bl -tag -offset indent -width Fl .It Fl n Do not create or copy files. +.It Fl s +Skip the initial question about adjusting the clock if not set to +.Tn UTC . .El .Pp It is possible to short-circuit the menu system by specifying a Modified: stable/7/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/7/usr.sbin/tzsetup/tzsetup.c Mon Sep 7 08:41:14 2009 (r196913) +++ stable/7/usr.sbin/tzsetup/tzsetup.c Mon Sep 7 08:46:26 2009 (r196914) @@ -648,11 +648,14 @@ main(int argc, char **argv) dialog_utc = dialog_noyes; #endif - while ((c = getopt(argc, argv, "n")) != -1) { + while ((c = getopt(argc, argv, "ns")) != -1) { switch(c) { case 'n': reallydoit = 0; break; + case 's': + dialog_utc = NULL; + break; default: usage(); @@ -671,22 +674,25 @@ main(int argc, char **argv) make_menus(); init_dialog(); - if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock", - "Is this machine's CMOS clock set to UTC? If it is set to local time,\n" - "or you don't know, please choose NO here!", 7, 72)) { - if (reallydoit) - unlink(_PATH_WALL_CMOS_CLOCK); - } else { - if (reallydoit) { - fd = open(_PATH_WALL_CMOS_CLOCK, - O_WRONLY|O_CREAT|O_TRUNC, - S_IRUSR|S_IRGRP|S_IROTH); - if (fd < 0) - err(1, "create %s", _PATH_WALL_CMOS_CLOCK); - close(fd); + if (dialog_utc != NULL) { + if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock", + "Is this machine's CMOS clock set to UTC? If it is set to local time,\n" + "or you don't know, please choose NO here!", 7, 72)) { + if (reallydoit) + unlink(_PATH_WALL_CMOS_CLOCK); + } else { + if (reallydoit) { + fd = open(_PATH_WALL_CMOS_CLOCK, + O_WRONLY|O_CREAT|O_TRUNC, + S_IRUSR|S_IRGRP|S_IROTH); + if (fd < 0) + err(1, "create %s", + _PATH_WALL_CMOS_CLOCK); + close(fd); + } } + dialog_clear_norefresh(); } - dialog_clear_norefresh(); if (optind == argc - 1) { char *msg; asprintf(&msg, "\nUse the default `%s' zone?", argv[optind]); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 08:52:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEFC01065679; Mon, 7 Sep 2009 08:52:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C31F98FC13; Mon, 7 Sep 2009 08:52:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n878qFLJ008671; Mon, 7 Sep 2009 08:52:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n878qFds008667; Mon, 7 Sep 2009 08:52:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909070852.n878qFds008667@svn.freebsd.org> From: Attilio Rao Date: Mon, 7 Sep 2009 08:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196915 - in stable/7/sys: dev/hwpmc kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 08:52:16 -0000 Author: attilio Date: Mon Sep 7 08:52:15 2009 New Revision: 196915 URL: http://svn.freebsd.org/changeset/base/196915 Log: MFC r195159 and r195005: * Don't assume a fixed number of preloaded KLDs but calculate at runtime. This avoind ending up into an endless loop. * Fix a LOR between pmc_sx and allproc/proctree locks Sponsored by: Sandvine Incorporated Modified: stable/7/sys/dev/hwpmc/hwpmc_logging.c stable/7/sys/dev/hwpmc/hwpmc_mod.c stable/7/sys/kern/kern_linker.c Modified: stable/7/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_logging.c Mon Sep 7 08:46:26 2009 (r196914) +++ stable/7/sys/dev/hwpmc/hwpmc_logging.c Mon Sep 7 08:52:15 2009 (r196915) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -552,6 +553,12 @@ pmclog_configure_log(struct pmc_mdep *md int error; struct proc *p; + /* + * As long as it is possible to get a LOR between pmc_sx lock and + * proctree/allproc sx locks used for adding a new process, assure + * the former is not held here. + */ + sx_assert(&pmc_sx, SA_UNLOCKED); PMCDBG(LOG,CFG,1, "config po=%p logfd=%d", po, logfd); p = po->po_owner; Modified: stable/7/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_mod.c Mon Sep 7 08:46:26 2009 (r196914) +++ stable/7/sys/dev/hwpmc/hwpmc_mod.c Mon Sep 7 08:52:15 2009 (r196915) @@ -2666,7 +2666,7 @@ static const char *pmc_op_to_name[] = { static int pmc_syscall_handler(struct thread *td, void *syscall_args) { - int error, is_sx_downgraded, op; + int error, is_sx_downgraded, is_sx_locked, op; struct pmc_syscall_args *c; void *arg; @@ -2675,6 +2675,7 @@ pmc_syscall_handler(struct thread *td, v DROP_GIANT(); is_sx_downgraded = 0; + is_sx_locked = 1; c = (struct pmc_syscall_args *) syscall_args; @@ -2723,9 +2724,11 @@ pmc_syscall_handler(struct thread *td, v * a log file configured, flush its buffers and * de-configure it. */ - if (cl.pm_logfd >= 0) + if (cl.pm_logfd >= 0) { + sx_xunlock(&pmc_sx); + is_sx_locked = 0; error = pmclog_configure_log(md, po, cl.pm_logfd); - else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { + } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_process_closelog(po); error = pmclog_flush(po); if (error == 0) { @@ -3776,10 +3779,12 @@ pmc_syscall_handler(struct thread *td, v break; } - if (is_sx_downgraded) - sx_sunlock(&pmc_sx); - else - sx_xunlock(&pmc_sx); + if (is_sx_locked != 0) { + if (is_sx_downgraded) + sx_sunlock(&pmc_sx); + else + sx_xunlock(&pmc_sx); + } if (error) atomic_add_int(&pmc_stats.pm_syscall_errors, 1); Modified: stable/7/sys/kern/kern_linker.c ============================================================================== --- stable/7/sys/kern/kern_linker.c Mon Sep 7 08:46:26 2009 (r196914) +++ stable/7/sys/kern/kern_linker.c Mon Sep 7 08:52:15 2009 (r196915) @@ -1882,62 +1882,41 @@ linker_basename(const char *path) } #ifdef HWPMC_HOOKS - -struct hwpmc_context { - int nobjects; - int nmappings; - struct pmckern_map_in *kobase; -}; - -static int -linker_hwpmc_list_object(linker_file_t lf, void *arg) -{ - struct hwpmc_context *hc; - - hc = arg; - - /* If we run out of mappings, fail. */ - if (hc->nobjects >= hc->nmappings) - return (1); - - /* Save the info for this linker file. */ - hc->kobase[hc->nobjects].pm_file = lf->filename; - hc->kobase[hc->nobjects].pm_address = (uintptr_t)lf->address; - hc->nobjects++; - return (0); -} - /* * Inform hwpmc about the set of kernel modules currently loaded. */ void * linker_hwpmc_list_objects(void) { - struct hwpmc_context hc; + linker_file_t lf; + struct pmckern_map_in *kobase; + int i, nmappings; - hc.nmappings = 15; /* a reasonable default */ + nmappings = 0; + KLD_LOCK(); + TAILQ_FOREACH(lf, &linker_files, link) + nmappings++; - retry: - /* allocate nmappings+1 entries */ - MALLOC(hc.kobase, struct pmckern_map_in *, - (hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER, - M_WAITOK | M_ZERO); - - hc.nobjects = 0; - if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) { - hc.nmappings = hc.nobjects; - FREE(hc.kobase, M_LINKER); - goto retry; + /* Allocate nmappings + 1 entries. */ + kobase = malloc((nmappings + 1) * sizeof(struct pmckern_map_in), + M_LINKER, M_WAITOK | M_ZERO); + i = 0; + TAILQ_FOREACH(lf, &linker_files, link) { + + /* Save the info for this linker file. */ + kobase[i].pm_file = lf->filename; + kobase[i].pm_address = (uintptr_t)lf->address; + i++; } + KLD_UNLOCK(); - KASSERT(hc.nobjects > 0, ("linker_hpwmc_list_objects: no kernel " - "objects?")); + KASSERT(i > 0, ("linker_hwpmc_list_objects: no kernel objects?")); /* The last entry of the malloced area comprises of all zeros. */ - KASSERT(hc.kobase[hc.nobjects].pm_file == NULL, + KASSERT(kobase[i].pm_file == NULL, ("linker_hwpmc_list_objects: last object not NULL")); - return ((void *)hc.kobase); + return ((void *)kobase); } #endif From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 09:30:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6023C1065670; Mon, 7 Sep 2009 09:30:38 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35FDB8FC0A; Mon, 7 Sep 2009 09:30:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n879UcTx009650; Mon, 7 Sep 2009 09:30:38 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n879UcSC009647; Mon, 7 Sep 2009 09:30:38 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909070930.n879UcSC009647@svn.freebsd.org> From: Attilio Rao Date: Mon, 7 Sep 2009 09:30:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196916 - head/contrib/gdtoa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 09:30:38 -0000 Author: attilio Date: Mon Sep 7 09:30:37 2009 New Revision: 196916 URL: http://svn.freebsd.org/changeset/base/196916 Log: Import a vendor fix for a list overrun. This has been considered as a security hole on some specialized ml, but currently the secteam@ doesn't consider that way. Reviewed by: emaste, des Sponsored by: Sandvine Incorporated MFC after: 3 days Modified: head/contrib/gdtoa/gdtoaimp.h head/contrib/gdtoa/misc.c Modified: head/contrib/gdtoa/gdtoaimp.h ============================================================================== --- head/contrib/gdtoa/gdtoaimp.h Mon Sep 7 08:52:15 2009 (r196915) +++ head/contrib/gdtoa/gdtoaimp.h Mon Sep 7 09:30:37 2009 (r196916) @@ -485,7 +485,7 @@ extern pthread_mutex_t __gdtoa_locks[2]; _pthread_mutex_unlock(&__gdtoa_locks[n]); \ } while(0) -#define Kmax 15 +#define Kmax 9 struct Bigint { Modified: head/contrib/gdtoa/misc.c ============================================================================== --- head/contrib/gdtoa/misc.c Mon Sep 7 08:52:15 2009 (r196915) +++ head/contrib/gdtoa/misc.c Mon Sep 7 09:30:37 2009 (r196916) @@ -55,7 +55,9 @@ Balloc #endif ACQUIRE_DTOA_LOCK(0); - if ( (rv = freelist[k]) !=0) { + /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ + /* but this case seems very unlikely. */ + if (k <= Kmax && (rv = freelist[k]) !=0) { freelist[k] = rv->next; } else { @@ -65,7 +67,7 @@ Balloc #else len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) /sizeof(double); - if (pmem_next - private_mem + len <= PRIVATE_mem) { + if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { rv = (Bigint*)pmem_next; pmem_next += len; } @@ -89,10 +91,14 @@ Bfree #endif { if (v) { - ACQUIRE_DTOA_LOCK(0); - v->next = freelist[v->k]; - freelist[v->k] = v; - FREE_DTOA_LOCK(0); + if (v->k > Kmax) + free((void*)v); + else { + ACQUIRE_DTOA_LOCK(0); + v->next = freelist[v->k]; + freelist[v->k] = v; + FREE_DTOA_LOCK(0); + } } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 09:51:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9A111065672; Mon, 7 Sep 2009 09:51:23 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6B058FC2A; Mon, 7 Sep 2009 09:51:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n879pNtm010179; Mon, 7 Sep 2009 09:51:23 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n879pNst010173; Mon, 7 Sep 2009 09:51:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909070951.n879pNst010173@svn.freebsd.org> From: Attilio Rao Date: Mon, 7 Sep 2009 09:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196917 - in stable/7: bin/ps sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 09:51:24 -0000 Author: attilio Date: Mon Sep 7 09:51:23 2009 New Revision: 196917 URL: http://svn.freebsd.org/changeset/base/196917 Log: MFC r189078: * Implement ucomm with a dynamic size function in order to print out the threads name also in the case they are not the last one shown. * On AMD64 pointers don't have enough space to be printed. Fix it. * Check a return value for malloc which wasn't checked before Sponsored by: Sandvine Incorporated Modified: stable/7/bin/ps/extern.h stable/7/bin/ps/keyword.c stable/7/bin/ps/print.c stable/7/bin/ps/ps.c stable/7/sys/kern/kern_proc.c Modified: stable/7/bin/ps/extern.h ============================================================================== --- stable/7/bin/ps/extern.h Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/extern.h Mon Sep 7 09:51:23 2009 (r196917) @@ -39,7 +39,7 @@ extern fixpt_t ccpu; extern int cflag, eval, fscale, nlistread, rawcpu; extern unsigned long mempages; extern time_t now; -extern int sumrusage, termwidth, totwidth; +extern int showthreads, sumrusage, termwidth, totwidth; extern STAILQ_HEAD(velisthead, varent) varlist; __BEGIN_DECLS @@ -71,6 +71,7 @@ void priorityr(KINFO *, VARENT *); void rgroupname(KINFO *, VARENT *); void runame(KINFO *, VARENT *); void rvar(KINFO *, VARENT *); +int s_comm(KINFO *); int s_label(KINFO *); int s_rgroupname(KINFO *); int s_runame(KINFO *); Modified: stable/7/bin/ps/keyword.c ============================================================================== --- stable/7/bin/ps/keyword.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/keyword.c Mon Sep 7 09:51:23 2009 (r196917) @@ -79,8 +79,8 @@ static VAR var[] = { CHAR, NULL, 0}, {"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"comm", "COMMAND", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, - NULL, 0}, + {"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm, + COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, {"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0, CHAR, NULL, 0}, {"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d", @@ -135,12 +135,13 @@ static VAR var[] = { LONG, "ld", 0}, {"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw), LONG, "ld", 0}, - {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, 8, 0, CHAR, NULL, 0}, + {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0, + CHAR, NULL, 0}, {"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock), LONG, "ld", 0}, {"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"paddr", "PADDR", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR, - "lx", 0}, + {"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_paddr), KPTR, "lx", 0}, {"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0}, {"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, @@ -194,13 +195,13 @@ static VAR var[] = { {"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0}, {"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0}, {"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0}, - {"ucomm", "UCOMM", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, NULL, - 0}, + {"ucomm", "UCOMM", NULL, LJUST|DSIZ, ucomm, s_comm, + COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, {"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT, UIDFMT, 0}, {"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0}, - {"uprocp", "UPROCP", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR, - "lx", 0}, + {"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_paddr), KPTR, "lx", 0}, {"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, @@ -324,6 +325,8 @@ findvar(char *p, int user, char **header */ rflen = strlen(v->alias) + strlen(hp) + 2; realfmt = malloc(rflen); + if (realfmt == NULL) + errx(1, "malloc failed"); snprintf(realfmt, rflen, "%s=%s", v->alias, hp); parsefmt(realfmt, user); } Modified: stable/7/bin/ps/print.c ============================================================================== --- stable/7/bin/ps/print.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/print.c Mon Sep 7 09:51:23 2009 (r196917) @@ -186,6 +186,7 @@ command(KINFO *k, VARENT *ve) void ucomm(KINFO *k, VARENT *ve) { + char tmpbuff[COMMLEN + OCOMMLEN + 2]; VAR *v; v = ve->var; @@ -193,8 +194,15 @@ ucomm(KINFO *k, VARENT *ve) if (k->ki_d.prefix) (void)printf("%s", k->ki_d.prefix); (void)printf("%s", k->ki_p->ki_comm); - } else - (void)printf("%-*s", v->width, k->ki_p->ki_comm); + } else { + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + (void)printf("%-*s", v->width, tmpbuff); + } } void @@ -822,6 +830,20 @@ out: } int +s_comm(KINFO *k) +{ + char tmpbuff[COMMLEN + OCOMMLEN + 2]; + + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + return (strlen(tmpbuff)); +} + +int s_label(KINFO *k) { char *string = NULL; Modified: stable/7/bin/ps/ps.c ============================================================================== --- stable/7/bin/ps/ps.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/ps.c Mon Sep 7 09:51:23 2009 (r196917) @@ -100,6 +100,7 @@ int rawcpu; /* -C */ int sumrusage; /* -S */ int termwidth; /* Width of the screen (0 == infinity). */ int totwidth; /* Calculated-width of requested variables. */ +int showthreads; /* will threads be shown? */ struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist); @@ -178,7 +179,7 @@ main(int argc, char *argv[]) char *cols; int all, ch, elem, flag, _fmt, i, lineno; int descendancy, nentries, nkept, nselectors; - int prtheader, showthreads, wflag, what, xkeep, xkeep_implied; + int prtheader, wflag, what, xkeep, xkeep_implied; char errbuf[_POSIX2_LINE_MAX]; (void) setlocale(LC_ALL, ""); Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/sys/kern/kern_proc.c Mon Sep 7 09:51:23 2009 (r196917) @@ -115,6 +115,7 @@ MALLOC_DEFINE(M_SUBPROC, "subproc", "Pro static void doenterpgrp(struct proc *, struct pgrp *); static void orphanpg(struct pgrp *pg); +static void fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread); @@ -670,6 +671,30 @@ DB_SHOW_COMMAND(pgrpdump, pgrpdump) #endif /* DDB */ /* + * Rework the kinfo_proc members which need to be aggregated in the + * case of process-ware informations. + * Must be called with the target spinlock process held. + */ +static void +fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp) +{ + struct thread *td; + + PROC_SLOCK_ASSERT(p, MA_OWNED); + + kp->ki_estcpu = 0; + kp->ki_pctcpu = 0; + kp->ki_runtime = 0; + FOREACH_THREAD_IN_PROC(p, td) { + thread_lock(td); + kp->ki_pctcpu += sched_pctcpu(td); + kp->ki_runtime += cputick2usec(td->td_runtime); + kp->ki_estcpu += td->td_estcpu; + thread_unlock(td); + } +} + +/* * Clear kinfo_proc and fill in any information that is common * to all threads in the process. * Must be called with the target process locked. @@ -868,14 +893,15 @@ fill_kinfo_thread(struct thread *td, str kp->ki_numthreads = p->p_numthreads; kp->ki_pcb = td->td_pcb; kp->ki_kstack = (void *)td->td_kstack; - kp->ki_pctcpu = sched_pctcpu(td); - kp->ki_estcpu = td->td_estcpu; kp->ki_slptime = (ticks - td->td_slptick) / hz; kp->ki_pri.pri_class = td->td_pri_class; kp->ki_pri.pri_user = td->td_user_pri; - if (preferthread) + if (preferthread) { kp->ki_runtime = cputick2usec(td->td_runtime); + kp->ki_pctcpu = sched_pctcpu(td); + kp->ki_estcpu = td->td_estcpu; + } /* We can't get this anymore but ps etc never used it anyway. */ kp->ki_rqindex = 0; @@ -895,8 +921,9 @@ fill_kinfo_proc(struct proc *p, struct k fill_kinfo_proc_only(p, kp); PROC_SLOCK(p); - if (FIRST_THREAD_IN_PROC(p) != NULL) - fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp, 0); + MPASS (FIRST_THREAD_IN_PROC(p) != NULL); + fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp, 0); + fill_kinfo_aggregate(p, kp); PROC_SUNLOCK(p); } @@ -962,28 +989,20 @@ sysctl_out_proc(struct proc *p, struct s PROC_LOCK_ASSERT(p, MA_OWNED); - fill_kinfo_proc_only(p, &kinfo_proc); - if (flags & KERN_PROC_NOTHREADS) { - PROC_SLOCK(p); - if (FIRST_THREAD_IN_PROC(p) != NULL) - fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), - &kinfo_proc, 0); - PROC_SUNLOCK(p); + fill_kinfo_proc(p, &kinfo_proc); + if (flags & KERN_PROC_NOTHREADS) error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); - } else { + sizeof(kinfo_proc)); + else { PROC_SLOCK(p); - if (FIRST_THREAD_IN_PROC(p) != NULL) - FOREACH_THREAD_IN_PROC(p, td) { - fill_kinfo_thread(td, &kinfo_proc, 1); - error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); - if (error) - break; - } - else + MPASS(FIRST_THREAD_IN_PROC(p) != NULL); + FOREACH_THREAD_IN_PROC(p, td) { + fill_kinfo_thread(td, &kinfo_proc, 1); error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); + sizeof(kinfo_proc)); + if (error) + break; + } PROC_SUNLOCK(p); } PROC_UNLOCK(p); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 10:15:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11652106566B; Mon, 7 Sep 2009 10:15:51 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1BB28FC15; Mon, 7 Sep 2009 10:15:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87AFoUg011808; Mon, 7 Sep 2009 10:15:50 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87AFoDx011798; Mon, 7 Sep 2009 10:15:50 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909071015.n87AFoDx011798@svn.freebsd.org> From: Hajimu UMEMOTO Date: Mon, 7 Sep 2009 10:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196918 - in stable/7: sbin/ifconfig share/man/man4 sys/net sys/netinet sys/netinet6 sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 10:15:51 -0000 Author: ume Date: Mon Sep 7 10:15:50 2009 New Revision: 196918 URL: http://svn.freebsd.org/changeset/base/196918 Log: MFC r193664, r193796, r193815: Fix and add a workaround on an issue of EtherIP packet with reversed version field sent via gif(4)+if_bridge(4). The EtherIP implementation found on FreeBSD 6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 had an interoperability issue because it sent the incorrect EtherIP packets and discarded the correct ones. Approved by: hrs Added: stable/7/sbin/ifconfig/ifgif.c - copied unchanged from r193664, head/sbin/ifconfig/ifgif.c Modified: stable/7/sbin/ifconfig/ (props changed) stable/7/sbin/ifconfig/Makefile stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/gif.4 stable/7/share/man/man4/if_bridge.4 stable/7/sys/net/ (props changed) stable/7/sys/net/if_gif.c stable/7/sys/net/if_gif.h stable/7/sys/netinet/in_gif.c stable/7/sys/netinet6/in6_gif.c stable/7/sys/sys/priv.h Modified: stable/7/sbin/ifconfig/Makefile ============================================================================== --- stable/7/sbin/ifconfig/Makefile Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sbin/ifconfig/Makefile Mon Sep 7 10:15:50 2009 (r196918) @@ -25,6 +25,7 @@ SRCS+= ifmedia.c # SIOC[GS]IFMEDIA supp SRCS+= ifvlan.c # SIOC[GS]ETVLAN support SRCS+= ifieee80211.c # SIOC[GS]IEEE80211 support SRCS+= ifgre.c # GRE keys etc +SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifcarp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... Copied: stable/7/sbin/ifconfig/ifgif.c (from r193664, head/sbin/ifconfig/ifgif.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sbin/ifconfig/ifgif.c Mon Sep 7 10:15:50 2009 (r196918, copy of r193664, head/sbin/ifconfig/ifgif.c) @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2009 Hiroki Sato. All rights reserved. + * + * 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 ``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 HIS RELATIVES 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 MIND, 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. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +static void gif_status(int); + +static struct { + const char *label; + u_int mask; +} gif_opts[] = { + { "ACCEPT_REV_ETHIP_VER", GIF_ACCEPT_REVETHIP }, + { "SEND_REV_ETHIP_VER", GIF_SEND_REVETHIP }, +}; + +static void +gif_status(int s) +{ + int opts; + int nopts = 0; + int i; + + ifr.ifr_data = (caddr_t)&opts; + if (ioctl(s, GIFGOPTS, &ifr) == -1) + return; + + printf("\toptions=%d<", opts); + for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { + if (opts & gif_opts[i].mask) { + if (nopts++) + printf(","); + printf("%s", gif_opts[i].label); + } + } + printf(">\n"); +} + +static void +setgifopts(const char *val, + int d, int s, const struct afswtch *afp) +{ + int opts; + + ifr.ifr_data = (caddr_t)&opts; + if (ioctl(s, GIFGOPTS, &ifr) == -1) { + warn("ioctl(GIFGOPTS)"); + return; + } + + if (d < 0) + opts &= ~(-d); + else + opts |= d; + + if (ioctl(s, GIFSOPTS, &ifr) == -1) { + warn("ioctl(GIFSOPTS)"); + return; + } +} + +static struct cmd gif_cmds[] = { + DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP, setgifopts), + DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP, setgifopts), + DEF_CMD("send_rev_ethip_ver", GIF_SEND_REVETHIP, setgifopts), + DEF_CMD("-send_rev_ethip_ver", -GIF_SEND_REVETHIP, setgifopts), +}; + +static struct afswtch af_gif = { + .af_name = "af_gif", + .af_af = AF_UNSPEC, + .af_other_status = gif_status, +}; + +static __constructor void +gif_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(gif_cmds); i++) + cmd_register(&gif_cmds[i]); + af_register(&af_gif); +#undef N +} Modified: stable/7/share/man/man4/gif.4 ============================================================================== --- stable/7/share/man/man4/gif.4 Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/share/man/man4/gif.4 Mon Sep 7 10:15:50 2009 (r196918) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 1999 +.Dd June 8, 2009 .Dt GIF 4 .Os .Sh NAME @@ -256,3 +256,32 @@ had a multi-destination behavior, config .Dv IFF_LINK0 flag. The behavior is obsolete and is no longer supported. +.Pp +On +.Fx +6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 +the +.Nm +sends and receives incorrect EtherIP packets with reversed version +field when +.Xr if_bridge 4 +is used together. As a workaround on this interoperability issue, the +following two +.Xr ifconfig 8 +flags can be used: +.Bl -tag -width "accept_rev_ethip_ver" -offset indent +.It accept_rev_ethip_ver +accepts both correct EtherIP packets and ones with reversed version +field, if enabled. If disabled, the +.Nm +accepts the correct packets only. This flag is enabled by default. +.It send_rev_ethip_ver +sends EtherIP packets with reversed version field intentionally, if +enabled. If disabled, the +.Nm +sends the correct packets only. This flag is disabled by default. +.El +.Pp +If interoperability with the older +.Fx +machines is needed, both of these two flags must be enabled. Modified: stable/7/share/man/man4/if_bridge.4 ============================================================================== --- stable/7/share/man/man4/if_bridge.4 Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/share/man/man4/if_bridge.4 Mon Sep 7 10:15:50 2009 (r196918) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2007 +.Dd June 8, 2009 .Dt IF_BRIDGE 4 .Os .Sh NAME @@ -389,6 +389,12 @@ ifconfig gif0 tunnel 1.2.3.4 5.6.7.8 up ifconfig bridge0 create ifconfig bridge0 addm fxp0 addm gif0 up .Ed +.Pp +Note that +.Fx +6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 have a bug in the EtherIP protocol. +For more details and workaround, see +.Xr gif 4 manual page. .Sh SEE ALSO .Xr gif 4 , .Xr ipf 4 , Modified: stable/7/sys/net/if_gif.c ============================================================================== --- stable/7/sys/net/if_gif.c Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/net/if_gif.c Mon Sep 7 10:15:50 2009 (r196918) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -169,6 +170,7 @@ gif_clone_create(ifc, unit, params) if_initname(GIF2IFP(sc), ifc->ifc_name, unit); sc->encap_cookie4 = sc->encap_cookie6 = NULL; + sc->gif_options = GIF_ACCEPT_REVETHIP; GIF2IFP(sc)->if_addrlen = 0; GIF2IFP(sc)->if_mtu = GIF_MTU; @@ -479,6 +481,7 @@ gif_input(m, af, ifp) struct ifnet *ifp; { int isr, n; + struct gif_softc *sc = ifp->if_softc; struct etherip_header *eip; struct ether_header *eh; struct ifnet *oldifp; @@ -539,11 +542,25 @@ gif_input(m, af, ifp) } eip = mtod(m, struct etherip_header *); - if (eip->eip_ver != - (ETHERIP_VERSION & ETHERIP_VER_VERS_MASK)) { - /* discard unknown versions */ - m_freem(m); - return; + /* + * GIF_ACCEPT_REVETHIP (enabled by default) intentionally + * accepts an EtherIP packet with revered version field in + * the header. This is a knob for backward compatibility + * with FreeBSD 7.2R or prior. + */ + if (sc->gif_options & GIF_ACCEPT_REVETHIP) { + if (eip->eip_resvl != ETHERIP_VERSION + && eip->eip_ver != ETHERIP_VERSION) { + /* discard unknown versions */ + m_freem(m); + return; + } + } else { + if (eip->eip_ver != ETHERIP_VERSION) { + /* discard unknown versions */ + m_freem(m); + return; + } } m_adj(m, sizeof(struct etherip_header)); @@ -598,6 +615,7 @@ gif_ioctl(ifp, cmd, data) struct gif_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq*)data; int error = 0, size; + u_int options; struct sockaddr *dst, *src; #ifdef SIOCSIFMTU /* xxx */ u_long mtu; @@ -832,6 +850,24 @@ gif_ioctl(ifp, cmd, data) /* if_ioctl() takes care of it */ break; + case GIFGOPTS: + options = sc->gif_options; + error = copyout(&options, ifr->ifr_data, + sizeof(options)); + break; + + case GIFSOPTS: + if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0) + break; + error = copyin(ifr->ifr_data, &options, sizeof(options)); + if (error) + break; + if (options & ~GIF_OPTMASK) + error = EINVAL; + else + sc->gif_options = options; + break; + default: error = EINVAL; break; Modified: stable/7/sys/net/if_gif.h ============================================================================== --- stable/7/sys/net/if_gif.h Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/net/if_gif.h Mon Sep 7 10:15:50 2009 (r196918) @@ -71,6 +71,7 @@ struct gif_softc { const struct encaptab *encap_cookie4; const struct encaptab *encap_cookie6; void *gif_netgraph; /* ng_gif(4) netgraph node info */ + u_int gif_options; LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */ }; #define GIF2IFP(sc) ((sc)->gif_ifp) @@ -94,12 +95,18 @@ struct gif_softc { #define MTAG_GIF_CALLED 0 struct etherip_header { - u_int8_t eip_ver; /* version/reserved */ - u_int8_t eip_pad; /* required padding byte */ -}; -#define ETHERIP_VER_VERS_MASK 0x0f -#define ETHERIP_VER_RSVD_MASK 0xf0 -#define ETHERIP_VERSION 0x03 +#if BYTE_ORDER == LITTLE_ENDIAN + u_int eip_resvl:4, /* reserved */ + eip_ver:4; /* version */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int eip_ver:4, /* version */ + eip_resvl:4; /* reserved */ +#endif + u_int8_t eip_resvh; /* reserved */ +} __packed; + +#define ETHERIP_VERSION 0x3 /* mbuf adjust factor to force 32-bit alignment of IP header */ #define ETHERIP_ALIGN 2 @@ -114,4 +121,11 @@ int gif_encapcheck(const struct mbuf *, #endif /* _KERNEL */ +#define GIFGOPTS _IOWR('i', 150, struct ifreq) +#define GIFSOPTS _IOW('i', 151, struct ifreq) + +#define GIF_ACCEPT_REVETHIP 0x0001 +#define GIF_SEND_REVETHIP 0x0010 +#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP) + #endif /* _NET_IF_GIF_H_ */ Modified: stable/7/sys/netinet/in_gif.c ============================================================================== --- stable/7/sys/netinet/in_gif.c Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/netinet/in_gif.c Mon Sep 7 10:15:50 2009 (r196918) @@ -144,8 +144,22 @@ in_gif_output(struct ifnet *ifp, int fam #endif /* INET6 */ case AF_LINK: proto = IPPROTO_ETHERIP; - eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK; - eiphdr.eip_pad = 0; + + /* + * GIF_SEND_REVETHIP (disabled by default) intentionally + * sends an EtherIP packet with revered version field in + * the header. This is a knob for backward compatibility + * with FreeBSD 7.2R or prior. + */ + if ((sc->gif_options & GIF_SEND_REVETHIP)) { + eiphdr.eip_ver = 0; + eiphdr.eip_resvl = ETHERIP_VERSION; + eiphdr.eip_resvh = 0; + } else { + eiphdr.eip_ver = ETHERIP_VERSION; + eiphdr.eip_resvl = 0; + eiphdr.eip_resvh = 0; + } /* prepend Ethernet-in-IP header */ M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m && m->m_len < sizeof(struct etherip_header)) Modified: stable/7/sys/netinet6/in6_gif.c ============================================================================== --- stable/7/sys/netinet6/in6_gif.c Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/netinet6/in6_gif.c Mon Sep 7 10:15:50 2009 (r196918) @@ -142,8 +142,22 @@ in6_gif_output(struct ifnet *ifp, #endif case AF_LINK: proto = IPPROTO_ETHERIP; - eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK; - eiphdr.eip_pad = 0; + + /* + * GIF_SEND_REVETHIP (disabled by default) intentionally + * sends an EtherIP packet with revered version field in + * the header. This is a knob for backward compatibility + * with FreeBSD 7.2R or prior. + */ + if ((sc->gif_options & GIF_SEND_REVETHIP)) { + eiphdr.eip_ver = 0; + eiphdr.eip_resvl = ETHERIP_VERSION; + eiphdr.eip_resvh = 0; + } else { + eiphdr.eip_ver = ETHERIP_VERSION; + eiphdr.eip_resvl = 0; + eiphdr.eip_resvh = 0; + } /* prepend Ethernet-in-IP header */ M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m && m->m_len < sizeof(struct etherip_header)) Modified: stable/7/sys/sys/priv.h ============================================================================== --- stable/7/sys/sys/priv.h Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/sys/priv.h Mon Sep 7 10:15:50 2009 (r196918) @@ -327,6 +327,7 @@ #define PRIV_NET_ADDIFADDR 413 /* Add protocol addr to interface. */ #define PRIV_NET_DELIFADDR 414 /* Delete protocol addr on interface. */ #define PRIV_NET_LAGG 415 /* Administer lagg interface. */ +#define PRIV_NET_GIF 416 /* Administer gif interface. */ /* * 802.11-related privileges. From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 11:38:44 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47534106566B; Mon, 7 Sep 2009 11:38:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35F9B8FC1A; Mon, 7 Sep 2009 11:38:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87Bci4X013364; Mon, 7 Sep 2009 11:38:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87BciEc013363; Mon, 7 Sep 2009 11:38:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071138.n87BciEc013363@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 11:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196919 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 11:38:44 -0000 Author: pjd Date: Mon Sep 7 11:38:43 2009 New Revision: 196919 URL: http://svn.freebsd.org/changeset/base/196919 Log: bzero() on-stack argument, so mutex_init() won't misinterpret that the lock is already initialized if we have some garbage on the stack. PR: kern/135480 Reported by: Emil Mikulic MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Mon Sep 7 10:15:50 2009 (r196918) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Mon Sep 7 11:38:43 2009 (r196919) @@ -1419,6 +1419,7 @@ dsl_dataset_drain_refs(dsl_dataset_t *ds { struct refsarg arg; + bzero(&arg, sizeof(arg)); mutex_init(&arg.lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arg.cv, NULL, CV_DEFAULT, NULL); arg.gone = FALSE; From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 11:55:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 881A91065672; Mon, 7 Sep 2009 11:55:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 773448FC72; Mon, 7 Sep 2009 11:55:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87BtYBH013768; Mon, 7 Sep 2009 11:55:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87BtYdV013765; Mon, 7 Sep 2009 11:55:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909071155.n87BtYdV013765@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 7 Sep 2009 11:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196920 - in head/sys: fs/pseudofs ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 11:55:34 -0000 Author: kib Date: Mon Sep 7 11:55:34 2009 New Revision: 196920 URL: http://svn.freebsd.org/changeset/base/196920 Log: insmntque_stddtr() clears vp->v_data and resets vp->v_op to dead_vnodeops before calling vgone(). Revert r189706 and corresponding part of the r186560. Noted and reviewed by: tegge Approved by: des (pseudofs part) MFC after: 3 days Modified: head/sys/fs/pseudofs/pseudofs_vncache.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 11:38:43 2009 (r196919) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 11:55:34 2009 (r196920) @@ -193,6 +193,7 @@ retry: vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); error = insmntque(*vpp, mp); if (error != 0) { + free(pvd, M_PFSVNCACHE); *vpp = NULLVP; return (error); } Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Sep 7 11:38:43 2009 (r196919) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Sep 7 11:55:34 2009 (r196920) @@ -1467,6 +1467,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags vp->v_vflag |= VV_FORCEINSMQ; error = insmntque(vp, mp); if (error != 0) { + uma_zfree(uma_inode, ip); *vpp = NULL; return (error); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 12:10:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7696F1065694; Mon, 7 Sep 2009 12:10:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65D3D8FC20; Mon, 7 Sep 2009 12:10:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87CAfwu014084; Mon, 7 Sep 2009 12:10:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87CAflU014082; Mon, 7 Sep 2009 12:10:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909071210.n87CAflU014082@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 7 Sep 2009 12:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196921 - head/sys/fs/pseudofs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 12:10:41 -0000 Author: kib Date: Mon Sep 7 12:10:41 2009 New Revision: 196921 URL: http://svn.freebsd.org/changeset/base/196921 Log: If a race is detected, pfs_vncache_alloc() may reclaim a vnode that had never been inserted into the pfs_vncache list. Since pfs_vncache_free() does not anticipate this case, it decrements pfs_vncache_entries unconditionally; if the vnode was not in the list, pfs_vncache_entries will no longer reflect the actual number of list entries. This may cause size of the cache to exceed the configured maximum. It may also trigger a panic during module unload or system shutdown. Do not decrement pfs_vncache_entries for the vnode that was not in the list. Submitted by: tegge Reviewed by: des MFC after: 1 week Modified: head/sys/fs/pseudofs/pseudofs_vncache.c Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 11:55:34 2009 (r196920) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 12:10:41 2009 (r196921) @@ -246,11 +246,13 @@ pfs_vncache_free(struct vnode *vp) KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n")); if (pvd->pvd_next) pvd->pvd_next->pvd_prev = pvd->pvd_prev; - if (pvd->pvd_prev) + if (pvd->pvd_prev) { pvd->pvd_prev->pvd_next = pvd->pvd_next; - else if (pfs_vncache == pvd) + --pfs_vncache_entries; + } else if (pfs_vncache == pvd) { pfs_vncache = pvd->pvd_next; - --pfs_vncache_entries; + --pfs_vncache_entries; + } mtx_unlock(&pfs_vncache_mutex); free(pvd, M_PFSVNCACHE); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 12:39:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27F131065670; Mon, 7 Sep 2009 12:39:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15FC98FC0C; Mon, 7 Sep 2009 12:39:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87CdsTA014742; Mon, 7 Sep 2009 12:39:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87Cds3C014740; Mon, 7 Sep 2009 12:39:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909071239.n87Cds3C014740@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 7 Sep 2009 12:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196922 - in stable/7/sys: . contrib/pf net ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 12:39:55 -0000 Author: kib Date: Mon Sep 7 12:39:54 2009 New Revision: 196922 URL: http://svn.freebsd.org/changeset/base/196922 Log: MFC r196206. Take the number of allocated freeblks into consideration for softdep_slowdown(). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/net/ (props changed) stable/7/sys/ufs/ffs/ffs_softdep.c Modified: stable/7/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 12:10:41 2009 (r196921) +++ stable/7/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 12:39:54 2009 (r196922) @@ -671,6 +671,8 @@ static int req_clear_inodedeps; /* synce static int req_clear_remove; /* syncer process flush some freeblks */ #define FLUSH_REMOVE 2 #define FLUSH_REMOVE_WAIT 3 +static long num_freeblkdep; /* number of freeblks workitems allocated */ + /* * runtime statistics */ @@ -2230,6 +2232,9 @@ softdep_setup_freeblocks(ip, length, fla freeblks->fb_uid = ip->i_uid; freeblks->fb_previousinum = ip->i_number; freeblks->fb_devvp = ip->i_devvp; + ACQUIRE_LOCK(&lk); + num_freeblkdep++; + FREE_LOCK(&lk); extblocks = 0; if (fs->fs_magic == FS_UFS2_MAGIC) extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); @@ -2821,6 +2826,7 @@ handle_workitem_freeblocks(freeblks, fla ACQUIRE_LOCK(&lk); WORKITEM_FREE(freeblks, D_FREEBLKS); + num_freeblkdep--; FREE_LOCK(&lk); } @@ -5748,7 +5754,8 @@ softdep_slowdown(vp) max_softdeps_hard = max_softdeps * 11 / 10; if (num_dirrem < max_softdeps_hard / 2 && num_inodedep < max_softdeps_hard && - VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { + VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps && + num_freeblkdep < max_softdeps_hard) { FREE_LOCK(&lk); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 13:37:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D6D106568B; Mon, 7 Sep 2009 13:37:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70E968FC17; Mon, 7 Sep 2009 13:37:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87Db4na016094; Mon, 7 Sep 2009 13:37:04 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87Db4tN016089; Mon, 7 Sep 2009 13:37:04 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200909071337.n87Db4tN016089@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 7 Sep 2009 13:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196924 - in stable/7/sys: . amd64/amd64 compat/ia32 contrib/pf i386/i386 kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 13:37:04 -0000 Author: bz Date: Mon Sep 7 13:37:04 2009 New Revision: 196924 URL: http://svn.freebsd.org/changeset/base/196924 Log: MFC r196653: Make sure FreeBSD binaries without .note.ABI-tag section work correctly and do not match a colliding Debian GNU/kFreeBSD brandinfo statements. For this mark the Debian GNU/kFreeBSD brandinfo that it must have an .note.ABI-tag section and ignore the old EI_OSABI brandinfo when comparing a possibly colliding set of options. Due to SYSINIT we add the brandinfo in a non-deterministic order, so native FreeBSD is not always first. We may want to consider to force native FreeBSD to come first as well. The only way a problem could currently be noticed is when running an i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD brandinfo was matched first, as the fallback to ld-elf32.so.1 does not exist in that case. Reported and tested by: ticso In collaboration with: kib Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/elf_machdep.c stable/7/sys/compat/ia32/ia32_sysvec.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/i386/elf_machdep.c stable/7/sys/kern/imgact_elf.c stable/7/sys/sys/imgact_elf.h Modified: stable/7/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/7/sys/amd64/amd64/elf_machdep.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/amd64/amd64/elf_machdep.c Mon Sep 7 13:37:04 2009 (r196924) @@ -117,7 +117,7 @@ static Elf64_Brandinfo kfreebsd_brand_in .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/7/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/7/sys/compat/ia32/ia32_sysvec.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/compat/ia32/ia32_sysvec.c Mon Sep 7 13:37:04 2009 (r196924) @@ -179,7 +179,7 @@ static Elf32_Brandinfo kia32_brand_info .interp_path = "/lib/ld.so.1", .sysvec = &ia32_freebsd_sysvec, .brand_note = &elf32_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/7/sys/i386/i386/elf_machdep.c ============================================================================== --- stable/7/sys/i386/i386/elf_machdep.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/i386/i386/elf_machdep.c Mon Sep 7 13:37:04 2009 (r196924) @@ -116,7 +116,7 @@ static Elf32_Brandinfo kfreebsd_brand_in .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/7/sys/kern/imgact_elf.c ============================================================================== --- stable/7/sys/kern/imgact_elf.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/kern/imgact_elf.c Mon Sep 7 13:37:04 2009 (r196924) @@ -241,8 +241,10 @@ __elfN(get_brandinfo)(struct image_param /* Look for an ".note.ABI-tag" ELF section */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && - (bi->flags & BI_BRAND_NOTE) != 0) { + if (bi == NULL) + continue; + if (hdr->e_machine == bi->machine && (bi->flags & + (BI_BRAND_NOTE|BI_BRAND_NOTE_MANDATORY)) != 0) { ret = __elfN(check_note)(imgp, bi->brand_note, osrel); if (ret) return (bi); @@ -252,7 +254,9 @@ __elfN(get_brandinfo)(struct image_param /* If the executable has a brand, search for it in the brand list. */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && (hdr->e_ident[EI_OSABI] == bi->brand || strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND], bi->compat_3_brand, strlen(bi->compat_3_brand)) == 0)) @@ -263,7 +267,9 @@ __elfN(get_brandinfo)(struct image_param if (interp != NULL) { for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && strcmp(interp, bi->interp_path) == 0) return (bi); } @@ -272,7 +278,9 @@ __elfN(get_brandinfo)(struct image_param /* Lacking a recognized interpreter, try the default brand */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && __elfN(fallback_brand) == bi->brand) return (bi); } Modified: stable/7/sys/sys/imgact_elf.h ============================================================================== --- stable/7/sys/sys/imgact_elf.h Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/sys/imgact_elf.h Mon Sep 7 13:37:04 2009 (r196924) @@ -75,8 +75,9 @@ typedef struct { const char *interp_newpath; int flags; Elf_Brandnote *brand_note; -#define BI_CAN_EXEC_DYN 0x0001 -#define BI_BRAND_NOTE 0x0002 +#define BI_CAN_EXEC_DYN 0x0001 +#define BI_BRAND_NOTE 0x0002 /* May have note.ABI-tag section. */ +#define BI_BRAND_NOTE_MANDATORY 0x0004 /* Must have note.ABI-tag section. */ } __ElfN(Brandinfo); __ElfType(Auxargs); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 13:58:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54AE9106566B; Mon, 7 Sep 2009 13:58:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 426578FC15; Mon, 7 Sep 2009 13:58:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87DwRI6016562; Mon, 7 Sep 2009 13:58:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87DwRYP016560; Mon, 7 Sep 2009 13:58:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909071358.n87DwRYP016560@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 7 Sep 2009 13:58:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196925 - in stable/6/sys: . conf contrib/pf dev/cxgb ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 13:58:27 -0000 Author: kib Date: Mon Sep 7 13:58:26 2009 New Revision: 196925 URL: http://svn.freebsd.org/changeset/base/196925 Log: MFC r196206. Take the number of allocated freeblks into consideration for softdep_slowdown(). Tested by: pluknet gmail com Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/ufs/ffs/ffs_softdep.c Modified: stable/6/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/6/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 13:37:04 2009 (r196924) +++ stable/6/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 13:58:26 2009 (r196925) @@ -668,6 +668,8 @@ static int req_clear_inodedeps; /* synce static int req_clear_remove; /* syncer process flush some freeblks */ #define FLUSH_REMOVE 2 #define FLUSH_REMOVE_WAIT 3 +static long num_freeblkdep; /* number of freeblks workitems allocated */ + /* * runtime statistics */ @@ -2195,6 +2197,9 @@ softdep_setup_freeblocks(ip, length, fla freeblks->fb_uid = ip->i_uid; freeblks->fb_previousinum = ip->i_number; freeblks->fb_devvp = ip->i_devvp; + ACQUIRE_LOCK(&lk); + num_freeblkdep++; + FREE_LOCK(&lk); extblocks = 0; if (fs->fs_magic == FS_UFS2_MAGIC) extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); @@ -2784,6 +2789,7 @@ handle_workitem_freeblocks(freeblks, fla ACQUIRE_LOCK(&lk); WORKITEM_FREE(freeblks, D_FREEBLKS); + num_freeblkdep--; FREE_LOCK(&lk); } @@ -5708,7 +5714,8 @@ softdep_slowdown(vp) max_softdeps_hard = max_softdeps * 11 / 10; if (num_dirrem < max_softdeps_hard / 2 && num_inodedep < max_softdeps_hard && - VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { + VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps && + num_freeblkdep < max_softdeps_hard) { FREE_LOCK(&lk); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 14:10:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1D1E1065672; Mon, 7 Sep 2009 14:10:55 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A62CD8FC0C; Mon, 7 Sep 2009 14:10:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87EAtrW016933; Mon, 7 Sep 2009 14:10:55 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87EAtqO016929; Mon, 7 Sep 2009 14:10:55 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <200909071410.n87EAtqO016929@svn.freebsd.org> From: Remko Lodder Date: Mon, 7 Sep 2009 14:10:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196926 - in stable/8: . etc libexec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 14:10:55 -0000 Author: remko Date: Mon Sep 7 14:10:55 2009 New Revision: 196926 URL: http://svn.freebsd.org/changeset/base/196926 Log: MFC r196787 Do the first step in removing lukemftpd from the base system. Disconnect it from the build. If you are using the FTP daemon, please consider using the port ftp/tnftpd which is the same FTP server, but newer and might have more/better functionality. This results in us providing only one ftp daemon by default. Reviewed by: bz Approved by: imp (mentor, implicit) MFC after: 3 days Silence from: obrien Approved by: re (kib), imp (mentor, implicit) Modified: stable/8/ObsoleteFiles.inc (contents, props changed) stable/8/etc/inetd.conf stable/8/libexec/Makefile Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Mon Sep 7 13:58:26 2009 (r196925) +++ stable/8/ObsoleteFiles.inc Mon Sep 7 14:10:55 2009 (r196926) @@ -14,6 +14,11 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090904: remove lukemftpd +OLD_FILES+=usr/libexec/lukemftpd +OLD_FILES+=usr/share/man/man5/ftpd.conf.5.gz +OLD_FILES+=usr/share/man/man5/ftpusers.5.gz +OLD_FILES+=usr/share/man/man8/lukemftpd.8.gz # 20090801: vimage.h removed in favour of vnet.h OLD_FILES+=usr/include/sys/vimage.h # 20090719: library version bump for 8.0 Modified: stable/8/etc/inetd.conf ============================================================================== --- stable/8/etc/inetd.conf Mon Sep 7 13:58:26 2009 (r196925) +++ stable/8/etc/inetd.conf Mon Sep 7 14:10:55 2009 (r196926) @@ -8,8 +8,6 @@ # #ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l #ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l -#ftp stream tcp nowait root /usr/libexec/lukemftpd ftpd -l -r -#ftp stream tcp6 nowait root /usr/libexec/lukemftpd ftpd -l -r #ssh stream tcp nowait root /usr/sbin/sshd sshd -i -4 #ssh stream tcp6 nowait root /usr/sbin/sshd sshd -i -6 #telnet stream tcp nowait root /usr/libexec/telnetd telnetd Modified: stable/8/libexec/Makefile ============================================================================== --- stable/8/libexec/Makefile Mon Sep 7 13:58:26 2009 (r196925) +++ stable/8/libexec/Makefile Mon Sep 7 14:10:55 2009 (r196926) @@ -9,7 +9,6 @@ SUBDIR= ${_atrun} \ fingerd \ ftpd \ getty \ - lukemftpd \ ${_mail.local} \ ${_mknetid} \ ${_pppoed} \ From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 14:16:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68C4F1065697; Mon, 7 Sep 2009 14:16:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 575378FC1C; Mon, 7 Sep 2009 14:16:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87EGo45017089; Mon, 7 Sep 2009 14:16:50 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87EGoiV017087; Mon, 7 Sep 2009 14:16:50 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071416.n87EGoiV017087@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 14:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196927 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 14:16:50 -0000 Author: pjd Date: Mon Sep 7 14:16:50 2009 New Revision: 196927 URL: http://svn.freebsd.org/changeset/base/196927 Log: Changing provider size is not really supported by GEOM, but doing so when provider is closed should be ok. When administrator requests to change ZVOL size do it immediately if ZVOL is closed or do it on last ZVOL close. PR: kern/136942 Requested by: Bernard Buri MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Sep 7 14:10:55 2009 (r196926) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Sep 7 14:16:50 2009 (r196927) @@ -153,7 +153,22 @@ static int zvol_dump_init(zvol_state_t * static void zvol_size_changed(zvol_state_t *zv, major_t maj) { + struct g_provider *pp; + + g_topology_assert(); + pp = zv->zv_provider; + if (pp == NULL) + return; + if (zv->zv_volsize == pp->mediasize) + return; + /* + * Changing provider size is not really supported by GEOM, but it + * should be safe when provider is closed. + */ + if (zv->zv_total_opens > 0) + return; + pp->mediasize = zv->zv_volsize; } int @@ -263,6 +278,7 @@ zvol_access(struct g_provider *pp, int a } zv->zv_total_opens += acr + acw + ace; + zvol_size_changed(zv, 0); mutex_exit(&zvol_state_lock); @@ -1072,11 +1088,6 @@ zvol_set_volblocksize(const char *name, if (error == ENOTSUP) error = EBUSY; dmu_tx_commit(tx); - /* XXX: Not supported. */ -#if 0 - if (error == 0) - zv->zv_provider->sectorsize = zc->zc_volblocksize; -#endif } end: mutex_exit(&zvol_state_lock); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 14:44:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 306F01065672; Mon, 7 Sep 2009 14:44:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F34B8FC1D; Mon, 7 Sep 2009 14:44:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87Ei5wp017652; Mon, 7 Sep 2009 14:44:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87Ei5ND017650; Mon, 7 Sep 2009 14:44:05 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071444.n87Ei5ND017650@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 14:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196928 - head/cddl/contrib/opensolaris/cmd/zdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 14:44:05 -0000 Author: pjd Date: Mon Sep 7 14:44:04 2009 New Revision: 196928 URL: http://svn.freebsd.org/changeset/base/196928 Log: Teach zdb(8) how to obtain GEOM provider size. PR: kern/133134 Reported by: Philipp Wuensche MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Sep 7 14:16:50 2009 (r196927) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Sep 7 14:44:04 2009 (r196928) @@ -1322,6 +1322,14 @@ dump_label(const char *dev) exit(1); } + if (S_ISCHR(statbuf.st_mode)) { + if (ioctl(fd, DIOCGMEDIASIZE, &statbuf.st_size) == -1) { + (void) printf("failed to get size of '%s': %s\n", dev, + strerror(errno)); + exit(1); + } + } + psize = statbuf.st_size; psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 15:22:54 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EB231065672; Mon, 7 Sep 2009 15:22:54 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DB138FC1F; Mon, 7 Sep 2009 15:22:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87FMsEm018547; Mon, 7 Sep 2009 15:22:54 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87FMs68018545; Mon, 7 Sep 2009 15:22:54 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909071522.n87FMs68018545@svn.freebsd.org> From: Hajimu UMEMOTO Date: Mon, 7 Sep 2009 15:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196929 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 15:22:54 -0000 Author: ume Date: Mon Sep 7 15:22:54 2009 New Revision: 196929 URL: http://svn.freebsd.org/changeset/base/196929 Log: Suppress an options line when no bit is on. Reviewed by: hrs MFC after: 3 days Modified: head/sbin/ifconfig/ifgif.c Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Mon Sep 7 14:44:04 2009 (r196928) +++ head/sbin/ifconfig/ifgif.c Mon Sep 7 15:22:54 2009 (r196929) @@ -71,6 +71,8 @@ gif_status(int s) ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; + if (opts == 0) + return; printf("\toptions=%d<", opts); for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 15:52:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A80D3106566B; Mon, 7 Sep 2009 15:52:15 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96E908FC12; Mon, 7 Sep 2009 15:52:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87FqFrs019222; Mon, 7 Sep 2009 15:52:15 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87FqFwD019220; Mon, 7 Sep 2009 15:52:15 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <200909071552.n87FqFwD019220@svn.freebsd.org> From: Hiroki Sato Date: Mon, 7 Sep 2009 15:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196931 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 15:52:15 -0000 Author: hrs Date: Mon Sep 7 15:52:15 2009 New Revision: 196931 URL: http://svn.freebsd.org/changeset/base/196931 Log: Use printb() instead of rolling its own routine to display bits in options=<>. Pointed out by: ume MFC after: 3 days Modified: head/sbin/ifconfig/ifgif.c Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Mon Sep 7 15:43:09 2009 (r196930) +++ head/sbin/ifconfig/ifgif.c Mon Sep 7 15:52:15 2009 (r196931) @@ -51,38 +51,22 @@ static const char rcsid[] = #include "ifconfig.h" -static void gif_status(int); +#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\5SEND_REV_ETHIP_VER" -static struct { - const char *label; - u_int mask; -} gif_opts[] = { - { "ACCEPT_REV_ETHIP_VER", GIF_ACCEPT_REVETHIP }, - { "SEND_REV_ETHIP_VER", GIF_SEND_REVETHIP }, -}; +static void gif_status(int); static void gif_status(int s) { int opts; - int nopts = 0; - size_t i; ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; if (opts == 0) return; - - printf("\toptions=%d<", opts); - for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { - if (opts & gif_opts[i].mask) { - if (nopts++) - printf(","); - printf("%s", gif_opts[i].label); - } - } - printf(">\n"); + printb("\toptions", opts, GIFBITS); + putchar('\n'); } static void From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:00:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADB25106566B; Mon, 7 Sep 2009 16:00:33 +0000 (UTC) (envelope-from syrinx@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6828FC08; Mon, 7 Sep 2009 16:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87G0Xnf019508; Mon, 7 Sep 2009 16:00:33 GMT (envelope-from syrinx@svn.freebsd.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87G0XdT019506; Mon, 7 Sep 2009 16:00:33 GMT (envelope-from syrinx@svn.freebsd.org) Message-Id: <200909071600.n87G0XdT019506@svn.freebsd.org> From: Shteryana Shopova Date: Mon, 7 Sep 2009 16:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196932 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:00:33 -0000 Author: syrinx Date: Mon Sep 7 16:00:33 2009 New Revision: 196932 URL: http://svn.freebsd.org/changeset/base/196932 Log: When joining a multicast group, the inp_lookup_mcast_ifp call does a KASSERT that the group address is multicast, so the check if this is indeed true and eventually return a EINVAL if not, should be done before calling inp_lookup_mcast_ifp. This fixes a kernel crash when calling setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,...) with invalid group address. Reviewed by: bms Approved by: bms MFC after: 3 days Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon Sep 7 15:52:15 2009 (r196931) +++ head/sys/netinet/in_mcast.c Mon Sep 7 16:00:33 2009 (r196932) @@ -1899,6 +1899,9 @@ inp_join_group(struct inpcb *inp, struct ssa->sin.sin_addr = mreqs.imr_sourceaddr; } + if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) + return (EINVAL); + ifp = inp_lookup_mcast_ifp(inp, &gsa->sin, mreqs.imr_interface); CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p", @@ -1936,6 +1939,9 @@ inp_join_group(struct inpcb *inp, struct ssa->sin.sin_port = 0; } + if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) + return (EINVAL); + if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface) return (EADDRNOTAVAIL); ifp = ifnet_byindex(gsr.gsr_interface); @@ -1948,9 +1954,6 @@ inp_join_group(struct inpcb *inp, struct break; } - if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) - return (EINVAL); - if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) return (EADDRNOTAVAIL); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:08:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F01CF106568F; Mon, 7 Sep 2009 16:08:21 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF4DB8FC14; Mon, 7 Sep 2009 16:08:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87G8LSU019729; Mon, 7 Sep 2009 16:08:21 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87G8Lqq019727; Mon, 7 Sep 2009 16:08:21 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200909071608.n87G8Lqq019727@svn.freebsd.org> From: Sam Leffler Date: Mon, 7 Sep 2009 16:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196933 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:08:22 -0000 Author: sam Date: Mon Sep 7 16:08:21 2009 New Revision: 196933 URL: http://svn.freebsd.org/changeset/base/196933 Log: correct typo that was a noop on 32-bit machines but a bug on 64-bit machines Submitted by: phk Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Sep 7 16:00:33 2009 (r196932) +++ head/sys/dev/ath/if_ath.c Mon Sep 7 16:08:21 2009 (r196933) @@ -1452,7 +1452,7 @@ ath_hal_gethangstate(struct ath_hal *ah, uint32_t rsize; void *sp; - if (!ath_hal_getdiagstate(ah, 32, &mask, sizeof(&mask), &sp, &rsize)) + if (!ath_hal_getdiagstate(ah, 32, &mask, sizeof(mask), &sp, &rsize)) return 0; KASSERT(rsize == sizeof(uint32_t), ("resultsize %u", rsize)); *hangs = *(uint32_t *)sp; From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:12:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6EE71065672; Mon, 7 Sep 2009 16:12:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C63828FC14; Mon, 7 Sep 2009 16:12:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GC7fd019852; Mon, 7 Sep 2009 16:12:07 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GC7tW019850; Mon, 7 Sep 2009 16:12:07 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200909071612.n87GC7tW019850@svn.freebsd.org> From: Sam Leffler Date: Mon, 7 Sep 2009 16:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196934 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:12:07 -0000 Author: sam Date: Mon Sep 7 16:12:07 2009 New Revision: 196934 URL: http://svn.freebsd.org/changeset/base/196934 Log: fix extraneous return that can cause a memory leak Submitted by: phk MFC after: 1 week Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Mon Sep 7 16:08:21 2009 (r196933) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Mon Sep 7 16:12:07 2009 (r196934) @@ -1759,7 +1759,7 @@ legacyEepromDetach(struct ath_hal *ah) HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; if (ee->ee_version >= AR_EEPROM_VER4_0 && ee->ee_eepMap == 1) - return freeEepromRawPowerCalInfo5112(ah, ee); + freeEepromRawPowerCalInfo5112(ah, ee); ath_hal_free(ee); AH_PRIVATE(ah)->ah_eeprom = AH_NULL; } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:18:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA8C61065696; Mon, 7 Sep 2009 16:18:16 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B05498FC19; Mon, 7 Sep 2009 16:18:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GIGeW020048; Mon, 7 Sep 2009 16:18:16 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GIGHh020046; Mon, 7 Sep 2009 16:18:16 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200909071618.n87GIGHh020046@svn.freebsd.org> From: Sam Leffler Date: Mon, 7 Sep 2009 16:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196935 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:18:17 -0000 Author: sam Date: Mon Sep 7 16:18:16 2009 New Revision: 196935 URL: http://svn.freebsd.org/changeset/base/196935 Log: remove extranous return Submitted by: phk MFC after: 1 week Modified: head/sys/dev/ath/ah_osdep.c Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Mon Sep 7 16:12:07 2009 (r196934) +++ head/sys/dev/ath/ah_osdep.c Mon Sep 7 16:18:16 2009 (r196935) @@ -110,7 +110,7 @@ ath_hal_malloc(size_t size) void ath_hal_free(void* p) { - return free(p, M_ATH_HAL); + free(p, M_ATH_HAL); } void From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:19:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EC1B106566B; Mon, 7 Sep 2009 16:19:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BEBE8FC22; Mon, 7 Sep 2009 16:19:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GJXxi020115; Mon, 7 Sep 2009 16:19:33 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GJXwc020108; Mon, 7 Sep 2009 16:19:33 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909071619.n87GJXwc020108@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 7 Sep 2009 16:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196936 - head/bin/setfacl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:19:33 -0000 Author: trasz Date: Mon Sep 7 16:19:32 2009 New Revision: 196936 URL: http://svn.freebsd.org/changeset/base/196936 Log: Add NFSv4 support to setfacl(1). Reviewed by: rwatson Modified: head/bin/setfacl/mask.c head/bin/setfacl/merge.c head/bin/setfacl/remove.c head/bin/setfacl/setfacl.1 head/bin/setfacl/setfacl.c head/bin/setfacl/setfacl.h Modified: head/bin/setfacl/mask.c ============================================================================== --- head/bin/setfacl/mask.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/mask.c Mon Sep 7 16:19:32 2009 (r196936) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); /* set the appropriate mask the given ACL's */ int -set_acl_mask(acl_t *prev_acl) +set_acl_mask(acl_t *prev_acl, const char *filename) { acl_entry_t entry; acl_t acl; @@ -59,7 +59,7 @@ set_acl_mask(acl_t *prev_acl) acl = acl_dup(*prev_acl); if (acl == NULL) - err(1, "acl_dup() failed"); + err(1, "%s: acl_dup() failed", filename); if (n_flag == 0) { /* @@ -70,7 +70,7 @@ set_acl_mask(acl_t *prev_acl) * class in the resulting ACL */ if (acl_calc_mask(&acl)) { - warn("acl_calc_mask() failed"); + warn("%s: acl_calc_mask() failed", filename); acl_free(acl); return (-1); } @@ -86,7 +86,8 @@ set_acl_mask(acl_t *prev_acl) while (acl_get_entry(acl, entry_id, &entry) == 1) { entry_id = ACL_NEXT_ENTRY; if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", + filename); if (tag == ACL_MASK) { acl_free(acl); @@ -100,7 +101,7 @@ set_acl_mask(acl_t *prev_acl) * file, then write an error message to standard error and * continue with the next file. */ - warnx("warning: no mask entry"); + warnx("%s: warning: no mask entry", filename); acl_free(acl); return (0); } Modified: head/bin/setfacl/merge.c ============================================================================== --- head/bin/setfacl/merge.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/merge.c Mon Sep 7 16:19:32 2009 (r196936) @@ -36,12 +36,15 @@ __FBSDID("$FreeBSD$"); #include "setfacl.h" -static int merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new); +static int merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new, + int acl_brand); static int -merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new) +merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new, int acl_brand) { acl_permset_t permset; + acl_entry_type_t entry_type; + acl_flagset_t flagset; int have_entry; uid_t *id, *id_new; @@ -59,6 +62,18 @@ merge_user_group(acl_entry_t *entry, acl err(1, "acl_get_permset() failed"); if (acl_set_permset(*entry_new, permset) == -1) err(1, "acl_set_permset() failed"); + + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_get_entry_type_np(*entry, &entry_type)) + err(1, "acl_get_entry_type_np() failed"); + if (acl_set_entry_type_np(*entry_new, entry_type)) + err(1, "acl_set_entry_type_np() failed"); + if (acl_get_flagset_np(*entry, &flagset)) + err(1, "acl_get_flagset_np() failed"); + if (acl_set_flagset_np(*entry_new, flagset)) + err(1, "acl_set_flagset_np() failed"); + } + have_entry = 1; } acl_free(id); @@ -71,20 +86,31 @@ merge_user_group(acl_entry_t *entry, acl * merge an ACL into existing file's ACL */ int -merge_acl(acl_t acl, acl_t *prev_acl) +merge_acl(acl_t acl, acl_t *prev_acl, const char *filename) { acl_entry_t entry, entry_new; acl_permset_t permset; acl_t acl_new; acl_tag_t tag, tag_new; - int entry_id, entry_id_new, have_entry; + acl_entry_type_t entry_type, entry_type_new; + acl_flagset_t flagset; + int entry_id, entry_id_new, have_entry, entry_number = 0; + int acl_brand, prev_acl_brand; + + acl_get_brand_np(acl, &acl_brand); + acl_get_brand_np(*prev_acl, &prev_acl_brand); + + if (acl_brand != prev_acl_brand) { + warnx("%s: branding mismatch; existing ACL is %s, " + "entry to be merged is %s", filename, + prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e", + acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e"); + return (-1); + } - if (acl_type == ACL_TYPE_ACCESS) - acl_new = acl_dup(prev_acl[ACCESS_ACL]); - else - acl_new = acl_dup(prev_acl[DEFAULT_ACL]); + acl_new = acl_dup(*prev_acl); if (acl_new == NULL) - err(1, "acl_dup() failed"); + err(1, "%s: acl_dup() failed", filename); entry_id = ACL_FIRST_ENTRY; @@ -94,28 +120,45 @@ merge_acl(acl_t acl, acl_t *prev_acl) /* keep track of existing ACL_MASK entries */ if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed - invalid ACL entry"); + err(1, "%s: acl_get_tag_type() failed - " + "invalid ACL entry", filename); if (tag == ACL_MASK) have_mask = 1; /* check against the existing ACL entries */ entry_id_new = ACL_FIRST_ENTRY; - while (have_entry == 0 && - acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) { + while (acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) { entry_id_new = ACL_NEXT_ENTRY; if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", + filename); if (acl_get_tag_type(entry_new, &tag_new) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", + filename); if (tag != tag_new) continue; + /* + * For NFSv4, in addition to "tag" and "id" we also + * compare "entry_type". + */ + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_get_entry_type_np(entry, &entry_type)) + err(1, "%s: acl_get_entry_type_np() " + "failed", filename); + if (acl_get_entry_type_np(entry_new, &entry_type_new)) + err(1, "%s: acl_get_entry_type_np() " + "failed", filename); + if (entry_type != entry_type_new) + continue; + } + switch(tag) { case ACL_USER: case ACL_GROUP: have_entry = merge_user_group(&entry, - &entry_new); + &entry_new, acl_brand); if (have_entry == 0) break; /* FALLTHROUGH */ @@ -123,37 +166,127 @@ merge_acl(acl_t acl, acl_t *prev_acl) case ACL_GROUP_OBJ: case ACL_OTHER: case ACL_MASK: + case ACL_EVERYONE: if (acl_get_permset(entry, &permset) == -1) - err(1, "acl_get_permset() failed"); + err(1, "%s: acl_get_permset() failed", + filename); if (acl_set_permset(entry_new, permset) == -1) - err(1, "acl_set_permset() failed"); + err(1, "%s: acl_set_permset() failed", + filename); + + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_get_entry_type_np(entry, &entry_type)) + err(1, "%s: acl_get_entry_type_np() failed", + filename); + if (acl_set_entry_type_np(entry_new, entry_type)) + err(1, "%s: acl_set_entry_type_np() failed", + filename); + if (acl_get_flagset_np(entry, &flagset)) + err(1, "%s: acl_get_flagset_np() failed", + filename); + if (acl_set_flagset_np(entry_new, flagset)) + err(1, "%s: acl_set_flagset_np() failed", + filename); + } have_entry = 1; break; default: /* should never be here */ - errx(1, "Invalid tag type: %i", tag); + errx(1, "%s: invalid tag type: %i", filename, tag); break; } } /* if this entry has not been found, it must be new */ if (have_entry == 0) { - if (acl_create_entry(&acl_new, &entry_new) == -1) { - acl_free(acl_new); - return (-1); + + /* + * NFSv4 ACL entries must be prepended to the ACL. + * Appending them at the end makes no sense, since + * in most cases they wouldn't even get evaluated. + */ + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_create_entry_np(&acl_new, &entry_new, entry_number) == -1) { + warn("%s: acl_create_entry_np() failed", filename); + acl_free(acl_new); + return (-1); + } + /* + * Without this increment, adding several + * entries at once, for example + * "setfacl -m user:1:r:allow,user:2:r:allow", + * would make them appear in reverse order. + */ + entry_number++; + } else { + if (acl_create_entry(&acl_new, &entry_new) == -1) { + warn("%s: acl_create_entry() failed", filename); + acl_free(acl_new); + return (-1); + } } if (acl_copy_entry(entry_new, entry) == -1) - err(1, "acl_copy_entry() failed"); + err(1, "%s: acl_copy_entry() failed", filename); } } - if (acl_type == ACL_TYPE_ACCESS) { - acl_free(prev_acl[ACCESS_ACL]); - prev_acl[ACCESS_ACL] = acl_new; - } else { - acl_free(prev_acl[DEFAULT_ACL]); - prev_acl[DEFAULT_ACL] = acl_new; + acl_free(*prev_acl); + *prev_acl = acl_new; + + return (0); +} + +int +add_acl(acl_t acl, uint entry_number, acl_t *prev_acl, const char *filename) +{ + acl_entry_t entry, entry_new; + acl_t acl_new; + int entry_id, acl_brand, prev_acl_brand; + + acl_get_brand_np(acl, &acl_brand); + acl_get_brand_np(*prev_acl, &prev_acl_brand); + + if (prev_acl_brand != ACL_BRAND_NFS4) { + warnx("%s: the '-a' option is only applicable to NFSv4 ACLs", + filename); + return (-1); + } + + if (acl_brand != ACL_BRAND_NFS4) { + warnx("%s: branding mismatch; existing ACL is NFSv4, " + "entry to be added is POSIX.1e", filename); + return (-1); + } + + acl_new = acl_dup(*prev_acl); + if (acl_new == NULL) + err(1, "%s: acl_dup() failed", filename); + + entry_id = ACL_FIRST_ENTRY; + + while (acl_get_entry(acl, entry_id, &entry) == 1) { + entry_id = ACL_NEXT_ENTRY; + + if (acl_create_entry_np(&acl_new, &entry_new, entry_number) == -1) { + warn("%s: acl_create_entry_np() failed", filename); + acl_free(acl_new); + return (-1); + } + + /* + * Without this increment, adding several + * entries at once, for example + * "setfacl -m user:1:r:allow,user:2:r:allow", + * would make them appear in reverse order. + */ + entry_number++; + + if (acl_copy_entry(entry_new, entry) == -1) + err(1, "%s: acl_copy_entry() failed", filename); } + acl_free(*prev_acl); + *prev_acl = acl_new; + return (0); } Modified: head/bin/setfacl/remove.c ============================================================================== --- head/bin/setfacl/remove.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/remove.c Mon Sep 7 16:19:32 2009 (r196936) @@ -41,21 +41,31 @@ __FBSDID("$FreeBSD$"); * remove ACL entries from an ACL */ int -remove_acl(acl_t acl, acl_t *prev_acl) +remove_acl(acl_t acl, acl_t *prev_acl, const char *filename) { acl_entry_t entry; acl_t acl_new; acl_tag_t tag; - int carried_error, entry_id; + int carried_error, entry_id, acl_brand, prev_acl_brand; + + carried_error = 0; + + acl_get_brand_np(acl, &acl_brand); + acl_get_brand_np(*prev_acl, &prev_acl_brand); + + if (acl_brand != prev_acl_brand) { + warnx("%s: branding mismatch; existing ACL is %s, " + "entry to be removed is %s", filename, + prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e", + acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e"); + return (-1); + } carried_error = 0; - if (acl_type == ACL_TYPE_ACCESS) - acl_new = acl_dup(prev_acl[ACCESS_ACL]); - else - acl_new = acl_dup(prev_acl[DEFAULT_ACL]); + acl_new = acl_dup(*prev_acl); if (acl_new == NULL) - err(1, "acl_dup() failed"); + err(1, "%s: acl_dup() failed", filename); tag = ACL_UNDEFINED_TAG; @@ -64,23 +74,68 @@ remove_acl(acl_t acl, acl_t *prev_acl) while (acl_get_entry(acl, entry_id, &entry) == 1) { entry_id = ACL_NEXT_ENTRY; if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", filename); if (tag == ACL_MASK) have_mask++; if (acl_delete_entry(acl_new, entry) == -1) { carried_error++; - warnx("cannot remove non-existent acl entry"); + warnx("%s: cannot remove non-existent ACL entry", + filename); } } - if (acl_type == ACL_TYPE_ACCESS) { - acl_free(prev_acl[ACCESS_ACL]); - prev_acl[ACCESS_ACL] = acl_new; - } else { - acl_free(prev_acl[DEFAULT_ACL]); - prev_acl[DEFAULT_ACL] = acl_new; + acl_free(*prev_acl); + *prev_acl = acl_new; + + if (carried_error) + return (-1); + + return (0); +} + +int +remove_by_number(uint entry_number, acl_t *prev_acl, const char *filename) +{ + acl_entry_t entry; + acl_t acl_new; + acl_tag_t tag; + int carried_error, entry_id; + uint i; + + carried_error = 0; + + acl_new = acl_dup(*prev_acl); + if (acl_new == NULL) + err(1, "%s: acl_dup() failed", filename); + + tag = ACL_UNDEFINED_TAG; + + /* + * Find out whether we're removing the mask entry, + * to behave the same as the routine above. + * + * XXX: Is this loop actually needed? + */ + entry_id = ACL_FIRST_ENTRY; + i = 0; + while (acl_get_entry(acl_new, entry_id, &entry) == 1) { + entry_id = ACL_NEXT_ENTRY; + if (i != entry_number) + continue; + if (acl_get_tag_type(entry, &tag) == -1) + err(1, "%s: acl_get_tag_type() failed", filename); + if (tag == ACL_MASK) + have_mask++; + } + + if (acl_delete_entry_np(acl_new, entry_number) == -1) { + carried_error++; + warn("%s: acl_delete_entry_np() failed", filename); } + acl_free(*prev_acl); + *prev_acl = acl_new; + if (carried_error) return (-1); @@ -91,18 +146,14 @@ remove_acl(acl_t acl, acl_t *prev_acl) * remove default entries */ int -remove_default(acl_t *prev_acl) +remove_default(acl_t *prev_acl, const char *filename) { - if (prev_acl[1]) { - acl_free(prev_acl[1]); - prev_acl[1] = acl_init(ACL_MAX_ENTRIES); - if (prev_acl[1] == NULL) - err(1, "acl_init() failed"); - } else { - warn("cannot remove default ACL"); - return (-1); - } + acl_free(*prev_acl); + *prev_acl = acl_init(ACL_MAX_ENTRIES); + if (*prev_acl == NULL) + err(1, "%s: acl_init() failed", filename); + return (0); } @@ -110,71 +161,14 @@ remove_default(acl_t *prev_acl) * remove extended entries */ void -remove_ext(acl_t *prev_acl) +remove_ext(acl_t *prev_acl, const char *filename) { - acl_t acl_new, acl_old; - acl_entry_t entry, entry_new; - acl_permset_t perm; - acl_tag_t tag; - int entry_id, have_mask_entry; - - if (acl_type == ACL_TYPE_ACCESS) - acl_old = acl_dup(prev_acl[ACCESS_ACL]); - else - acl_old = acl_dup(prev_acl[DEFAULT_ACL]); - if (acl_old == NULL) - err(1, "acl_dup() failed"); + acl_t acl_new; - have_mask_entry = 0; - acl_new = acl_init(ACL_MAX_ENTRIES); + acl_new = acl_strip_np(*prev_acl, !n_flag); if (acl_new == NULL) - err(1, "acl_init() failed"); - tag = ACL_UNDEFINED_TAG; - - /* only save the default user/group/other entries */ - entry_id = ACL_FIRST_ENTRY; - while (acl_get_entry(acl_old, entry_id, &entry) == 1) { - entry_id = ACL_NEXT_ENTRY; - - if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); - - switch(tag) { - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - case ACL_OTHER: - if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); - if (acl_get_permset(entry, &perm) == -1) - err(1, "acl_get_permset() failed"); - if (acl_create_entry(&acl_new, &entry_new) == -1) - err(1, "acl_create_entry() failed"); - if (acl_set_tag_type(entry_new, tag) == -1) - err(1, "acl_set_tag_type() failed"); - if (acl_set_permset(entry_new, perm) == -1) - err(1, "acl_get_permset() failed"); - if (acl_copy_entry(entry_new, entry) == -1) - err(1, "acl_copy_entry() failed"); - break; - case ACL_MASK: - have_mask_entry = 1; - break; - default: - break; - } - } - if (have_mask_entry && n_flag == 0) { - if (acl_calc_mask(&acl_new) == -1) - err(1, "acl_calc_mask() failed"); - } else { - have_mask = 1; - } + err(1, "%s: acl_strip_np() failed", filename); - if (acl_type == ACL_TYPE_ACCESS) { - acl_free(prev_acl[ACCESS_ACL]); - prev_acl[ACCESS_ACL] = acl_new; - } else { - acl_free(prev_acl[DEFAULT_ACL]); - prev_acl[DEFAULT_ACL] = acl_new; - } + acl_free(*prev_acl); + *prev_acl = acl_new; } Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/setfacl.1 Mon Sep 7 16:19:32 2009 (r196936) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2001 +.Dd September 5, 2009 .Dt SETFACL 1 .Os .Sh NAME @@ -34,9 +34,10 @@ .Sh SYNOPSIS .Nm .Op Fl bdhkn +.Op Fl a Ar position entries .Op Fl m Ar entries .Op Fl M Ar file -.Op Fl x Ar entries +.Op Fl x Ar entries | position .Op Fl X Ar file .Op Ar .Sh DESCRIPTION @@ -50,9 +51,19 @@ the file names are taken from the standa .Pp The following options are available: .Bl -tag -width indent +.It Fl a Ar position entries +Modify the ACL on the specified files by inserting new +ACL entries +specified in +.Ar entries , +starting at position +.Ar position , +counting from zero. +This option is only applicable to NFSv4 ACLs. .It Fl b -Remove all ACL entries except for the three required entries. -If the ACL contains a +Remove all ACL entries except for the three required entries +(POSIX.1e ACLs) or six "canonical" entries (NFSv4 ACLs). +If the POSIX.1e ACL contains a .Dq Li mask entry, the permissions of the .Dq Li group @@ -66,7 +77,7 @@ entries of the current ACL. The operations apply to the default ACL entries instead of access ACL entries. Currently only directories may have -default ACL's. +default ACL's. This option is not applicable to NFSv4 ACLs. .It Fl h If the target of the operation is a symbolic link, perform the operation on the symbolic link itself, rather than following the link. @@ -77,7 +88,7 @@ is not considered an error if the specif any default ACL entries. An error will be reported if any of the specified files cannot have a default entry (i.e.\& -non-directories). +non-directories). This option is not applicable to NFSv4 ACLs. .It Fl m Ar entries Modify the ACL entries on the specified files by adding new entries and modifying existing ACL entries with the ACL entries @@ -95,11 +106,15 @@ is the input is taken from stdin. .It Fl n Do not recalculate the permissions associated with the ACL -mask entry. -.It Fl x Ar entries -Remove the ACL entries specified in +mask entry. This option is not applicable to NFSv4 ACLs. +.It Fl x Ar entries | position +If .Ar entries +is specified, remove the ACL entries specified there from the access or default ACL of the specified files. +Otherwise, remove entry at index +.Ar position , +counting from zero. .It Fl X Ar file Remove the ACL entries specified in the file .Ar file @@ -108,8 +123,8 @@ from the access or default ACL of the sp .Pp The above options are evaluated in the order specified on the command-line. -.Sh ACL ENTRIES -An ACL entry contains three colon-separated fields: +.Sh POSIX.1e ACL ENTRIES +A POSIX.1E ACL entry contains three colon-separated fields: an ACL tag, an ACL qualifier, and discretionary access permissions: .Bl -tag -width indent @@ -223,7 +238,7 @@ previously specified; whitespace is igno .Ql # is ignored (comments). .Pp -When ACL entries are evaluated, the access check algorithm checks +When POSIX.1e ACL entries are evaluated, the access check algorithm checks the ACL entries in the following order: file owner, .Dq Li user ACL entries, file owning group, @@ -243,13 +258,135 @@ ACL entries for user, group, other and m For more details see the examples below. Default ACLs can be created by using .Fl d . +.Sh NFSv4 ACL ENTRIES +An NFSv4 ACL entry contains four or five colon-separated fields: an ACL tag, +an ACL qualifier (only for +.Dq Li user +and +.Dq Li group +tags), discretionary access permissions, ACL inheritance flags, and ACL type: +.Bl -tag -width indent +.It Ar "ACL tag" +The ACL tag specifies the ACL entry type and consists of +one of the following: +.Dq Li user +or +.Ql u +specifying the access +granted to the specified user; +.Dq Li group +or +.Ql g +specifying the access granted to the specified group; +.Dq Li owner@ +specifying the access granted to the owner of the file; +.Dq Li group@ +specifying the access granted to the file owning group; +.Dq Li everyone@ +specifying everyone. Note that +.Dq Li everyone@ +is not the same as traditional Unix +.Dq Li other +- it means, +literally, everyone, including file owner and owning group. +.It Ar "ACL qualifier" +The ACL qualifier field describes the user or group associated with +the ACL entry. +It may consist of one of the following: uid or +user name, or gid or group name. In entries whose tag type is +one of +.Dq Li owner@ , +.Dq Li group@ , +or +.Dq Li everyone@ , +this field is ommited altogether, including the trailing comma. +.It Ar "access permissions" +Access permissions may be specified in either short or long form. +Short and long forms may not be mixed. +Permissions in long form are separated by the +.Ql / +character; in short form, they are concatenated together. +Valid permissions are: +.Bl -tag -width ".Dv short" +.It Short +Long +.It r +read_data +.It w +write_data +.It x +execute +.It p +append_data +.It d +delete_child +.It D +delete +.It a +read_attributes +.It A +write_attributes +.It R +read_xattr +.It W +write_xattr +.It c +read_acl +.It C +write_acl +.It o +write_owner +.It S +synchronize +.El +.It Ar "ACL inheritance flags" +Inheritance flags may be specified in either short or long form. +Short and long forms may not be mixed. +Access flags in long form are separated by the +.Ql / +character; in short form, they are concatenated together. +Valid inheritance flags are: +.Bl -tag -width ".Dv short" +.It Short +Long +.It f +file_inherit +.It d +dir_inherit +.It i +inherit_only +.It n +no_propagate +.El +.Pp +Inheritance flags may be only set on directories. +.It Ar "ACL type" +The ACL type field is either +.Dq Li allow +or +.Dq Li deny . +.El +.Pp +ACL entries applied from a file using the +.Fl M +or +.Fl X +options shall be of the following form: one ACL entry per line, as +previously specified; whitespace is ignored; any text after a +.Ql # +is ignored (comments). +.Pp +NFSv4 ACL entries are evaluated in their visible order. +.Pp +Multiple ACL entries specified on the command line are +separated by commas. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES .Dl setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx dir .Dl setfacl -d -m g:admins:rwx dir .Pp -The first command sets the mandatory elements of the default ACL. +The first command sets the mandatory elements of the POSIX.1e default ACL. The second command specifies that users in group admins can have read, write, and execute permissions for directory named "dir". It should be noted that any files or directories created underneath "dir" will @@ -259,9 +396,13 @@ inherit these default ACLs upon creation .Pp Sets read, write, and execute permissions for the .Pa file -owner's ACL entry and read and write permissions for group mail on +owner's POSIX.1e ACL entry and read and write permissions for group mail on .Pa file . .Pp +.Dl setfacl -m owner@:rwxp::allow,g:mail:rwp::allow file +.Pp +Semantically equal to the example above, but for NFSv4 ACL. +.Pp .Dl setfacl -M file1 file2 .Pp Sets/updates the ACL entries contained in @@ -271,10 +412,15 @@ on .Pp .Dl setfacl -x g:mail:rw file .Pp -Remove the group mail ACL entry containing read/write permissions +Remove the group mail POSIX.1e ACL entry containing read/write permissions from .Pa file . .Pp +.Dl setfacl -x0 file +.Pp +Remove the first entry from the NFSv4 ACL from +.Pa file . +.Pp .Dl setfacl -bn file .Pp Remove all Modified: head/bin/setfacl/setfacl.c ============================================================================== --- head/bin/setfacl/setfacl.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/setfacl.c Mon Sep 7 16:19:32 2009 (r196936) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -41,9 +42,8 @@ __FBSDID("$FreeBSD$"); #include "setfacl.h" -static void add_filename(const char *filename); -static acl_t *get_file_acls(const char *filename); -static void usage(void); +static void add_filename(const char *filename); +static void usage(void); static void add_filename(const char *filename) @@ -59,57 +59,28 @@ add_filename(const char *filename) TAILQ_INSERT_TAIL(&filelist, file, next); } -static acl_t * -get_file_acls(const char *filename) -{ - acl_t *acl; - struct stat sb; - - if (stat(filename, &sb) == -1) { - warn("stat() of %s failed", filename); - return (NULL); - } - - acl = zmalloc(sizeof(acl_t) * 2); - if (h_flag) - acl[ACCESS_ACL] = acl_get_link_np(filename, ACL_TYPE_ACCESS); - else - acl[ACCESS_ACL] = acl_get_file(filename, ACL_TYPE_ACCESS); - if (acl[ACCESS_ACL] == NULL) - err(1, "acl_get_file() failed"); - if (S_ISDIR(sb.st_mode)) { - if (h_flag) - acl[DEFAULT_ACL] = acl_get_link_np(filename, - ACL_TYPE_DEFAULT); - else - acl[DEFAULT_ACL] = acl_get_file(filename, - ACL_TYPE_DEFAULT); - if (acl[DEFAULT_ACL] == NULL) - err(1, "acl_get_file() failed"); - } else - acl[DEFAULT_ACL] = NULL; - - return (acl); -} - static void usage(void) { - fprintf(stderr, "usage: setfacl [-bdhkn] [-m entries] [-M file] " - "[-x entries] [-X file] [file ...]\n"); + fprintf(stderr, "usage: setfacl [-bdhkn] [-a position entries] " + "[-m entries] [-M file] [-x entries] [-X file] [file ...]\n"); exit(1); } int main(int argc, char *argv[]) { - acl_t *acl, final_acl; + acl_t acl; + acl_type_t acl_type; char filename[PATH_MAX]; - int local_error, carried_error, ch, i; + int local_error, carried_error, ch, i, entry_number, ret; + int h_flag; struct sf_file *file; struct sf_entry *entry; const char *fn_dup; + char *end; + struct stat sb; acl_type = ACL_TYPE_ACCESS; carried_error = local_error = 0; @@ -118,13 +89,13 @@ main(int argc, char *argv[]) TAILQ_INIT(&entrylist); TAILQ_INIT(&filelist); - while ((ch = getopt(argc, argv, "M:X:bdhkm:nx:")) != -1) + while ((ch = getopt(argc, argv, "M:X:a:bdhkm:nx:")) != -1) switch(ch) { case 'M': entry = zmalloc(sizeof(struct sf_entry)); entry->acl = get_acl_from_file(optarg); if (entry->acl == NULL) - err(1, "get_acl_from_file() failed"); + err(1, "%s: get_acl_from_file() failed", optarg); entry->op = OP_MERGE_ACL; TAILQ_INSERT_TAIL(&entrylist, entry, next); break; @@ -134,6 +105,25 @@ main(int argc, char *argv[]) entry->op = OP_REMOVE_ACL; TAILQ_INSERT_TAIL(&entrylist, entry, next); break; + case 'a': + entry = zmalloc(sizeof(struct sf_entry)); + + entry_number = strtol(optarg, &end, 10); + if (end - optarg != (int)strlen(optarg)) + errx(1, "%s: invalid entry number", optarg); + if (entry_number < 0) + errx(1, "%s: entry number cannot be less than zero", optarg); + entry->entry_number = entry_number; + + if (argv[optind] == NULL) + errx(1, "missing ACL"); + entry->acl = acl_from_text(argv[optind]); + if (entry->acl == NULL) + err(1, "%s", argv[optind]); + optind++; + entry->op = OP_ADD_ACL; + TAILQ_INSERT_TAIL(&entrylist, entry, next); + break; case 'b': entry = zmalloc(sizeof(struct sf_entry)); entry->op = OP_REMOVE_EXT; @@ -163,10 +153,18 @@ main(int argc, char *argv[]) break; case 'x': entry = zmalloc(sizeof(struct sf_entry)); - entry->acl = acl_from_text(optarg); - if (entry->acl == NULL) - err(1, "%s", optarg); - entry->op = OP_REMOVE_ACL; + entry_number = strtol(optarg, &end, 10); + if (end - optarg == (int)strlen(optarg)) { + if (entry_number < 0) + errx(1, "%s: entry number cannot be less than zero", optarg); + entry->entry_number = entry_number; + entry->op = OP_REMOVE_BY_NUMBER; + } else { + entry->acl = acl_from_text(optarg); + if (entry->acl == NULL) + err(1, "%s", optarg); + entry->op = OP_REMOVE_ACL; + } TAILQ_INSERT_TAIL(&entrylist, entry, next); break; default: @@ -199,16 +197,51 @@ main(int argc, char *argv[]) /* cycle through each file */ TAILQ_FOREACH(file, &filelist, next) { - /* get our initial access and default ACL's */ - acl = get_file_acls(file->filename); - if (acl == NULL) + local_error = 0; + + if (stat(file->filename, &sb) == -1) { + warn("%s: stat() failed", file->filename); continue; - if ((acl_type == ACL_TYPE_DEFAULT) && !acl[1]) { - warnx("Default ACL not valid for %s", file->filename); + } + + if (acl_type == ACL_TYPE_DEFAULT && S_ISDIR(sb.st_mode) == 0) { + warnx("%s: default ACL may only be set on a directory", + file->filename); continue; } - local_error = 0; + if (h_flag) + ret = lpathconf(file->filename, _PC_ACL_NFS4); + else + ret = pathconf(file->filename, _PC_ACL_NFS4); + if (ret > 0) { + if (acl_type == ACL_TYPE_DEFAULT) { + warnx("%s: there are no default entries " + "in NFSv4 ACLs", file->filename); + continue; + } + acl_type = ACL_TYPE_NFS4; + } else if (ret == 0) { + if (acl_type == ACL_TYPE_NFS4) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:25:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33A881065672; Mon, 7 Sep 2009 16:25:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 204DA8FC12; Mon, 7 Sep 2009 16:25:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GPA2p020397; Mon, 7 Sep 2009 16:25:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GPAxt020395; Mon, 7 Sep 2009 16:25:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071625.n87GPAxt020395@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 16:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196937 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci geom/multipath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:25:10 -0000 Author: pjd Date: Mon Sep 7 16:25:09 2009 New Revision: 196937 URL: http://svn.freebsd.org/changeset/base/196937 Log: MFC r196579: Fix an obvious topology lock leak. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/multipath/g_multipath.c Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Mon Sep 7 16:19:32 2009 (r196936) +++ stable/8/sys/geom/multipath/g_multipath.c Mon Sep 7 16:25:09 2009 (r196937) @@ -198,6 +198,7 @@ g_multipath_done_error(struct bio *bp) if (sc->cp_active == NULL) { printf("GEOM_MULTIPATH: out of providers for %s\n", sc->sc_name); + g_topology_unlock(); return; } else { printf("GEOM_MULTIPATH: %s now active path in %s\n", From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:26:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB095106566B; Mon, 7 Sep 2009 16:26:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7EF98FC15; Mon, 7 Sep 2009 16:26:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GQ3b4020454; Mon, 7 Sep 2009 16:26:03 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GQ3al020449; Mon, 7 Sep 2009 16:26:03 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909071626.n87GQ3al020449@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 7 Sep 2009 16:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196938 - head/tools/regression/acltools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:26:04 -0000 Author: trasz Date: Mon Sep 7 16:26:03 2009 New Revision: 196938 URL: http://svn.freebsd.org/changeset/base/196938 Log: Add regression tests for NFSv4 ACLs and update POSIX.1e tests to the changed error messages. Added: head/tools/regression/acltools/01.t (contents, props changed) head/tools/regression/acltools/tools-nfs4.test (contents, props changed) Modified: head/tools/regression/acltools/00.t head/tools/regression/acltools/tools-posix.test Modified: head/tools/regression/acltools/00.t ============================================================================== --- head/tools/regression/acltools/00.t Mon Sep 7 16:25:09 2009 (r196937) +++ head/tools/regression/acltools/00.t Mon Sep 7 16:26:03 2009 (r196938) @@ -1,5 +1,32 @@ #!/bin/sh # +# Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a +# All rights reserved. +# +# 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$ +# + # This is a wrapper script to run tools-posix.test. # # If any of the tests fails, here is how to debug it: go to @@ -9,9 +36,6 @@ # /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-posix.test # # Output should be obvious. -# -# $FreeBSD$ -# echo "1..4" @@ -59,4 +83,3 @@ rmdir $MNT mdconfig -du $MD echo "ok 4" - Added: head/tools/regression/acltools/01.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/01.t Mon Sep 7 16:26:03 2009 (r196938) @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a +# All rights reserved. +# +# 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$ +# + +# This is a wrapper script to run tools-nfs4.test on ZFS filesystem. +# +# WARNING: It uses hardcoded ZFS pool name "acltools" +# +# If any of the tests fails, here is how to debug it: go to +# the directory with problematic filesystem mounted on it, +# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test +# +# Output should be obvious. + +echo "1..4" + +if [ `whoami` != "root" ]; then + echo "not ok 1 - you need to be root to run this test." + exit 1 +fi + +TESTDIR=`dirname $0` + +# Set up the test filesystem. +MD=`mdconfig -at swap -s 64m` +MNT=`mktemp -dt acltools` +zpool create -R $MNT acltools /dev/$MD +if [ $? -ne 0 ]; then + echo "not ok 1 - 'zpool create' failed." + exit 1 +fi + +echo "ok 1" + +cd $MNT + +# First, check whether we can crash the kernel by creating too many +# entries. For some reason this won't work in the test file. +touch xxx +setfacl -x5 xxx +while :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done +chmod 600 xxx +rm xxx +echo "ok 2" + +perl $TESTDIR/run $TESTDIR/tools-nfs4.test > /dev/null + +if [ $? -eq 0 ]; then + echo "ok 3" +else + echo "not ok 3" +fi + +cd / +zpool destroy -f acltools +rmdir $MNT +mdconfig -du $MD + +echo "ok 4" Added: head/tools/regression/acltools/tools-nfs4.test ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/tools-nfs4.test Mon Sep 7 16:26:03 2009 (r196938) @@ -0,0 +1,829 @@ +# Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a +# All rights reserved. +# +# 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$ +# + +# This is a tools-level test for NFSv4 ACL functionality. Run it as root +# using ACL-enabled kernel: +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test +# +# WARNING: Creates files in unsafe way. + +$ whoami +> root +$ umask 022 + +# Smoke test for getfacl(1). +$ touch xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ getfacl -q xxx +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Check verbose mode formatting. +$ getfacl -v xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:execute::deny +> owner@:read_data/write_data/append_data/write_attributes/write_xattr/write_acl/write_owner::allow +> group@:write_data/execute/append_data::deny +> group@:read_data::allow +> everyone@:write_data/execute/append_data/write_attributes/write_xattr/write_acl/write_owner::deny +> everyone@:read_data/read_attributes/read_xattr/read_acl/synchronize::allow + +# Test setfacl -a. +$ setfacl -a2 u:0:write_acl:allow,g:1:read_acl:deny xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test user and group name resolving. +$ rm xxx +$ touch xxx +$ setfacl -a2 u:root:write_acl:allow,g:daemon:read_acl:deny xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:root:-----------C--:------:allow +> group:daemon:----------c---:------:deny +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Check whether ls correctly marks files with "+". +$ ls -l xxx | cut -d' ' -f1 +> -rw-r--r--+ + +# Test removing entries by number. +$ setfacl -x 4 xxx +$ setfacl -x 4 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test setfacl -m. +$ setfacl -a0 everyone@:rwx:deny xxx +$ setfacl -a0 everyone@:rwx:deny xxx +$ setfacl -a0 everyone@:rwx:deny xxx +$ setfacl -m everyone@::deny xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:--------------:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test getfacl -i. +$ getfacl -i xxx +> # file: xxx +> # owner: root +> # group: wheel +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:root:-----------C--:------:allow:0 +> group:daemon:----------c---:------:deny:1 +> everyone@:--------------:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Make sure cp without any flags does not copy copy the ACL. +$ cp xxx yyy +$ ls -l yyy | cut -d' ' -f1 +> -rw-r--r-- + +# Make sure it does with the "-p" flag. +$ rm yyy +$ cp -p xxx yyy +$ getfacl -n yyy +> # file: yyy +> # owner: root +> # group: wheel +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:--------------:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rm yyy + +# Test removing entries by... by example? +$ setfacl -x everyone@::deny xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test setfacl -b. +$ setfacl -b xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ ls -l xxx | cut -d' ' -f1 +> -rw-r--r-- + +# Check setfacl(1) and getfacl(1) with multiple files. +$ touch xxx yyy zzz + +$ ls -l xxx yyy zzz | cut -d' ' -f1 +> -rw-r--r-- +> -rw-r--r-- +> -rw-r--r-- + +$ setfacl -m u:42:x:allow,g:43:w:allow nnn xxx yyy zzz +> setfacl: nnn: stat() failed: No such file or directory + +$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 +> ls: nnn: No such file or directory +> -rw-r--r--+ +> -rw-r--r--+ +> -rw-r--r--+ + +$ getfacl -nq nnn xxx yyy zzz +> getfacl: nnn: stat() failed: No such file or directory +> user:42:--x-----------:------:allow +> group:43:-w------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow +> +> user:42:--x-----------:------:allow +> group:43:-w------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow +> +> user:42:--x-----------:------:allow +> group:43:-w------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ setfacl -b nnn xxx yyy zzz +> setfacl: nnn: stat() failed: No such file or directory + +$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 +> ls: nnn: No such file or directory +> -rw-r--r-- +> -rw-r--r-- +> -rw-r--r-- + +$ rm xxx yyy zzz + +# Test applying mode to an ACL. +$ touch xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow -x everyone@::allow xxx +$ chmod 600 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--x-----------:------:deny +> user:44:--x-----------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> -rw-------+ + +$ rm xxx +$ touch xxx +$ chown 42 xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx +$ chmod 600 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: 42 +> # group: wheel +> user:42:--------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--x-----------:------:deny +> user:44:--x-----------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> -rw-------+ + +$ rm xxx +$ touch xxx +$ chown 43 xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx +$ chmod 124 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: 43 +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--x-----------:------:deny +> user:44:--x-----------:------:allow +> owner@:rw-p----------:------:deny +> owner@:--x----A-W-Co-:------:allow +> group@:r-x-----------:------:deny +> group@:-w-p----------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> ---x-w-r--+ + +$ rm xxx +$ touch xxx +$ chown 43 xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx +$ chmod 412 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: 43 +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--------------:------:deny +> user:44:--x-----------:------:allow +> owner@:-wxp----------:------:deny +> owner@:r------A-W-Co-:------:allow +> group@:rw-p----------:------:deny +> group@:--x-----------:------:allow +> everyone@:r-x----A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> -r----x-w-+ + +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-d----:allow +> group:43:-w--D---------:-d----:deny +> group@:-----da-------:------:allow +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +$ chmod 777 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:--------------:------:deny +> group:42:-w--D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:--------------:------:deny +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:rwxp----------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:rwxp--a-R-c--s:------:allow + +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ chmod 124 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:--------------:------:deny +> group:42:----D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:r-------------:------:deny +> group:44:r----da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:rw-p----------:------:deny +> owner@:--x----A-W-Co-:------:allow +> group@:r-x-----------:------:deny +> group@:-w-p----------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:allow,user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ chmod 412 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-x-----------:------:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:-w------------:------:deny +> group:42:-w--D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:rw-p----------:------:deny +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:-wxp----------:------:deny +> owner@:r------A-W-Co-:------:allow +> group@:rw-p----------:------:deny +> group@:--x-----------:------:allow +> everyone@:r-x----A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:------:allow + +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:allow,user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ chown 42 ddd +$ chmod 412 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: 42 +> # group: wheel +> user:42:--x-----------:------:deny +> user:42:r-x-----------:------:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:-w------------:------:deny +> group:42:-w--D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:rw-p----------:------:deny +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:-wxp----------:------:deny +> owner@:r------A-W-Co-:------:allow +> group@:rw-p----------:------:deny +> group@:--x-----------:------:allow +> everyone@:r-x----A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:------:allow + +# Test applying ACL to mode. +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 u:42:rwx:fi:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> drwxr-xr-x+ + +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,group@:w:deny,group@:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr----x---+ + +# XXX: This one is fishy. Shouldn't it be "dr---wx---+"? +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,group@:w:fi:deny,group@:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr---wx---+ + +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,group:43:w:deny,group:43:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr--------+ + +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,user:43:w:deny,user:43:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr--------+ + +# Test inheritance. +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:43:write_data/write_acl:fin:deny,u:43:rwxp:allow ddd +$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:dn:deny ddd +$ setfacl -a0 user:42:write_acl/write_owner:fi:allow ddd +$ setfacl -a0 group:41:read_data/read_attributes:dni:allow ddd +$ setfacl -a0 user:41:write_data/write_attributes:fn:allow ddd +$ getfacl -qn ddd +> user:41:-w-----A------:f--n--:allow +> group:41:r-----a-------:-din--:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-d-n--:deny +> group:43:-w---------C--:f-in--:deny +> user:43:rwxp----------:------:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:r-x---a-R-c--s:------:allow + +$ cd ddd +$ touch xxx +$ getfacl -qn xxx +> user:41:-w------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:--x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rm xxx +$ umask 077 +$ touch xxx +$ getfacl -qn xxx +> user:41:-w------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:r-x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +$ rm xxx +$ umask 770 +$ touch xxx +$ getfacl -qn xxx +> user:41:-w------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:r-x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:--x----A-W-Co-:------:deny +> everyone@:rw-p--a-R-c--s:------:allow + +$ rm xxx +$ umask 707 +$ touch xxx +$ getfacl -qn xxx +> user:41:--------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:--x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--x-----------:------:deny +> group@:rw-p----------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +$ umask 077 +$ mkdir yyy +$ getfacl -qn yyy +> group:41:r-------------:------:deny +> group:41:r-----a-------:------:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:------:deny +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +$ rmdir yyy +$ umask 770 +$ mkdir yyy +$ getfacl -qn yyy +> group:41:r-------------:------:deny +> group:41:r-----a-------:------:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:rwxp--a-R-c--s:------:allow + +$ rmdir yyy +$ umask 707 +$ mkdir yyy +$ getfacl -qn yyy +> group:41:--------------:------:deny +> group:41:------a-------:------:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:rwxp----------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +# There is some complication regarding how write_acl and write_owner flags +# get inherited. Make sure we got it right. +$ setfacl -b . +$ setfacl -a0 u:42:Co:f:allow . +$ setfacl -a0 u:43:Co:d:allow . +$ setfacl -a0 u:44:Co:fd:allow . +$ setfacl -a0 u:45:Co:fi:allow . +$ setfacl -a0 u:46:Co:di:allow . +$ setfacl -a0 u:47:Co:fdi:allow . +$ setfacl -a0 u:48:Co:fn:allow . +$ setfacl -a0 u:49:Co:dn:allow . +$ setfacl -a0 u:50:Co:fdn:allow . +$ setfacl -a0 u:51:Co:fni:allow . +$ setfacl -a0 u:52:Co:dni:allow . +$ setfacl -a0 u:53:Co:fdni:allow . +$ umask 022 +$ rm xxx +$ touch xxx +$ getfacl -nq xxx +> user:53:--------------:------:deny +> user:53:--------------:------:allow +> user:51:--------------:------:deny +> user:51:--------------:------:allow +> user:50:--------------:------:deny +> user:50:--------------:------:allow +> user:48:--------------:------:deny +> user:48:--------------:------:allow +> user:47:--------------:------:deny +> user:47:--------------:------:allow +> user:45:--------------:------:deny +> user:45:--------------:------:allow +> user:44:--------------:------:deny +> user:44:--------------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rmdir yyy +$ mkdir yyy +$ getfacl -nq yyy +> user:53:--------------:------:deny +> user:53:--------------:------:allow +> user:52:--------------:------:deny +> user:52:--------------:------:allow +> user:50:--------------:------:deny +> user:50:--------------:------:allow +> user:49:--------------:------:deny +> user:49:--------------:------:allow +> user:47:-----------Co-:fdi---:allow +> user:47:--------------:------:deny +> user:47:--------------:------:allow +> user:46:-----------Co-:-di---:allow +> user:46:--------------:------:deny +> user:46:--------------:------:allow +> user:45:-----------Co-:f-i---:allow +> user:44:-----------Co-:fdi---:allow +> user:44:--------------:------:deny +> user:44:--------------:------:allow +> user:43:-----------Co-:-di---:allow +> user:43:--------------:------:deny +> user:43:--------------:------:allow +> user:42:-----------Co-:f-i---:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:r-x---a-R-c--s:------:allow + +$ setfacl -b . +$ setfacl -a0 u:42:Co:f:deny . +$ setfacl -a0 u:43:Co:d:deny . +$ setfacl -a0 u:44:Co:fd:deny . +$ setfacl -a0 u:45:Co:fi:deny . +$ setfacl -a0 u:46:Co:di:deny . +$ setfacl -a0 u:47:Co:fdi:deny . +$ setfacl -a0 u:48:Co:fn:deny . +$ setfacl -a0 u:49:Co:dn:deny . +$ setfacl -a0 u:50:Co:fdn:deny . +$ setfacl -a0 u:51:Co:fni:deny . +$ setfacl -a0 u:52:Co:dni:deny . +$ setfacl -a0 u:53:Co:fdni:deny . +$ umask 022 +$ rm xxx +$ touch xxx +$ getfacl -nq xxx +> user:53:-----------Co-:------:deny +> user:51:-----------Co-:------:deny +> user:50:-----------Co-:------:deny +> user:48:-----------Co-:------:deny +> user:47:-----------Co-:------:deny +> user:45:-----------Co-:------:deny +> user:44:-----------Co-:------:deny +> user:42:-----------Co-:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rmdir yyy +$ mkdir yyy +$ getfacl -nq yyy +> user:53:-----------Co-:------:deny +> user:52:-----------Co-:------:deny +> user:50:-----------Co-:------:deny +> user:49:-----------Co-:------:deny +> user:47:-----------Co-:fdi---:deny +> user:47:-----------Co-:------:deny +> user:46:-----------Co-:-di---:deny +> user:46:-----------Co-:------:deny +> user:45:-----------Co-:f-i---:deny +> user:44:-----------Co-:fdi---:deny +> user:44:-----------Co-:------:deny +> user:43:-----------Co-:-di---:deny +> user:43:-----------Co-:------:deny +> user:42:-----------Co-:f-i---:deny +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:r-x---a-R-c--s:------:allow + +$ rmdir yyy +$ rm xxx +$ cd .. +$ rmdir ddd + +$ rm xxx + Modified: head/tools/regression/acltools/tools-posix.test ============================================================================== --- head/tools/regression/acltools/tools-posix.test Mon Sep 7 16:25:09 2009 (r196937) +++ head/tools/regression/acltools/tools-posix.test Mon Sep 7 16:26:03 2009 (r196938) @@ -1,11 +1,36 @@ +# Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a +# All rights reserved. +# +# 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$ +# *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:33:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94CEB106566C; Mon, 7 Sep 2009 16:33:27 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 818918FC13; Mon, 7 Sep 2009 16:33:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GXRog020643; Mon, 7 Sep 2009 16:33:27 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GXRBM020641; Mon, 7 Sep 2009 16:33:27 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200909071633.n87GXRBM020641@svn.freebsd.org> From: Sam Leffler Date: Mon, 7 Sep 2009 16:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196939 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:33:27 -0000 Author: sam Date: Mon Sep 7 16:33:27 2009 New Revision: 196939 URL: http://svn.freebsd.org/changeset/base/196939 Log: MFC r196785: correct timeout for doing NOL processing; need a ticks-relative value Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/net80211/ieee80211_dfs.c Modified: stable/8/sys/net80211/ieee80211_dfs.c ============================================================================== --- stable/8/sys/net80211/ieee80211_dfs.c Mon Sep 7 16:26:03 2009 (r196938) +++ stable/8/sys/net80211/ieee80211_dfs.c Mon Sep 7 16:33:27 2009 (r196939) @@ -235,7 +235,7 @@ dfs_timeout(void *arg) } if (oldest != now) { /* arrange to process next channel up for a status change */ - callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT); + callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT - now); } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:41:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B6821065672; Mon, 7 Sep 2009 16:41:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECB818FC13; Mon, 7 Sep 2009 16:41:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GfIs2020844; Mon, 7 Sep 2009 16:41:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GfINm020842; Mon, 7 Sep 2009 16:41:18 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200909071641.n87GfINm020842@svn.freebsd.org> From: Sam Leffler Date: Mon, 7 Sep 2009 16:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196940 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ath dev/xen/xenpci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:41:19 -0000 Author: sam Date: Mon Sep 7 16:41:18 2009 New Revision: 196940 URL: http://svn.freebsd.org/changeset/base/196940 Log: MFC r196717: fix beacon timers on resume in sta mode so raoming works Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ath/if_ath.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ath/if_ath.c ============================================================================== --- stable/8/sys/dev/ath/if_ath.c Mon Sep 7 16:33:27 2009 (r196939) +++ stable/8/sys/dev/ath/if_ath.c Mon Sep 7 16:41:18 2009 (r196940) @@ -1236,7 +1236,16 @@ ath_resume(struct ath_softc *sc) if (sc->sc_resume_up) { if (ic->ic_opmode == IEEE80211_M_STA) { ath_init(sc); - ieee80211_beacon_miss(ic); + /* + * Program the beacon registers using the last rx'd + * beacon frame and enable sync on the next beacon + * we see. This should handle the case where we + * wakeup and find the same AP and also the case where + * we wakeup and need to roam. For the latter we + * should get bmiss events that trigger a roam. + */ + ath_beacon_config(sc, NULL); + sc->sc_syncbeacon = 1; } else ieee80211_resume_all(ic); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 16:56:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85CB7106566C; Mon, 7 Sep 2009 16:56:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 741AC8FC12; Mon, 7 Sep 2009 16:56:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87GufRh021185; Mon, 7 Sep 2009 16:56:41 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87GufHG021183; Mon, 7 Sep 2009 16:56:41 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909071656.n87GufHG021183@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 7 Sep 2009 16:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196941 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 16:56:41 -0000 Author: trasz Date: Mon Sep 7 16:56:41 2009 New Revision: 196941 URL: http://svn.freebsd.org/changeset/base/196941 Log: Prevent the line from wrapping. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Sep 7 16:41:18 2009 (r196940) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Sep 7 16:56:41 2009 (r196941) @@ -3567,7 +3567,7 @@ arc_init(void) if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) && prefetch_tunable_set == 0) { printf("ZFS NOTICE: Prefetch is disabled by default if less " - "than 4 GB of RAM is present;\n" + "than 4GB of RAM is present;\n" " to enable, add \"vfs.zfs.prefetch_disable=0\" " "to /boot/loader.conf.\n"); zfs_prefetch_disable=1; From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 17:54:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF180106566B; Mon, 7 Sep 2009 17:54:20 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADBB88FC21; Mon, 7 Sep 2009 17:54:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87HsKEE022312; Mon, 7 Sep 2009 17:54:20 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87HsKIJ022310; Mon, 7 Sep 2009 17:54:20 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200909071754.n87HsKIJ022310@svn.freebsd.org> From: Ken Smith Date: Mon, 7 Sep 2009 17:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196942 - head/release/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 17:54:20 -0000 Author: kensmith Date: Mon Sep 7 17:54:20 2009 New Revision: 196942 URL: http://svn.freebsd.org/changeset/base/196942 Log: Bring the layout of package-split.py more in line with where we're going with packages on the release media. It looks like we'll be putting just the doc packages on the new "memory stick" image as well as disc1. There will be no other packages on the CDROM-sized media. The DVD sized media will include the doc packages plus whatever other packages we decide to make part of the release. This commit just brings the basic structure in line with being able to do this. We still need to discuss with various people exactly which packages will be included on the DVD. If the environement variable "PKG_DVD" is set a tree suitable for the DVD media is generated. Otherwise a tree suitable for the "memory stick" and disc1 is generated. MFC after: 3 days Modified: head/release/scripts/package-split.py Modified: head/release/scripts/package-split.py ============================================================================== --- head/release/scripts/package-split.py Mon Sep 7 16:56:41 2009 (r196941) +++ head/release/scripts/package-split.py Mon Sep 7 17:54:20 2009 (r196942) @@ -23,71 +23,14 @@ if 'PKG_VERBOSE' in os.environ: else: verbose = 0 -# List of packages for disc1. This just includes packages sysinstall can -# install as a distribution -def disc1_packages(): - pkgs = ['lang/perl5.8'] - pkgs.extend(['x11/xorg', - 'devel/imake']) - if arch == 'i386': - pkgs.append('emulators/linux_base-fc4') - return pkgs - -# List of packages for disc2. This includes packages that the X desktop -# menu depends on (if it still exists) and other "nice to have" packages. -# For architectures that use a separate livefs, this is actually disc3. -def disc2_packages(): - # X Desktops - if arch == 'ia64': - pkgs = ['x11/gnome2-lite', - 'x11/kde-lite'] - else: - pkgs = ['x11/gnome2', - 'x11/kde3'] - pkgs.extend(['x11-wm/afterstep', - 'x11-wm/windowmaker', - 'x11-wm/fvwm2', - # "Nice to have" - 'archivers/unzip', - 'astro/xearth', - 'devel/gmake', - 'editors/emacs', - 'editors/vim-lite', - 'emulators/mtools', - 'graphics/png', - 'graphics/xv', - 'irc/xchat', - 'mail/exim', - 'mail/fetchmail', - 'mail/mutt', - 'mail/pine4', - 'mail/popd', - 'mail/xfmail', - 'mail/postfix', - 'net/cvsup-without-gui', - 'net/rsync', - 'net/samba3', - 'news/slrn', - 'news/tin', - 'ports-mgmt/portupgrade', - 'print/a2ps-letter', - 'print/apsfilter', - 'print/ghostscript-gnu-nox11', - 'print/gv', - 'print/psutils-letter', - 'shells/bash', - 'shells/pdksh', - 'shells/zsh', - 'security/sudo', - 'www/links', - 'www/lynx', - 'x11/rxvt', - # Formerly on disc3 - 'ports-mgmt/portaudit']) - return pkgs +if 'PKG_DVD' in os.environ: + doing_dvd = 1 +else: + doing_dvd = 0 -def docs_packages(): - pkgs = ['misc/freebsd-doc-bn', +# List of packages for disc1. +def disc1_packages(): + pkgs = ['misc/freebsd-doc-bn', 'misc/freebsd-doc-da', 'misc/freebsd-doc-de', 'misc/freebsd-doc-el', @@ -106,14 +49,58 @@ def docs_packages(): 'misc/freebsd-doc-tr', 'misc/freebsd-doc-zh_cn', 'misc/freebsd-doc-zh_tw'] + + if doing_dvd: + pkgs.extend(['lang/perl5.8', + 'x11/xorg', + 'devel/imake', + 'emulators/linux_base-fc4', + 'x11/gnome2', + 'x11/kde4', + 'x11-wm/afterstep', + 'x11-wm/windowmaker', + 'x11-wm/fvwm2', + 'archivers/unzip', + 'astro/xearth', + 'devel/gmake', + 'editors/emacs', + 'editors/vim-lite', + 'emulators/mtools', + 'graphics/png', + 'graphics/xv', + 'irc/xchat', + 'mail/exim', + 'mail/fetchmail', + 'mail/mutt', + 'mail/alpine', + 'mail/popd', + 'mail/xfmail', + 'mail/postfix', + 'net/cvsup-without-gui', + 'net/rsync', + 'net/samba3', + 'news/slrn', + 'news/tin', + 'ports-mgmt/portupgrade', + 'print/a2ps-letter', + 'print/apsfilter', + 'print/ghostscript7-nox11', + 'print/gv', + 'print/psutils-letter', + 'shells/bash', + 'shells/pdksh', + 'shells/zsh', + 'security/sudo', + 'www/links', + 'www/lynx', + 'x11/rxvt', + 'ports-mgmt/portaudit']) return pkgs # The list of desired packages def desired_packages(): disc1 = disc1_packages() - disc2 = disc2_packages() - docs = docs_packages() - return [disc1, disc2, docs] + return [disc1] # Suck the entire INDEX file into a two different dictionaries. The first # dictionary maps port names (origins) to package names. The second From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 18:23:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 160DE1065670; Mon, 7 Sep 2009 18:23:27 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFCB38FC14; Mon, 7 Sep 2009 18:23:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87INQvp022932; Mon, 7 Sep 2009 18:23:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87INQpL022930; Mon, 7 Sep 2009 18:23:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071823.n87INQpL022930@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 18:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196943 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 18:23:27 -0000 Author: pjd Date: Mon Sep 7 18:23:26 2009 New Revision: 196943 URL: http://svn.freebsd.org/changeset/base/196943 Log: - Avoid holding mutex around M_WAITOK allocations. - Add locking for mnt_opt field. MFC after: 1 week Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 7 17:54:20 2009 (r196942) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 7 18:23:26 2009 (r196943) @@ -45,20 +45,33 @@ vfs_setmntopt(vfs_t *vfsp, const char *n { struct vfsopt *opt; size_t namesize; + int locked; + + if (!(locked = mtx_owned(MNT_MTX(vfsp)))) + MNT_ILOCK(vfsp); if (vfsp->mnt_opt == NULL) { - vfsp->mnt_opt = malloc(sizeof(*vfsp->mnt_opt), M_MOUNT, M_WAITOK); - TAILQ_INIT(vfsp->mnt_opt); + void *opts; + + MNT_IUNLOCK(vfsp); + opts = malloc(sizeof(*vfsp->mnt_opt), M_MOUNT, M_WAITOK); + MNT_ILOCK(vfsp); + if (vfsp->mnt_opt == NULL) { + vfsp->mnt_opt = opts; + TAILQ_INIT(vfsp->mnt_opt); + } else { + free(opts, M_MOUNT); + } } - opt = malloc(sizeof(*opt), M_MOUNT, M_WAITOK); + MNT_IUNLOCK(vfsp); + opt = malloc(sizeof(*opt), M_MOUNT, M_WAITOK); namesize = strlen(name) + 1; opt->name = malloc(namesize, M_MOUNT, M_WAITOK); strlcpy(opt->name, name, namesize); opt->pos = -1; opt->seen = 1; - if (arg == NULL) { opt->value = NULL; opt->len = 0; @@ -67,16 +80,23 @@ vfs_setmntopt(vfs_t *vfsp, const char *n opt->value = malloc(opt->len, M_MOUNT, M_WAITOK); bcopy(arg, opt->value, opt->len); } - /* TODO: Locking. */ + + MNT_ILOCK(vfsp); TAILQ_INSERT_TAIL(vfsp->mnt_opt, opt, link); + if (!locked) + MNT_IUNLOCK(vfsp); } void vfs_clearmntopt(vfs_t *vfsp, const char *name) { + int locked; - /* TODO: Locking. */ + if (!(locked = mtx_owned(MNT_MTX(vfsp)))) + MNT_ILOCK(vfsp); vfs_deleteopt(vfsp->mnt_opt, name); + if (!locked) + MNT_IUNLOCK(vfsp); } int From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 18:54:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9537E106568D; Mon, 7 Sep 2009 18:54:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83EB48FC0C; Mon, 7 Sep 2009 18:54:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87IstO1023619; Mon, 7 Sep 2009 18:54:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87IstZ7023617; Mon, 7 Sep 2009 18:54:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071854.n87IstZ7023617@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 18:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196944 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 18:54:55 -0000 Author: pjd Date: Mon Sep 7 18:54:55 2009 New Revision: 196944 URL: http://svn.freebsd.org/changeset/base/196944 Log: Don't recheck ownership on update mount. This will eliminate LOR between vfs_busy() and mount mutex. We check ownership in vfs_domount() anyway. Noticed by: kib Reviewed by: kib MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Sep 7 18:23:26 2009 (r196943) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Sep 7 18:54:55 2009 (r196944) @@ -719,7 +719,10 @@ zfs_mount(vfs_t *vfsp) error = secpolicy_fs_mount(cr, mvp, vfsp); if (error) { error = dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr); - if (error == 0) { + if (error != 0) + goto out; + + if (!(vfsp->vfs_flag & MS_REMOUNT)) { vattr_t vattr; /* @@ -753,11 +756,9 @@ zfs_mount(vfs_t *vfsp) } VOP_UNLOCK(mvp, 0); #endif - - secpolicy_fs_mount_clearopts(cr, vfsp); - } else { - goto out; } + + secpolicy_fs_mount_clearopts(cr, vfsp); } /* From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 19:22:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F1991065670; Mon, 7 Sep 2009 19:22:45 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E2268FC0C; Mon, 7 Sep 2009 19:22:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87JMjJn024272; Mon, 7 Sep 2009 19:22:45 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87JMjYV024270; Mon, 7 Sep 2009 19:22:45 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909071922.n87JMjYV024270@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 19:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196947 - head/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 19:22:45 -0000 Author: pjd Date: Mon Sep 7 19:22:44 2009 New Revision: 196947 URL: http://svn.freebsd.org/changeset/base/196947 Log: Defer thread start until we set priority. Reviewed by: kib MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/sys/proc.h Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Mon Sep 7 19:15:07 2009 (r196946) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Mon Sep 7 19:22:44 2009 (r196947) @@ -37,6 +37,7 @@ #include #include #include +#include #include #ifdef _KERNEL @@ -74,11 +75,12 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(state == TS_RUN); ASSERT(pp == &p0); - error = kproc_kthread_add(proc, arg, &zfsproc, &td, 0, + error = kproc_kthread_add(proc, arg, &zfsproc, &td, RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); if (error == 0) { thread_lock(td); sched_prio(td, pri); + sched_add(td, SRQ_BORING); thread_unlock(td); } return (td); From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 19:40:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CE66106568F; Mon, 7 Sep 2009 19:40:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3B48FC1E; Mon, 7 Sep 2009 19:40:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87JeMuH024648; Mon, 7 Sep 2009 19:40:22 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87JeMXk024638; Mon, 7 Sep 2009 19:40:22 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909071940.n87JeMXk024638@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 7 Sep 2009 19:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196948 - in head/tools/regression/fstest: . tests/chmod tests/granular X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 19:40:22 -0000 Author: trasz Date: Mon Sep 7 19:40:22 2009 New Revision: 196948 URL: http://svn.freebsd.org/changeset/base/196948 Log: Add regression tests for NFSv4 ACL granular permission enforcement. Added: head/tools/regression/fstest/tests/chmod/12.t (contents, props changed) head/tools/regression/fstest/tests/granular/ head/tools/regression/fstest/tests/granular/00.t (contents, props changed) head/tools/regression/fstest/tests/granular/01.t (contents, props changed) head/tools/regression/fstest/tests/granular/02.t (contents, props changed) head/tools/regression/fstest/tests/granular/03.t (contents, props changed) head/tools/regression/fstest/tests/granular/04.t (contents, props changed) head/tools/regression/fstest/tests/granular/05.t (contents, props changed) Modified: head/tools/regression/fstest/Makefile head/tools/regression/fstest/fstest.c Modified: head/tools/regression/fstest/Makefile ============================================================================== --- head/tools/regression/fstest/Makefile Mon Sep 7 19:22:44 2009 (r196947) +++ head/tools/regression/fstest/Makefile Mon Sep 7 19:40:22 2009 (r196948) @@ -4,7 +4,7 @@ OSTYPE=$(shell uname) ifeq "${OSTYPE}" "FreeBSD" CFLAGS += -D__OS_FreeBSD__ -CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS +CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL endif ifeq "${OSTYPE}" "SunOS" Modified: head/tools/regression/fstest/fstest.c ============================================================================== --- head/tools/regression/fstest/fstest.c Mon Sep 7 19:22:44 2009 (r196947) +++ head/tools/regression/fstest/fstest.c Mon Sep 7 19:40:22 2009 (r196948) @@ -45,6 +45,9 @@ #define stat64 stat #define lstat64 lstat #endif +#ifdef HAS_FREEBSD_ACL +#include +#endif #ifndef ALLPERMS #define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) @@ -75,7 +78,12 @@ enum action { ACTION_TRUNCATE, ACTION_STAT, ACTION_LSTAT, - ACTION_PATHCONF + ACTION_PATHCONF, +#ifdef HAS_FREEBSD_ACL + ACTION_PREPENDACL, + ACTION_READACL, +#endif + ACTION_WRITE, }; #define TYPE_NONE 0x0000 @@ -118,6 +126,11 @@ static struct syscall_desc syscalls[] = { "stat", ACTION_STAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "lstat", ACTION_LSTAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#ifdef HAS_FREEBSD_ACL + { "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, + { "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } }, +#endif + { "write", ACTION_WRITE, { TYPE_STRING, TYPE_NONE } }, { NULL, -1, { TYPE_NONE } } }; @@ -397,6 +410,11 @@ call_syscall(struct syscall_desc *scall, char *str; long long num; } args[MAX_ARGS]; +#ifdef HAS_FREEBSD_ACL + int entry_id = ACL_FIRST_ENTRY; + acl_t acl, newacl; + acl_entry_t entry, newentry; +#endif /* * Verify correctness of the arguments. @@ -540,6 +558,48 @@ call_syscall(struct syscall_desc *scall, rval = -1; break; } +#ifdef HAS_FREEBSD_ACL + case ACTION_PREPENDACL: + rval = -1; + + acl = acl_get_file(STR(0), ACL_TYPE_NFS4); + if (acl == NULL) + break; + + newacl = acl_from_text(STR(1)); + if (acl == NULL) + break; + + while (acl_get_entry(newacl, entry_id, &newentry) == 1) { + entry_id = ACL_NEXT_ENTRY; + + if (acl_create_entry_np(&acl, &entry, 0)) + break; + + if (acl_copy_entry(entry, newentry)) + break; + } + + rval = acl_set_file(STR(0), ACL_TYPE_NFS4, acl); + break; + + case ACTION_READACL: + acl = acl_get_file(STR(0), ACL_TYPE_NFS4); + if (acl == NULL) + rval = -1; + else + rval = 0; + break; +#endif + + case ACTION_WRITE: + rval = open(STR(0), O_WRONLY); + if (rval < 0) + break; + + rval = write(rval, "x", 1); + break; + default: fprintf(stderr, "unsupported syscall\n"); exit(1); Added: head/tools/regression/fstest/tests/chmod/12.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/chmod/12.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,32 @@ +#!/bin/sh +# $FreeBSD$ + +desc="verify SUID/SGID bit behaviour" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..10" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Check whether writing to the file by non-owner clears the SUID. +expect 0 create ${n0} 04777 +expect 0 -u 65534 -g 65534 write ${n0} +expect 0777 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether writing to the file by non-owner clears the SGID. +expect 0 create ${n0} 02777 +expect 0 -u 65534 -g 65534 write ${n0} +expect 0777 stat ${n0} mode +expect 0 unlink ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/00.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/00.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,110 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..49" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Tests 2..7 - check out whether root user can do stuff. +# Can create files? +expect 0 create ${n0} 0644 + +# Can create symlinks? +expect 0 link ${n0} ${n1} +expect 0 unlink ${n1} +expect 0 unlink ${n0} + +# Can create directories? +expect 0 mkdir ${n0} 0755 +expect 0 rmdir ${n0} + +# Check whether user 65534 is permitted to create and remove +# files, but not subdirectories. +expect 0 prependacl . user:65534:write_data::allow,user:65534:append_data::deny + +# Can create files? +expect 0 -u 65534 -g 65534 create ${n0} 0644 + +# Can create symlinks? +expect 0 -u 65534 -g 65534 link ${n0} ${n1} +expect 0 -u 65534 -g 65534 unlink ${n1} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Can create directories? +expect EACCES -u 65534 -g 65534 mkdir ${n0} 0755 +expect ENOENT -u 65534 -g 65534 rmdir ${n0} +expect 0 mkdir ${n0} 0755 +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Can move files from other directory? +expect 0 create ../${n3}/${n1} 0644 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move files from other directory overwriting existing files? +expect 0 create ../${n3}/${n1} 0644 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Can move directories from other directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move directories from other directory overwriting existing directory? +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 rmdir ../${n3}/${n1} + +# Check whether user 65534 is permitted to create +# subdirectories, but not files - and to remove neither of them. +expect 0 prependacl . user:65534:write_data::deny,user:65534:append_data::allow + +# Can create files? +expect EACCES -u 65534 -g 65534 create ${n0} 0644 + +# Can create symlinks? +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 link ${n0} ${n1} +expect ENOENT -u 65534 -g 65534 unlink ${n1} +expect EACCES -u 65534 -g 65534 unlink ${n0} +expect 0 unlink ${n0} + +# Can create directories? +expect 0 -u 65534 -g 65534 mkdir ${n0} 0755 +expect EACCES -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# Can move files from other directory? +expect 0 create ../${n3}/${n1} 0644 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move files from other directory overwriting existing files? +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 unlink ../${n3}/${n1} + +# Can move directories from other directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move directories from other directory overwriting existing directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} +expect 0 rmdir ${n3} Added: head/tools/regression/fstest/tests/granular/01.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/01.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,35 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_ATTRIBUTES" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..12" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Tests 1..12 - check out whether user 65534 is permitted to read attributes. +expect 0 create ${n0} 0644 +expect 0 lstat ${n0} size +expect 0 -u 65534 -g 65534 stat ${n0} size +expect 0 prependacl ${n0} user:65534:read_attributes::deny +expect 0 lstat ${n0} size +expect EACCES -u 65534 -g 65534 stat ${n0} size +expect 0 prependacl ${n0} user:65534:read_attributes::allow +expect 0 -u 65534 -g 65534 stat ${n0} size +expect 0 lstat ${n0} size +expect 0 unlink ${n0} + +# Tests 12..12 - check out whether user 65534 is permitted to write attributes. +# XXX: Check if ACL_WRITE_ATTRIBUTES allows for modifying access times. + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/02.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/02.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,142 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..83" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Check whether user 65534 is permitted to read ACL. +expect 0 create ${n0} 0644 +expect 0 readacl ${n0} +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0 prependacl ${n0} user:65534:read_acl::deny +expect 0 readacl ${n0} +expect EACCES -u 65534 -g 65534 readacl ${n0} +expect 0 prependacl ${n0} user:65534:read_acl::allow +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0 readacl ${n0} +expect 0 unlink ${n0} + +# Check whether user 65534 is permitted to write ACL. +expect 0 create ${n0} 0644 +expect EPERM -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow +expect 0 unlink ${n0} + +# Check whether user 65534 is permitted to write mode. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 unlink ${n0} + +# There is an interesting problem with interaction between ACL_WRITE_ACL +# and SUID/SGID bits. In case user does have ACL_WRITE_ACL, but is not +# a file owner, Solaris does the following: +# 1. Setting SUID fails with EPERM. +# 2. Setting SGID succeeds, but mode is not changed. +# 3. Modifying ACL does not clear SUID nor SGID bits. +# 4. Writing the file does clear both SUID and SGID bits. +# +# What we are doing is the following: +# 1. Setting SUID or SGID fails with EPERM. +# 2. Modifying ACL does not clear SUID nor SGID bits. +# 3. Writing the file does clear both SUID and SGID bits. +# +# Check whether user 65534 is denied to write mode with SUID bit. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 +expect 0 unlink ${n0} + +# Check whether user 65534 is denied to write mode with SGID bit. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 +expect 0 unlink ${n0} + +# Check whether user 65534 is allowed to write mode with sticky bit. +expect 0 mkdir ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 01777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 chmod ${n0} 01777 +expect 0 rmdir ${n0} + +# Check whether modifying the ACL by not-owner preserves the SUID. +expect 0 create ${n0} 04755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 04755 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether modifying the ACL by not-owner preserves the SGID. +expect 0 create ${n0} 02755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 02755 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether modifying the ACL by not-owner preserves the sticky bit. +expect 0 mkdir ${n0} 0755 +expect 0 chmod ${n0} 01755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 01755 stat ${n0} mode +expect 0 rmdir ${n0} + +# Clearing the SUID and SGID bits when being written to by non-owner +# is checked in chmod/12.t. + +# Check whether the file owner is always permitted to get and set +# ACL and file mode, even if ACL_{READ,WRITE}_ACL would deny it. +expect 0 chmod . 0777 +expect 0 -u 65534 -g 65534 create ${n0} 0600 +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0600 -u 65534 -g 65534 stat ${n0} mode +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 unlink ${n0} + +expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0600 -u 65534 -g 65534 stat ${n0} mode +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 rmdir ${n0} + +# Check whether the root is allowed for these as well. +expect 0 -u 65534 -g 65534 create ${n0} 0600 +expect 0 prependacl ${n0} everyone@:write_acl::deny +expect 0 prependacl ${n0} everyone@:read_acl::deny +expect 0 readacl ${n0} +expect 0600 stat ${n0} mode +expect 0 chmod ${n0} 0777 +expect 0 unlink ${n0} + +expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 +expect 0 prependacl ${n0} everyone@:write_acl::deny +expect 0 prependacl ${n0} everyone@:read_acl::deny +expect 0600 stat ${n0} mode +expect 0 readacl ${n0} +expect 0600 stat ${n0} mode +expect 0 chmod ${n0} 0777 +expect 0 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/03.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/03.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,132 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..65" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Unlink allowed on writable directory. +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 unlink ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving file elsewhere allowed on writable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Moving file from elsewhere allowed on writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving file from elsewhere overwriting local file allowed +# on writable directory. +expect 0 create ${n0} 0644 +expect 0 create ../${n3}/${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. +expect 0 create ${n0} 0644 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# DELETE_CHILD denies unlink on writable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 unlink ${n0} +expect 0 unlink ${n0} + +# DELETE_CHILD denies moving file elsewhere. +expect 0 create ${n0} 0644 +expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 rename ${n0} ../${n3}/${n0} + +# DELETE_CHILD does not deny moving file from elsewhere +# to a writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE_CHILD denies moving file from elsewhere +# to a writable directory overwriting local file. +expect 0 create ../${n3}/${n0} 0644 +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE allowed on file allows for unlinking, no matter +# what permissions on containing directory are. +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Same for moving the file elsewhere. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Same for moving the file from elsewhere into a writable +# directory with DELETE_CHILD denied. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 unlink ${n0} + +# DELETE does not allow for overwriting a file in a unwritable +# directory with DELETE_CHILD denied. +expect 0 create ${n0} 0644 +expect 0 create ../${n3}/${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl ${n0} user:65534:delete::allow +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# But it allows for plain deletion. +expect 0 -u 65534 -g 65534 unlink ${n0} + +# DELETE_CHILD allowed on unwritable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving things elsewhere is allowed. +expect 0 create ${n0} 0644 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Moving things back is not. +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we're overwriting. +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we have DELETE on the existing file. +expect 0 prependacl ${n0} user:65534:delete::allow +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 unlink ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/04.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/04.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,78 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..52" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# ACL_WRITE_OWNER permits to set gid to our own only. +expect 0 create ${n0} 0644 +expect 0,0 lstat ${n0} uid,gid +expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0,0 lstat ${n0} uid,gid +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65530 +expect 0,0 lstat ${n0} uid,gid +expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0,65532 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +# ACL_WRITE_OWNER permits to set uid to our own only. +expect 0 create ${n0} 0644 +expect 0,0 lstat ${n0} uid,gid +expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65534 65531 +expect 0,0 lstat ${n0} uid,gid +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65530 65531 +expect 0,0 lstat ${n0} uid,gid +expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 +expect 65534,65531 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +# When non-owner calls chown(2) successfully, set-uid and set-gid bits are +# removed, except when both uid and gid are equal to -1. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 +expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 unlink ${n0} + +expect 0 mkdir ${n0} 0755 +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 +expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/05.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/05.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,147 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directories" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..68" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Unlink allowed on writable directory. +expect 0 mkdir ${n0} 0755 +expect EACCES -u 65534 -g 65534 rmdir ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving directory elsewhere allowed on writable directory. +expect 0 mkdir ${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 12 +# Moving directory from elsewhere allowed on writable directory. +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:append_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving directory from elsewhere overwriting local directory allowed +# on writable directory. +expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# 23 +# Denied DELETE changes nothing wrt removing. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. +expect 0 mkdir ${n0} 0777 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# DELETE_CHILD denies unlink on writable directory. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# 35 +# DELETE_CHILD denies moving directory elsewhere. +expect 0 mkdir ${n0} 0777 +expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 rename ${n0} ../${n3}/${n0} + +# DELETE_CHILD does not deny moving directory from elsewhere +# to a writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE_CHILD denies moving directory from elsewhere +# to a writable directory overwriting local directory. +expect 0 mkdir ../${n3}/${n0} 0755 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE allowed on directory allows for unlinking, no matter +# what permissions on containing directory are. +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Same for moving the directory elsewhere. +expect 0 mkdir ${n0} 0777 +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 46 +# Same for moving the directory from elsewhere into a writable +# directory with DELETE_CHILD denied. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 rmdir ${n0} + +# DELETE does not allow for overwriting a directory in a unwritable +# directory with DELETE_CHILD denied. +expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl ${n0} user:65534:delete::allow +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# 54 +# But it allows for plain deletion. +# XXX: expect 0 -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# DELETE_CHILD allowed on unwritable directory. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving things elsewhere is allowed. +expect 0 mkdir ${n0} 0777 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 60 +# Moving things back is not. +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we're overwriting. +# XXX: expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 mkdir ../${n3}/${n0} 0777 + +# Even if we have DELETE on the existing directory. +expect 0 prependacl ${n0} user:65534:delete::allow +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 19:43:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 298411065676; Mon, 7 Sep 2009 19:43:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2DDE8FC18; Mon, 7 Sep 2009 19:43:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87JhDwW024745; Mon, 7 Sep 2009 19:43:13 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87JhDYk024743; Mon, 7 Sep 2009 19:43:13 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909071943.n87JhDYk024743@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 7 Sep 2009 19:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196949 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 19:43:14 -0000 Author: trasz Date: Mon Sep 7 19:43:13 2009 New Revision: 196949 URL: http://svn.freebsd.org/changeset/base/196949 Log: Enable NFSv4 ACL support in ZFS. Reviewed by: pjd Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Sep 7 19:40:22 2009 (r196948) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Sep 7 19:43:13 2009 (r196949) @@ -3834,7 +3834,15 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong #endif case _PC_ACL_EXTENDED: - *valp = 0; /* TODO */ + *valp = 0; + return (0); + + case _PC_ACL_NFS4: + *valp = 1; + return (0); + + case _PC_ACL_PATH_MAX: + *valp = ACL_MAX_ENTRIES; return (0); case _PC_MIN_HOLE_SIZE: @@ -4425,6 +4433,26 @@ zfs_freebsd_pathconf(ap) return (error); } +static int +zfs_freebsd_fifo_pathconf(ap) + struct vop_pathconf_args /* { + struct vnode *a_vp; + int a_name; + register_t *a_retval; + } */ *ap; +{ + + switch (ap->a_name) { + case _PC_ACL_EXTENDED: + case _PC_ACL_NFS4: + case _PC_ACL_PATH_MAX: + case _PC_MAC_PRESENT: + return (zfs_freebsd_pathconf(ap)); + default: + return (fifo_specops.vop_pathconf(ap)); + } +} + /* * FreeBSD's extended attributes namespace defines file name prefix for ZFS' * extended attribute name: @@ -4854,7 +4882,7 @@ zfs_freebsd_setacl(ap) return (EINVAL); /* - * With NFS4 ACLs, chmod(2) may need to add additional entries, + * With NFSv4 ACLs, chmod(2) may need to add additional entries, * splitting every entry into two and appending "canonical six" * entries at the end. Don't allow for setting an ACL that would * cause chmod(2) to run out of ACL entries. @@ -4928,11 +4956,9 @@ struct vop_vector zfs_vnodeops = { .vop_deleteextattr = zfs_deleteextattr, .vop_setextattr = zfs_setextattr, .vop_listextattr = zfs_listextattr, -#ifdef notyet .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, -#endif }; struct vop_vector zfs_fifoops = { @@ -4945,10 +4971,9 @@ struct vop_vector zfs_fifoops = { .vop_reclaim = zfs_freebsd_reclaim, .vop_setattr = zfs_freebsd_setattr, .vop_write = VOP_PANIC, + .vop_pathconf = zfs_freebsd_fifo_pathconf, .vop_fid = zfs_freebsd_fid, -#ifdef notyet .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, -#endif }; From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 20:10:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C21CB106568B; Mon, 7 Sep 2009 20:10:33 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B11368FC16; Mon, 7 Sep 2009 20:10:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87KAXOM025630; Mon, 7 Sep 2009 20:10:33 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87KAXa7025628; Mon, 7 Sep 2009 20:10:33 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909072010.n87KAXa7025628@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 20:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196950 - head/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 20:10:33 -0000 Author: pjd Date: Mon Sep 7 20:10:33 2009 New Revision: 196950 URL: http://svn.freebsd.org/changeset/base/196950 Log: Fix detection of file system being shared. After this change commands like: # zfs unshare -a # zfs destroy foo/bar # zfs rename foo/bar foo/baz should properly remove exported file systems. MFC after: 3 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Sep 7 19:43:13 2009 (r196949) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Sep 7 20:10:33 2009 (r196950) @@ -172,6 +172,7 @@ is_shared(libzfs_handle_t *hdl, const ch *tab = '\0'; if (strcmp(buf, mountpoint) == 0) { +#if defined(sun) /* * the protocol field is the third field * skip over second field @@ -194,6 +195,10 @@ is_shared(libzfs_handle_t *hdl, const ch return (0); } } +#else + if (proto == PROTO_NFS) + return (SHARED_NFS); +#endif } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 20:57:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0780F1065672; Mon, 7 Sep 2009 20:57:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA9628FC14; Mon, 7 Sep 2009 20:57:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87Kv1hK026705; Mon, 7 Sep 2009 20:57:01 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87Kv1Jx026703; Mon, 7 Sep 2009 20:57:01 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909072057.n87Kv1Jx026703@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 7 Sep 2009 20:57:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196952 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 20:57:02 -0000 Author: trasz Date: Mon Sep 7 20:57:01 2009 New Revision: 196952 URL: http://svn.freebsd.org/changeset/base/196952 Log: Some of the controllers sold as ServeRAID (IBM ServeRAID-MR10i, in particular) are actually mfi(4) devices. Provide hints. Submitted by: Modified: head/share/man/man4/ips.4 Modified: head/share/man/man4/ips.4 ============================================================================== --- head/share/man/man4/ips.4 Mon Sep 7 20:39:04 2009 (r196951) +++ head/share/man/man4/ips.4 Mon Sep 7 20:57:01 2009 (r196952) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 4, 2006 +.Dd August 7, 2009 .Dt IPS 4 .Os .Sh NAME @@ -95,6 +95,8 @@ ServeRAID 7t/7k/7M .Pp Newer ServeRAID controllers are supported by the .Xr aac 4 +or +.Xr mfi 4 driver. .Sh DIAGNOSTICS Several error codes may be shown when the card initializes the @@ -185,6 +187,7 @@ driver does not use the subsystem. .Sh SEE ALSO .Xr aac 4 , +.Xr mfi 4 , .Xr ch 4 , .Xr da 4 , .Xr sysctl 8 From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 21:46:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DED81065670; Mon, 7 Sep 2009 21:46:52 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C95B8FC0C; Mon, 7 Sep 2009 21:46:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87LkqrW027677; Mon, 7 Sep 2009 21:46:52 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87Lkpw6027675; Mon, 7 Sep 2009 21:46:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909072146.n87Lkpw6027675@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 21:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196953 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 21:46:52 -0000 Author: pjd Date: Mon Sep 7 21:46:51 2009 New Revision: 196953 URL: http://svn.freebsd.org/changeset/base/196953 Log: When snapshot mount point is busy (for example we are still in it) we will fail to unmount it, but it won't be removed from the tree, so in that case there is no need to reinsert it. This fixes a panic reproducable in the following steps: # zfs create tank/foo # zfs snapshot tank/foo@snap # cd /tank/foo/.zfs/snapshot/snap # umount /tank/foo panic: avl_find() succeeded inside avl_add() Reported by: trasz MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 20:57:01 2009 (r196952) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 21:46:51 2009 (r196953) @@ -1344,7 +1344,15 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int if (vn_ismntpt(sep->se_root)) { error = zfsctl_unmount_snap(sep, fflags, cr); if (error) { - avl_add(&sdp->sd_snaps, sep); + /* + * Before reinserting snapshot to the tree, + * check if it was actually removed. For example + * when snapshot mount point is busy, we will + * have an error here, but there will be no need + * to reinsert snapshot. + */ + if (avl_find(&sdp->sd_snaps, sep, NULL) == NULL) + avl_add(&sdp->sd_snaps, sep); break; } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 21:58:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 625CA1065676; Mon, 7 Sep 2009 21:58:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 50F4D8FC12; Mon, 7 Sep 2009 21:58:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87Lwsdx027947; Mon, 7 Sep 2009 21:58:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87LwsQR027945; Mon, 7 Sep 2009 21:58:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909072158.n87LwsQR027945@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 7 Sep 2009 21:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196954 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 21:58:55 -0000 Author: pjd Date: Mon Sep 7 21:58:54 2009 New Revision: 196954 URL: http://svn.freebsd.org/changeset/base/196954 Log: If we have to use avl_find(), optimize a bit and use avl_insert() instead of avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()). Fix similar case in the code that is currently commented out. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 21:46:51 2009 (r196953) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 21:58:54 2009 (r196954) @@ -669,9 +669,12 @@ zfsctl_snapdir_remove(vnode_t *dvp, char if (sep) { avl_remove(&sdp->sd_snaps, sep); err = zfsctl_unmount_snap(sep, MS_FORCE, cr); - if (err) - avl_add(&sdp->sd_snaps, sep); - else + if (err) { + avl_index_t where; + + if (avl_find(&sdp->sd_snaps, sep, &where) == NULL) + avl_insert(&sdp->sd_snaps, sep, where); + } else err = dmu_objset_destroy(snapname); } else { err = ENOENT; @@ -1344,6 +1347,8 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int if (vn_ismntpt(sep->se_root)) { error = zfsctl_unmount_snap(sep, fflags, cr); if (error) { + avl_index_t where; + /* * Before reinserting snapshot to the tree, * check if it was actually removed. For example @@ -1351,8 +1356,8 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int * have an error here, but there will be no need * to reinsert snapshot. */ - if (avl_find(&sdp->sd_snaps, sep, NULL) == NULL) - avl_add(&sdp->sd_snaps, sep); + if (avl_find(&sdp->sd_snaps, sep, &where) == NULL) + avl_insert(&sdp->sd_snaps, sep, where); break; } } From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 22:59:18 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A3CF106566B; Mon, 7 Sep 2009 22:59:18 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 839F38FC08; Mon, 7 Sep 2009 22:59:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.3/8.14.3) with ESMTP id n87MxFv7044813; Tue, 8 Sep 2009 02:59:15 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Tue, 8 Sep 2009 02:59:15 +0400 (MSD) From: Dmitry Morozovsky To: Pawel Jakub Dawidek In-Reply-To: <200909072158.n87LwsQR027945@svn.freebsd.org> Message-ID: References: <200909072158.n87LwsQR027945@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (woozle.rinet.ru [0.0.0.0]); Tue, 08 Sep 2009 02:59:15 +0400 (MSD) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196954 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 22:59:18 -0000 Pawel, On Mon, 7 Sep 2009, Pawel Jakub Dawidek wrote: PJD> Author: pjd PJD> Date: Mon Sep 7 21:58:54 2009 PJD> New Revision: 196954 PJD> URL: http://svn.freebsd.org/changeset/base/196954 PJD> PJD> Log: PJD> If we have to use avl_find(), optimize a bit and use avl_insert() instead of PJD> avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()). PJD> PJD> Fix similar case in the code that is currently commented out. Any chance it would fix my panic reported this spring? Thanks! -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-all@FreeBSD.ORG Mon Sep 7 23:16:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBED81065672; Mon, 7 Sep 2009 23:16:27 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0A7A8FC0A; Mon, 7 Sep 2009 23:16:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n87NGRIm029453; Mon, 7 Sep 2009 23:16:27 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n87NGRRm029450; Mon, 7 Sep 2009 23:16:27 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <200909072316.n87NGRRm029450@svn.freebsd.org> From: Sean Bruno Date: Mon, 7 Sep 2009 23:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196955 - head/share/examples/scsi_target X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2009 23:16:28 -0000 Author: sbruno Date: Mon Sep 7 23:16:27 2009 New Revision: 196955 URL: http://svn.freebsd.org/changeset/base/196955 Log: A few enhancements I made while working on the Firewire target (sbp_targ). Update the error handling in a couple of cases to exit gracefully if certain mandatory conditions aren't met. Reduce the maximum number of initiators to 8 for this example code. While 1024 is more correct, this example code would act like it was stalled out even though it was merely allocating the needed structures in init_ccbs() Reviewed by: scottl@freebsd.org Modified: head/share/examples/scsi_target/scsi_target.c head/share/examples/scsi_target/scsi_target.h Modified: head/share/examples/scsi_target/scsi_target.c ============================================================================== --- head/share/examples/scsi_target/scsi_target.c Mon Sep 7 21:58:54 2009 (r196954) +++ head/share/examples/scsi_target/scsi_target.c Mon Sep 7 23:16:27 2009 (r196955) @@ -226,7 +226,7 @@ main(int argc, char *argv[]) /* Open backing store for IO */ file_fd = open(file_name, O_RDWR); if (file_fd < 0) - err(1, "open backing store file"); + errx(EX_NOINPUT, "open backing store file"); /* Check backing store size or use the size user gave us */ if (user_size == 0) { @@ -291,7 +291,9 @@ main(int argc, char *argv[]) } while (targ_fd < 0 && errno == EBUSY); if (targ_fd < 0) - err(1, "Tried to open %d devices, none available", unit); + errx(1, "Tried to open %d devices, none available", unit); + else + warnx("opened /dev/targ%d", unit); /* The first three are handled by kevent() later */ signal(SIGHUP, SIG_IGN); @@ -318,6 +320,7 @@ main(int argc, char *argv[]) /* Set up inquiry data according to what SIM supports */ if (get_sim_flags(&sim_flags) != CAM_REQ_CMP) errx(1, "get_sim_flags"); + if (tcmd_init(req_flags, sim_flags) != 0) errx(1, "Initializing tcmd subsystem failed"); @@ -327,6 +330,7 @@ main(int argc, char *argv[]) if (debug) warnx("main loop beginning"); + request_loop(); exit(0); Modified: head/share/examples/scsi_target/scsi_target.h ============================================================================== --- head/share/examples/scsi_target/scsi_target.h Mon Sep 7 21:58:54 2009 (r196954) +++ head/share/examples/scsi_target/scsi_target.h Mon Sep 7 23:16:27 2009 (r196955) @@ -35,7 +35,7 @@ * Maximum number of parallel commands to accept, * 1024 for Fibre Channel (SPI is 16). */ -#define MAX_INITIATORS 1024 +#define MAX_INITIATORS 8 #define SECTOR_SIZE 512 #define MAX_EVENTS (MAX_INITIATORS + 5) /* kqueue for AIO, signals */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 01:11:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4EDE106568F; Tue, 8 Sep 2009 01:11:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C48BB8FC58; Tue, 8 Sep 2009 01:11:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n881BNvU031628; Tue, 8 Sep 2009 01:11:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n881BNxQ031626; Tue, 8 Sep 2009 01:11:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200909080111.n881BNxQ031626@svn.freebsd.org> From: Xin LI Date: Tue, 8 Sep 2009 01:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196956 - head/usr.bin/w X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 01:11:23 -0000 Author: delphij Date: Tue Sep 8 01:11:23 2009 New Revision: 196956 URL: http://svn.freebsd.org/changeset/base/196956 Log: Constify format string pointer, otherwise this would trigger warning when higher warning level is enabled. Modified: head/usr.bin/w/pr_time.c Modified: head/usr.bin/w/pr_time.c ============================================================================== --- head/usr.bin/w/pr_time.c Mon Sep 7 23:16:27 2009 (r196955) +++ head/usr.bin/w/pr_time.c Tue Sep 8 01:11:23 2009 (r196956) @@ -58,7 +58,7 @@ pr_attime(time_t *started, time_t *now) static wchar_t buf[256]; struct tm tp, tm; time_t diff; - wchar_t *fmt; + const wchar_t *fmt; int len, width, offset = 0; tp = *localtime(started); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 04:52:13 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22149106566C; Tue, 8 Sep 2009 04:52:13 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 060F88FC15; Tue, 8 Sep 2009 04:52:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n884qCNr036197; Tue, 8 Sep 2009 04:52:12 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n884qC2n036193; Tue, 8 Sep 2009 04:52:12 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200909080452.n884qC2n036193@svn.freebsd.org> From: Tim Kientzle Date: Tue, 8 Sep 2009 04:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196961 - in head/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 04:52:13 -0000 Author: kientzle Date: Tue Sep 8 04:52:12 2009 New Revision: 196961 URL: http://svn.freebsd.org/changeset/base/196961 Log: Update tests to match r195873, which corrected how hardlinked files on iso9660 images were returned. While I'm poking around, update some comments around this area to try to clarify what's going on and what still remains to be improved. Modified: head/lib/libarchive/archive_read_support_format_iso9660.c head/lib/libarchive/test/test_read_format_isojoliet_bz2.c head/lib/libarchive/test/test_read_format_isorr_bz2.c Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Tue Sep 8 04:08:14 2009 (r196960) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Tue Sep 8 04:52:12 2009 (r196961) @@ -571,9 +571,13 @@ archive_read_format_iso9660_read_header( if (file->symlink.s != NULL) archive_entry_copy_symlink(entry, file->symlink.s); - /* If this entry points to the same data as the previous - * entry, convert this into a hardlink to that entry. - * But don't bother for zero-length files. */ + /* Note: If the input isn't seekable, we can't rewind to + * return the same body again, so if the next entry refers to + * the same data, we have to return it as a hardlink to the + * original entry. */ + /* TODO: We have enough information here to compute an + * accurate value for nlinks. We should do so and ignore + * nlinks from the RR extensions. */ if (file->offset == iso9660->previous_offset && file->size == iso9660->previous_size && file->size > 0) { @@ -586,8 +590,21 @@ archive_read_format_iso9660_read_header( return (ARCHIVE_OK); } - /* If the offset is before our current position, we can't - * seek backwards to extract it, so issue a warning. */ + /* Except for the hardlink case above, if the offset of the + * next entry is before our current position, we can't seek + * backwards to extract it, so issue a warning. Note that + * this can only happen if this entry was added to the heap + * after we passed this offset, that is, only if the directory + * mentioning this entry is later than the body of the entry. + * Such layouts are very unusual; most ISO9660 writers lay out + * and record all directory information first, then store + * all file bodies. */ + /* TODO: Someday, libarchive's I/O core will support optional + * seeking. When that day comes, this code should attempt to + * seek and only return the error if the seek fails. That + * will give us support for whacky ISO images that require + * seeking while retaining the ability to read almost all ISO + * images in a streaming fashion. */ if (file->offset < iso9660->current_position) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order file @%x (%s) %jd < %jd", @@ -628,7 +645,7 @@ archive_read_format_iso9660_read_header( struct file_info *child; /* N.B.: these special directory identifiers - * are 8 bit "values" even on a + * are 8 bit "values" even on a * Joliet CD with UCS-2 (16bit) encoding. */ Modified: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Tue Sep 8 04:08:14 2009 (r196960) +++ head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Tue Sep 8 04:52:12 2009 (r196961) @@ -107,14 +107,12 @@ joliettest(int withrr) assertEqualInt(2, archive_entry_gid(ae)); } - /* A hardlink to the regular file. */ + /* A regular file with two names ("hardlink" gets returned + * first, so it's not marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("hardlink", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - if (withrr) { - assertEqualString("long-joliet-file-name.textfile", - archive_entry_hardlink(ae)); - } + assert(archive_entry_hardlink(ae) == NULL); assertEqualInt(6, archive_entry_size(ae)); assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); assertEqualInt(6, (int)size); @@ -123,20 +121,27 @@ joliettest(int withrr) if (withrr) { assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + /* TODO: Actually, libarchive should be able to + * compute nlinks correctly even without RR + * extensions. See comments in libarchive source. */ + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); } - /* A regular file. */ + /* Second name for the same regular file (this happens to be + * returned second, so does get marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("long-joliet-file-name.textfile", archive_entry_pathname(ae)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assertEqualInt(6, archive_entry_size(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); + assert(!archive_entry_size_is_set(ae)); if (withrr) { assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + /* TODO: See above. */ + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); } @@ -153,7 +158,7 @@ joliettest(int withrr) assertEqualInt(172802, archive_entry_mtime(ae)); assertEqualInt(172802, archive_entry_atime(ae)); if (withrr) { - assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); } Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isorr_bz2.c Tue Sep 8 04:08:14 2009 (r196960) +++ head/lib/libarchive/test/test_read_format_isorr_bz2.c Tue Sep 8 04:52:12 2009 (r196961) @@ -111,7 +111,7 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualString("hardlink", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); assertEqualString("file", archive_entry_hardlink(ae)); - assertEqualInt(12345684, archive_entry_size(ae)); + assert(!archive_entry_size_is_set(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); assertEqualInt(2, archive_entry_stat(ae)->st_nlink); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 05:02:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A23841065670; Tue, 8 Sep 2009 05:02:42 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 779718FC0A; Tue, 8 Sep 2009 05:02:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8852gdk036457; Tue, 8 Sep 2009 05:02:42 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8852gH4036454; Tue, 8 Sep 2009 05:02:42 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200909080502.n8852gH4036454@svn.freebsd.org> From: Tim Kientzle Date: Tue, 8 Sep 2009 05:02:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196962 - in head/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 05:02:42 -0000 Author: kientzle Date: Tue Sep 8 05:02:41 2009 New Revision: 196962 URL: http://svn.freebsd.org/changeset/base/196962 Log: Fiz /usr/bin/unzip: A bug deep in libarchive's read-ahead logic (incorrect handling of zero-length reads before the copy buffer is allocated) is masked by the iso9660 taster. Tar and cpio both enable that taster so were protected from the bug; unzip is susceptible. This both fixes the bug and updates the test harness to exercise this case. Submitted by: Ed Schouten diagnosed the bug and drafted a patch MFC after: 7 days Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/test/test_compat_zip.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Tue Sep 8 04:52:12 2009 (r196961) +++ head/lib/libarchive/archive_read.c Tue Sep 8 05:02:41 2009 (r196962) @@ -928,9 +928,12 @@ __archive_read_filter_ahead(struct archi for (;;) { /* - * If we can satisfy from the copy buffer, we're done. + * If we can satisfy from the copy buffer (and the + * copy buffer isn't empty), we're done. In particular, + * note that min == 0 is a perfectly well-defined + * request. */ - if (filter->avail >= min) { + if (filter->avail >= min && filter->avail > 0) { if (avail != NULL) *avail = filter->avail; return (filter->next); Modified: head/lib/libarchive/test/test_compat_zip.c ============================================================================== --- head/lib/libarchive/test/test_compat_zip.c Tue Sep 8 04:52:12 2009 (r196961) +++ head/lib/libarchive/test/test_compat_zip.c Tue Sep 8 05:02:41 2009 (r196962) @@ -36,7 +36,7 @@ test_compat_zip_1(void) assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); - assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 05:03:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B2191065670; Tue, 8 Sep 2009 05:03:38 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl [87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id AC78F8FC1A; Tue, 8 Sep 2009 05:03:36 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 38FFD45CA6; Tue, 8 Sep 2009 07:03:34 +0200 (CEST) Received: from localhost (chello087206049004.chello.pl [87.206.49.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 191074569A; Tue, 8 Sep 2009 07:03:29 +0200 (CEST) Date: Tue, 8 Sep 2009 07:03:30 +0200 From: Pawel Jakub Dawidek To: Dmitry Morozovsky Message-ID: <20090908050330.GE1574@garage.freebsd.pl> References: <200909072158.n87LwsQR027945@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uh9ZiVrAOUUm9fzH" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196954 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 05:03:38 -0000 --uh9ZiVrAOUUm9fzH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 08, 2009 at 02:59:15AM +0400, Dmitry Morozovsky wrote: >=20 > Pawel, >=20 >=20 > On Mon, 7 Sep 2009, Pawel Jakub Dawidek wrote: >=20 > PJD> Author: pjd > PJD> Date: Mon Sep 7 21:58:54 2009 > PJD> New Revision: 196954 > PJD> URL: http://svn.freebsd.org/changeset/base/196954 > PJD>=20 > PJD> Log: > PJD> If we have to use avl_find(), optimize a bit and use avl_insert() = instead of > PJD> avl_add() (the latter is actually a wrapper around avl_find() + av= l_insert()). > PJD> =20 > PJD> Fix similar case in the code that is currently commented out. >=20 > Any chance it would fix my panic reported this spring? I'm sorry, but no. Your panic was related to ZAP code. We can still try to debug it further if you still have this file system somewhere, but last I remember your mail server was refusing e-mails from me. If that's still the case and you read this e-mail from the mailing list could you check logs of your e-mail server and whitelist my? I have many problems because reverse DNS for my IP has *dsl* in it, which is often interpreted as dynamic IP address. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --uh9ZiVrAOUUm9fzH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKpeWiForvXbEpPzQRAkypAJ9M1LQFj9a+XWZA7s6pvxytadAppgCeIB/3 4A6L7NJE9GcVhotuBRRc38c= =F5qA -----END PGP SIGNATURE----- --uh9ZiVrAOUUm9fzH-- From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 05:46:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50CE41065676; Tue, 8 Sep 2009 05:46:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F8858FC08; Tue, 8 Sep 2009 05:46:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n885kc4P037458; Tue, 8 Sep 2009 05:46:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n885kcHx037457; Tue, 8 Sep 2009 05:46:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200909080546.n885kcHx037457@svn.freebsd.org> From: Alexander Motin Date: Tue, 8 Sep 2009 05:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196964 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 05:46:39 -0000 Author: mav Date: Tue Sep 8 05:46:38 2009 New Revision: 196964 URL: http://svn.freebsd.org/changeset/base/196964 Log: Do not check proper request alignment here in geom_dev in production. It will be checked any way later by g_io_check() in g_io_schedule_down(). It is only needed here to not trigger panic from additional check, when INVARIANTS enabled. So cover it with #ifdef INVARIANTS. It saves two 64bit divisions per request. Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Tue Sep 8 05:24:09 2009 (r196963) +++ head/sys/geom/geom_dev.c Tue Sep 8 05:46:38 2009 (r196964) @@ -371,14 +371,14 @@ g_dev_strategy(struct bio *bp) cp = dev->si_drv2; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_strategy")); - +#ifdef INVARIANTS if ((bp->bio_offset % cp->provider->sectorsize) != 0 || (bp->bio_bcount % cp->provider->sectorsize) != 0) { bp->bio_resid = bp->bio_bcount; biofinish(bp, NULL, EINVAL); return; } - +#endif for (;;) { /* * XXX: This is not an ideal solution, but I belive it to From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 08:54:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A39FE1065679; Tue, 8 Sep 2009 08:54:15 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92C218FC1F; Tue, 8 Sep 2009 08:54:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n888sFdU041202; Tue, 8 Sep 2009 08:54:15 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n888sFGR041201; Tue, 8 Sep 2009 08:54:15 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909080854.n888sFGR041201@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 08:54:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196965 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 08:54:15 -0000 Author: pjd Date: Tue Sep 8 08:54:15 2009 New Revision: 196965 URL: http://svn.freebsd.org/changeset/base/196965 Log: Fix reference count leak for a case where snapshot's mount point is updated. Such situation is not supported. This problem was triggered by something like this: # zpool create tank da0 # zfs snapshot tank@snap # cd /tank/.zfs/snapshot/snap (this will mount the snapshot) # cd # mount -u nosuid /tank/.zfs/snapshot/snap (refcount leak) # zpool export tank cannot export 'tank': pool is busy MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 05:46:38 2009 (r196964) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 08:54:15 2009 (r196965) @@ -337,6 +337,13 @@ zfs_register_callbacks(vfs_t *vfsp) os = zfsvfs->z_os; /* + * This function can be called for a snapshot when we update snapshot's + * mount point, which isn't really supported. + */ + if (dmu_objset_is_snapshot(os)) + return (EOPNOTSUPP); + + /* * The act of registering our callbacks will destroy any mount * options we may have. In order to enable temporary overrides * of mount options, we stash away the current values and From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 09:17:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CA47106566B; Tue, 8 Sep 2009 09:17:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C01A8FC1B; Tue, 8 Sep 2009 09:17:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n889HYKc041728; Tue, 8 Sep 2009 09:17:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n889HYI1041726; Tue, 8 Sep 2009 09:17:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909080917.n889HYI1041726@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 8 Sep 2009 09:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196966 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 09:17:34 -0000 Author: kib Date: Tue Sep 8 09:17:34 2009 New Revision: 196966 URL: http://svn.freebsd.org/changeset/base/196966 Log: Lock Giant around vn_open_cred(). Remove innocent unnecessary call to NDFREE(). Reported by: marcel Reviewed and tested by: pjd MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Tue Sep 8 08:54:15 2009 (r196965) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Tue Sep 8 09:17:34 2009 (r196966) @@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file) struct thread *td = curthread; struct filedesc *fd; struct nameidata nd; - int error, flags; + int error, flags, vfslocked; fd = td->td_proc->p_fd; FILEDESC_XLOCK(fd); @@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file) flags = FREAD | O_NOFOLLOW; NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL); - NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) return (NULL); + vfslocked = NDHASGIANT(&nd); + NDFREE(&nd, NDF_ONLY_PNBUF); /* We just unlock so we hold a reference. */ VOP_UNLOCK(nd.ni_vp, 0); + VFS_UNLOCK_GIANT(vfslocked); return (nd.ni_vp); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 10:39:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AE8B1065755; Tue, 8 Sep 2009 10:39:38 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79BFD8FC23; Tue, 8 Sep 2009 10:39:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88AdcG5045218; Tue, 8 Sep 2009 10:39:38 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88AdcNU045214; Tue, 8 Sep 2009 10:39:38 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909081039.n88AdcNU045214@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 10:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196967 - in head/sys: netinet sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 10:39:38 -0000 Author: phk Date: Tue Sep 8 10:39:38 2009 New Revision: 196967 URL: http://svn.freebsd.org/changeset/base/196967 Log: Move the duplicate definition of struct sockaddr_storage to its own include file, and include this where the previous duplicate definitions were. Static program checkers like FlexeLint rightfully take a dim view of duplicate definitions, even if they currently are identical. Added: head/sys/sys/_sockaddr_storage.h (contents, props changed) Modified: head/sys/netinet/in.h head/sys/sys/socket.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Tue Sep 8 09:17:34 2009 (r196966) +++ head/sys/netinet/in.h Tue Sep 8 10:39:38 2009 (r196967) @@ -89,27 +89,7 @@ typedef __socklen_t socklen_t; #define _SOCKLEN_T_DECLARED #endif -/* Avoid collision with original definition in sys/socket.h. */ -#ifndef _STRUCT_SOCKADDR_STORAGE_DECLARED -/* - * RFC 2553: protocol-independent placeholder for socket addresses - */ -#define _SS_MAXSIZE 128U -#define _SS_ALIGNSIZE (sizeof(__int64_t)) -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) - -struct sockaddr_storage { - unsigned char ss_len; /* address length */ - sa_family_t ss_family; /* address family */ - char __ss_pad1[_SS_PAD1SIZE]; - __int64_t __ss_align; /* force desired struct alignment */ - char __ss_pad2[_SS_PAD2SIZE]; -}; -#define _STRUCT_SOCKADDR_STORAGE_DECLARED -#endif +#include /* Socket address, internet style. */ struct sockaddr_in { Added: head/sys/sys/_sockaddr_storage.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/_sockaddr_storage.h Tue Sep 8 10:39:38 2009 (r196967) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + * $FreeBSD$ + */ + +#ifndef _SYS__SOCKADDR_STORAGE_H_ +#define _SYS__SOCKADDR_STORAGE_H_ + +/* + * RFC 2553: protocol-independent placeholder for socket addresses + */ +#define _SS_MAXSIZE 128U +#define _SS_ALIGNSIZE (sizeof(__int64_t)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) + +struct sockaddr_storage { + unsigned char ss_len; /* address length */ + sa_family_t ss_family; /* address family */ + char __ss_pad1[_SS_PAD1SIZE]; + __int64_t __ss_align; /* force desired struct alignment */ + char __ss_pad2[_SS_PAD2SIZE]; +}; + +#endif /* !_SYS__SOCKADDR_STORAGE_H_ */ Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Tue Sep 8 09:17:34 2009 (r196966) +++ head/sys/sys/socket.h Tue Sep 8 10:39:38 2009 (r196967) @@ -290,26 +290,7 @@ struct sockproto { }; #endif -#ifndef _STRUCT_SOCKADDR_STORAGE_DECLARED -/* - * RFC 2553: protocol-independent placeholder for socket addresses - */ -#define _SS_MAXSIZE 128U -#define _SS_ALIGNSIZE (sizeof(__int64_t)) -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) - -struct sockaddr_storage { - unsigned char ss_len; /* address length */ - sa_family_t ss_family; /* address family */ - char __ss_pad1[_SS_PAD1SIZE]; - __int64_t __ss_align; /* force desired struct alignment */ - char __ss_pad2[_SS_PAD2SIZE]; -}; -#define _STRUCT_SOCKADDR_STORAGE_DECLARED -#endif +#include #if __BSD_VISIBLE /* From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 12:59:57 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A569F106566B; Tue, 8 Sep 2009 12:59:57 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9485D8FC1B; Tue, 8 Sep 2009 12:59:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88CxvEe048047; Tue, 8 Sep 2009 12:59:57 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88Cxvan048046; Tue, 8 Sep 2009 12:59:57 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909081259.n88Cxvan048046@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 12:59:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196968 - head/sys/amd64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 12:59:57 -0000 Author: phk Date: Tue Sep 8 12:59:56 2009 New Revision: 196968 URL: http://svn.freebsd.org/changeset/base/196968 Log: Move multi-include protection back up to the top of the file and name after the physical file rather than the aliased name. Modified: head/sys/amd64/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Tue Sep 8 10:39:38 2009 (r196967) +++ head/sys/amd64/include/param.h Tue Sep 8 12:59:56 2009 (r196968) @@ -39,6 +39,9 @@ * $FreeBSD$ */ +#ifndef _AMD64_INCLUDE_PARAM_H_ +#define _AMD64_INCLUDE_PARAM_H_ + /* * Machine dependent constants for AMD64. */ @@ -60,9 +63,6 @@ #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "amd64" #endif @@ -150,5 +150,5 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ #endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_AMD64_INCLUDE_PARAM_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 13:16:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16ABE106566B; Tue, 8 Sep 2009 13:16:56 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01DB28FC08; Tue, 8 Sep 2009 13:16:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88DGut4048489; Tue, 8 Sep 2009 13:16:56 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88DGtVn048461; Tue, 8 Sep 2009 13:16:55 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909081316.n88DGtVn048461@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 13:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196969 - in head/sys: cam/scsi contrib/dev/acpica/executer dev/aac dev/ae dev/amr dev/ata dev/ata/chipsets dev/ath dev/ath/ath_hal dev/bce dev/e1000 dev/ep dev/firewire dev/fxp dev/hpt... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 13:16:56 -0000 Author: phk Date: Tue Sep 8 13:16:55 2009 New Revision: 196969 URL: http://svn.freebsd.org/changeset/base/196969 Log: Add necessary include. Modified: head/sys/cam/scsi/scsi_cd.c head/sys/contrib/dev/acpica/executer/exfldio.c head/sys/dev/aac/aac.c head/sys/dev/ae/if_ae.c head/sys/dev/amr/amr.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah_eeprom_v3.c head/sys/dev/bce/if_bce.c head/sys/dev/e1000/if_em.c head/sys/dev/ep/if_ep.c head/sys/dev/ep/if_epreg.h head/sys/dev/firewire/fwcrom.c head/sys/dev/firewire/fwdev.c head/sys/dev/fxp/if_fxp.c head/sys/dev/hptiop/hptiop.c head/sys/dev/iir/iir.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/msk/if_msk.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/wi/if_wi.c head/sys/fs/msdosfs/msdosfs_conv.c head/sys/kern/kern_jail.c head/sys/kern/kern_linker.c head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_proto.h head/sys/security/audit/audit_bsm_token.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:16:55 2009 (r196969) @@ -2528,7 +2528,7 @@ cdioctl(struct disk *dp, u_long cmd, voi error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(¶ms, M_SCSICD); + free(¶ms.mode_buf, M_SCSICD); cam_periph_unlock(periph); break; } Modified: head/sys/contrib/dev/acpica/executer/exfldio.c ============================================================================== --- head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:16:55 2009 (r196969) @@ -992,6 +992,7 @@ AcpiExInsertIntoField ( /* Get initial Datum from the input buffer */ + /* XXX: Flexelint sees arg 9 for bufferlen 8 */ ACPI_MEMCPY (&RawDatum, Buffer, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/aac/aac.c Tue Sep 8 13:16:55 2009 (r196969) @@ -3556,7 +3556,7 @@ aac_supported_features(struct aac_softc * associated with the feature in the data field or perform whatever * action needed indicates in the data field. */ - if (f.feat.fValue == 0) { + if (f.feat.fValue == 0) { f.feat.fBits.largeLBA = (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0; /* TODO: In the future, add other features state here as well */ Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ae/if_ae.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1662,6 +1662,7 @@ ae_stop_rxmac(ae_softc_t *sc) /* * Wait for IDLE state. */ + /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0) @@ -1698,6 +1699,7 @@ ae_stop_txmac(ae_softc_t *sc) /* * Wait for IDLE state. */ + /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0) Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/amr/amr.c Tue Sep 8 13:16:55 2009 (r196969) @@ -527,7 +527,7 @@ amr_rescan_drives(struct cdev *dev) sc->amr_drive[i].al_disk)) != 0) goto shutdown_out; - sc->amr_drive[i].al_disk = 0; + sc->amr_drive[i].al_disk = 0; } } Modified: head/sys/dev/ata/ata-raid.c ============================================================================== --- head/sys/dev/ata/ata-raid.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ata/ata-raid.c Tue Sep 8 13:16:55 2009 (r196969) @@ -407,7 +407,7 @@ ata_raid_strategy(struct bio *bp) if (rdp->status & AR_S_REBUILDING) blk = ((lba / rdp->interleave) * rdp->width) * rdp->interleave + (rdp->interleave * (drv % rdp->width)) + - lba % rdp->interleave;; + lba % rdp->interleave; if (bp->bio_cmd == BIO_READ) { int src_online = @@ -1138,6 +1138,7 @@ ata_raid_create(struct ata_ioc_raid_conf rdp->type == AR_T_RAID5) { int bit = 0; + /* XXX: Flexelint not happy */ while (config->interleave >>= 1) bit++; rdp->interleave = 1 << bit; Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:16:55 2009 (r196969) @@ -127,6 +127,7 @@ ata_ali_chipinit(device_t dev) RF_ACTIVE); if (res->bars[i] == NULL) { device_printf(dev, "Failed to allocate BAR %d\n", i); + /* XXX: Flexelint: Reuse of for loop variable 'i' at 'line 124' could cause chaos */ for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:16:55 2009 (r196969) @@ -153,7 +153,7 @@ ata_marvell_pata_ch_attach(device_t dev) return ENXIO; /* dont use 32 bit PIO transfers */ - ch->flags |= ATA_USE_16BIT; + ch->flags |= ATA_USE_16BIT; return 0; } Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:16:55 2009 (r196969) @@ -107,6 +107,7 @@ ath_hal_malloc(size_t size) return malloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO); } +/* XXX: FlexeLint return in void function ? */ void ath_hal_free(void* p) { Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:16:55 2009 (r196969) @@ -566,6 +566,7 @@ ath_hal_getregdump(struct ath_hal *ah, c uint32_t *dp = dstbuf; int i; + /* XXX: FlexeLint: ">" test with ++ */ for (i = 0; space >= 2*sizeof(uint32_t); i++) { u_int r = regs[i].start; u_int e = regs[i].end; Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1753,6 +1753,8 @@ legacyEepromGetSpurChan(struct ath_hal * /* * Reclaim any EEPROM-related storage. */ + +/* XXX: FlexeLint: return in void function */ static void legacyEepromDetach(struct ath_hal *ah) { Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/bce/if_bce.c Tue Sep 8 13:16:55 2009 (r196969) @@ -608,17 +608,17 @@ bce_print_adapter_info(struct bce_softc #endif if (sc->bce_flags & BCE_USING_MSI_FLAG) { if (i > 0) printf("|"); - printf("MSI"); i++; + printf("MSI"); i++; } if (sc->bce_flags & BCE_USING_MSIX_FLAG) { if (i > 0) printf("|"); - printf("MSI-X "); i++; + printf("MSI-X "); i++; } if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { if (i > 0) printf("|"); - printf("2.5G"); i++; + printf("2.5G"); i++; } if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { @@ -628,7 +628,7 @@ bce_print_adapter_info(struct bce_softc printf(")\n"); } - DBEXIT(BCE_VERBOSE_LOAD); + DBEXIT(BCE_VERBOSE_LOAD); } Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/e1000/if_em.c Tue Sep 8 13:16:55 2009 (r196969) @@ -2826,7 +2826,7 @@ em_allocate_pci_resources(struct adapter * Setup the Legacy or MSI Interrupt handler * **********************************************************************/ -int +static int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ep/if_ep.c Tue Sep 8 13:16:55 2009 (r196969) @@ -666,6 +666,7 @@ rescan: sc->tx_underrun++; #endif } else { + /* XXX: FlexeLint doesn't like ; */ if (status & TXS_JABBER); else ++ifp->if_collisions; Modified: head/sys/dev/ep/if_epreg.h ============================================================================== --- head/sys/dev/ep/if_epreg.h Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ep/if_epreg.h Tue Sep 8 13:16:55 2009 (r196969) @@ -315,7 +315,11 @@ S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) #define S_COMMAND_IN_PROGRESS (u_short) (0x1000) -#define EP_BUSY_WAIT(sc) while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) +#define EP_BUSY_WAIT(sc) \ + do { \ + while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) \ + continue; \ + } while (0) /* Address Config. Register. * Window 0/Port 06 Modified: head/sys/dev/firewire/fwcrom.c ============================================================================== --- head/sys/dev/firewire/fwcrom.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/firewire/fwcrom.c Tue Sep 8 13:16:55 2009 (r196969) @@ -454,9 +454,9 @@ crom_add_simple_text(struct crom_src *sr len = strlen(buf); if (len > MAX_TEXT) { #if defined(__DragonFly__) || __FreeBSD_version < 500000 - printf("text(%d) trancated to %d.\n", len, MAX_TEXT); + printf("text(%d) truncated to %d.\n", len, MAX_TEXT); #else - printf("text(%d) trancated to %td.\n", len, MAX_TEXT); + printf("text(%d) truncated to %td.\n", len, MAX_TEXT); #endif len = MAX_TEXT; } Modified: head/sys/dev/firewire/fwdev.c ============================================================================== --- head/sys/dev/firewire/fwdev.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/firewire/fwdev.c Tue Sep 8 13:16:55 2009 (r196969) @@ -844,6 +844,7 @@ out: err = copyout(ptr, crom_buf->ptr, len); if (fwdev == NULL) /* myself */ + /* XXX: Flexelint no sure about modified pointer */ free(ptr, M_FW); break; default: Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/fxp/if_fxp.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1597,6 +1597,7 @@ fxp_encap(struct fxp_softc *sc, struct m cbp->tbd_number = nseg; /* Configure TSO. */ if (m->m_pkthdr.csum_flags & CSUM_TSO) { + /* XXX: FlexeLint: negative subscript */ cbp->tbd[-1].tb_size = htole32(m->m_pkthdr.tso_segsz << 16); cbp->tbd[1].tb_size |= htole32(tcp_payload << 16); cbp->ipcb_ip_schedule |= FXP_IPCB_LARGESEND_ENABLE | Modified: head/sys/dev/hptiop/hptiop.c ============================================================================== --- head/sys/dev/hptiop/hptiop.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/hptiop/hptiop.c Tue Sep 8 13:16:55 2009 (r196969) @@ -432,6 +432,7 @@ srb_complete: sg_list), (u_int8_t *)&ccb->csio.sense_data, MIN(dxfer, sizeof(ccb->csio.sense_data))); } else { + /* XXX: Flexelint arg2 is 16 bytes, arg3 is 32 */ memcpy(&ccb->csio.sense_data, &req->sg_list, MIN(dxfer, sizeof(ccb->csio.sense_data))); } @@ -575,6 +576,7 @@ static void hptiop_request_callback_mv(s ccb->ccb_h.status = CAM_BUSY; break; case IOP_RESULT_CHECK_CONDITION: + /* XXX: FlexeLint: arg2=16b arg3=32 */ memcpy(&ccb->csio.sense_data, &req->sg_list, MIN(req->dataxfer_length, sizeof(ccb->csio.sense_data))); ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; Modified: head/sys/dev/iir/iir.c ============================================================================== --- head/sys/dev/iir/iir.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/iir/iir.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1203,6 +1203,7 @@ gdt_internal_cache_cmd(struct gdt_softc bzero( ccb->csio.data_ptr+copylen, ccb->csio.dxfer_len - copylen ); page=((struct scsi_mode_sense_6 *)ccb->csio.cdb_io.cdb_bytes)->page; + /* XXX: FlexeLint: why ?? */ switch (page) { default: GDT_DPRINTF(GDT_D_MISC, ("MODE_SENSE_6: page 0x%x\n", page)); Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/mpt/mpt_raid.c Tue Sep 8 13:16:55 2009 (r196969) @@ -562,6 +562,7 @@ mpt_raid_reply_frame_handler(struct mpt_ break; } action_result = REQ_TO_RAID_ACTION_RESULT(req); + /* XXX: FlexeLint: ActionData is only 4 bytes */ memcpy(&action_result->action_data, &reply->ActionData, sizeof(action_result->action_data)); action_result->action_status = le16toh(reply->ActionStatus); Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/msk/if_msk.c Tue Sep 8 13:16:55 2009 (r196969) @@ -118,26 +118,21 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include #include -#include #include #include -#include #include #include #include #include -#include #include -#include #include #include Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 13:16:55 2009 (r196969) @@ -42,12 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include -#include #include #include #include @@ -1489,7 +1486,7 @@ rum_rf_write(struct rum_softc *sc, uint8 return; } - tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | (val & 0xfffff) << 2 | + tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | ((val & 0xfffff) << 2) | (reg & 3); rum_write(sc, RT2573_PHY_CSR4, tmp); Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 13:16:55 2009 (r196969) @@ -139,7 +139,7 @@ #define RT2573_BBP_BUSY (1 << 16) /* possible flags for register PHY_CSR4 */ #define RT2573_RF_20BIT (20 << 24) -#define RT2573_RF_BUSY (1 << 31) +#define RT2573_RF_BUSY (1U << 31) /* LED values */ #define RT2573_LED_RADIO (1 << 8) Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 13:16:55 2009 (r196969) @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define nitems(a) (sizeof(a) / sizeof((a)[0])) + SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW, 0, "USB Realtek 8187L"); #ifdef URTW_DEBUG int urtw_debug = 0; @@ -175,6 +177,46 @@ struct urtw_pair { uint32_t val; }; +static const uint8_t urtw_8187b_reg_table[][3] = { + { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, + { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, + { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, + { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, + { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, + { 0xff, 0x00, 0 }, + + { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, { 0x5a, 0x4b, 1 }, + { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, { 0x61, 0x09, 1 }, + { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, { 0xce, 0x0f, 1 }, + { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, { 0xe1, 0x0f, 1 }, + { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, { 0xf1, 0x01, 1 }, + { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, { 0xf4, 0x04, 1 }, + { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, { 0xf7, 0x07, 1 }, + { 0xf8, 0x08, 1 }, + + { 0x4e, 0x00, 2 }, { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, + { 0x22, 0x68, 2 }, { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, + { 0x25, 0x7d, 2 }, { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, + { 0x4d, 0x08, 2 }, { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, + { 0x52, 0x04, 2 }, { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, + { 0x55, 0x23, 2 }, { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, + { 0x58, 0x08, 2 }, { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, + { 0x5b, 0x08, 2 }, { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, + { 0x62, 0x08, 2 }, { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, + { 0x72, 0x56, 2 }, { 0x73, 0x9a, 2 }, + + { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, { 0x5b, 0x40, 0 }, + { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, { 0x88, 0x54, 0 }, + { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, { 0x8d, 0x00, 0 }, + { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, { 0x96, 0x00, 0 }, + { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, { 0x9f, 0x10, 0 }, + { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, { 0xdb, 0x00, 0 }, + { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, + + { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, + { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } +}; + static uint8_t urtw_8225_agc[] = { 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, @@ -190,21 +232,6 @@ static uint8_t urtw_8225_agc[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; -static uint8_t urtw_8225z2_agc[] = { - 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, - 0x4f, 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, - 0x39, 0x37, 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, - 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, - 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0x19, - 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23, - 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, - 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 -}; - static uint32_t urtw_8225_channel[] = { 0x0000, /* dummy channel 0 */ 0x085c, /* 1 */ @@ -237,7 +264,7 @@ static struct urtw_pair urtw_8225_rf_par { 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, { 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a }, { 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 }, - { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 }, + { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 } }; static struct urtw_pair urtw_8225_rf_part2[] = { @@ -279,7 +306,7 @@ static uint16_t urtw_8225_rxgain[] = { }; static uint8_t urtw_8225_threshold[] = { - 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd, + 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd }; static uint8_t urtw_8225_tx_gain_cck_ofdm[] = { @@ -304,10 +331,29 @@ static uint8_t urtw_8225_txpwr_cck_ch14[ 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00 }; -static uint8_t urtw_8225_txpwr_ofdm[]={ +static uint8_t urtw_8225_txpwr_ofdm[] = { 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4 }; +static uint8_t urtw_8225z2_agc[] = { + 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, + 0x55, 0x53, 0x51, 0x4f, 0x4d, 0x4b, 0x49, 0x47, + 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37, + 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, + 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, + 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07, + 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, + 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, + 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, + 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, + 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 +}; + static uint8_t urtw_8225v2_gain_bg[]={ 0x23, 0x15, 0xa5, /* -82-1dbm */ 0x23, 0x15, 0xb5, /* -82-2dbm */ @@ -410,11 +456,7 @@ static uint8_t urtw_8225v2_tx_gain_cck_o 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, - 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, -}; - -static uint8_t urtw_8225v2_txpwr_cck[] = { - 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 + 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 }; static uint8_t urtw_8225v2_txpwr_cck_ch14[] = { @@ -428,6 +470,10 @@ static uint8_t urtw_8225v2b_txpwr_cck[] 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03 }; +static uint8_t urtw_8225v2_txpwr_cck[] = { + 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 +}; + static uint8_t urtw_8225v2b_txpwr_cck_ch14[] = { 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, @@ -441,40 +487,6 @@ static struct urtw_pair urtw_ratetable[] { 96, 10 }, { 108, 11 } }; -static const uint8_t urtw_8187b_reg_table[][3] = { - { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, - { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, - { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, - { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, - { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, - { 0xff, 0x00, 0 }, { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, - { 0x5a, 0x4b, 1 }, { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, - { 0x61, 0x09, 1 }, { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, - { 0xce, 0x0f, 1 }, { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, - { 0xe1, 0x0f, 1 }, { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, - { 0xf1, 0x01, 1 }, { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, - { 0xf4, 0x04, 1 }, { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, - { 0xf7, 0x07, 1 }, { 0xf8, 0x08, 1 }, { 0x4e, 0x00, 2 }, - { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, { 0x22, 0x68, 2 }, - { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, { 0x25, 0x7d, 2 }, - { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, { 0x4d, 0x08, 2 }, - { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, { 0x52, 0x04, 2 }, - { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, { 0x55, 0x23, 2 }, - { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, { 0x58, 0x08, 2 }, - { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, { 0x5b, 0x08, 2 }, - { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, { 0x62, 0x08, 2 }, - { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, { 0x72, 0x56, 2 }, - { 0x73, 0x9a, 2 }, { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, - { 0x5b, 0x40, 0 }, { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, - { 0x88, 0x54, 0 }, { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, - { 0x8d, 0x00, 0 }, { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, - { 0x96, 0x00, 0 }, { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, - { 0x9f, 0x10, 0 }, { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, - { 0xdb, 0x00, 0 }, { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, - { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, - { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } -}; - static usb_callback_t urtw_bulk_rx_callback; static usb_callback_t urtw_bulk_tx_callback; @@ -1034,7 +1046,6 @@ urtw_init(void *arg) static usb_error_t urtw_adapter_start_b(struct urtw_softc *sc) { -#define N(a) (sizeof(a) / sizeof((a)[0])) int i; uint8_t data8; usb_error_t error; @@ -1098,7 +1109,7 @@ urtw_adapter_start_b(struct urtw_softc * goto fail; urtw_write8_m(sc, URTW_WPA_CONFIG, 0); - for (i = 0; i < N(urtw_8187b_reg_table); i++) { + for (i = 0; i < nitems(urtw_8187b_reg_table); i++) { error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0], urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]); if (error) @@ -1208,7 +1219,6 @@ urtw_adapter_start_b(struct urtw_softc * fail: return (error); -#undef N } static usb_error_t @@ -1273,19 +1283,6 @@ fail: return (error); } -static usb_error_t -urtw_set_mode(struct urtw_softc *sc, uint32_t mode) -{ - uint8_t data; - usb_error_t error; - - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT); - data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK); - urtw_write8_m(sc, URTW_EPROM_CMD, data); -fail: - return (error); -} static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *sc) @@ -1395,56 +1392,6 @@ urtw_write32_i(struct urtw_softc *sc, in } static void -urtw_stop_locked(struct ifnet *ifp, int disable) -{ - struct urtw_softc *sc = ifp->if_softc; - uint8_t data8; - usb_error_t error; - - (void)disable; - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - - error = urtw_intr_disable(sc); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CMD, &data8); - data8 &= ~(URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE); - urtw_write8_m(sc, URTW_CMD, data8); - - error = sc->sc_rf_stop(sc); - if (error != 0) - goto fail; - - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CONFIG4, &data8); - urtw_write8_m(sc, URTW_CONFIG4, data8 | URTW_CONFIG4_VCOOFF); - error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); - if (error) - goto fail; -fail: - if (error) - device_printf(sc->sc_dev, "failed to stop (%s)\n", - usbd_errstr(error)); - - usb_callout_stop(&sc->sc_led_ch); - callout_stop(&sc->sc_watchdog_ch); - - urtw_abort_xfers(sc); -} - -static void -urtw_stop(struct ifnet *ifp, int disable) -{ - struct urtw_softc *sc = ifp->if_softc; - - URTW_LOCK(sc); - urtw_stop_locked(ifp, disable); - URTW_UNLOCK(sc); -} - -static void urtw_abort_xfers(struct urtw_softc *sc) { int i, max; @@ -1949,105 +1896,198 @@ urtw_set_multi(void *arg) ifp->if_flags |= IFF_ALLMULTI; } + static usb_error_t -urtw_set_rate(struct urtw_softc *sc) +urtw_get_macaddr(struct urtw_softc *sc) { - int i, basic_rate, min_rr_rate, max_rr_rate; - uint16_t data; + uint32_t data; usb_error_t error; - basic_rate = urtw_rate2rtl(48); - min_rr_rate = urtw_rate2rtl(12); - max_rr_rate = urtw_rate2rtl(48); - - urtw_write8_m(sc, URTW_RESP_RATE, - max_rr_rate << URTW_RESP_MAX_RATE_SHIFT | - min_rr_rate << URTW_RESP_MIN_RATE_SHIFT); - - urtw_read16_m(sc, URTW_BRSR, &data); - data &= ~URTW_BRSR_MBR_8185; - - for (i = 0; i <= basic_rate; i++) - data |= (1 << i); - - urtw_write16_m(sc, URTW_BRSR, data); + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data); + if (error != 0) + goto fail; + sc->sc_bssid[0] = data & 0xff; + sc->sc_bssid[1] = (data & 0xff00) >> 8; + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data); + if (error != 0) + goto fail; + sc->sc_bssid[2] = data & 0xff; + sc->sc_bssid[3] = (data & 0xff00) >> 8; + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data); + if (error != 0) + goto fail; + sc->sc_bssid[4] = data & 0xff; + sc->sc_bssid[5] = (data & 0xff00) >> 8; fail: return (error); } -static uint16_t -urtw_rate2rtl(int rate) +static usb_error_t +urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) { -#define N(a) (sizeof(a) / sizeof((a)[0])) - int i; +#define URTW_READCMD_LEN 3 + int addrlen, i; + int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 }; + usb_error_t error; - for (i = 0; i < N(urtw_ratetable); i++) { - if (rate == urtw_ratetable[i].reg) - return urtw_ratetable[i].val; + /* NB: make sure the buffer is initialized */ + *data = 0; + + /* enable EPROM programming */ + urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE); + DELAY(URTW_EPROM_DELAY); + + error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE); + if (error != 0) + goto fail; + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + error = urtw_eprom_sendbits(sc, readcmd, URTW_READCMD_LEN); + if (error != 0) + goto fail; + if (sc->sc_epromtype == URTW_EEPROM_93C56) { + addrlen = 8; + addrstr[0] = addr & (1 << 7); + addrstr[1] = addr & (1 << 6); + addrstr[2] = addr & (1 << 5); + addrstr[3] = addr & (1 << 4); + addrstr[4] = addr & (1 << 3); + addrstr[5] = addr & (1 << 2); + addrstr[6] = addr & (1 << 1); + addrstr[7] = addr & (1 << 0); + } else { + addrlen=6; + addrstr[0] = addr & (1 << 5); + addrstr[1] = addr & (1 << 4); + addrstr[2] = addr & (1 << 3); + addrstr[3] = addr & (1 << 2); + addrstr[4] = addr & (1 << 1); + addrstr[5] = addr & (1 << 0); } + error = urtw_eprom_sendbits(sc, addrstr, addrlen); + if (error != 0) + goto fail; - return (3); -#undef N -} + error = urtw_eprom_writebit(sc, 0); + if (error != 0) + goto fail; -static uint16_t -urtw_rtl2rate(int rate) -{ -#define N(a) (sizeof(a) / sizeof((a)[0])) - int i; + for (i = 0; i < 16; i++) { + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + error = urtw_eprom_readbit(sc, &data16); + if (error != 0) + goto fail; - for (i = 0; i < N(urtw_ratetable); i++) { - if (rate == urtw_ratetable[i].val) - return urtw_ratetable[i].reg; + (*data) |= (data16 << (15 - i)); } - return (0); -#undef N + error = urtw_eprom_cs(sc, URTW_EPROM_DISABLE); + if (error != 0) + goto fail; + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + + /* now disable EPROM programming */ + urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_NORMAL_MODE); +fail: + return (error); +#undef URTW_READCMD_LEN } static usb_error_t -urtw_update_msr(struct urtw_softc *sc) +urtw_eprom_readbit(struct urtw_softc *sc, int16_t *data) { - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - uint8_t data; + uint8_t data8; usb_error_t error; - urtw_read8_m(sc, URTW_MSR, &data); - data &= ~URTW_MSR_LINK_MASK; - - if (sc->sc_state == IEEE80211_S_RUN) { - switch (ic->ic_opmode) { - case IEEE80211_M_STA: - case IEEE80211_M_MONITOR: - data |= URTW_MSR_LINK_STA; - if (sc->sc_flags & URTW_RTL8187B) - data |= URTW_MSR_LINK_ENEDCA; - break; - case IEEE80211_M_IBSS: - data |= URTW_MSR_LINK_ADHOC; - break; - case IEEE80211_M_HOSTAP: - data |= URTW_MSR_LINK_HOSTAP; - break; - default: - panic("unsupported operation mode 0x%x\n", - ic->ic_opmode); - /* never reach */ - } - } else - data |= URTW_MSR_LINK_NONE; + urtw_read8_m(sc, URTW_EPROM_CMD, &data8); + *data = (data8 & URTW_EPROM_READBIT) ? 1 : 0; + DELAY(URTW_EPROM_DELAY); - urtw_write8_m(sc, URTW_MSR, data); fail: return (error); } static usb_error_t -urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) +urtw_eprom_sendbits(struct urtw_softc *sc, int16_t *buf, int buflen) { - struct usb_device_request req; - usb_error_t error; + int i = 0; + usb_error_t error = 0; + + for (i = 0; i < buflen; i++) { + error = urtw_eprom_writebit(sc, buf[i]); + if (error != 0) + goto fail; + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + } +fail: + return (error); +} + +static usb_error_t +urtw_eprom_writebit(struct urtw_softc *sc, int16_t bit) +{ + uint8_t data; + usb_error_t error; + + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + if (bit != 0) + urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_WRITEBIT); + else + urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_WRITEBIT); + DELAY(URTW_EPROM_DELAY); +fail: + return (error); +} + +static usb_error_t +urtw_eprom_ck(struct urtw_softc *sc) +{ + uint8_t data; + usb_error_t error; + + /* masking */ + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CK); + DELAY(URTW_EPROM_DELAY); + /* unmasking */ + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CK); + DELAY(URTW_EPROM_DELAY); +fail: + return (error); +} + + +static usb_error_t +urtw_eprom_cs(struct urtw_softc *sc, int able) +{ + uint8_t data; + usb_error_t error; + + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + if (able == URTW_EPROM_ENABLE) + urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CS); + else + urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CS); + DELAY(URTW_EPROM_DELAY); +fail: + return (error); +} + + + +static usb_error_t +urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) +{ + struct usb_device_request req; + usb_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2062,6 +2102,22 @@ urtw_read8_c(struct urtw_softc *sc, int } static usb_error_t +urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) +{ + struct usb_device_request req; + usb_error_t error; + + req.bmRequestType = UT_READ_VENDOR_DEVICE; + req.bRequest = URTW_8187_GETREGS_REQ; + USETW(req.wValue, val | 0xfe00); + USETW(req.wIndex, 0); + USETW(req.wLength, sizeof(uint8_t)); + + error = urtw_do_request(sc, &req, data); + return (error); +} + +static usb_error_t urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data) { struct usb_device_request req; @@ -2114,6 +2170,20 @@ urtw_write8_c(struct urtw_softc *sc, int } static usb_error_t +urtw_write8e(struct urtw_softc *sc, int val, uint8_t data) +{ + struct usb_device_request req; + + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; + req.bRequest = URTW_8187_SETREGS_REQ; + USETW(req.wValue, val | 0xfe00); + USETW(req.wIndex, 0); + USETW(req.wLength, sizeof(uint8_t)); + + return (urtw_do_request(sc, &req, &data)); +} + +static usb_error_t urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data) { struct usb_device_request req; @@ -2146,308 +2216,180 @@ urtw_write32_c(struct urtw_softc *sc, in } static usb_error_t -urtw_get_macaddr(struct urtw_softc *sc) +urtw_set_mode(struct urtw_softc *sc, uint32_t mode) { - uint32_t data; + uint8_t data; usb_error_t error; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data); - if (error != 0) - goto fail; - sc->sc_bssid[0] = data & 0xff; - sc->sc_bssid[1] = (data & 0xff00) >> 8; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data); - if (error != 0) - goto fail; - sc->sc_bssid[2] = data & 0xff; - sc->sc_bssid[3] = (data & 0xff00) >> 8; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data); - if (error != 0) - goto fail; - sc->sc_bssid[4] = data & 0xff; - sc->sc_bssid[5] = (data & 0xff00) >> 8; + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT); + data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK); + urtw_write8_m(sc, URTW_EPROM_CMD, data); fail: return (error); } static usb_error_t -urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) +urtw_8180_set_anaparam(struct urtw_softc *sc, uint32_t val) { -#define URTW_READCMD_LEN 3 - int addrlen, i; - int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 }; + uint8_t data; usb_error_t error; - /* NB: make sure the buffer is initialized */ - *data = 0; - - /* enable EPROM programming */ - urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE); - DELAY(URTW_EPROM_DELAY); - - error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE); - if (error != 0) - goto fail; - error = urtw_eprom_ck(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 13:19:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDE071065692; Tue, 8 Sep 2009 13:19:05 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B91498FC1D; Tue, 8 Sep 2009 13:19:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88DJ5GB048600; Tue, 8 Sep 2009 13:19:05 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88DJ5ne048573; Tue, 8 Sep 2009 13:19:05 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909081319.n88DJ5ne048573@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 13:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196970 - in head/sys: cam/scsi contrib/dev/acpica/executer dev/aac dev/ae dev/amr dev/ata dev/ata/chipsets dev/ath dev/ath/ath_hal dev/bce dev/e1000 dev/ep dev/firewire dev/fxp dev/hpt... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 13:19:05 -0000 Author: phk Date: Tue Sep 8 13:19:05 2009 New Revision: 196970 URL: http://svn.freebsd.org/changeset/base/196970 Log: Revert previous commit and add myself to the list of people who should know better than to commit with a cat in the area. Modified: head/sys/cam/scsi/scsi_cd.c head/sys/contrib/dev/acpica/executer/exfldio.c head/sys/dev/aac/aac.c head/sys/dev/ae/if_ae.c head/sys/dev/amr/amr.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah_eeprom_v3.c head/sys/dev/bce/if_bce.c head/sys/dev/e1000/if_em.c head/sys/dev/ep/if_ep.c head/sys/dev/ep/if_epreg.h head/sys/dev/firewire/fwcrom.c head/sys/dev/firewire/fwdev.c head/sys/dev/fxp/if_fxp.c head/sys/dev/hptiop/hptiop.c head/sys/dev/iir/iir.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/msk/if_msk.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/wi/if_wi.c head/sys/fs/msdosfs/msdosfs_conv.c head/sys/kern/kern_jail.c head/sys/kern/kern_linker.c head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_proto.h head/sys/security/audit/audit_bsm_token.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:19:05 2009 (r196970) @@ -2528,7 +2528,7 @@ cdioctl(struct disk *dp, u_long cmd, voi error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(¶ms.mode_buf, M_SCSICD); + free(¶ms, M_SCSICD); cam_periph_unlock(periph); break; } Modified: head/sys/contrib/dev/acpica/executer/exfldio.c ============================================================================== --- head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:19:05 2009 (r196970) @@ -992,7 +992,6 @@ AcpiExInsertIntoField ( /* Get initial Datum from the input buffer */ - /* XXX: Flexelint sees arg 9 for bufferlen 8 */ ACPI_MEMCPY (&RawDatum, Buffer, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/aac/aac.c Tue Sep 8 13:19:05 2009 (r196970) @@ -3556,7 +3556,7 @@ aac_supported_features(struct aac_softc * associated with the feature in the data field or perform whatever * action needed indicates in the data field. */ - if (f.feat.fValue == 0) { + if (f.feat.fValue == 0) { f.feat.fBits.largeLBA = (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0; /* TODO: In the future, add other features state here as well */ Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ae/if_ae.c Tue Sep 8 13:19:05 2009 (r196970) @@ -1662,7 +1662,6 @@ ae_stop_rxmac(ae_softc_t *sc) /* * Wait for IDLE state. */ - /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0) @@ -1699,7 +1698,6 @@ ae_stop_txmac(ae_softc_t *sc) /* * Wait for IDLE state. */ - /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0) Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/amr/amr.c Tue Sep 8 13:19:05 2009 (r196970) @@ -527,7 +527,7 @@ amr_rescan_drives(struct cdev *dev) sc->amr_drive[i].al_disk)) != 0) goto shutdown_out; - sc->amr_drive[i].al_disk = 0; + sc->amr_drive[i].al_disk = 0; } } Modified: head/sys/dev/ata/ata-raid.c ============================================================================== --- head/sys/dev/ata/ata-raid.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ata/ata-raid.c Tue Sep 8 13:19:05 2009 (r196970) @@ -407,7 +407,7 @@ ata_raid_strategy(struct bio *bp) if (rdp->status & AR_S_REBUILDING) blk = ((lba / rdp->interleave) * rdp->width) * rdp->interleave + (rdp->interleave * (drv % rdp->width)) + - lba % rdp->interleave; + lba % rdp->interleave;; if (bp->bio_cmd == BIO_READ) { int src_online = @@ -1138,7 +1138,6 @@ ata_raid_create(struct ata_ioc_raid_conf rdp->type == AR_T_RAID5) { int bit = 0; - /* XXX: Flexelint not happy */ while (config->interleave >>= 1) bit++; rdp->interleave = 1 << bit; Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:19:05 2009 (r196970) @@ -127,7 +127,6 @@ ata_ali_chipinit(device_t dev) RF_ACTIVE); if (res->bars[i] == NULL) { device_printf(dev, "Failed to allocate BAR %d\n", i); - /* XXX: Flexelint: Reuse of for loop variable 'i' at 'line 124' could cause chaos */ for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:19:05 2009 (r196970) @@ -153,7 +153,7 @@ ata_marvell_pata_ch_attach(device_t dev) return ENXIO; /* dont use 32 bit PIO transfers */ - ch->flags |= ATA_USE_16BIT; + ch->flags |= ATA_USE_16BIT; return 0; } Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:19:05 2009 (r196970) @@ -107,7 +107,6 @@ ath_hal_malloc(size_t size) return malloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO); } -/* XXX: FlexeLint return in void function ? */ void ath_hal_free(void* p) { Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:19:05 2009 (r196970) @@ -566,7 +566,6 @@ ath_hal_getregdump(struct ath_hal *ah, c uint32_t *dp = dstbuf; int i; - /* XXX: FlexeLint: ">" test with ++ */ for (i = 0; space >= 2*sizeof(uint32_t); i++) { u_int r = regs[i].start; u_int e = regs[i].end; Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:19:05 2009 (r196970) @@ -1753,8 +1753,6 @@ legacyEepromGetSpurChan(struct ath_hal * /* * Reclaim any EEPROM-related storage. */ - -/* XXX: FlexeLint: return in void function */ static void legacyEepromDetach(struct ath_hal *ah) { Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/bce/if_bce.c Tue Sep 8 13:19:05 2009 (r196970) @@ -608,17 +608,17 @@ bce_print_adapter_info(struct bce_softc #endif if (sc->bce_flags & BCE_USING_MSI_FLAG) { if (i > 0) printf("|"); - printf("MSI"); i++; + printf("MSI"); i++; } if (sc->bce_flags & BCE_USING_MSIX_FLAG) { if (i > 0) printf("|"); - printf("MSI-X "); i++; + printf("MSI-X "); i++; } if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { if (i > 0) printf("|"); - printf("2.5G"); i++; + printf("2.5G"); i++; } if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { @@ -628,7 +628,7 @@ bce_print_adapter_info(struct bce_softc printf(")\n"); } - DBEXIT(BCE_VERBOSE_LOAD); + DBEXIT(BCE_VERBOSE_LOAD); } Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/e1000/if_em.c Tue Sep 8 13:19:05 2009 (r196970) @@ -2826,7 +2826,7 @@ em_allocate_pci_resources(struct adapter * Setup the Legacy or MSI Interrupt handler * **********************************************************************/ -static int +int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ep/if_ep.c Tue Sep 8 13:19:05 2009 (r196970) @@ -666,7 +666,6 @@ rescan: sc->tx_underrun++; #endif } else { - /* XXX: FlexeLint doesn't like ; */ if (status & TXS_JABBER); else ++ifp->if_collisions; Modified: head/sys/dev/ep/if_epreg.h ============================================================================== --- head/sys/dev/ep/if_epreg.h Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ep/if_epreg.h Tue Sep 8 13:19:05 2009 (r196970) @@ -315,11 +315,7 @@ S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) #define S_COMMAND_IN_PROGRESS (u_short) (0x1000) -#define EP_BUSY_WAIT(sc) \ - do { \ - while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) \ - continue; \ - } while (0) +#define EP_BUSY_WAIT(sc) while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) /* Address Config. Register. * Window 0/Port 06 Modified: head/sys/dev/firewire/fwcrom.c ============================================================================== --- head/sys/dev/firewire/fwcrom.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/firewire/fwcrom.c Tue Sep 8 13:19:05 2009 (r196970) @@ -454,9 +454,9 @@ crom_add_simple_text(struct crom_src *sr len = strlen(buf); if (len > MAX_TEXT) { #if defined(__DragonFly__) || __FreeBSD_version < 500000 - printf("text(%d) truncated to %d.\n", len, MAX_TEXT); + printf("text(%d) trancated to %d.\n", len, MAX_TEXT); #else - printf("text(%d) truncated to %td.\n", len, MAX_TEXT); + printf("text(%d) trancated to %td.\n", len, MAX_TEXT); #endif len = MAX_TEXT; } Modified: head/sys/dev/firewire/fwdev.c ============================================================================== --- head/sys/dev/firewire/fwdev.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/firewire/fwdev.c Tue Sep 8 13:19:05 2009 (r196970) @@ -844,7 +844,6 @@ out: err = copyout(ptr, crom_buf->ptr, len); if (fwdev == NULL) /* myself */ - /* XXX: Flexelint no sure about modified pointer */ free(ptr, M_FW); break; default: Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/fxp/if_fxp.c Tue Sep 8 13:19:05 2009 (r196970) @@ -1597,7 +1597,6 @@ fxp_encap(struct fxp_softc *sc, struct m cbp->tbd_number = nseg; /* Configure TSO. */ if (m->m_pkthdr.csum_flags & CSUM_TSO) { - /* XXX: FlexeLint: negative subscript */ cbp->tbd[-1].tb_size = htole32(m->m_pkthdr.tso_segsz << 16); cbp->tbd[1].tb_size |= htole32(tcp_payload << 16); cbp->ipcb_ip_schedule |= FXP_IPCB_LARGESEND_ENABLE | Modified: head/sys/dev/hptiop/hptiop.c ============================================================================== --- head/sys/dev/hptiop/hptiop.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/hptiop/hptiop.c Tue Sep 8 13:19:05 2009 (r196970) @@ -432,7 +432,6 @@ srb_complete: sg_list), (u_int8_t *)&ccb->csio.sense_data, MIN(dxfer, sizeof(ccb->csio.sense_data))); } else { - /* XXX: Flexelint arg2 is 16 bytes, arg3 is 32 */ memcpy(&ccb->csio.sense_data, &req->sg_list, MIN(dxfer, sizeof(ccb->csio.sense_data))); } @@ -576,7 +575,6 @@ static void hptiop_request_callback_mv(s ccb->ccb_h.status = CAM_BUSY; break; case IOP_RESULT_CHECK_CONDITION: - /* XXX: FlexeLint: arg2=16b arg3=32 */ memcpy(&ccb->csio.sense_data, &req->sg_list, MIN(req->dataxfer_length, sizeof(ccb->csio.sense_data))); ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; Modified: head/sys/dev/iir/iir.c ============================================================================== --- head/sys/dev/iir/iir.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/iir/iir.c Tue Sep 8 13:19:05 2009 (r196970) @@ -1203,7 +1203,6 @@ gdt_internal_cache_cmd(struct gdt_softc bzero( ccb->csio.data_ptr+copylen, ccb->csio.dxfer_len - copylen ); page=((struct scsi_mode_sense_6 *)ccb->csio.cdb_io.cdb_bytes)->page; - /* XXX: FlexeLint: why ?? */ switch (page) { default: GDT_DPRINTF(GDT_D_MISC, ("MODE_SENSE_6: page 0x%x\n", page)); Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/mpt/mpt_raid.c Tue Sep 8 13:19:05 2009 (r196970) @@ -562,7 +562,6 @@ mpt_raid_reply_frame_handler(struct mpt_ break; } action_result = REQ_TO_RAID_ACTION_RESULT(req); - /* XXX: FlexeLint: ActionData is only 4 bytes */ memcpy(&action_result->action_data, &reply->ActionData, sizeof(action_result->action_data)); action_result->action_status = le16toh(reply->ActionStatus); Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/msk/if_msk.c Tue Sep 8 13:19:05 2009 (r196970) @@ -118,21 +118,26 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include +#include #include #include +#include #include #include #include #include +#include #include +#include #include #include Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 13:19:05 2009 (r196970) @@ -42,9 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include +#include #include #include #include @@ -1486,7 +1489,7 @@ rum_rf_write(struct rum_softc *sc, uint8 return; } - tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | ((val & 0xfffff) << 2) | + tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | (val & 0xfffff) << 2 | (reg & 3); rum_write(sc, RT2573_PHY_CSR4, tmp); Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 13:19:05 2009 (r196970) @@ -139,7 +139,7 @@ #define RT2573_BBP_BUSY (1 << 16) /* possible flags for register PHY_CSR4 */ #define RT2573_RF_20BIT (20 << 24) -#define RT2573_RF_BUSY (1U << 31) +#define RT2573_RF_BUSY (1 << 31) /* LED values */ #define RT2573_LED_RADIO (1 << 8) Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 13:19:05 2009 (r196970) @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define nitems(a) (sizeof(a) / sizeof((a)[0])) - SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW, 0, "USB Realtek 8187L"); #ifdef URTW_DEBUG int urtw_debug = 0; @@ -177,46 +175,6 @@ struct urtw_pair { uint32_t val; }; -static const uint8_t urtw_8187b_reg_table[][3] = { - { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, - { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, - { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, - { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, - { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, - { 0xff, 0x00, 0 }, - - { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, { 0x5a, 0x4b, 1 }, - { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, { 0x61, 0x09, 1 }, - { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, { 0xce, 0x0f, 1 }, - { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, { 0xe1, 0x0f, 1 }, - { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, { 0xf1, 0x01, 1 }, - { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, { 0xf4, 0x04, 1 }, - { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, { 0xf7, 0x07, 1 }, - { 0xf8, 0x08, 1 }, - - { 0x4e, 0x00, 2 }, { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, - { 0x22, 0x68, 2 }, { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, - { 0x25, 0x7d, 2 }, { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, - { 0x4d, 0x08, 2 }, { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, - { 0x52, 0x04, 2 }, { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, - { 0x55, 0x23, 2 }, { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, - { 0x58, 0x08, 2 }, { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, - { 0x5b, 0x08, 2 }, { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, - { 0x62, 0x08, 2 }, { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, - { 0x72, 0x56, 2 }, { 0x73, 0x9a, 2 }, - - { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, { 0x5b, 0x40, 0 }, - { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, { 0x88, 0x54, 0 }, - { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, { 0x8d, 0x00, 0 }, - { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, { 0x96, 0x00, 0 }, - { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, { 0x9f, 0x10, 0 }, - { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, { 0xdb, 0x00, 0 }, - { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, - - { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, - { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } -}; - static uint8_t urtw_8225_agc[] = { 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, @@ -232,6 +190,21 @@ static uint8_t urtw_8225_agc[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; +static uint8_t urtw_8225z2_agc[] = { + 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, + 0x4f, 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, + 0x39, 0x37, 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, + 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, + 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0x19, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, + 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, + 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 +}; + static uint32_t urtw_8225_channel[] = { 0x0000, /* dummy channel 0 */ 0x085c, /* 1 */ @@ -264,7 +237,7 @@ static struct urtw_pair urtw_8225_rf_par { 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, { 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a }, { 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 }, - { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 } + { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 }, }; static struct urtw_pair urtw_8225_rf_part2[] = { @@ -306,7 +279,7 @@ static uint16_t urtw_8225_rxgain[] = { }; static uint8_t urtw_8225_threshold[] = { - 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd + 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd, }; static uint8_t urtw_8225_tx_gain_cck_ofdm[] = { @@ -331,29 +304,10 @@ static uint8_t urtw_8225_txpwr_cck_ch14[ 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00 }; -static uint8_t urtw_8225_txpwr_ofdm[] = { +static uint8_t urtw_8225_txpwr_ofdm[]={ 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4 }; -static uint8_t urtw_8225z2_agc[] = { - 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, - 0x55, 0x53, 0x51, 0x4f, 0x4d, 0x4b, 0x49, 0x47, - 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37, - 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, - 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, - 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07, - 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, - 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, - 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, - 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, - 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 -}; - static uint8_t urtw_8225v2_gain_bg[]={ 0x23, 0x15, 0xa5, /* -82-1dbm */ 0x23, 0x15, 0xb5, /* -82-2dbm */ @@ -456,7 +410,11 @@ static uint8_t urtw_8225v2_tx_gain_cck_o 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, - 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 + 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, +}; + +static uint8_t urtw_8225v2_txpwr_cck[] = { + 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 }; static uint8_t urtw_8225v2_txpwr_cck_ch14[] = { @@ -470,10 +428,6 @@ static uint8_t urtw_8225v2b_txpwr_cck[] 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03 }; -static uint8_t urtw_8225v2_txpwr_cck[] = { - 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 -}; - static uint8_t urtw_8225v2b_txpwr_cck_ch14[] = { 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, @@ -487,6 +441,40 @@ static struct urtw_pair urtw_ratetable[] { 96, 10 }, { 108, 11 } }; +static const uint8_t urtw_8187b_reg_table[][3] = { + { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, + { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, + { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, + { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, + { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, + { 0xff, 0x00, 0 }, { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, + { 0x5a, 0x4b, 1 }, { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, + { 0x61, 0x09, 1 }, { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, + { 0xce, 0x0f, 1 }, { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, + { 0xe1, 0x0f, 1 }, { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, + { 0xf1, 0x01, 1 }, { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, + { 0xf4, 0x04, 1 }, { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, + { 0xf7, 0x07, 1 }, { 0xf8, 0x08, 1 }, { 0x4e, 0x00, 2 }, + { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, { 0x22, 0x68, 2 }, + { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, { 0x25, 0x7d, 2 }, + { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, { 0x4d, 0x08, 2 }, + { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, { 0x52, 0x04, 2 }, + { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, { 0x55, 0x23, 2 }, + { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, { 0x58, 0x08, 2 }, + { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, { 0x5b, 0x08, 2 }, + { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, { 0x62, 0x08, 2 }, + { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, { 0x72, 0x56, 2 }, + { 0x73, 0x9a, 2 }, { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, + { 0x5b, 0x40, 0 }, { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, + { 0x88, 0x54, 0 }, { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, + { 0x8d, 0x00, 0 }, { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, + { 0x96, 0x00, 0 }, { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, + { 0x9f, 0x10, 0 }, { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, + { 0xdb, 0x00, 0 }, { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, + { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, + { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } +}; + static usb_callback_t urtw_bulk_rx_callback; static usb_callback_t urtw_bulk_tx_callback; @@ -1046,6 +1034,7 @@ urtw_init(void *arg) static usb_error_t urtw_adapter_start_b(struct urtw_softc *sc) { +#define N(a) (sizeof(a) / sizeof((a)[0])) int i; uint8_t data8; usb_error_t error; @@ -1109,7 +1098,7 @@ urtw_adapter_start_b(struct urtw_softc * goto fail; urtw_write8_m(sc, URTW_WPA_CONFIG, 0); - for (i = 0; i < nitems(urtw_8187b_reg_table); i++) { + for (i = 0; i < N(urtw_8187b_reg_table); i++) { error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0], urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]); if (error) @@ -1219,6 +1208,7 @@ urtw_adapter_start_b(struct urtw_softc * fail: return (error); +#undef N } static usb_error_t @@ -1283,6 +1273,19 @@ fail: return (error); } +static usb_error_t +urtw_set_mode(struct urtw_softc *sc, uint32_t mode) +{ + uint8_t data; + usb_error_t error; + + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT); + data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK); + urtw_write8_m(sc, URTW_EPROM_CMD, data); +fail: + return (error); +} static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *sc) @@ -1392,6 +1395,56 @@ urtw_write32_i(struct urtw_softc *sc, in } static void +urtw_stop_locked(struct ifnet *ifp, int disable) +{ + struct urtw_softc *sc = ifp->if_softc; + uint8_t data8; + usb_error_t error; + + (void)disable; + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + error = urtw_intr_disable(sc); + if (error) + goto fail; + urtw_read8_m(sc, URTW_CMD, &data8); + data8 &= ~(URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE); + urtw_write8_m(sc, URTW_CMD, data8); + + error = sc->sc_rf_stop(sc); + if (error != 0) + goto fail; + + error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); + if (error) + goto fail; + urtw_read8_m(sc, URTW_CONFIG4, &data8); + urtw_write8_m(sc, URTW_CONFIG4, data8 | URTW_CONFIG4_VCOOFF); + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); + if (error) + goto fail; +fail: + if (error) + device_printf(sc->sc_dev, "failed to stop (%s)\n", + usbd_errstr(error)); + + usb_callout_stop(&sc->sc_led_ch); + callout_stop(&sc->sc_watchdog_ch); + + urtw_abort_xfers(sc); +} + +static void +urtw_stop(struct ifnet *ifp, int disable) +{ + struct urtw_softc *sc = ifp->if_softc; + + URTW_LOCK(sc); + urtw_stop_locked(ifp, disable); + URTW_UNLOCK(sc); +} + +static void urtw_abort_xfers(struct urtw_softc *sc) { int i, max; @@ -1896,198 +1949,105 @@ urtw_set_multi(void *arg) ifp->if_flags |= IFF_ALLMULTI; } - static usb_error_t -urtw_get_macaddr(struct urtw_softc *sc) +urtw_set_rate(struct urtw_softc *sc) { - uint32_t data; + int i, basic_rate, min_rr_rate, max_rr_rate; + uint16_t data; usb_error_t error; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data); - if (error != 0) - goto fail; - sc->sc_bssid[0] = data & 0xff; - sc->sc_bssid[1] = (data & 0xff00) >> 8; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data); - if (error != 0) - goto fail; - sc->sc_bssid[2] = data & 0xff; - sc->sc_bssid[3] = (data & 0xff00) >> 8; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data); - if (error != 0) - goto fail; - sc->sc_bssid[4] = data & 0xff; - sc->sc_bssid[5] = (data & 0xff00) >> 8; + basic_rate = urtw_rate2rtl(48); + min_rr_rate = urtw_rate2rtl(12); + max_rr_rate = urtw_rate2rtl(48); + + urtw_write8_m(sc, URTW_RESP_RATE, + max_rr_rate << URTW_RESP_MAX_RATE_SHIFT | + min_rr_rate << URTW_RESP_MIN_RATE_SHIFT); + + urtw_read16_m(sc, URTW_BRSR, &data); + data &= ~URTW_BRSR_MBR_8185; + + for (i = 0; i <= basic_rate; i++) + data |= (1 << i); + + urtw_write16_m(sc, URTW_BRSR, data); fail: return (error); } -static usb_error_t -urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) +static uint16_t +urtw_rate2rtl(int rate) { -#define URTW_READCMD_LEN 3 - int addrlen, i; - int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 }; - usb_error_t error; - - /* NB: make sure the buffer is initialized */ - *data = 0; - - /* enable EPROM programming */ - urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE); - DELAY(URTW_EPROM_DELAY); +#define N(a) (sizeof(a) / sizeof((a)[0])) + int i; - error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE); - if (error != 0) - goto fail; - error = urtw_eprom_ck(sc); - if (error != 0) - goto fail; - error = urtw_eprom_sendbits(sc, readcmd, URTW_READCMD_LEN); - if (error != 0) - goto fail; - if (sc->sc_epromtype == URTW_EEPROM_93C56) { - addrlen = 8; - addrstr[0] = addr & (1 << 7); - addrstr[1] = addr & (1 << 6); - addrstr[2] = addr & (1 << 5); - addrstr[3] = addr & (1 << 4); - addrstr[4] = addr & (1 << 3); - addrstr[5] = addr & (1 << 2); - addrstr[6] = addr & (1 << 1); - addrstr[7] = addr & (1 << 0); - } else { - addrlen=6; - addrstr[0] = addr & (1 << 5); - addrstr[1] = addr & (1 << 4); - addrstr[2] = addr & (1 << 3); - addrstr[3] = addr & (1 << 2); - addrstr[4] = addr & (1 << 1); - addrstr[5] = addr & (1 << 0); + for (i = 0; i < N(urtw_ratetable); i++) { + if (rate == urtw_ratetable[i].reg) + return urtw_ratetable[i].val; } - error = urtw_eprom_sendbits(sc, addrstr, addrlen); - if (error != 0) - goto fail; - error = urtw_eprom_writebit(sc, 0); - if (error != 0) - goto fail; + return (3); +#undef N +} - for (i = 0; i < 16; i++) { - error = urtw_eprom_ck(sc); - if (error != 0) - goto fail; - error = urtw_eprom_readbit(sc, &data16); - if (error != 0) - goto fail; +static uint16_t +urtw_rtl2rate(int rate) +{ +#define N(a) (sizeof(a) / sizeof((a)[0])) + int i; - (*data) |= (data16 << (15 - i)); + for (i = 0; i < N(urtw_ratetable); i++) { + if (rate == urtw_ratetable[i].val) + return urtw_ratetable[i].reg; } - error = urtw_eprom_cs(sc, URTW_EPROM_DISABLE); - if (error != 0) - goto fail; - error = urtw_eprom_ck(sc); - if (error != 0) - goto fail; - - /* now disable EPROM programming */ - urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_NORMAL_MODE); -fail: - return (error); -#undef URTW_READCMD_LEN + return (0); +#undef N } static usb_error_t -urtw_eprom_readbit(struct urtw_softc *sc, int16_t *data) +urtw_update_msr(struct urtw_softc *sc) { - uint8_t data8; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + uint8_t data; usb_error_t error; - urtw_read8_m(sc, URTW_EPROM_CMD, &data8); - *data = (data8 & URTW_EPROM_READBIT) ? 1 : 0; - DELAY(URTW_EPROM_DELAY); + urtw_read8_m(sc, URTW_MSR, &data); + data &= ~URTW_MSR_LINK_MASK; + + if (sc->sc_state == IEEE80211_S_RUN) { + switch (ic->ic_opmode) { + case IEEE80211_M_STA: + case IEEE80211_M_MONITOR: + data |= URTW_MSR_LINK_STA; + if (sc->sc_flags & URTW_RTL8187B) + data |= URTW_MSR_LINK_ENEDCA; + break; + case IEEE80211_M_IBSS: + data |= URTW_MSR_LINK_ADHOC; + break; + case IEEE80211_M_HOSTAP: + data |= URTW_MSR_LINK_HOSTAP; + break; + default: + panic("unsupported operation mode 0x%x\n", + ic->ic_opmode); + /* never reach */ + } + } else + data |= URTW_MSR_LINK_NONE; + urtw_write8_m(sc, URTW_MSR, data); fail: return (error); } static usb_error_t -urtw_eprom_sendbits(struct urtw_softc *sc, int16_t *buf, int buflen) +urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) { - int i = 0; - usb_error_t error = 0; - - for (i = 0; i < buflen; i++) { - error = urtw_eprom_writebit(sc, buf[i]); - if (error != 0) - goto fail; - error = urtw_eprom_ck(sc); - if (error != 0) - goto fail; - } -fail: - return (error); -} - -static usb_error_t -urtw_eprom_writebit(struct urtw_softc *sc, int16_t bit) -{ - uint8_t data; - usb_error_t error; - - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - if (bit != 0) - urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_WRITEBIT); - else - urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_WRITEBIT); - DELAY(URTW_EPROM_DELAY); -fail: - return (error); -} - -static usb_error_t -urtw_eprom_ck(struct urtw_softc *sc) -{ - uint8_t data; - usb_error_t error; - - /* masking */ - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CK); - DELAY(URTW_EPROM_DELAY); - /* unmasking */ - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CK); - DELAY(URTW_EPROM_DELAY); -fail: - return (error); -} - - -static usb_error_t -urtw_eprom_cs(struct urtw_softc *sc, int able) -{ - uint8_t data; - usb_error_t error; - - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - if (able == URTW_EPROM_ENABLE) - urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CS); - else - urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CS); - DELAY(URTW_EPROM_DELAY); -fail: - return (error); -} - - - -static usb_error_t -urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) -{ - struct usb_device_request req; - usb_error_t error; + struct usb_device_request req; + usb_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2102,22 +2062,6 @@ urtw_read8_c(struct urtw_softc *sc, int } static usb_error_t -urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) -{ - struct usb_device_request req; - usb_error_t error; - - req.bmRequestType = UT_READ_VENDOR_DEVICE; - req.bRequest = URTW_8187_GETREGS_REQ; - USETW(req.wValue, val | 0xfe00); - USETW(req.wIndex, 0); - USETW(req.wLength, sizeof(uint8_t)); - - error = urtw_do_request(sc, &req, data); - return (error); -} - -static usb_error_t urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data) { struct usb_device_request req; @@ -2170,20 +2114,6 @@ urtw_write8_c(struct urtw_softc *sc, int } static usb_error_t -urtw_write8e(struct urtw_softc *sc, int val, uint8_t data) -{ - struct usb_device_request req; - - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = URTW_8187_SETREGS_REQ; - USETW(req.wValue, val | 0xfe00); - USETW(req.wIndex, 0); - USETW(req.wLength, sizeof(uint8_t)); - - return (urtw_do_request(sc, &req, &data)); -} - -static usb_error_t urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data) { struct usb_device_request req; @@ -2216,180 +2146,308 @@ urtw_write32_c(struct urtw_softc *sc, in } static usb_error_t -urtw_set_mode(struct urtw_softc *sc, uint32_t mode) +urtw_get_macaddr(struct urtw_softc *sc) { - uint8_t data; + uint32_t data; usb_error_t error; - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT); - data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK); - urtw_write8_m(sc, URTW_EPROM_CMD, data); + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data); + if (error != 0) + goto fail; + sc->sc_bssid[0] = data & 0xff; + sc->sc_bssid[1] = (data & 0xff00) >> 8; + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data); + if (error != 0) + goto fail; + sc->sc_bssid[2] = data & 0xff; + sc->sc_bssid[3] = (data & 0xff00) >> 8; + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data); + if (error != 0) + goto fail; + sc->sc_bssid[4] = data & 0xff; + sc->sc_bssid[5] = (data & 0xff00) >> 8; fail: return (error); } static usb_error_t -urtw_8180_set_anaparam(struct urtw_softc *sc, uint32_t val) +urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) { - uint8_t data; +#define URTW_READCMD_LEN 3 + int addrlen, i; + int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 }; usb_error_t error; - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) + /* NB: make sure the buffer is initialized */ + *data = 0; + + /* enable EPROM programming */ + urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE); + DELAY(URTW_EPROM_DELAY); + + error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE); + if (error != 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 13:24:36 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6E3B1065692; Tue, 8 Sep 2009 13:24:36 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5FA68FC0A; Tue, 8 Sep 2009 13:24:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88DOaCV048787; Tue, 8 Sep 2009 13:24:36 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88DOaE6048785; Tue, 8 Sep 2009 13:24:36 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909081324.n88DOaE6048785@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 13:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196971 - head/sys/security/audit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 13:24:36 -0000 Author: phk Date: Tue Sep 8 13:24:36 2009 New Revision: 196971 URL: http://svn.freebsd.org/changeset/base/196971 Log: Having thrown the cat out of the house, add a necessary include. Modified: head/sys/security/audit/audit_bsm_token.c Modified: head/sys/security/audit/audit_bsm_token.c ============================================================================== --- head/sys/security/audit/audit_bsm_token.c Tue Sep 8 13:19:05 2009 (r196970) +++ head/sys/security/audit/audit_bsm_token.c Tue Sep 8 13:24:36 2009 (r196971) @@ -36,6 +36,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 13:28:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A33C31065670; Tue, 8 Sep 2009 13:28:03 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 633D58FC1A; Tue, 8 Sep 2009 13:28:02 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 013E169959; Tue, 8 Sep 2009 13:28:00 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n88DSCsn031625; Tue, 8 Sep 2009 13:28:12 GMT (envelope-from phk@critter.freebsd.dk) From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 08 Sep 2009 13:16:55 GMT." <200909081316.n88DGtVn048461@svn.freebsd.org> Date: Tue, 08 Sep 2009 13:28:12 +0000 Message-ID: <31624.1252416492@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196969 - in head/sys: cam/scsi contrib/dev/acpica/executer dev/aac dev/ae dev/amr dev/ata dev/ata/chipsets dev/ath dev/ath/ath_hal dev/bce dev/e1000 dev/ep dev/firewire dev/fxp dev/hpt... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 13:28:03 -0000 Hep! Pointy hat over here! Thanks... So, anyway, I spent a hour stuck in a train yesterday and ran flexelint on the kernel. Apart from if_urtw.c, all the stuff below was flagged by FlexeLint and if any of your files were included, please take a peek and see if it is only smoke or if there is a fire. Poul-Henning >Modified: > head/sys/cam/scsi/scsi_cd.c > head/sys/contrib/dev/acpica/executer/exfldio.c > head/sys/dev/aac/aac.c [...] -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 14:15:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 481CA106568F; Tue, 8 Sep 2009 14:15:15 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35DBF8FC1C; Tue, 8 Sep 2009 14:15:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88EFF4v049885; Tue, 8 Sep 2009 14:15:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88EFF4R049882; Tue, 8 Sep 2009 14:15:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909081415.n88EFF4R049882@svn.freebsd.org> From: Attilio Rao Date: Tue, 8 Sep 2009 14:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196972 - stable/6/usr.sbin/tzsetup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 14:15:15 -0000 Author: attilio Date: Tue Sep 8 14:15:14 2009 New Revision: 196972 URL: http://svn.freebsd.org/changeset/base/196972 Log: MFC r195339: Add a new option (-s) that, when specified, skips the question about adjusting the clock to UTC. Sponsored by: Sandvine Incorporated Modified: stable/6/usr.sbin/tzsetup/tzsetup.8 stable/6/usr.sbin/tzsetup/tzsetup.c Modified: stable/6/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- stable/6/usr.sbin/tzsetup/tzsetup.8 Tue Sep 8 13:24:36 2009 (r196971) +++ stable/6/usr.sbin/tzsetup/tzsetup.8 Tue Sep 8 14:15:14 2009 (r196972) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 24, 1996 +.Dd September 08, 2009 .Dt TZSETUP 8 .Os .Sh NAME @@ -31,7 +31,7 @@ .Nd set local timezone .Sh SYNOPSIS .Nm -.Op Fl n +.Op Fl ns .Op Ar default .Sh DESCRIPTION The @@ -51,6 +51,9 @@ The following option is available: .Bl -tag -offset indent -width Fl .It Fl n Do not create or copy files. +.It Fl s +Skip the initial question about adjusting the clock if not set to +.Tn UTC . .El .Pp It is possible to short-circuit the menu system by specifying a Modified: stable/6/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/6/usr.sbin/tzsetup/tzsetup.c Tue Sep 8 13:24:36 2009 (r196971) +++ stable/6/usr.sbin/tzsetup/tzsetup.c Tue Sep 8 14:15:14 2009 (r196972) @@ -648,11 +648,14 @@ main(int argc, char **argv) dialog_utc = dialog_noyes; #endif - while ((c = getopt(argc, argv, "n")) != -1) { + while ((c = getopt(argc, argv, "ns")) != -1) { switch(c) { case 'n': reallydoit = 0; break; + case 's': + dialog_utc = NULL; + break; default: usage(); @@ -671,22 +674,25 @@ main(int argc, char **argv) make_menus(); init_dialog(); - if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock", - "Is this machine's CMOS clock set to UTC? If it is set to local time,\n" - "or you don't know, please choose NO here!", 7, 72)) { - if (reallydoit) - unlink(_PATH_WALL_CMOS_CLOCK); - } else { - if (reallydoit) { - fd = open(_PATH_WALL_CMOS_CLOCK, - O_WRONLY|O_CREAT|O_TRUNC, - S_IRUSR|S_IRGRP|S_IROTH); - if (fd < 0) - err(1, "create %s", _PATH_WALL_CMOS_CLOCK); - close(fd); + if (dialog_utc != NULL) { + if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock", + "Is this machine's CMOS clock set to UTC? If it is set to local time,\n" + "or you don't know, please choose NO here!", 7, 72)) { + if (reallydoit) + unlink(_PATH_WALL_CMOS_CLOCK); + } else { + if (reallydoit) { + fd = open(_PATH_WALL_CMOS_CLOCK, + O_WRONLY|O_CREAT|O_TRUNC, + S_IRUSR|S_IRGRP|S_IROTH); + if (fd < 0) + err(1, "create %s", + _PATH_WALL_CMOS_CLOCK); + close(fd); + } } + dialog_clear_norefresh(); } - dialog_clear_norefresh(); if (optind == argc - 1) { char *msg; asprintf(&msg, "\nUse the default `%s' zone?", argv[optind]); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 14:19:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A018106566B; Tue, 8 Sep 2009 14:19:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBE28FC22; Tue, 8 Sep 2009 14:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88EJEba049983; Tue, 8 Sep 2009 14:19:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88EJE4P049981; Tue, 8 Sep 2009 14:19:14 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909081419.n88EJE4P049981@svn.freebsd.org> From: Attilio Rao Date: Tue, 8 Sep 2009 14:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196973 - stable/6/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 14:19:14 -0000 Author: attilio Date: Tue Sep 8 14:19:14 2009 New Revision: 196973 URL: http://svn.freebsd.org/changeset/base/196973 Log: MFC r180758: Prevent the bdflush() activity when trying to lock an indirect block buffer setting TDP_INBDFUSH in the appropriate code paths. Sponsored by: Sandvine Incorporated Modified: stable/6/sys/ufs/ffs/ffs_balloc.c Modified: stable/6/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- stable/6/sys/ufs/ffs/ffs_balloc.c Tue Sep 8 14:15:14 2009 (r196972) +++ stable/6/sys/ufs/ffs/ffs_balloc.c Tue Sep 8 14:19:14 2009 (r196973) @@ -104,6 +104,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t ufs1_daddr_t *allocib, *blkp, *allocblk, allociblk[NIADDR + 1]; ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1]; int unwindidx = -1; + int saved_inbdflush; ip = VTOI(vp); dp = ip->i_din1; @@ -225,6 +226,9 @@ ffs_balloc_ufs1(struct vnode *vp, off_t if (num < 1) panic ("ffs_balloc_ufs1: ufs_getlbns returned indirect block"); #endif + saved_inbdflush = ~TDP_INBDFLUSH | (curthread->td_pflags & + TDP_INBDFLUSH); + curthread->td_pflags |= TDP_INBDFLUSH; /* * Fetch the first indirect block allocating if necessary. */ @@ -237,8 +241,10 @@ ffs_balloc_ufs1(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) != 0) + cred, &newb)) != 0) { + curthread->td_pflags &= saved_inbdflush; return (error); + } nb = newb; *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; @@ -329,6 +335,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t * If asked only for the indirect block, then return it. */ if (flags & BA_METAONLY) { + curthread->td_pflags &= saved_inbdflush; *bpp = bp; return (0); } @@ -366,6 +373,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } + curthread->td_pflags &= saved_inbdflush; *bpp = nbp; return (0); } @@ -387,9 +395,11 @@ ffs_balloc_ufs1(struct vnode *vp, off_t nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); } + curthread->td_pflags &= saved_inbdflush; *bpp = nbp; return (0); fail: + curthread->td_pflags &= saved_inbdflush; /* * If we have failed to allocate any blocks, simply return the error. * This is the usual case and avoids the need to fsync the file. @@ -489,6 +499,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t ufs2_daddr_t *lbns_remfree, lbns[NIADDR + 1]; int deallocated, osize, nsize, num, i, error; int unwindidx = -1; + int saved_inbdflush; ip = VTOI(vp); dp = ip->i_din2; @@ -719,6 +730,9 @@ ffs_balloc_ufs2(struct vnode *vp, off_t if (num < 1) panic ("ffs_balloc_ufs2: ufs_getlbns returned indirect block"); #endif + saved_inbdflush = ~TDP_INBDFLUSH | (curthread->td_pflags & + TDP_INBDFLUSH); + curthread->td_pflags |= TDP_INBDFLUSH; /* * Fetch the first indirect block allocating if necessary. */ @@ -731,8 +745,10 @@ ffs_balloc_ufs2(struct vnode *vp, off_t UFS_LOCK(ump); pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0); if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize, - cred, &newb)) != 0) + cred, &newb)) != 0) { + curthread->td_pflags &= saved_inbdflush; return (error); + } nb = newb; *allocblk++ = nb; *lbns_remfree++ = indirs[1].in_lbn; @@ -823,6 +839,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t * If asked only for the indirect block, then return it. */ if (flags & BA_METAONLY) { + curthread->td_pflags &= saved_inbdflush; *bpp = bp; return (0); } @@ -860,6 +877,7 @@ ffs_balloc_ufs2(struct vnode *vp, off_t bp->b_flags |= B_CLUSTEROK; bdwrite(bp); } + curthread->td_pflags &= saved_inbdflush; *bpp = nbp; return (0); } @@ -887,9 +905,11 @@ ffs_balloc_ufs2(struct vnode *vp, off_t nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); } + curthread->td_pflags &= saved_inbdflush; *bpp = nbp; return (0); fail: + curthread->td_pflags &= saved_inbdflush; /* * If we have failed to allocate any blocks, simply return the error. * This is the usual case and avoids the need to fsync the file. From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 14:43:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECC2B106568B; Tue, 8 Sep 2009 14:43:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D97FD8FC21; Tue, 8 Sep 2009 14:43:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88EhgQD050550; Tue, 8 Sep 2009 14:43:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88EhgHj050548; Tue, 8 Sep 2009 14:43:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909081443.n88EhgHj050548@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 8 Sep 2009 14:43:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196974 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 14:43:43 -0000 Author: kib Date: Tue Sep 8 14:43:42 2009 New Revision: 196974 URL: http://svn.freebsd.org/changeset/base/196974 Log: MFC r196692: Make the mnt_writeopcount and mnt_secondary_writes counters, used by the suspension code, not greater then mnt_ref reference counter value. MFC r196733: Fix mount reference leak when V_XSLEEP is specified to vn_start_write(). Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/vfs_vnops.c Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Tue Sep 8 14:19:14 2009 (r196973) +++ stable/8/sys/kern/vfs_vnops.c Tue Sep 8 14:43:42 2009 (r196974) @@ -999,7 +999,8 @@ vn_start_write(vp, mpp, flags) goto unlock; mp->mnt_writeopcount++; unlock: - MNT_REL(mp); + if (error != 0 || (flags & V_XSLEEP) != 0) + MNT_REL(mp); MNT_IUNLOCK(mp); return (error); } @@ -1049,7 +1050,6 @@ vn_start_secondary_write(vp, mpp, flags) if ((mp->mnt_kern_flag & (MNTK_SUSPENDED | MNTK_SUSPEND2)) == 0) { mp->mnt_secondary_writes++; mp->mnt_secondary_accwrites++; - MNT_REL(mp); MNT_IUNLOCK(mp); return (0); } @@ -1081,6 +1081,7 @@ vn_finished_write(mp) if (mp == NULL) return; MNT_ILOCK(mp); + MNT_REL(mp); mp->mnt_writeopcount--; if (mp->mnt_writeopcount < 0) panic("vn_finished_write: neg cnt"); @@ -1103,6 +1104,7 @@ vn_finished_secondary_write(mp) if (mp == NULL) return; MNT_ILOCK(mp); + MNT_REL(mp); mp->mnt_secondary_writes--; if (mp->mnt_secondary_writes < 0) panic("vn_finished_secondary_write: neg cnt"); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:13:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14A621065679; Tue, 8 Sep 2009 15:13:50 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 010728FC19; Tue, 8 Sep 2009 15:13:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88FDnOk051226; Tue, 8 Sep 2009 15:13:49 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88FDn06051220; Tue, 8 Sep 2009 15:13:49 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909081513.n88FDn06051220@svn.freebsd.org> From: Attilio Rao Date: Tue, 8 Sep 2009 15:13:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196975 - in stable/6: bin/ps sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:13:50 -0000 Author: attilio Date: Tue Sep 8 15:13:49 2009 New Revision: 196975 URL: http://svn.freebsd.org/changeset/base/196975 Log: MFC r189078: * Implement ucomm with a dynamic size function in order to print out the threads name also in the case they are not the last one shown. * On AMD64 pointers don't have enough space to be printed. Fix it. * Check a return value for malloc which wasn't checked before Sponsored by: Sandvine Incorporated Modified: stable/6/bin/ps/extern.h stable/6/bin/ps/keyword.c stable/6/bin/ps/print.c stable/6/bin/ps/ps.c stable/6/sys/kern/kern_proc.c Modified: stable/6/bin/ps/extern.h ============================================================================== --- stable/6/bin/ps/extern.h Tue Sep 8 14:43:42 2009 (r196974) +++ stable/6/bin/ps/extern.h Tue Sep 8 15:13:49 2009 (r196975) @@ -39,7 +39,7 @@ extern fixpt_t ccpu; extern int cflag, eval, fscale, nlistread, rawcpu; extern unsigned long mempages; extern time_t now; -extern int sumrusage, termwidth, totwidth; +extern int showthreads, sumrusage, termwidth, totwidth; extern STAILQ_HEAD(velisthead, varent) varlist; __BEGIN_DECLS @@ -71,6 +71,7 @@ void priorityr(KINFO *, VARENT *); void rgroupname(KINFO *, VARENT *); void runame(KINFO *, VARENT *); void rvar(KINFO *, VARENT *); +int s_comm(KINFO *); int s_label(KINFO *); int s_rgroupname(KINFO *); int s_runame(KINFO *); Modified: stable/6/bin/ps/keyword.c ============================================================================== --- stable/6/bin/ps/keyword.c Tue Sep 8 14:43:42 2009 (r196974) +++ stable/6/bin/ps/keyword.c Tue Sep 8 15:13:49 2009 (r196975) @@ -79,8 +79,8 @@ static VAR var[] = { CHAR, NULL, 0}, {"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"comm", "COMMAND", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, - NULL, 0}, + {"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm, + COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, {"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0, CHAR, NULL, 0}, {"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d", @@ -135,12 +135,13 @@ static VAR var[] = { LONG, "ld", 0}, {"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw), LONG, "ld", 0}, - {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, 8, 0, CHAR, NULL, 0}, + {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0, + CHAR, NULL, 0}, {"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock), LONG, "ld", 0}, {"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"paddr", "PADDR", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR, - "lx", 0}, + {"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_paddr), KPTR, "lx", 0}, {"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0}, {"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, @@ -194,13 +195,13 @@ static VAR var[] = { {"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0}, {"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0}, {"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0}, - {"ucomm", "UCOMM", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, NULL, - 0}, + {"ucomm", "UCOMM", NULL, LJUST|DSIZ, ucomm, s_comm, + COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, {"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT, UIDFMT, 0}, {"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0}, - {"uprocp", "UPROCP", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR, - "lx", 0}, + {"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_paddr), KPTR, "lx", 0}, {"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, @@ -324,6 +325,8 @@ findvar(char *p, int user, char **header */ rflen = strlen(v->alias) + strlen(hp) + 2; realfmt = malloc(rflen); + if (realfmt == NULL) + errx(1, "malloc failed"); snprintf(realfmt, rflen, "%s=%s", v->alias, hp); parsefmt(realfmt, user); } Modified: stable/6/bin/ps/print.c ============================================================================== --- stable/6/bin/ps/print.c Tue Sep 8 14:43:42 2009 (r196974) +++ stable/6/bin/ps/print.c Tue Sep 8 15:13:49 2009 (r196975) @@ -175,13 +175,22 @@ command(KINFO *k, VARENT *ve) void ucomm(KINFO *k, VARENT *ve) { + char tmpbuff[COMMLEN + OCOMMLEN + 2]; VAR *v; v = ve->var; if (STAILQ_NEXT(ve, next_ve) == NULL) /* last field, don't pad */ (void)printf("%s", k->ki_p->ki_comm); - else - (void)printf("%-*s", v->width, k->ki_p->ki_comm); + else { + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + (void)printf("%-*s", v->width, tmpbuff); + } + } void @@ -804,6 +813,20 @@ out: } int +s_comm(KINFO *k) +{ + char tmpbuff[COMMLEN + OCOMMLEN + 2]; + + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + return (strlen(tmpbuff)); +} + +int s_label(KINFO *k) { char *string = NULL; Modified: stable/6/bin/ps/ps.c ============================================================================== --- stable/6/bin/ps/ps.c Tue Sep 8 14:43:42 2009 (r196974) +++ stable/6/bin/ps/ps.c Tue Sep 8 15:13:49 2009 (r196975) @@ -98,6 +98,7 @@ int rawcpu; /* -C */ int sumrusage; /* -S */ int termwidth; /* Width of the screen (0 == infinity). */ int totwidth; /* Calculated-width of requested variables. */ +int showthreads; /* will threads be shown? */ struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist); @@ -175,7 +176,7 @@ main(int argc, char *argv[]) char *cols; int all, ch, elem, flag, _fmt, i, lineno; int nentries, nkept, nselectors; - int prtheader, showthreads, wflag, what, xkeep, xkeep_implied; + int prtheader, wflag, what, xkeep, xkeep_implied; char errbuf[_POSIX2_LINE_MAX]; (void) setlocale(LC_ALL, ""); Modified: stable/6/sys/kern/kern_proc.c ============================================================================== --- stable/6/sys/kern/kern_proc.c Tue Sep 8 14:43:42 2009 (r196974) +++ stable/6/sys/kern/kern_proc.c Tue Sep 8 15:13:49 2009 (r196975) @@ -72,6 +72,7 @@ MALLOC_DEFINE(M_SUBPROC, "subproc", "Pro static void doenterpgrp(struct proc *, struct pgrp *); static void orphanpg(struct pgrp *pg); +static void fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp); static void pgadjustjobc(struct pgrp *pgrp, int entering); @@ -611,6 +612,26 @@ DB_SHOW_COMMAND(pgrpdump, pgrpdump) #endif /* DDB */ /* + * Rework the kinfo_proc members which need to be aggregated in the + * case of process-ware informations. + * Must be called with sched_lock held. + */ +static void +fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp) +{ + struct thread *td; + + mtx_assert(&sched_lock, MA_OWNED); + + kp->ki_estcpu = 0; + kp->ki_pctcpu = 0; + FOREACH_THREAD_IN_PROC(p, td) { + kp->ki_pctcpu += sched_pctcpu(td); + kp->ki_estcpu += td->td_ksegrp->kg_estcpu; + } +} + +/* * Clear kinfo_proc and fill in any information that is common * to all threads in the process. * Must be called with the target process locked. @@ -830,8 +851,9 @@ fill_kinfo_proc(struct proc *p, struct k fill_kinfo_proc_only(p, kp); mtx_lock_spin(&sched_lock); - if (FIRST_THREAD_IN_PROC(p) != NULL) - fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp); + MPASS(FIRST_THREAD_IN_PROC(p) != NULL); + fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp); + fill_kinfo_aggregate(p, kp); mtx_unlock_spin(&sched_lock); } @@ -897,27 +919,20 @@ sysctl_out_proc(struct proc *p, struct s PROC_LOCK_ASSERT(p, MA_OWNED); - fill_kinfo_proc_only(p, &kinfo_proc); - if (flags & KERN_PROC_NOTHREADS) { - mtx_lock_spin(&sched_lock); - if (FIRST_THREAD_IN_PROC(p) != NULL) - fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), &kinfo_proc); - mtx_unlock_spin(&sched_lock); + fill_kinfo_proc(p, &kinfo_proc); + if (flags & KERN_PROC_NOTHREADS) error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); - } else { + sizeof(kinfo_proc)); + else { mtx_lock_spin(&sched_lock); - if (FIRST_THREAD_IN_PROC(p) != NULL) - FOREACH_THREAD_IN_PROC(p, td) { - fill_kinfo_thread(td, &kinfo_proc); - error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); - if (error) - break; - } - else + MPASS(FIRST_THREAD_IN_PROC(p) != NULL); + FOREACH_THREAD_IN_PROC(p, td) { + fill_kinfo_thread(td, &kinfo_proc); error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); + sizeof(kinfo_proc)); + if (error) + break; + } mtx_unlock_spin(&sched_lock); } PROC_UNLOCK(p); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:18:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB2171065692; Tue, 8 Sep 2009 15:18:25 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0A0D8FC14; Tue, 8 Sep 2009 15:18:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88FIPJk051350; Tue, 8 Sep 2009 15:18:25 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88FIPOZ051348; Tue, 8 Sep 2009 15:18:25 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909081518.n88FIPOZ051348@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 15:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196976 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:18:25 -0000 Author: phk Date: Tue Sep 8 15:18:25 2009 New Revision: 196976 URL: http://svn.freebsd.org/changeset/base/196976 Log: Add necessary include Modified: head/lib/libc/net/getifaddrs.c Modified: head/lib/libc/net/getifaddrs.c ============================================================================== --- head/lib/libc/net/getifaddrs.c Tue Sep 8 15:13:49 2009 (r196975) +++ head/lib/libc/net/getifaddrs.c Tue Sep 8 15:18:25 2009 (r196976) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:31:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D28D41065693; Tue, 8 Sep 2009 15:31:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD7BD8FC21; Tue, 8 Sep 2009 15:31:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88FVNOk051741; Tue, 8 Sep 2009 15:31:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88FVNDQ051731; Tue, 8 Sep 2009 15:31:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909081531.n88FVNDQ051731@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 8 Sep 2009 15:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196977 - in stable/8/sys: . amd64/include/xen arm/arm cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:31:23 -0000 Author: kib Date: Tue Sep 8 15:31:23 2009 New Revision: 196977 URL: http://svn.freebsd.org/changeset/base/196977 Log: MFC r196730: Remove the altkstacks, instead instantiate threads with kernel stack allocated with the right size from the start. For the thread that has kernel stack cached, verify that requested stack size is equial to the actual, and reallocate the stack if sizes differ. Introduce separate kernel stack cache that keeps some limited amount of preallocated kernel stacks to lower the latency of thread allocation. Not a merge: instead of removing td_altkstack* members of struct thread, replace them with placeholders to keep struct thread layout on the stable branch. Also, record r196640, r196644 and r196648 as merged. Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/arm/arm/vm_machdep.c stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/kern_fork.c stable/8/sys/kern/kern_kthread.c stable/8/sys/kern/kern_proc.c stable/8/sys/kern/kern_thr.c stable/8/sys/kern/kern_thread.c stable/8/sys/sys/proc.h stable/8/sys/vm/vm_extern.h stable/8/sys/vm/vm_glue.c Modified: stable/8/sys/arm/arm/vm_machdep.c ============================================================================== --- stable/8/sys/arm/arm/vm_machdep.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/arm/arm/vm_machdep.c Tue Sep 8 15:31:23 2009 (r196977) @@ -119,9 +119,6 @@ cpu_fork(register struct thread *td1, re #ifdef __XSCALE__ #ifndef CPU_XSCALE_CORE3 pmap_use_minicache(td2->td_kstack, td2->td_kstack_pages * PAGE_SIZE); - if (td2->td_altkstack) - pmap_use_minicache(td2->td_altkstack, td2->td_altkstack_pages * - PAGE_SIZE); #endif #endif td2->td_pcb = pcb2; Modified: stable/8/sys/kern/kern_fork.c ============================================================================== --- stable/8/sys/kern/kern_fork.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/kern/kern_fork.c Tue Sep 8 15:31:23 2009 (r196977) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" #include "opt_ktrace.h" +#include "opt_kstack_pages.h" #include #include @@ -276,25 +277,29 @@ norfproc_fail: mem_charged = 0; vm2 = NULL; + if (pages == 0) + pages = KSTACK_PAGES; /* Allocate new proc. */ newproc = uma_zalloc(proc_zone, M_WAITOK); - if (TAILQ_EMPTY(&newproc->p_threads)) { - td2 = thread_alloc(); + td2 = FIRST_THREAD_IN_PROC(newproc); + if (td2 == NULL) { + td2 = thread_alloc(pages); if (td2 == NULL) { error = ENOMEM; goto fail1; } proc_linkup(newproc, td2); - } else - td2 = FIRST_THREAD_IN_PROC(newproc); - - /* Allocate and switch to an alternate kstack if specified. */ - if (pages != 0) { - if (!vm_thread_new_altkstack(td2, pages)) { - error = ENOMEM; - goto fail1; + } else { + if (td2->td_kstack == 0 || td2->td_kstack_pages != pages) { + if (td2->td_kstack != 0) + vm_thread_dispose(td2); + if (!thread_alloc_stack(td2, pages)) { + error = ENOMEM; + goto fail1; + } } } + if ((flags & RFMEM) == 0) { vm2 = vmspace_fork(p1->p_vmspace, &mem_charged); if (vm2 == NULL) { Modified: stable/8/sys/kern/kern_kthread.c ============================================================================== --- stable/8/sys/kern/kern_kthread.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/kern/kern_kthread.c Tue Sep 8 15:31:23 2009 (r196977) @@ -256,7 +256,7 @@ kthread_add(void (*func)(void *), void * } /* Initialize our new td */ - newtd = thread_alloc(); + newtd = thread_alloc(pages); if (newtd == NULL) return (ENOMEM); @@ -282,9 +282,6 @@ kthread_add(void (*func)(void *), void * newtd->td_pflags |= TDP_KTHREAD; newtd->td_ucred = crhold(p->p_ucred); - /* Allocate and switch to an alternate kstack if specified. */ - if (pages != 0) - vm_thread_new_altkstack(newtd, pages); /* this code almost the same as create_thread() in kern_thr.c */ PROC_LOCK(p); Modified: stable/8/sys/kern/kern_proc.c ============================================================================== --- stable/8/sys/kern/kern_proc.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/kern/kern_proc.c Tue Sep 8 15:31:23 2009 (r196977) @@ -203,14 +203,6 @@ proc_dtor(void *mem, int size, void *arg #endif /* Free all OSD associated to this thread. */ osd_thread_exit(td); - - /* Dispose of an alternate kstack, if it exists. - * XXX What if there are more than one thread in the proc? - * The first thread in the proc is special and not - * freed, so you gotta do this here. - */ - if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0)) - vm_thread_dispose_altkstack(td); } EVENTHANDLER_INVOKE(process_dtor, p); if (p->p_ksi != NULL) @@ -767,8 +759,6 @@ fill_kinfo_proc_only(struct proc *p, str FOREACH_THREAD_IN_PROC(p, td0) { if (!TD_IS_SWAPPED(td0)) kp->ki_rssize += td0->td_kstack_pages; - if (td0->td_altkstack_obj != NULL) - kp->ki_rssize += td0->td_altkstack_pages; } kp->ki_swrss = vm->vm_swrss; kp->ki_tsize = vm->vm_tsize; Modified: stable/8/sys/kern/kern_thr.c ============================================================================== --- stable/8/sys/kern/kern_thr.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/kern/kern_thr.c Tue Sep 8 15:31:23 2009 (r196977) @@ -176,7 +176,7 @@ create_thread(struct thread *td, mcontex } /* Initialize our td */ - newtd = thread_alloc(); + newtd = thread_alloc(0); if (newtd == NULL) return (ENOMEM); Modified: stable/8/sys/kern/kern_thread.c ============================================================================== --- stable/8/sys/kern/kern_thread.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/kern/kern_thread.c Tue Sep 8 15:31:23 2009 (r196977) @@ -283,7 +283,7 @@ thread_reap(void) * Allocate a thread. */ struct thread * -thread_alloc(void) +thread_alloc(int pages) { struct thread *td; @@ -291,7 +291,7 @@ thread_alloc(void) td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK); KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack")); - if (!vm_thread_new(td, 0)) { + if (!vm_thread_new(td, pages)) { uma_zfree(thread_zone, td); return (NULL); } @@ -299,6 +299,17 @@ thread_alloc(void) return (td); } +int +thread_alloc_stack(struct thread *td, int pages) +{ + + KASSERT(td->td_kstack == 0, + ("thread_alloc_stack called on a thread with kstack")); + if (!vm_thread_new(td, pages)) + return (0); + cpu_thread_alloc(td); + return (1); +} /* * Deallocate a thread. @@ -312,8 +323,6 @@ thread_free(struct thread *td) cpuset_rel(td->td_cpuset); td->td_cpuset = NULL; cpu_thread_free(td); - if (td->td_altkstack != 0) - vm_thread_dispose_altkstack(td); if (td->td_kstack != 0) vm_thread_dispose(td); uma_zfree(thread_zone, td); Modified: stable/8/sys/sys/proc.h ============================================================================== --- stable/8/sys/sys/proc.h Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/sys/proc.h Tue Sep 8 15:31:23 2009 (r196977) @@ -267,9 +267,9 @@ struct thread { struct vm_object *td_kstack_obj;/* (a) Kstack object. */ vm_offset_t td_kstack; /* (a) Kernel VA of kstack. */ int td_kstack_pages; /* (a) Size of the kstack. */ - struct vm_object *td_altkstack_obj;/* (a) Alternate kstack object. */ - vm_offset_t td_altkstack; /* (a) Kernel VA of alternate kstack. */ - int td_altkstack_pages; /* (a) Size of alternate kstack. */ + void *td_space1; + vm_offset_t td_space2; + int td_space3; volatile u_int td_critnest; /* (k*) Critical section nest level. */ struct mdthread td_md; /* (k) Any machine-dependent fields. */ struct td_sched *td_sched; /* (*) Scheduler-specific data. */ @@ -850,7 +850,8 @@ void cpu_thread_exit(struct thread *); void cpu_thread_free(struct thread *); void cpu_thread_swapin(struct thread *); void cpu_thread_swapout(struct thread *); -struct thread *thread_alloc(void); +struct thread *thread_alloc(int pages); +int thread_alloc_stack(struct thread *, int pages); void thread_exit(void) __dead2; void thread_free(struct thread *td); void thread_link(struct thread *td, struct proc *p); Modified: stable/8/sys/vm/vm_extern.h ============================================================================== --- stable/8/sys/vm/vm_extern.h Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/vm/vm_extern.h Tue Sep 8 15:31:23 2009 (r196977) @@ -80,9 +80,7 @@ int vm_fault_quick(caddr_t v, int prot); struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset); void vm_imgact_unmap_page(struct sf_buf *sf); void vm_thread_dispose(struct thread *td); -void vm_thread_dispose_altkstack(struct thread *td); int vm_thread_new(struct thread *td, int pages); -int vm_thread_new_altkstack(struct thread *td, int pages); void vm_thread_swapin(struct thread *td); void vm_thread_swapout(struct thread *td); #endif /* _KERNEL */ Modified: stable/8/sys/vm/vm_glue.c ============================================================================== --- stable/8/sys/vm/vm_glue.c Tue Sep 8 15:18:25 2009 (r196976) +++ stable/8/sys/vm/vm_glue.c Tue Sep 8 15:31:23 2009 (r196977) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -308,6 +309,20 @@ vm_imgact_unmap_page(struct sf_buf *sf) vm_page_unlock_queues(); } +struct kstack_cache_entry { + vm_object_t ksobj; + struct kstack_cache_entry *next_ks_entry; +}; + +static struct kstack_cache_entry *kstack_cache; +static int kstack_cache_size = 128; +static int kstacks; +static struct mtx kstack_cache_mtx; +SYSCTL_INT(_vm, OID_AUTO, kstack_cache_size, CTLFLAG_RW, &kstack_cache_size, 0, + ""); +SYSCTL_INT(_vm, OID_AUTO, kstacks, CTLFLAG_RD, &kstacks, 0, + ""); + #ifndef KSTACK_MAX_PAGES #define KSTACK_MAX_PAGES 32 #endif @@ -323,6 +338,7 @@ vm_thread_new(struct thread *td, int pag vm_object_t ksobj; vm_offset_t ks; vm_page_t m, ma[KSTACK_MAX_PAGES]; + struct kstack_cache_entry *ks_ce; int i; /* Bounds check */ @@ -330,6 +346,22 @@ vm_thread_new(struct thread *td, int pag pages = KSTACK_PAGES; else if (pages > KSTACK_MAX_PAGES) pages = KSTACK_MAX_PAGES; + + if (pages == KSTACK_PAGES) { + mtx_lock(&kstack_cache_mtx); + if (kstack_cache != NULL) { + ks_ce = kstack_cache; + kstack_cache = ks_ce->next_ks_entry; + mtx_unlock(&kstack_cache_mtx); + + td->td_kstack_obj = ks_ce->ksobj; + td->td_kstack = (vm_offset_t)ks_ce; + td->td_kstack_pages = KSTACK_PAGES; + return (1); + } + mtx_unlock(&kstack_cache_mtx); + } + /* * Allocate an object for the kstack. */ @@ -345,7 +377,8 @@ vm_thread_new(struct thread *td, int pag vm_object_deallocate(ksobj); return (0); } - + + atomic_add_int(&kstacks, 1); if (KSTACK_GUARD_PAGES != 0) { pmap_qremove(ks, KSTACK_GUARD_PAGES); ks += KSTACK_GUARD_PAGES * PAGE_SIZE; @@ -376,20 +409,13 @@ vm_thread_new(struct thread *td, int pag return (1); } -/* - * Dispose of a thread's kernel stack. - */ -void -vm_thread_dispose(struct thread *td) +static void +vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t ks, int pages) { - vm_object_t ksobj; - vm_offset_t ks; vm_page_t m; - int i, pages; + int i; - pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; - ks = td->td_kstack; + atomic_add_int(&kstacks, -1); pmap_qremove(ks, pages); VM_OBJECT_LOCK(ksobj); for (i = 0; i < pages; i++) { @@ -405,9 +431,66 @@ vm_thread_dispose(struct thread *td) vm_object_deallocate(ksobj); kmem_free(kernel_map, ks - (KSTACK_GUARD_PAGES * PAGE_SIZE), (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE); +} + +/* + * Dispose of a thread's kernel stack. + */ +void +vm_thread_dispose(struct thread *td) +{ + vm_object_t ksobj; + vm_offset_t ks; + struct kstack_cache_entry *ks_ce; + int pages; + + pages = td->td_kstack_pages; + ksobj = td->td_kstack_obj; + ks = td->td_kstack; td->td_kstack = 0; + td->td_kstack_pages = 0; + if (pages == KSTACK_PAGES && kstacks <= kstack_cache_size) { + ks_ce = (struct kstack_cache_entry *)ks; + ks_ce->ksobj = ksobj; + mtx_lock(&kstack_cache_mtx); + ks_ce->next_ks_entry = kstack_cache; + kstack_cache = ks_ce; + mtx_unlock(&kstack_cache_mtx); + return; + } + vm_thread_stack_dispose(ksobj, ks, pages); +} + +static void +vm_thread_stack_lowmem(void *nulll) +{ + struct kstack_cache_entry *ks_ce, *ks_ce1; + + mtx_lock(&kstack_cache_mtx); + ks_ce = kstack_cache; + kstack_cache = NULL; + mtx_unlock(&kstack_cache_mtx); + + while (ks_ce != NULL) { + ks_ce1 = ks_ce; + ks_ce = ks_ce->next_ks_entry; + + vm_thread_stack_dispose(ks_ce1->ksobj, (vm_offset_t)ks_ce1, + KSTACK_PAGES); + } +} + +static void +kstack_cache_init(void *nulll) +{ + + EVENTHANDLER_REGISTER(vm_lowmem, vm_thread_stack_lowmem, NULL, + EVENTHANDLER_PRI_ANY); } +MTX_SYSINIT(kstack_cache, &kstack_cache_mtx, "kstkch", MTX_DEF); +SYSINIT(vm_kstacks, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, kstack_cache_init, NULL); + /* * Allow a thread's kernel stack to be paged out. */ @@ -468,37 +551,6 @@ vm_thread_swapin(struct thread *td) } /* - * Set up a variable-sized alternate kstack. - */ -int -vm_thread_new_altkstack(struct thread *td, int pages) -{ - - td->td_altkstack = td->td_kstack; - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack_pages = td->td_kstack_pages; - - return (vm_thread_new(td, pages)); -} - -/* - * Restore the original kstack. - */ -void -vm_thread_dispose_altkstack(struct thread *td) -{ - - vm_thread_dispose(td); - - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Implement fork's actions on an address space. * Here we arrange for the address space to be copied or referenced, * allocate a user struct (pcb and kernel stack), then call the From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:37:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D29A1106568F; Tue, 8 Sep 2009 15:37:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0ED28FC1D; Tue, 8 Sep 2009 15:37:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88Fb1Z0051895; Tue, 8 Sep 2009 15:37:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88Fb1HQ051893; Tue, 8 Sep 2009 15:37:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909081537.n88Fb1HQ051893@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 15:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196978 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:37:01 -0000 Author: pjd Date: Tue Sep 8 15:37:01 2009 New Revision: 196978 URL: http://svn.freebsd.org/changeset/base/196978 Log: Call ZFS_EXIT() after locking the vnode. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 15:31:23 2009 (r196977) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 15:37:01 2009 (r196978) @@ -1173,9 +1173,8 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno } else { VN_HOLD(*vpp); } - ZFS_EXIT(zfsvfs); - /* XXX: LK_RETRY? */ vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + ZFS_EXIT(zfsvfs); return (0); } @@ -1197,7 +1196,6 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno } *vpp = ZTOV(zp); - /* XXX: LK_RETRY? */ vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); vnode_create_vobject(*vpp, zp->z_phys->zp_size, curthread); ZFS_EXIT(zfsvfs); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:42:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E03DE1065693; Tue, 8 Sep 2009 15:42:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE8568FC0C; Tue, 8 Sep 2009 15:42:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88FgtRK052044; Tue, 8 Sep 2009 15:42:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88FgtUw052042; Tue, 8 Sep 2009 15:42:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909081542.n88FgtUw052042@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 15:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196979 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:42:56 -0000 Author: pjd Date: Tue Sep 8 15:42:55 2009 New Revision: 196979 URL: http://svn.freebsd.org/changeset/base/196979 Log: On FreeBSD we don't have to look for snapshot's mount point, because fhtovp method is already called with proper mount point. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 15:37:01 2009 (r196978) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 15:42:55 2009 (r196979) @@ -1130,6 +1130,11 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno ZFS_ENTER(zfsvfs); + /* + * On FreeBSD we are already called with snapshot's mount point + * and not the mount point of its parent. + */ +#ifndef __FreeBSD__ if (fidp->fid_len == LONG_FID_LEN) { zfid_long_t *zlfid = (zfid_long_t *)fidp; uint64_t objsetid = 0; @@ -1148,6 +1153,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno return (EINVAL); ZFS_ENTER(zfsvfs); } +#endif if (fidp->fid_len == SHORT_FID_LEN || fidp->fid_len == LONG_FID_LEN) { zfid_short_t *zfid = (zfid_short_t *)fidp; From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:51:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BBB6106568F; Tue, 8 Sep 2009 15:51:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89BBC8FC19; Tue, 8 Sep 2009 15:51:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88Fperw052402; Tue, 8 Sep 2009 15:51:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88Fpeta052400; Tue, 8 Sep 2009 15:51:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909081551.n88Fpeta052400@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 15:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196980 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:51:40 -0000 Author: pjd Date: Tue Sep 8 15:51:40 2009 New Revision: 196980 URL: http://svn.freebsd.org/changeset/base/196980 Log: When we automatically mount snapshot we want to return vnode of the mount point from the lookup and not covered vnode. This is one of the fixes for using .zfs/ over NFS. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 8 15:42:55 2009 (r196979) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 8 15:51:40 2009 (r196980) @@ -882,9 +882,25 @@ domount: dvp->v_vfsp->mnt_stat.f_mntonname, nm); err = domount(curthread, *vpp, "zfs", mountpoint, snapname, 0); kmem_free(mountpoint, mountpoint_len); - /* FreeBSD: This line was moved from below to avoid a lock recursion. */ - if (err == 0) - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + if (err == 0) { + vnode_t *mvp; + + ASSERT((*vpp)->v_mountedhere != NULL); + err = VFS_ROOT((*vpp)->v_mountedhere, LK_EXCLUSIVE, &mvp); + ASSERT(err == 0); + VN_RELE(*vpp); + *vpp = mvp; + + /* + * Fix up the root vnode mounted on .zfs/snapshot/. + * + * This is where we lie about our v_vfsp in order to + * make .zfs/snapshot/ accessible over NFS + * without requiring manual mounts of . + */ + ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs); + VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; + } mutex_exit(&sdp->sd_lock); /* * If we had an error, drop our hold on the vnode and From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:55:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FDF61065693; Tue, 8 Sep 2009 15:55:14 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F12348FC1D; Tue, 8 Sep 2009 15:55:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88FtDEO052526; Tue, 8 Sep 2009 15:55:13 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88FtDwe052523; Tue, 8 Sep 2009 15:55:13 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200909081555.n88FtDwe052523@svn.freebsd.org> From: Roman Divacky Date: Tue, 8 Sep 2009 15:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196981 - head/usr.bin/unzip X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:55:14 -0000 Author: rdivacky Date: Tue Sep 8 15:55:13 2009 New Revision: 196981 URL: http://svn.freebsd.org/changeset/base/196981 Log: Add C/c/f/p/v switches plus a bunch of minor fixes and cleanups. Obtained from: NetBSD Approved by: des (maintainer) Approved by: ed (mentor, implicit) Modified: head/usr.bin/unzip/unzip.1 head/usr.bin/unzip/unzip.c Modified: head/usr.bin/unzip/unzip.1 ============================================================================== --- head/usr.bin/unzip/unzip.1 Tue Sep 8 15:51:40 2009 (r196980) +++ head/usr.bin/unzip/unzip.1 Tue Sep 8 15:55:13 2009 (r196981) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2008 +.Dd September 7, 2009 .Dt UNZIP 1 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd extract files from a ZIP archive .Sh SYNOPSIS .Nm -.Op Fl ajLlnoqtu +.Op Fl aCcfjLlnopqtuv .Op Fl d Ar dir .Ar zipfile .Sh DESCRIPTION @@ -44,9 +44,22 @@ The following options are available: .It Fl a When extracting a text file, convert DOS-style line endings to Unix-style line endings. +.It Fl C +Match file names case-insensitively. +.It Fl c +Extract to stdout/screen. +When extracting files from the zipfile, they are written to stdout. +This is similar to +.Fl p , +but doesn't suppress normal output. .It Fl d Ar dir Extract files into the specified directory rather than the current directory. +.It Fl f +Update existing. +Extract only files from the zipfile if a file with the same name +already exists on disk and is older than the former. +Otherwise, the file is silently skipped. .It Fl j Ignore directories stored in the zipfile; instead, extract all files directly into the extraction directory. @@ -56,13 +69,19 @@ Convert the names of the extracted files List, rather than extract, the contents of the zipfile. .It Fl n No overwrite. -When extacting a file from the zipfile, if a file with the same name +When extracting a file from the zipfile, if a file with the same name already exists on disk, the file is silently skipped. .It Fl o Overwrite. -When extacting a file from the zipfile, if a file with the same name +When extracting a file from the zipfile, if a file with the same name already exists on disk, the existing file is replaced with the file from the zipfile. +.It Fl p +Extract to stdout. +When extracting files from the zipfile, they are written to stdout. +The normal output is suppressed as if +.Fl q +was specified. .It Fl q Quiet: print less information while extracting. .It Fl t @@ -70,15 +89,25 @@ Test: do not extract anything, but verif in the archive. .It Fl u Update. -When extacting a file from the zipfile, if a file with the same name +When extracting a file from the zipfile, if a file with the same name already exists on disk, the existing file is replaced with the file from the zipfile if and only if the latter is newer than the former. Otherwise, the file is silently skipped. +.It Fl v +List verbosely, rather than extract, the contents of the zipfile. +This differs from +.Fl l +by using the long listing. +Note that most of the data is currently fake and does not reflect the +content of the archive. +.It Fl x Ar pattern +Exclude files matching the pattern +.Ar pattern . .El .Pp Note that only one of .Fl n , -.Fl o +.Fl o , and .Fl u may be specified. Modified: head/usr.bin/unzip/unzip.c ============================================================================== --- head/usr.bin/unzip/unzip.c Tue Sep 8 15:51:40 2009 (r196980) +++ head/usr.bin/unzip/unzip.c Tue Sep 8 15:55:13 2009 (r196981) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009 Joerg Sonnenberger * Copyright (c) 2007-2008 Dag-Erling Coïdan Smørgrav * All rights reserved. * @@ -51,15 +52,19 @@ /* command-line options */ static int a_opt; /* convert EOL */ +static int C_opt; /* match case-insensitively */ +static int c_opt; /* extract to stdout */ static const char *d_arg; /* directory */ +static int f_opt; /* update existing files only */ static int j_opt; /* junk directories */ static int L_opt; /* lowercase names */ -static int l_opt; /* list */ static int n_opt; /* never overwrite */ static int o_opt; /* always overwrite */ +static int p_opt; /* extract to stdout, quiet */ static int q_opt; /* quiet */ static int t_opt; /* test */ static int u_opt; /* update */ +static int v_opt; /* verbose/list */ /* time when unzip started */ static time_t now; @@ -70,9 +75,6 @@ static int unzip_debug; /* running on tty? */ static int tty; -/* error flag for -t */ -static int test_failed; - /* convenience macro */ /* XXX should differentiate between ARCHIVE_{WARN,FAIL,RETRY} */ #define ac(call) \ @@ -162,7 +164,6 @@ static void info(const char *fmt, ...) { va_list ap; - int i; if (q_opt && !unzip_debug) return; @@ -171,9 +172,10 @@ info(const char *fmt, ...) va_end(ap); fflush(stdout); - for (i = 0; fmt[i] != '\0'; ++i) - /* nothing */ ; - noeol = !(i && fmt[i - 1] == '\n'); + if (*fmt == '\0') + noeol = 1; + else + noeol = fmt[strlen(fmt) - 1] != '\n'; } /* debug message (if unzip_debug) */ @@ -181,7 +183,6 @@ static void debug(const char *fmt, ...) { va_list ap; - int i; if (!unzip_debug) return; @@ -190,9 +191,10 @@ debug(const char *fmt, ...) va_end(ap); fflush(stderr); - for (i = 0; fmt[i] != '\0'; ++i) - /* nothing */ ; - noeol = !(i && fmt[i - 1] == '\n'); + if (*fmt == '\0') + noeol = 1; + else + noeol = fmt[strlen(fmt) - 1] != '\n'; } /* duplicate a path name, possibly converting to lower case */ @@ -200,7 +202,7 @@ static char * pathdup(const char *path) { char *str; - int len; + size_t i, len; len = strlen(path); while (len && path[len - 1] == '/') @@ -209,8 +211,12 @@ pathdup(const char *path) errno = ENOMEM; error("malloc()"); } - for (int i = 0; i < len; ++i) - str[i] = L_opt ? tolower(path[i]) : path[i]; + if (L_opt) { + for (i = 0; i < len; ++i) + str[i] = tolower((unsigned char)path[i]); + } else { + memcpy(str, path, len); + } str[len] = '\0'; return (str); @@ -221,7 +227,7 @@ static char * pathcat(const char *prefix, const char *path) { char *str; - int prelen, len; + size_t prelen, len; prelen = prefix ? strlen(prefix) + 1 : 0; len = strlen(path) + 1; @@ -257,7 +263,7 @@ static void add_pattern(struct pattern_list *list, const char *pattern) { struct pattern *entry; - int len; + size_t len; debug("adding pattern '%s'\n", pattern); len = strlen(pattern); @@ -265,7 +271,6 @@ add_pattern(struct pattern_list *list, c errno = ENOMEM; error("malloc()"); } - memset(&entry->link, 0, sizeof entry->link); memcpy(entry->pattern, pattern, len + 1); STAILQ_INSERT_TAIL(list, entry, link); } @@ -279,7 +284,7 @@ match_pattern(struct pattern_list *list, struct pattern *entry; STAILQ_FOREACH(entry, list, link) { - if (fnmatch(entry->pattern, str, 0) == 0) + if (fnmatch(entry->pattern, str, C_opt ? FNM_CASEFOLD : 0) == 0) return (1); } return (0); @@ -427,9 +432,9 @@ extract_file(struct archive *a, struct a /* look for existing file of same name */ if (lstat(path, &sb) == 0) { - if (u_opt) { + if (u_opt || f_opt) { /* check if up-to-date */ - if (S_ISREG(sb.st_mode) && sb.st_mtime > mtime) + if (S_ISREG(sb.st_mode) && sb.st_mtime >= mtime) return; (void)unlink(path); } else if (o_opt) { @@ -442,13 +447,16 @@ extract_file(struct archive *a, struct a /* XXX ask user */ errorx("not implemented"); } + } else { + if (f_opt) + return; } if ((fd = open(path, O_RDWR|O_CREAT|O_TRUNC, mode)) < 0) error("open('%s')", path); /* loop over file contents and write to disk */ - info("x %s", path); + info(" extracting: %s", path); text = a_opt; warn = 0; cr = 0; @@ -618,40 +626,172 @@ extract(struct archive *a, struct archiv free(pathname); } +static void +extract_stdout(struct archive *a, struct archive_entry *e) +{ + char *pathname; + mode_t filetype; + int cr, text, warn; + ssize_t len; + unsigned char *p, *q, *end; + + pathname = pathdup(archive_entry_pathname(e)); + filetype = archive_entry_filetype(e); + + /* I don't think this can happen in a zipfile.. */ + if (!S_ISDIR(filetype) && !S_ISREG(filetype)) { + warningx("skipping non-regular entry '%s'", pathname); + ac(archive_read_data_skip(a)); + free(pathname); + return; + } + + /* skip directories in -j case */ + if (S_ISDIR(filetype)) { + ac(archive_read_data_skip(a)); + free(pathname); + return; + } + + /* apply include / exclude patterns */ + if (!accept_pathname(pathname)) { + ac(archive_read_data_skip(a)); + free(pathname); + return; + } + + if (c_opt) + info("x %s\n", pathname); + + text = a_opt; + warn = 0; + cr = 0; + for (int n = 0; ; n++) { + len = archive_read_data(a, buffer, sizeof buffer); + + if (len < 0) + ac(len); + + /* left over CR from previous buffer */ + if (a_opt && cr) { + if (len == 0 || buffer[0] != '\n') { + if (fwrite("\r", 1, 1, stderr) != 1) + error("write('%s')", pathname); + } + cr = 0; + } + + /* EOF */ + if (len == 0) + break; + end = buffer + len; + + /* + * Detect whether this is a text file. The correct way to + * do this is to check the least significant bit of the + * "internal file attributes" field of the corresponding + * file header in the central directory, but libarchive + * does not read the central directory, so we have to + * guess by looking for non-ASCII characters in the + * buffer. Hopefully we won't guess wrong. If we do + * guess wrong, we print a warning message later. + */ + if (a_opt && n == 0) { + for (p = buffer; p < end; ++p) { + if (!isascii((unsigned char)*p)) { + text = 0; + break; + } + } + } + + /* simple case */ + if (!a_opt || !text) { + if (fwrite(buffer, 1, len, stdout) != (size_t)len) + error("write('%s')", pathname); + continue; + } + + /* hard case: convert \r\n to \n (sigh...) */ + for (p = buffer; p < end; p = q + 1) { + for (q = p; q < end; q++) { + if (!warn && !isascii(*q)) { + warningx("%s may be corrupted due" + " to weak text file detection" + " heuristic", pathname); + warn = 1; + } + if (q[0] != '\r') + continue; + if (&q[1] == end) { + cr = 1; + break; + } + if (q[1] == '\n') + break; + } + if (fwrite(p, 1, q - p, stdout) != (size_t)(q - p)) + error("write('%s')", pathname); + } + } + + free(pathname); +} + /* * Print the name of an entry to stdout. */ static void list(struct archive *a, struct archive_entry *e) { + char buf[20]; + time_t mtime; + + mtime = archive_entry_mtime(e); + strftime(buf, sizeof(buf), "%m-%d-%g %R", localtime(&mtime)); - printf("%s\n", archive_entry_pathname(e)); + if (v_opt == 1) { + printf(" %8ju %s %s\n", + (uintmax_t)archive_entry_size(e), + buf, archive_entry_pathname(e)); + } else if (v_opt == 2) { + printf("%8ju Stored %7ju 0%% %s %08x %s\n", + (uintmax_t)archive_entry_size(e), + (uintmax_t)archive_entry_size(e), + buf, + 0U, + archive_entry_pathname(e)); + } ac(archive_read_data_skip(a)); } /* * Extract to memory to check CRC */ -static void +static int test(struct archive *a, struct archive_entry *e) { ssize_t len; + int error_count; + error_count = 0; if (S_ISDIR(archive_entry_filetype(e))) - return; + return 0; - info("%s ", archive_entry_pathname(e)); + info(" testing: %s\t", archive_entry_pathname(e)); while ((len = archive_read_data(a, buffer, sizeof buffer)) > 0) /* nothing */; if (len < 0) { - info("%s\n", archive_error_string(a)); - ++test_failed; + info(" %s\n", archive_error_string(a)); + ++error_count; } else { - info("OK\n"); + info(" OK\n"); } /* shouldn't be necessary, but it doesn't hurt */ ac(archive_read_data_skip(a)); + + return error_count; } @@ -665,6 +805,7 @@ unzip(const char *fn) struct archive *a; struct archive_entry *e; int fd, ret; + uintmax_t total_size, file_count, error_count; if ((fd = open(fn, O_RDONLY)) < 0) error("%s", fn); @@ -673,33 +814,69 @@ unzip(const char *fn) ac(archive_read_support_format_zip(a)); ac(archive_read_open_fd(a, fd, 8192)); + printf("Archive: %s\n", fn); + if (v_opt == 1) { + printf(" Length Date Time Name\n"); + printf(" -------- ---- ---- ----\n"); + } else if (v_opt == 2) { + printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); + printf("-------- ------ ------- ----- ---- ---- ------ ----\n"); + } + + total_size = 0; + file_count = 0; + error_count = 0; for (;;) { ret = archive_read_next_header(a, &e); if (ret == ARCHIVE_EOF) break; ac(ret); if (t_opt) - test(a, e); - else if (l_opt) + error_count += test(a, e); + else if (v_opt) list(a, e); + else if (p_opt || c_opt) + extract_stdout(a, e); else extract(a, e); + + total_size += archive_entry_size(e); + ++file_count; + } + + if (v_opt == 1) { + printf(" -------- -------\n"); + printf(" %8ju %ju file%s\n", + total_size, file_count, file_count != 1 ? "s" : ""); + } else if (v_opt == 2) { + printf("-------- ------- --- -------\n"); + printf("%8ju %7ju 0%% %ju file%s\n", + total_size, total_size, file_count, + file_count != 1 ? "s" : ""); } ac(archive_read_close(a)); (void)archive_read_finish(a); + if (close(fd) != 0) error("%s", fn); - if (t_opt && test_failed) - errorx("%d checksum error(s) found.", test_failed); + if (t_opt) { + if (error_count > 0) { + errorx("%d checksum error(s) found.", error_count); + } + else { + printf("No errors detected in compressed data of %s.\n", + fn); + } + } } static void usage(void) { - fprintf(stderr, "usage: unzip [-ajLlnoqtu] [-d dir] zipfile\n"); + fprintf(stderr, "usage: unzip [-aCcfjLlnopqtuv] [-d dir] [-x pattern] zipfile\n"); exit(1); } @@ -709,14 +886,23 @@ getopts(int argc, char *argv[]) int opt; optreset = optind = 1; - while ((opt = getopt(argc, argv, "ad:jLlnoqtux:")) != -1) + while ((opt = getopt(argc, argv, "aCcd:fjLlnopqtuvx:")) != -1) switch (opt) { case 'a': a_opt = 1; break; + case 'C': + C_opt = 1; + break; + case 'c': + c_opt = 1; + break; case 'd': d_arg = optarg; break; + case 'f': + f_opt = 1; + break; case 'j': j_opt = 1; break; @@ -724,13 +910,18 @@ getopts(int argc, char *argv[]) L_opt = 1; break; case 'l': - l_opt = 1; + if (v_opt == 0) + v_opt = 1; break; case 'n': n_opt = 1; break; case 'o': o_opt = 1; + q_opt = 1; + break; + case 'p': + p_opt = 1; break; case 'q': q_opt = 1; @@ -741,6 +932,9 @@ getopts(int argc, char *argv[]) case 'u': u_opt = 1; break; + case 'v': + v_opt = 2; + break; case 'x': add_pattern(&exclude, optarg); break; From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:57:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD60A106566B; Tue, 8 Sep 2009 15:57:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1F698FC15; Tue, 8 Sep 2009 15:57:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88Fv37J052599; Tue, 8 Sep 2009 15:57:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88Fv3Pg052597; Tue, 8 Sep 2009 15:57:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909081557.n88Fv3Pg052597@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 15:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196982 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:57:03 -0000 Author: pjd Date: Tue Sep 8 15:57:03 2009 New Revision: 196982 URL: http://svn.freebsd.org/changeset/base/196982 Log: We don't export individual snapshots, so mnt_export field in snapshot's mount point is NULL. That's why when we try to access snapshots over NFS use mnt_export field from the parent file system. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 15:55:13 2009 (r196981) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 15:57:03 2009 (r196982) @@ -97,6 +97,8 @@ static int zfs_root(vfs_t *vfsp, int fla static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); static int zfs_sync(vfs_t *vfsp, int waitfor); +static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, + struct ucred **credanonp, int *numsecflavors, int **secflavors); static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp); static void zfs_objset_close(zfsvfs_t *zfsvfs); static void zfs_freevfs(vfs_t *vfsp); @@ -108,6 +110,7 @@ static struct vfsops zfs_vfsops = { .vfs_statfs = zfs_statfs, .vfs_vget = zfs_vget, .vfs_sync = zfs_sync, + .vfs_checkexp = zfs_checkexp, .vfs_fhtovp = zfs_fhtovp, }; @@ -1116,6 +1119,26 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla } static int +zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, + struct ucred **credanonp, int *numsecflavors, int **secflavors) +{ + zfsvfs_t *zfsvfs = vfsp->vfs_data; + + /* + * If this is regular file system vfsp is the same as + * zfsvfs->z_parent->z_vfs, but if it is snapshot, + * zfsvfs->z_parent->z_vfs represents parent file system + * which we have to use here, because only this file system + * has mnt_export configured. + */ + vfsp = zfsvfs->z_parent->z_vfs; + + return (vfs_stdcheckexp(zfsvfs->z_parent->z_vfs, nam, extflagsp, + credanonp, numsecflavors, secflavors)); +} + + +static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 15:58:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1185106566C; Tue, 8 Sep 2009 15:58:56 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl [87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id CFD088FC08; Tue, 8 Sep 2009 15:58:55 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 940D64569A; Tue, 8 Sep 2009 17:58:53 +0200 (CEST) Received: from localhost (pdawidek.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 0EF0545683; Tue, 8 Sep 2009 17:58:48 +0200 (CEST) Date: Tue, 8 Sep 2009 17:58:50 +0200 From: Pawel Jakub Dawidek To: Poul-Henning Kamp Message-ID: <20090908155850.GM1577@garage.freebsd.pl> References: <200909081518.n88FIPOZ051348@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oplxJGu+Ee5xywIT" Content-Disposition: inline In-Reply-To: <200909081518.n88FIPOZ051348@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196976 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:58:56 -0000 --oplxJGu+Ee5xywIT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 08, 2009 at 03:18:25PM +0000, Poul-Henning Kamp wrote: > Author: phk > Date: Tue Sep 8 15:18:25 2009 > New Revision: 196976 > URL: http://svn.freebsd.org/changeset/base/196976 >=20 > Log: > Add necessary include >=20 > Modified: > head/lib/libc/net/getifaddrs.c >=20 > Modified: head/lib/libc/net/getifaddrs.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libc/net/getifaddrs.c Tue Sep 8 15:13:49 2009 (r196975) > +++ head/lib/libc/net/getifaddrs.c Tue Sep 8 15:18:25 2009 (r196976) > @@ -33,6 +33,7 @@ > __FBSDID("$FreeBSD$"); > =20 > #include "namespace.h" > +#include > #include style(9) seems to advice to include either types.h or param.h, but not both. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --oplxJGu+Ee5xywIT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKpn86ForvXbEpPzQRAm2sAJ9bZ4pAkHutI7d99X77WqIEjRICyQCfaPRb 80ghQGL7RjFu3ND0TrN1++E= =ho1u -----END PGP SIGNATURE----- --oplxJGu+Ee5xywIT-- From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 16:00:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5C0F1065696; Tue, 8 Sep 2009 16:00:45 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 8E5F48FC18; Tue, 8 Sep 2009 16:00:45 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 6FA3F6D418; Tue, 8 Sep 2009 16:00:44 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 4397A844D2; Tue, 8 Sep 2009 18:00:44 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Pawel Jakub Dawidek References: <200909081518.n88FIPOZ051348@svn.freebsd.org> <20090908155850.GM1577@garage.freebsd.pl> Date: Tue, 08 Sep 2009 18:00:44 +0200 In-Reply-To: <20090908155850.GM1577@garage.freebsd.pl> (Pawel Jakub Dawidek's message of "Tue, 8 Sep 2009 17:58:50 +0200") Message-ID: <86d461juj7.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Poul-Henning Kamp Subject: Re: svn commit: r196976 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 16:00:45 -0000 Pawel Jakub Dawidek writes: > style(9) seems to advice to include either types.h or param.h, but not bo= th. correct, already includes . DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 16:09:29 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07E1D106566B; Tue, 8 Sep 2009 16:09:29 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAA718FC12; Tue, 8 Sep 2009 16:09:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88G9SCl052996; Tue, 8 Sep 2009 16:09:28 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88G9Sxa052994; Tue, 8 Sep 2009 16:09:28 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200909081609.n88G9Sxa052994@svn.freebsd.org> From: Scott Long Date: Tue, 8 Sep 2009 16:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196983 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 16:09:29 -0000 Author: scottl Date: Tue Sep 8 16:09:28 2009 New Revision: 196983 URL: http://svn.freebsd.org/changeset/base/196983 Log: Free the correct buffer in an error case. Submitted by: phk Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Sep 8 15:57:03 2009 (r196982) +++ head/sys/cam/scsi/scsi_cd.c Tue Sep 8 16:09:28 2009 (r196983) @@ -2528,7 +2528,7 @@ cdioctl(struct disk *dp, u_long cmd, voi error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(¶ms, M_SCSICD); + free(¶ms.mode_buf, M_SCSICD); cam_periph_unlock(periph); break; } From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 16:37:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 740FC1065672; Tue, 8 Sep 2009 16:37:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62E308FC0A; Tue, 8 Sep 2009 16:37:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88GbJBt053591; Tue, 8 Sep 2009 16:37:19 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88GbJeq053589; Tue, 8 Sep 2009 16:37:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200909081637.n88GbJeq053589@svn.freebsd.org> From: Warner Losh Date: Tue, 8 Sep 2009 16:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196984 - head/sys/dev/ep X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 16:37:19 -0000 Author: imp Date: Tue Sep 8 16:37:18 2009 New Revision: 196984 URL: http://svn.freebsd.org/changeset/base/196984 Log: Cleanup tortured logic a big. Noticed by FlexLint, per phk. # My reading of the docs suggests this can only happen on 10Base5 and # 10Base2 setups (and maybe only the former), which I can't test # adequately since I have nothing but 10BaseT, etc here. Modified: head/sys/dev/ep/if_ep.c Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Tue Sep 8 16:09:28 2009 (r196983) +++ head/sys/dev/ep/if_ep.c Tue Sep 8 16:37:18 2009 (r196984) @@ -665,14 +665,13 @@ rescan: #ifdef EP_LOCAL_STATS sc->tx_underrun++; #endif - } else { - if (status & TXS_JABBER); - else - ++ifp->if_collisions; - /* TXS_MAX_COLLISION - * we shouldn't get - * here - */ + } + if (status & TXS_MAX_COLLISION) { + /* + * TXS_MAX_COLLISION we + * shouldn't get here + */ + ++ifp->if_collisions; } ++ifp->if_oerrors; CSR_WRITE_2(sc, EP_COMMAND, TX_ENABLE); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 16:40:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB127106566C; Tue, 8 Sep 2009 16:40:08 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A96BD8FC15; Tue, 8 Sep 2009 16:40:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88Ge8eo053693; Tue, 8 Sep 2009 16:40:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88Ge8BL053691; Tue, 8 Sep 2009 16:40:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909081640.n88Ge8BL053691@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 16:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196985 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 16:40:08 -0000 Author: pjd Date: Tue Sep 8 16:40:08 2009 New Revision: 196985 URL: http://svn.freebsd.org/changeset/base/196985 Log: Only log successful commands! Without this fix we log even unsuccessful commands executed by unprivileged users. Action is not really taken, but it is logged to pool history, which might be confusing. Reported by: Denis Ahrens MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 8 16:37:18 2009 (r196984) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 8 16:40:08 2009 (r196985) @@ -3021,8 +3021,10 @@ zfsdev_ioctl(struct cdev *dev, u_long cm if (error == 0) error = zfs_ioc_vec[vec].zvec_func(zc); - if (zfs_ioc_vec[vec].zvec_his_log == B_TRUE) - zfs_log_history(zc); + if (error == 0) { + if (zfs_ioc_vec[vec].zvec_his_log == B_TRUE) + zfs_log_history(zc); + } return (error); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 17:14:15 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF4BC1065692; Tue, 8 Sep 2009 17:14:15 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 33DC78FC0A; Tue, 8 Sep 2009 17:14:15 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 15C2669959; Tue, 8 Sep 2009 17:14:14 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n88HEPW3032054; Tue, 8 Sep 2009 17:14:25 GMT (envelope-from phk@critter.freebsd.dk) To: Pawel Jakub Dawidek From: "Poul-Henning Kamp" In-Reply-To: Your message of "Tue, 08 Sep 2009 17:58:50 +0200." <20090908155850.GM1577@garage.freebsd.pl> Date: Tue, 08 Sep 2009 17:14:25 +0000 Message-ID: <32053.1252430065@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196976 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 17:14:15 -0000 >> @@ -33,6 +33,7 @@ >> __FBSDID("$FreeBSD$"); >> >> #include "namespace.h" >> +#include >> #include > >style(9) seems to advice to include either types.h or param.h, but not both. yeah, I had to dig deeper and found the _NO_NAMESPACE_POLLUTION hack which makes a mess of . I'm trying to do that stuff the right way, but it is cross-platform so my universe needs to complete before commit. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 17:20:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7C32106566B; Tue, 8 Sep 2009 17:20:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B69768FC1E; Tue, 8 Sep 2009 17:20:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88HKHZe054565; Tue, 8 Sep 2009 17:20:17 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88HKHE9054563; Tue, 8 Sep 2009 17:20:17 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909081720.n88HKHE9054563@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 8 Sep 2009 17:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196986 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 17:20:17 -0000 Author: trasz Date: Tue Sep 8 17:20:17 2009 New Revision: 196986 URL: http://svn.freebsd.org/changeset/base/196986 Log: Remove unused variable. Modified: head/sys/geom/geom_vfs.c Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Tue Sep 8 16:40:08 2009 (r196985) +++ head/sys/geom/geom_vfs.c Tue Sep 8 17:20:17 2009 (r196986) @@ -134,12 +134,10 @@ static void g_vfs_orphan(struct g_consumer *cp) { struct g_geom *gp; - struct bufobj *bo; g_topology_assert(); gp = cp->geom; - bo = gp->softc; g_trace(G_T_TOPOLOGY, "g_vfs_orphan(%p(%s))", cp, gp->name); if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) g_access(cp, -cp->acr, -cp->acw, -cp->ace); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 17:23:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3871A106566B; Tue, 8 Sep 2009 17:23:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27AF58FC13; Tue, 8 Sep 2009 17:23:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88HNXs9054666; Tue, 8 Sep 2009 17:23:33 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88HNXfl054664; Tue, 8 Sep 2009 17:23:33 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200909081723.n88HNXfl054664@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 8 Sep 2009 17:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196987 - head/sys/ufs/ufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 17:23:33 -0000 Author: trasz Date: Tue Sep 8 17:23:32 2009 New Revision: 196987 URL: http://svn.freebsd.org/changeset/base/196987 Log: Remove useless variable assignment. Modified: head/sys/ufs/ufs/ufs_acl.c Modified: head/sys/ufs/ufs/ufs_acl.c ============================================================================== --- head/sys/ufs/ufs/ufs_acl.c Tue Sep 8 17:20:17 2009 (r196986) +++ head/sys/ufs/ufs/ufs_acl.c Tue Sep 8 17:23:32 2009 (r196987) @@ -255,9 +255,6 @@ ufs_getacl_posix1e(struct vop_getacl_arg old->acl_cnt = 0; break; } - - error = 0; - /* FALLTHROUGH */ case 0: error = acl_copy_oldacl_into_acl(old, ap->a_aclp); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 19:18:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 471301065670; Tue, 8 Sep 2009 19:18:03 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B80A8FC13; Tue, 8 Sep 2009 19:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88JI3Wm057180; Tue, 8 Sep 2009 19:18:03 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88JI33k057178; Tue, 8 Sep 2009 19:18:03 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200909081918.n88JI33k057178@svn.freebsd.org> From: Jamie Gritton Date: Tue, 8 Sep 2009 19:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196989 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 19:18:03 -0000 Author: jamie Date: Tue Sep 8 19:18:02 2009 New Revision: 196989 URL: http://svn.freebsd.org/changeset/base/196989 Log: MFC r196835: Allow a jail's name to be the same as its jid (which is the default if no name is specified), and let a numeric name specify the jid for a new jail when the jid isn't otherwise set. Still disallow other numeric names. Reviewed by: zec Approved by: re (kib), bz (mentor) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/kern_jail.c Modified: stable/8/sys/kern/kern_jail.c ============================================================================== --- stable/8/sys/kern/kern_jail.c Tue Sep 8 19:15:29 2009 (r196988) +++ stable/8/sys/kern/kern_jail.c Tue Sep 8 19:18:02 2009 (r196989) @@ -478,7 +478,7 @@ kern_jail_set(struct thread *td, struct struct vfsoptlist *opts; struct prison *pr, *deadpr, *mypr, *ppr, *tpr; struct vnode *root; - char *domain, *errmsg, *host, *name, *p, *path, *uuid; + char *domain, *errmsg, *host, *name, *namelc, *p, *path, *uuid; #if defined(INET) || defined(INET6) struct prison *tppr; void *op; @@ -907,6 +907,13 @@ kern_jail_set(struct thread *td, struct goto done_unlock_list; } pr = NULL; + namelc = NULL; + if (cuflags == JAIL_CREATE && jid == 0 && name != NULL) { + namelc = strrchr(name, '.'); + jid = strtoul(namelc != NULL ? namelc + 1 : name, &p, 10); + if (*p != '\0') + jid = 0; + } if (jid != 0) { /* * See if a requested jid already exists. There is an @@ -973,17 +980,19 @@ kern_jail_set(struct thread *td, struct * because that is the jail being updated). */ if (name != NULL) { - p = strrchr(name, '.'); - if (p != NULL) { + namelc = strrchr(name, '.'); + if (namelc == NULL) + namelc = name; + else { /* * This is a hierarchical name. Split it into the * parent and child names, and make sure the parent * exists or matches an already found jail. */ - *p = '\0'; + *namelc = '\0'; if (pr != NULL) { - if (strncmp(name, ppr->pr_name, p - name) || - ppr->pr_name[p - name] != '\0') { + if (strncmp(name, ppr->pr_name, namelc - name) + || ppr->pr_name[namelc - name] != '\0') { mtx_unlock(&pr->pr_mtx); error = EINVAL; vfs_opterror(opts, @@ -1000,7 +1009,7 @@ kern_jail_set(struct thread *td, struct } mtx_unlock(&ppr->pr_mtx); } - name = p + 1; + name = ++namelc; } if (name[0] != '\0') { namelen = @@ -1412,9 +1421,11 @@ kern_jail_set(struct thread *td, struct /* Give a default name of the jid. */ if (name[0] == '\0') snprintf(name = numbuf, sizeof(numbuf), "%d", jid); - else if (strtoul(name, &p, 10) != jid && *p == '\0') { + else if (*namelc == '0' || (strtoul(namelc, &p, 10) != jid && + *p == '\0')) { error = EINVAL; - vfs_opterror(opts, "name cannot be numeric"); + vfs_opterror(opts, + "name cannot be numeric (unless it is the jid)"); goto done_deref_locked; } /* From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 19:38:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AC2A106566C; Tue, 8 Sep 2009 19:38:00 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A6848FC19; Tue, 8 Sep 2009 19:38:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88JbxiP057664; Tue, 8 Sep 2009 19:37:59 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88Jbxqj057662; Tue, 8 Sep 2009 19:37:59 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <200909081937.n88Jbxqj057662@svn.freebsd.org> From: Brooks Davis Date: Tue, 8 Sep 2009 19:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196990 - head/lib/libkvm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 19:38:00 -0000 Author: brooks Date: Tue Sep 8 19:37:59 2009 New Revision: 196990 URL: http://svn.freebsd.org/changeset/base/196990 Log: cr_groups is no longer embedded in struct ucred and is instead stored in a seperate array. As such we need to use kvm_read rather than bcopy to populate the ki_groups field. This fixes a crash when running ps -ax on a coredump. Reported by: brucec Tested by: brucec MFC after: 3 days Modified: head/lib/libkvm/kvm_proc.c Modified: head/lib/libkvm/kvm_proc.c ============================================================================== --- head/lib/libkvm/kvm_proc.c Tue Sep 8 19:18:02 2009 (r196989) +++ head/lib/libkvm/kvm_proc.c Tue Sep 8 19:37:59 2009 (r196990) @@ -151,7 +151,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcn kp->ki_cr_flags |= KI_CRF_GRP_OVERFLOW; } kp->ki_ngroups = ucred.cr_ngroups; - bcopy(ucred.cr_groups, kp->ki_groups, + kvm_read(kd, (u_long)ucred.cr_groups, kp->ki_groups, kp->ki_ngroups * sizeof(gid_t)); kp->ki_uid = ucred.cr_uid; if (ucred.cr_prison != NULL) { From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 19:44:05 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B96E106568B; Tue, 8 Sep 2009 19:44:05 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (cl-162.ewr-01.us.sixxs.net [IPv6:2001:4830:1200:a1::2]) by mx1.freebsd.org (Postfix) with ESMTP id 8863F8FC25; Tue, 8 Sep 2009 19:44:04 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n88JhBQ1034349; Tue, 8 Sep 2009 14:43:11 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n88JhBhg034348; Tue, 8 Sep 2009 14:43:11 -0500 (CDT) (envelope-from brooks) Date: Tue, 8 Sep 2009 14:43:11 -0500 From: Brooks Davis To: Bruce Cran Message-ID: <20090908194311.GB32690@lor.one-eyed-alien.net> References: <200907241503.n6OF3ATP013228@svn.freebsd.org> <20090829201228.00005860@unknown> <20090904221432.GC82231@lor.one-eyed-alien.net> <20090906044700.5208ba62@gluon.draftnet> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pvezYHf7grwyp3Bc" Content-Disposition: inline In-Reply-To: <20090906044700.5208ba62@gluon.draftnet> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Tue, 08 Sep 2009 14:43:11 -0500 (CDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r195843 - in head: lib/libkvm sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 19:44:05 -0000 --pvezYHf7grwyp3Bc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 06, 2009 at 04:47:00AM +0100, Bruce Cran wrote: > On Fri, 4 Sep 2009 17:14:32 -0500 > Brooks Davis wrote: >=20 > > On Sat, Aug 29, 2009 at 08:12:28PM +0100, Bruce Cran wrote: > > > On Fri, 24 Jul 2009 15:03:10 +0000 (UTC) > > > Brooks Davis wrote: > > >=20 > > > > Author: brooks > > > > Date: Fri Jul 24 15:03:10 2009 > > > > New Revision: 195843 > > > > URL: http://svn.freebsd.org/changeset/base/195843 > > > >=20 > > > > Log: > > > > Revert the changes to struct kinfo_proc in r194498. Instead, > > > > fill in up to 16 (KI_NGROUPS) values and steal a bit from > > > > ki_cr_flags (all bits currently unused) to indicate overflow with > > > > the new flag KI_CRF_GRP_OVERFLOW. > > > > =20 > > > > This fixes procstat -s. > > > > =20 > > > > Approved by: re (kib) > > >=20 > > > Hi Brooks, > > >=20 > > > This checkin appears to have broken crash dump support: the bcopy in > > > kvm_proc.c crashes when running "ps -ax -M /var/crash/vmcore.x > > > -N /boot/kernel/kernel", apparently because ucred.cr_groups isn't > > > valid. Does it need converted using KVM_READ first? > >=20 > > Sorry for the delay, I believe you are correct we need to use kvm_read > > here instead of the bcopy. Do you still have a core handy you can > > test a patch against? The following should do it. >=20 > The patch has fixed the crash, and data is now returned too. Thanks for testing! I've committed the patch and will MFC in the next week or so. -- Brooks --pvezYHf7grwyp3Bc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFKprPOXY6L6fI4GtQRAlpVAKCmyIq5Pttd5EDXtpTfzqv2d037vACgvYbn uiFQ9oKfoKCAnzcL6HNJjZU= =9/4F -----END PGP SIGNATURE----- --pvezYHf7grwyp3Bc-- From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 20:05:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CD7F106566B; Tue, 8 Sep 2009 20:05:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43A568FC13; Tue, 8 Sep 2009 20:05:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88K5qct058385; Tue, 8 Sep 2009 20:05:52 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88K5qQY058383; Tue, 8 Sep 2009 20:05:52 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200909082005.n88K5qQY058383@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 8 Sep 2009 20:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196991 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 20:05:52 -0000 Author: bz Date: Tue Sep 8 20:05:51 2009 New Revision: 196991 URL: http://svn.freebsd.org/changeset/base/196991 Log: Free jamie from the jail of mentorship. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Sep 8 19:37:59 2009 (r196990) +++ svnadmin/conf/mentors Tue Sep 8 20:05:51 2009 (r196991) @@ -15,7 +15,6 @@ dchagin kib eri mlaier Co-mentor: thompsa fabient jkoshy ivoras gnn -jamie bz Co-mentor: brooks jinmei gnn lstewart gnn nork imp From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 20:06:35 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF556106568B; Tue, 8 Sep 2009 20:06:35 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84DB38FC0C; Tue, 8 Sep 2009 20:06:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88K6ZCY058433; Tue, 8 Sep 2009 20:06:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88K6Z3F058431; Tue, 8 Sep 2009 20:06:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909082006.n88K6Z3F058431@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 8 Sep 2009 20:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196992 - in head/cddl: compat/opensolaris/include contrib/opensolaris/head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 20:06:35 -0000 Author: pjd Date: Tue Sep 8 20:06:35 2009 New Revision: 196992 URL: http://svn.freebsd.org/changeset/base/196992 Log: Implement __assert() for Solaris-specific code. Until now Solaris code was using Solaris prototype for __assert(), but FreeBSD's implementation. Both take different arguments, so we were either core-dumping in assert() or printing garbage. Reported by: avg MFC after: 1 week Added: head/cddl/compat/opensolaris/include/assert.h (contents, props changed) Deleted: head/cddl/contrib/opensolaris/head/assert.h Added: head/cddl/compat/opensolaris/include/assert.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/compat/opensolaris/include/assert.h Tue Sep 8 20:06:35 2009 (r196992) @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2009 Pawel Jakub Dawidek + * All rights reserved. + * + * 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 AUTHORS 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 AUTHORS 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$ + */ + +#undef assert +#undef _assert + +#ifdef NDEBUG +#define assert(e) ((void)0) +#define _assert(e) ((void)0) +#else +#define _assert(e) assert(e) + +#define assert(e) ((e) ? (void)0 : __assert(#e, __FILE__, __LINE__)) +#endif /* NDEBUG */ + +#ifndef _ASSERT_H_ +#define _ASSERT_H_ +#include +#include + +static __inline void +__assert(const char *expr, const char *file, int line) +{ + + (void)fprintf(stderr, "Assertion failed: (%s), file %s, line %d.\n", + expr, file, line); + abort(); + /* NOTREACHED */ +} +#endif /* !_ASSERT_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 20:12:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A892F106566B; Tue, 8 Sep 2009 20:12:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 980D98FC17; Tue, 8 Sep 2009 20:12:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88KCQ2C058610; Tue, 8 Sep 2009 20:12:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88KCQbh058608; Tue, 8 Sep 2009 20:12:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200909082012.n88KCQbh058608@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 8 Sep 2009 20:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196993 - head/sys/powerpc/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 20:12:26 -0000 Author: nwhitehorn Date: Tue Sep 8 20:12:26 2009 New Revision: 196993 URL: http://svn.freebsd.org/changeset/base/196993 Log: Remove some debugging (KTR_VERBOSE) that crept into ppc GENERIC long ago and is present on no other architectures by default. MFC after: 4 days Modified: head/sys/powerpc/conf/GENERIC Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Tue Sep 8 20:06:35 2009 (r196992) +++ head/sys/powerpc/conf/GENERIC Tue Sep 8 20:12:26 2009 (r196993) @@ -170,7 +170,3 @@ device pmu device iicbus # I2C bus code device kiic # Keywest I2C -options KTR -options KTR_COMPILE=0xffffffff -#options KTR_MASK=KTR_SIG -options KTR_VERBOSE From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 20:45:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B85FE106568B; Tue, 8 Sep 2009 20:45:40 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4B838FC15; Tue, 8 Sep 2009 20:45:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88KjeTC059487; Tue, 8 Sep 2009 20:45:40 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88KjenF059468; Tue, 8 Sep 2009 20:45:40 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200909082045.n88KjenF059468@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 8 Sep 2009 20:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196994 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include pc98/include powerpc/include sparc64/include sun4v/include sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 20:45:40 -0000 Author: phk Date: Tue Sep 8 20:45:40 2009 New Revision: 196994 URL: http://svn.freebsd.org/changeset/base/196994 Log: Get rid of the _NO_NAMESPACE_POLLUTION kludge by creating an architecture specific include file containing the _ALIGN* stuff which needs. Added: head/sys/amd64/include/_align.h (contents, props changed) head/sys/arm/include/_align.h (contents, props changed) head/sys/i386/include/_align.h (contents, props changed) head/sys/ia64/include/_align.h (contents, props changed) head/sys/mips/include/_align.h (contents, props changed) head/sys/pc98/include/_align.h (contents, props changed) head/sys/powerpc/include/_align.h (contents, props changed) head/sys/sparc64/include/_align.h (contents, props changed) head/sys/sun4v/include/_align.h (contents, props changed) Modified: head/sys/amd64/include/param.h head/sys/arm/include/param.h head/sys/i386/include/param.h head/sys/ia64/include/param.h head/sys/mips/include/param.h head/sys/powerpc/include/param.h head/sys/sparc64/include/param.h head/sys/sun4v/include/param.h head/sys/sys/param.h head/sys/sys/socket.h Added: head/sys/amd64/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2002 David E. O'Brien. All rights reserved. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)param.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD$ + */ + +#ifndef _AMD64_INCLUDE__ALIGN_H_ +#define _AMD64_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is u_long and + * must be cast to any desired pointer type. + */ +#define _ALIGNBYTES (sizeof(long) - 1) +#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) + +#endif /* !_AMD64_INCLUDE__ALIGN_H_ */ Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/amd64/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -39,26 +39,16 @@ * $FreeBSD$ */ + #ifndef _AMD64_INCLUDE_PARAM_H_ #define _AMD64_INCLUDE_PARAM_H_ -/* - * Machine dependent constants for AMD64. - */ +#include /* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is u_long and - * must be cast to any desired pointer type. + * Machine dependent constants for AMD64. */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES (sizeof(long) - 1) -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) -#endif -#ifndef _NO_NAMESPACE_POLLUTION #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT @@ -150,5 +140,4 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) -#endif /* !_NO_NAMESPACE_POLLUTION */ #endif /* !_AMD64_INCLUDE_PARAM_H_ */ Added: head/sys/arm/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2001 David E. O'Brien + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD$ + */ + +#ifndef _ARM_INCLUDE__ALIGN_H_ +#define _ARM_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define _ALIGNBYTES (sizeof(int) - 1) +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) + +#endif /* !_ARM_INCLUDE__ALIGN_H_ */ Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/arm/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -38,32 +38,20 @@ * $FreeBSD$ */ +#ifndef _ARM_INCLUDE_PARAM_H_ +#define _ARM_INCLUDE_PARAM_H_ + /* * Machine dependent constants for StrongARM */ -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES (sizeof(int) - 1) -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) -#endif +#include #define STACKALIGNBYTES (8 - 1) #define STACKALIGN(p) ((u_int)(p) & ~STACKALIGNBYTES) -#ifndef _NO_NAMESPACE_POLLUTION - #define __PCI_REROUTE_INTERRUPT -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "arm" #endif @@ -136,5 +124,4 @@ #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_ARM_INCLUDE_PARAM_H_ */ Added: head/sys/i386/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD$ + */ + +#ifndef _I386_INCLUDE__ALIGN_H_ +#define _I386_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define _ALIGNBYTES (sizeof(int) - 1) +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) + +#endif /* !_I386_INCLUDE__ALIGN_H_ */ Modified: head/sys/i386/include/param.h ============================================================================== --- head/sys/i386/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/i386/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -33,6 +33,11 @@ * $FreeBSD$ */ +#include + +#ifndef _I386_INCLUDE_PARAM_H_ +#define _I386_INCLUDE_PARAM_H_ + /* * Machine dependent constants for Intel 386. */ @@ -49,14 +54,10 @@ #define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) #endif -#ifndef _NO_NAMESPACE_POLLUTION #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "i386" #endif @@ -149,5 +150,4 @@ #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_I386_INCLUDE_PARAM_H_ */ Added: head/sys/ia64/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/ia64/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,53 @@ +/* $FreeBSD$ */ +/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */ + +/*- + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: machparam.h 1.11 89/08/14$ + * + * @(#)param.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _IA64_INCLUDE__ALIGN_H_ +#define _IA64_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for all + * data types (int, long, ...). The result is u_long and must be cast to + * any desired pointer type. + */ +#define _ALIGNBYTES 15 +#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) + +#endif /* !_IA64_INCLUDE__ALIGN_H_ */ Modified: head/sys/ia64/include/param.h ============================================================================== --- head/sys/ia64/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/ia64/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -39,29 +39,18 @@ * @(#)param.h 8.1 (Berkeley) 6/10/93 */ +#ifndef _IA64_INCLUDE_PARAM_H_ +#define _IA64_INCLUDE_PARAM_H_ + /* * Machine dependent constants for the IA64. */ -/* - * Round p (pointer or byte index) up to a correctly-aligned value for all - * data types (int, long, ...). The result is u_long and must be cast to - * any desired pointer type. - */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES 15 -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) -#endif -#ifndef _NO_NAMESPACE_POLLUTION +#include #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "ia64" #endif @@ -119,5 +108,4 @@ #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_IA64_INCLUDE_PARAM_H_ */ Added: head/sys/mips/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,53 @@ +/* $OpenBSD: param.h,v 1.11 1998/08/30 22:05:35 millert Exp $ */ + +/*- + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department and Ralph Campbell. + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah Hdr: machparam.h 1.11 89/08/14 + * from: @(#)param.h 8.1 (Berkeley) 6/10/93 + * JNPR: param.h,v 1.6.2.1 2007/09/10 07:49:36 girish + * $FreeBSD$ + */ + +#ifndef _MIPS_INCLUDE__ALIGN_H_ +#define _MIPS_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for all + * data types (int, long, ...). The result is u_int and must be cast to + * any desired pointer type. + */ +#define _ALIGNBYTES 7 +#define _ALIGN(p) (((u_int)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) + +#endif /* !_MIPS_INCLUDE__ALIGN_H_ */ Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/mips/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -39,8 +39,10 @@ * $FreeBSD$ */ -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ +#ifndef _MIPS_INCLUDE_PARAM_H_ +#define _MIPS_INCLUDE_PARAM_H_ + +#include #include #ifdef _KERNEL @@ -82,8 +84,6 @@ * data types (int, long, ...). The result is u_int and must be cast to * any desired pointer type. */ -#define _ALIGNBYTES 7 -#define _ALIGN(p) (((u_int)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) @@ -167,4 +167,4 @@ #define DELAY(n) { register int N = (n); while (--N > 0); } #endif /* !_KERNEL */ -#endif /* !_MACHINE_PARAM_H_ */ +#endif /* !_MIPS_INCLUDE_PARAM_H_ */ Added: head/sys/pc98/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/pc98/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,29 @@ +/*- + * Copyright (c) 2005 TAKAHASHI Yoshihiro. + * All rights reserved. + * + * 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$ + */ + +#include Added: head/sys/powerpc/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2001 David E. O'Brien + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD$ + */ + +#ifndef _POWERPC_INCLUDE__ALIGN_H_ +#define _POWERPC_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define _ALIGNBYTES (sizeof(int) - 1) +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) + +#endif /* !_POWERPC_INCLUDE__ALIGN_H_ */ Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/powerpc/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -38,30 +38,18 @@ * $FreeBSD$ */ +#ifndef _POWERPC_INCLUDE_PARAM_H_ +#define _POWERPC_INCLUDE_PARAM_H_ + /* * Machine dependent constants for PowerPC (32-bit only currently) */ -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES (sizeof(int) - 1) -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) -#endif - -#ifndef _NO_NAMESPACE_POLLUTION +#include /* Needed to display interrupts on OFW PCI */ #define __PCI_REROUTE_INTERRUPT -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "powerpc" #endif @@ -120,5 +108,4 @@ #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_POWERPC_INCLUDE_PARAM_H_ */ Added: head/sys/sparc64/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sparc64/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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 REGENTS 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 REGENTS 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. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD$ + */ + +#ifndef _SPARC64_INCLUDE__ALIGN_H_ +#define _SPARC64_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define _ALIGNBYTES 0xf +#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) + +#endif /* !_SPARC64_INCLUDE__ALIGN_H_ */ Modified: head/sys/sparc64/include/param.h ============================================================================== --- head/sys/sparc64/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/sparc64/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -30,29 +30,17 @@ * $FreeBSD$ */ +#ifndef _SPARC64_INCLUDE_PARAM_H_ +#define _SPARC64_INCLUDE_PARAM_H_ + /* * Machine dependent constants for sparc64. */ -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES 0xf -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) -#endif - -#ifndef _NO_NAMESPACE_POLLUTION +#include #define __PCI_BAR_ZERO_VALID -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "sparc64" #endif @@ -150,5 +138,4 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_SPARC64_INCLUDE_PARAM_H_ */ Added: head/sys/sun4v/include/_align.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sun4v/include/_align.h Tue Sep 8 20:45:40 2009 (r196994) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * 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 REGENTS 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 REGENTS 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. + * + * from: @(#)param.h 5.8 (Berkeley) 6/28/91 + * $FreeBSD$ + */ + +#ifndef _SUN4V_INCLUDE__ALIGN_H_ +#define _SUN4V_INCLUDE__ALIGN_H_ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value + * for all data types (int, long, ...). The result is unsigned int + * and must be cast to any desired pointer type. + */ +#define _ALIGNBYTES 0xf +#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) + +#endif /* !_SUN4V_INCLUDE__ALIGN_H_ */ Modified: head/sys/sun4v/include/param.h ============================================================================== --- head/sys/sun4v/include/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/sun4v/include/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -30,26 +30,14 @@ * $FreeBSD$ */ +#ifndef _SUN4V_INCLUDE_PARAM_H_ +#define _SUN4V_INCLUDE_PARAM_H_ + /* * Machine dependent constants for sparc64. */ -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES 0xf -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) -#endif - -#ifndef _NO_NAMESPACE_POLLUTION - -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ +#include #ifndef MACHINE #define MACHINE "sun4v" @@ -147,7 +135,4 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) #endif /* LOCORE */ - - -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_SUN4V_INCLUDE_PARAM_H_ */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/sys/param.h Tue Sep 8 20:45:40 2009 (r196994) @@ -112,8 +112,6 @@ #include #endif -#ifndef _NO_NAMESPACE_POLLUTION - #ifndef DEV_BSHIFT #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #endif @@ -182,8 +180,6 @@ ((off_t)(db) << DEV_BSHIFT) #endif -#endif /* _NO_NAMESPACE_POLLUTION */ - #define PRIMASK 0x0ff #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ #define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Tue Sep 8 20:12:26 2009 (r196993) +++ head/sys/sys/socket.h Tue Sep 8 20:45:40 2009 (r196994) @@ -36,9 +36,7 @@ #include #include #include -#define _NO_NAMESPACE_POLLUTION -#include -#undef _NO_NAMESPACE_POLLUTION +#include /* * Definitions related to sockets: types, address families, options. From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 21:17:18 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42A7F1065672; Tue, 8 Sep 2009 21:17:18 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32C8F8FC14; Tue, 8 Sep 2009 21:17:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88LHIbu060350; Tue, 8 Sep 2009 21:17:18 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88LHIeZ060345; Tue, 8 Sep 2009 21:17:18 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200909082117.n88LHIeZ060345@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 8 Sep 2009 21:17:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196995 - in head/sys: net netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 21:17:18 -0000 Author: np Date: Tue Sep 8 21:17:17 2009 New Revision: 196995 URL: http://svn.freebsd.org/changeset/base/196995 Log: Add arp_update_event. This replaces route_arp_update_event, which has not worked since the arp-v2 rewrite. The event handler will be called with the llentry write-locked and can examine la_flags to determine whether the entry is being added or removed. Reviewed by: gnn, kmacy Approved by: gnn (mentor) MFC after: 1 month Modified: head/sys/net/route.h head/sys/netinet/if_ether.c head/sys/netinet/if_ether.h head/sys/netinet/in.c Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Sep 8 20:45:40 2009 (r196994) +++ head/sys/net/route.h Tue Sep 8 21:17:17 2009 (r196995) @@ -435,6 +435,7 @@ int rtrequest1_fib(int, struct rt_addri #include typedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *); typedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *); +/* route_arp_update_event is no longer generated; see arp_update_event */ EVENTHANDLER_DECLARE(route_arp_update_event, rtevent_arp_update_fn); EVENTHANDLER_DECLARE(route_redirect_event, rtevent_redirect_fn); #endif Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Sep 8 20:45:40 2009 (r196994) +++ head/sys/netinet/if_ether.c Tue Sep 8 21:17:17 2009 (r196995) @@ -684,6 +684,8 @@ match: (void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen); la->la_flags |= LLE_VALID; + EVENTHANDLER_INVOKE(arp_update_event, la); + if (!(la->la_flags & LLE_STATIC)) { la->la_expire = time_uptime + V_arpt_keep; callout_reset(&la->la_timer, hz * V_arpt_keep, Modified: head/sys/netinet/if_ether.h ============================================================================== --- head/sys/netinet/if_ether.h Tue Sep 8 20:45:40 2009 (r196994) +++ head/sys/netinet/if_ether.h Tue Sep 8 21:17:17 2009 (r196995) @@ -117,6 +117,11 @@ int arpresolve(struct ifnet *ifp, struct struct llentry **lle); void arp_ifinit(struct ifnet *, struct ifaddr *); void arp_ifinit2(struct ifnet *, struct ifaddr *, u_char *); + +#include +typedef void (*llevent_arp_update_fn)(void *, struct llentry *); +EVENTHANDLER_DECLARE(arp_update_event, llevent_arp_update_fn); + #endif #endif Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Sep 8 20:45:40 2009 (r196994) +++ head/sys/netinet/in.c Tue Sep 8 21:17:17 2009 (r196995) @@ -1418,6 +1418,7 @@ in_lltable_lookup(struct lltable *llt, u if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { LLE_WLOCK(lle); lle->la_flags = LLE_DELETED; + EVENTHANDLER_INVOKE(arp_update_event, lle); LLE_WUNLOCK(lle); #ifdef DIAGNOSTICS log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 21:50:36 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E212F1065672; Tue, 8 Sep 2009 21:50:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C888E8FC16; Tue, 8 Sep 2009 21:50:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88LoZMo061444; Tue, 8 Sep 2009 21:50:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88LoYUI061443; Tue, 8 Sep 2009 21:50:34 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200909082150.n88LoYUI061443@svn.freebsd.org> From: John Baldwin Date: Tue, 8 Sep 2009 21:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196996 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 21:50:36 -0000 Author: jhb Date: Tue Sep 8 21:50:34 2009 New Revision: 196996 URL: http://svn.freebsd.org/changeset/base/196996 Log: MFC 196745: Don't attempt to bind the current thread to the CPU an IRQ is bound to when removing an interrupt handler from an IRQ during shutdown. During shutdown we are already bound to CPU 0 and this was triggering a panic. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/local_apic.c stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/i386/local_apic.c Modified: stable/8/sys/amd64/amd64/local_apic.c ============================================================================== --- stable/8/sys/amd64/amd64/local_apic.c Tue Sep 8 21:17:17 2009 (r196995) +++ stable/8/sys/amd64/amd64/local_apic.c Tue Sep 8 21:50:34 2009 (r196996) @@ -990,18 +990,21 @@ apic_free_vector(u_int apic_id, u_int ve * we don't lose an interrupt delivery race. */ td = curthread; - thread_lock(td); - if (sched_is_bound(td)) - panic("apic_free_vector: Thread already bound.\n"); - sched_bind(td, apic_cpuid(apic_id)); - thread_unlock(td); + if (!rebooting) { + thread_lock(td); + if (sched_is_bound(td)) + panic("apic_free_vector: Thread already bound.\n"); + sched_bind(td, apic_cpuid(apic_id)); + thread_unlock(td); + } mtx_lock_spin(&icu_lock); lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1; mtx_unlock_spin(&icu_lock); - thread_lock(td); - sched_unbind(td); - thread_unlock(td); - + if (!rebooting) { + thread_lock(td); + sched_unbind(td); + thread_unlock(td); + } } /* Map an IDT vector (APIC) to an IRQ (interrupt source). */ Modified: stable/8/sys/i386/i386/local_apic.c ============================================================================== --- stable/8/sys/i386/i386/local_apic.c Tue Sep 8 21:17:17 2009 (r196995) +++ stable/8/sys/i386/i386/local_apic.c Tue Sep 8 21:50:34 2009 (r196996) @@ -994,18 +994,21 @@ apic_free_vector(u_int apic_id, u_int ve * we don't lose an interrupt delivery race. */ td = curthread; - thread_lock(td); - if (sched_is_bound(td)) - panic("apic_free_vector: Thread already bound.\n"); - sched_bind(td, apic_cpuid(apic_id)); - thread_unlock(td); + if (!rebooting) { + thread_lock(td); + if (sched_is_bound(td)) + panic("apic_free_vector: Thread already bound.\n"); + sched_bind(td, apic_cpuid(apic_id)); + thread_unlock(td); + } mtx_lock_spin(&icu_lock); lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1; mtx_unlock_spin(&icu_lock); - thread_lock(td); - sched_unbind(td); - thread_unlock(td); - + if (!rebooting) { + thread_lock(td); + sched_unbind(td); + thread_unlock(td); + } } /* Map an IDT vector (APIC) to an IRQ (interrupt source). */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 8 23:25:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAC08106566B; Tue, 8 Sep 2009 23:25:39 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5B18FC14; Tue, 8 Sep 2009 23:25:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n88NPduY064555; Tue, 8 Sep 2009 23:25:39 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n88NPdDs064553; Tue, 8 Sep 2009 23:25:39 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200909082325.n88NPdDs064553@svn.freebsd.org> From: Jack F Vogel Date: Tue, 8 Sep 2009 23:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196997 - stable/8/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 23:25:40 -0000 Author: jfv Date: Tue Sep 8 23:25:39 2009 New Revision: 196997 URL: http://svn.freebsd.org/changeset/base/196997 Log: Make LRO turned off uncategorically for devices attached to the bridge, rather than just in the case when some device cannot do TSO. Customer tests have shown that even when all devices can do TSO that LRO will cause problems when bridging. Approved by: re Modified: stable/8/sys/net/if_bridge.c Modified: stable/8/sys/net/if_bridge.c ============================================================================== --- stable/8/sys/net/if_bridge.c Tue Sep 8 21:50:34 2009 (r196996) +++ stable/8/sys/net/if_bridge.c Tue Sep 8 23:25:39 2009 (r196997) @@ -171,6 +171,11 @@ __FBSDID("$FreeBSD$"); #define BRIDGE_IFCAPS_MASK (IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM) /* + * List of capabilities to strip + */ +#define BRIDGE_IFCAPS_STRIP IFCAP_LRO + +/* * Bridge interface list entry. */ struct bridge_iflist { @@ -802,16 +807,10 @@ bridge_mutecaps(struct bridge_softc *sc) LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { enabled = bif->bif_ifp->if_capenable; + enabled &= ~BRIDGE_IFCAPS_STRIP; /* strip off mask bits and enable them again if allowed */ enabled &= ~BRIDGE_IFCAPS_MASK; enabled |= mask; - /* - * Receive offload can only be enabled if all members also - * support send offload. - */ - if ((enabled & IFCAP_TSO) == 0) - enabled &= ~IFCAP_LRO; - bridge_set_ifcap(sc, bif, enabled); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 9 00:01:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEE5E1065679; Wed, 9 Sep 2009 00:01:09 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE31F8FC1A; Wed, 9 Sep 2009 00:01:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89019s1065652; Wed, 9 Sep 2009 00:01:09 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n890192M065649; Wed, 9 Sep 2009 00:01:09 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200909090001.n890192M065649@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 9 Sep 2009 00:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196998 - vendor/tzdata/dist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2009 00:01:10 -0000 Author: edwin Date: Wed Sep 9 00:01:09 2009 New Revision: 196998 URL: http://svn.freebsd.org/changeset/base/196998 Log: Vendor import of tzdata2008m: Samoa will go in DST on 4 October 2009 till 28 March 2010 Palestine will go back from DST on 4 September 2009 Obtained from: ftp://elsie.nci.nih.gov/pub/ Modified: vendor/tzdata/dist/asia vendor/tzdata/dist/australasia Modified: vendor/tzdata/dist/asia ============================================================================== --- vendor/tzdata/dist/asia Tue Sep 8 23:25:39 2009 (r196997) +++ vendor/tzdata/dist/asia Wed Sep 9 00:01:09 2009 (r196998) @@ -1,5 +1,5 @@ #
-# @(#)asia	8.36
+# @(#)asia	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1836,6 +1836,42 @@ Zone	Asia/Karachi	4:28:12 -	LMT	1907
 # http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
 # 
 
+# From Steffen Thorsen (2009-08-31):
+# Palestine's Council of Ministers announced that they will revert back to
+# winter time on Friday, 2009-09-04.
+#
+# One news source:
+# 
+# http://www.safa.ps/ara/?action=showdetail&seid=4158
+# 
+# (Palestinian press agency, Arabic),
+# Google translate: "Decided that the Palestinian government in Ramallah
+# headed by Salam Fayyad, the start of work in time for the winter of
+# 2009, starting on Friday approved the fourth delay Sept. clock sixty
+# minutes per hour as of Friday morning."
+#
+# We are not sure if Gaza will do the same, last year they had a different
+# end date, we will keep this page updated:
+# 
+# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# 
+
+# From Alexander Krivenyshev (2009-09-02):
+# Seems that Gaza Strip will go back to Winter Time same date as West Bank.
+#
+# According to Palestinian Ministry Of Interior, West Bank and Gaza Strip plan
+# to change time back to Standard time on September 4, 2009.
+#
+# "Winter time unite the West Bank and Gaza"
+# (from Palestinian National Authority):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
+# 
+
 # The rules for Egypt are stolen from the `africa' file.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -1854,7 +1890,7 @@ Rule Palestine	2006	only	-	Sep	22	0:00	0
 Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
 Rule Palestine	2008	only	-	Aug	lastFri	2:00	0	-
 Rule Palestine	2009	max	-	Mar	lastFri	0:00	1:00	S
-Rule Palestine	2009	max	-	Sep	lastMon	2:00	0	-
+Rule Palestine	2009	max	-	Sep	Fri>=1	2:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct

Modified: vendor/tzdata/dist/australasia
==============================================================================
--- vendor/tzdata/dist/australasia	Tue Sep  8 23:25:39 2009	(r196997)
+++ vendor/tzdata/dist/australasia	Wed Sep  9 00:01:09 2009	(r196998)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.12
+# @(#)australasia	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -443,10 +443,26 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
 # 
 
+# From Steffen Thorsen (2009-08-27):
+# Samoa's parliament passed the Daylight Saving Bill 2009, and will start 
+# daylight saving time on the first Sunday of October 2009 and end on the 
+# last Sunday of March 2010. We hope that the full text will be published 
+# soon, but we believe that the bill is only valid for 2009-2010. Samoa's 
+# Daylight Saving Act 2009 will be enforced as soon as the Head of State 
+# executes a proclamation publicizing this Act.
+#
+# Some background information here, which will be updated once we have 
+# more details:
+# 
+# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
-			-11:00	-	WST			# Samoa Time
+			-11:00	-	WST	2009 Oct 4
+			-11:00	1:00	WSDT	2010 Mar 28
+			-11:00	-	WST
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 00:03:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50A19106568F;
	Wed,  9 Sep 2009 00:03:16 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2773B8FC14;
	Wed,  9 Sep 2009 00:03:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8903GNM065742;
	Wed, 9 Sep 2009 00:03:16 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8903GGZ065741;
	Wed, 9 Sep 2009 00:03:16 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200909090003.n8903GGZ065741@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 9 Sep 2009 00:03:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196999 - vendor/tzdata/tzdata2009m
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 00:03:16 -0000

Author: edwin
Date: Wed Sep  9 00:03:15 2009
New Revision: 196999
URL: http://svn.freebsd.org/changeset/base/196999

Log:
  Tag of tzdata2009m

Added:
  vendor/tzdata/tzdata2009m/
     - copied from r196998, vendor/tzdata/dist/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 00:07:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 761FD106566C;
	Wed,  9 Sep 2009 00:07:05 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 65AAA8FC17;
	Wed,  9 Sep 2009 00:07:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89075bU065887;
	Wed, 9 Sep 2009 00:07:05 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89075V0065884;
	Wed, 9 Sep 2009 00:07:05 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200909090007.n89075V0065884@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 9 Sep 2009 00:07:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197000 - head/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 00:07:05 -0000

Author: edwin
Date: Wed Sep  9 00:07:05 2009
New Revision: 197000
URL: http://svn.freebsd.org/changeset/base/197000

Log:
  MFV of r196998.
  
  Import of tzdata2008m
  
  Samoa will go in DST on 4 October 2009 till 28 March 2010
  Palestine will go back from DST on 4 September 2009

Modified:
  head/share/zoneinfo/   (props changed)
  head/share/zoneinfo/asia
  head/share/zoneinfo/australasia

Modified: head/share/zoneinfo/asia
==============================================================================
--- head/share/zoneinfo/asia	Wed Sep  9 00:03:15 2009	(r196999)
+++ head/share/zoneinfo/asia	Wed Sep  9 00:07:05 2009	(r197000)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.36
+# @(#)asia	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1836,6 +1836,42 @@ Zone	Asia/Karachi	4:28:12 -	LMT	1907
 # http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
 # 
 
+# From Steffen Thorsen (2009-08-31):
+# Palestine's Council of Ministers announced that they will revert back to
+# winter time on Friday, 2009-09-04.
+#
+# One news source:
+# 
+# http://www.safa.ps/ara/?action=showdetail&seid=4158
+# 
+# (Palestinian press agency, Arabic),
+# Google translate: "Decided that the Palestinian government in Ramallah
+# headed by Salam Fayyad, the start of work in time for the winter of
+# 2009, starting on Friday approved the fourth delay Sept. clock sixty
+# minutes per hour as of Friday morning."
+#
+# We are not sure if Gaza will do the same, last year they had a different
+# end date, we will keep this page updated:
+# 
+# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# 
+
+# From Alexander Krivenyshev (2009-09-02):
+# Seems that Gaza Strip will go back to Winter Time same date as West Bank.
+#
+# According to Palestinian Ministry Of Interior, West Bank and Gaza Strip plan
+# to change time back to Standard time on September 4, 2009.
+#
+# "Winter time unite the West Bank and Gaza"
+# (from Palestinian National Authority):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
+# 
+
 # The rules for Egypt are stolen from the `africa' file.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -1854,7 +1890,7 @@ Rule Palestine	2006	only	-	Sep	22	0:00	0
 Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
 Rule Palestine	2008	only	-	Aug	lastFri	2:00	0	-
 Rule Palestine	2009	max	-	Mar	lastFri	0:00	1:00	S
-Rule Palestine	2009	max	-	Sep	lastMon	2:00	0	-
+Rule Palestine	2009	max	-	Sep	Fri>=1	2:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct

Modified: head/share/zoneinfo/australasia
==============================================================================
--- head/share/zoneinfo/australasia	Wed Sep  9 00:03:15 2009	(r196999)
+++ head/share/zoneinfo/australasia	Wed Sep  9 00:07:05 2009	(r197000)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.12
+# @(#)australasia	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -443,10 +443,26 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
 # 
 
+# From Steffen Thorsen (2009-08-27):
+# Samoa's parliament passed the Daylight Saving Bill 2009, and will start 
+# daylight saving time on the first Sunday of October 2009 and end on the 
+# last Sunday of March 2010. We hope that the full text will be published 
+# soon, but we believe that the bill is only valid for 2009-2010. Samoa's 
+# Daylight Saving Act 2009 will be enforced as soon as the Head of State 
+# executes a proclamation publicizing this Act.
+#
+# Some background information here, which will be updated once we have 
+# more details:
+# 
+# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
-			-11:00	-	WST			# Samoa Time
+			-11:00	-	WST	2009 Oct 4
+			-11:00	1:00	WSDT	2010 Mar 28
+			-11:00	-	WST
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 00:15:43 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD7E81065670;
	Wed,  9 Sep 2009 00:15:43 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BC0C18FC0A;
	Wed,  9 Sep 2009 00:15:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n890FhAC066122;
	Wed, 9 Sep 2009 00:15:43 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n890Fhnp066119;
	Wed, 9 Sep 2009 00:15:43 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200909090015.n890Fhnp066119@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 9 Sep 2009 00:15:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197001 - stable/7/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 00:15:43 -0000

Author: edwin
Date: Wed Sep  9 00:15:43 2009
New Revision: 197001
URL: http://svn.freebsd.org/changeset/base/197001

Log:
  MFC from 197000:
  
  Update to tzdata2008m:
  
  Samoa will go in DST on 4 October 2009 till 28 March 2010
  Palestine will go back from DST on 4 September 2009

Modified:
  stable/7/share/zoneinfo/   (props changed)
  stable/7/share/zoneinfo/asia
  stable/7/share/zoneinfo/australasia

Modified: stable/7/share/zoneinfo/asia
==============================================================================
--- stable/7/share/zoneinfo/asia	Wed Sep  9 00:07:05 2009	(r197000)
+++ stable/7/share/zoneinfo/asia	Wed Sep  9 00:15:43 2009	(r197001)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.36
+# @(#)asia	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1836,6 +1836,42 @@ Zone	Asia/Karachi	4:28:12 -	LMT	1907
 # http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
 # 
 
+# From Steffen Thorsen (2009-08-31):
+# Palestine's Council of Ministers announced that they will revert back to
+# winter time on Friday, 2009-09-04.
+#
+# One news source:
+# 
+# http://www.safa.ps/ara/?action=showdetail&seid=4158
+# 
+# (Palestinian press agency, Arabic),
+# Google translate: "Decided that the Palestinian government in Ramallah
+# headed by Salam Fayyad, the start of work in time for the winter of
+# 2009, starting on Friday approved the fourth delay Sept. clock sixty
+# minutes per hour as of Friday morning."
+#
+# We are not sure if Gaza will do the same, last year they had a different
+# end date, we will keep this page updated:
+# 
+# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# 
+
+# From Alexander Krivenyshev (2009-09-02):
+# Seems that Gaza Strip will go back to Winter Time same date as West Bank.
+#
+# According to Palestinian Ministry Of Interior, West Bank and Gaza Strip plan
+# to change time back to Standard time on September 4, 2009.
+#
+# "Winter time unite the West Bank and Gaza"
+# (from Palestinian National Authority):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
+# 
+
 # The rules for Egypt are stolen from the `africa' file.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -1854,7 +1890,7 @@ Rule Palestine	2006	only	-	Sep	22	0:00	0
 Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
 Rule Palestine	2008	only	-	Aug	lastFri	2:00	0	-
 Rule Palestine	2009	max	-	Mar	lastFri	0:00	1:00	S
-Rule Palestine	2009	max	-	Sep	lastMon	2:00	0	-
+Rule Palestine	2009	max	-	Sep	Fri>=1	2:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Wed Sep  9 00:07:05 2009	(r197000)
+++ stable/7/share/zoneinfo/australasia	Wed Sep  9 00:15:43 2009	(r197001)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.12
+# @(#)australasia	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -443,10 +443,26 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
 # 
 
+# From Steffen Thorsen (2009-08-27):
+# Samoa's parliament passed the Daylight Saving Bill 2009, and will start 
+# daylight saving time on the first Sunday of October 2009 and end on the 
+# last Sunday of March 2010. We hope that the full text will be published 
+# soon, but we believe that the bill is only valid for 2009-2010. Samoa's 
+# Daylight Saving Act 2009 will be enforced as soon as the Head of State 
+# executes a proclamation publicizing this Act.
+#
+# Some background information here, which will be updated once we have 
+# more details:
+# 
+# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
-			-11:00	-	WST			# Samoa Time
+			-11:00	-	WST	2009 Oct 4
+			-11:00	1:00	WSDT	2010 Mar 28
+			-11:00	-	WST
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 00:16:49 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E66C41065693;
	Wed,  9 Sep 2009 00:16:49 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D548D8FC12;
	Wed,  9 Sep 2009 00:16:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n890GnZs066191;
	Wed, 9 Sep 2009 00:16:49 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n890Gnvw066188;
	Wed, 9 Sep 2009 00:16:49 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200909090016.n890Gnvw066188@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 9 Sep 2009 00:16:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197002 - stable/6/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 00:16:50 -0000

Author: edwin
Date: Wed Sep  9 00:16:49 2009
New Revision: 197002
URL: http://svn.freebsd.org/changeset/base/197002

Log:
  MFC from 197000:
  
  Update to tzdata2008m:
  
  Samoa will go in DST on 4 October 2009 till 28 March 2010
  Palestine will go back from DST on 4 September 2009

Modified:
  stable/6/share/zoneinfo/   (props changed)
  stable/6/share/zoneinfo/asia
  stable/6/share/zoneinfo/australasia

Modified: stable/6/share/zoneinfo/asia
==============================================================================
--- stable/6/share/zoneinfo/asia	Wed Sep  9 00:15:43 2009	(r197001)
+++ stable/6/share/zoneinfo/asia	Wed Sep  9 00:16:49 2009	(r197002)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.36
+# @(#)asia	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1836,6 +1836,42 @@ Zone	Asia/Karachi	4:28:12 -	LMT	1907
 # http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
 # 
 
+# From Steffen Thorsen (2009-08-31):
+# Palestine's Council of Ministers announced that they will revert back to
+# winter time on Friday, 2009-09-04.
+#
+# One news source:
+# 
+# http://www.safa.ps/ara/?action=showdetail&seid=4158
+# 
+# (Palestinian press agency, Arabic),
+# Google translate: "Decided that the Palestinian government in Ramallah
+# headed by Salam Fayyad, the start of work in time for the winter of
+# 2009, starting on Friday approved the fourth delay Sept. clock sixty
+# minutes per hour as of Friday morning."
+#
+# We are not sure if Gaza will do the same, last year they had a different
+# end date, we will keep this page updated:
+# 
+# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# 
+
+# From Alexander Krivenyshev (2009-09-02):
+# Seems that Gaza Strip will go back to Winter Time same date as West Bank.
+#
+# According to Palestinian Ministry Of Interior, West Bank and Gaza Strip plan
+# to change time back to Standard time on September 4, 2009.
+#
+# "Winter time unite the West Bank and Gaza"
+# (from Palestinian National Authority):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
+# 
+
 # The rules for Egypt are stolen from the `africa' file.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -1854,7 +1890,7 @@ Rule Palestine	2006	only	-	Sep	22	0:00	0
 Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
 Rule Palestine	2008	only	-	Aug	lastFri	2:00	0	-
 Rule Palestine	2009	max	-	Mar	lastFri	0:00	1:00	S
-Rule Palestine	2009	max	-	Sep	lastMon	2:00	0	-
+Rule Palestine	2009	max	-	Sep	Fri>=1	2:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct

Modified: stable/6/share/zoneinfo/australasia
==============================================================================
--- stable/6/share/zoneinfo/australasia	Wed Sep  9 00:15:43 2009	(r197001)
+++ stable/6/share/zoneinfo/australasia	Wed Sep  9 00:16:49 2009	(r197002)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.12
+# @(#)australasia	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -443,10 +443,26 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
 # 
 
+# From Steffen Thorsen (2009-08-27):
+# Samoa's parliament passed the Daylight Saving Bill 2009, and will start 
+# daylight saving time on the first Sunday of October 2009 and end on the 
+# last Sunday of March 2010. We hope that the full text will be published 
+# soon, but we believe that the bill is only valid for 2009-2010. Samoa's 
+# Daylight Saving Act 2009 will be enforced as soon as the Head of State 
+# executes a proclamation publicizing this Act.
+#
+# Some background information here, which will be updated once we have 
+# more details:
+# 
+# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
-			-11:00	-	WST			# Samoa Time
+			-11:00	-	WST	2009 Oct 4
+			-11:00	1:00	WSDT	2010 Mar 28
+			-11:00	-	WST
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 01:14:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC22B106566B;
	Wed,  9 Sep 2009 01:14:10 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B24DC8FC1F;
	Wed,  9 Sep 2009 01:14:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n891EA7E067813;
	Wed, 9 Sep 2009 01:14:10 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n891EAAb067812;
	Wed, 9 Sep 2009 01:14:10 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090114.n891EAAb067812@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 01:14:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-svnadmin@freebsd.org
X-SVN-Group: svnadmin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197006 - svnadmin/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 01:14:11 -0000

Author: delphij
Date: Wed Sep  9 01:14:09 2009
New Revision: 197006
URL: http://svn.freebsd.org/changeset/base/197006

Log:
  Add vendor-sys/x86emu to allow list so that I will be able to import it.

Modified:
  svnadmin/conf/paths

Modified: svnadmin/conf/paths
==============================================================================
--- svnadmin/conf/paths	Wed Sep  9 00:50:17 2009	(r197005)
+++ svnadmin/conf/paths	Wed Sep  9 01:14:09 2009	(r197006)
@@ -52,6 +52,7 @@
 ^vendor-sys/ath
 ^vendor-sys/opensolaris
 ^vendor-sys/pf
+^vendor-sys/x86emu
 
 ^vendor/bind9
 ^vendor/binutils

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 01:14:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 817E5106568D;
	Wed,  9 Sep 2009 01:14:25 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F4DE8FC14;
	Wed,  9 Sep 2009 01:14:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n891EPrR067858;
	Wed, 9 Sep 2009 01:14:25 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n891EPnm067855;
	Wed, 9 Sep 2009 01:14:25 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090114.n891EPnm067855@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 01:14:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor-sys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197007 - in vendor-sys/x86emu: . dist
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 01:14:25 -0000

Author: delphij
Date: Wed Sep  9 01:14:25 2009
New Revision: 197007
URL: http://svn.freebsd.org/changeset/base/197007

Log:
  Import x86emu from OpenBSD (src/sys/dev/x86emu).
  
  x86emu is a software emulator for the real mode x86 processor, originally
  written by SciTech Software, Inc. for XFree86 and has been later ported
  to NetBSD then OpenBSD.

Added:
  vendor-sys/x86emu/
  vendor-sys/x86emu/dist/
  vendor-sys/x86emu/dist/x86emu.c
  vendor-sys/x86emu/dist/x86emu.h
  vendor-sys/x86emu/dist/x86emu_regs.h
  vendor-sys/x86emu/dist/x86emu_util.c

Added: vendor-sys/x86emu/dist/x86emu.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor-sys/x86emu/dist/x86emu.c	Wed Sep  9 01:14:25 2009	(r197007)
@@ -0,0 +1,8341 @@
+/*	$OpenBSD: x86emu.c,v 1.4 2009/06/18 14:19:21 pirofti Exp $	*/
+/*	$NetBSD: x86emu.c,v 1.7 2009/02/03 19:26:29 joerg Exp $	*/
+
+/*
+ *
+ *  Realmode X86 Emulator Library
+ *
+ *  Copyright (C) 1996-1999 SciTech Software, Inc.
+ *  Copyright (C) David Mosberger-Tang
+ *  Copyright (C) 1999 Egbert Eich
+ *  Copyright (C) 2007 Joerg Sonnenberger
+ *
+ *  ========================================================================
+ *
+ *  Permission to use, copy, modify, distribute, and sell this software and
+ *  its documentation for any purpose is hereby granted without fee,
+ *  provided that the above copyright notice appear in all copies and that
+ *  both that copyright notice and this permission notice appear in
+ *  supporting documentation, and that the name of the authors not be used
+ *  in advertising or publicity pertaining to distribution of the software
+ *  without specific, written prior permission.  The authors makes no
+ *  representations about the suitability of this software for any purpose.
+ *  It is provided "as is" without express or implied warranty.
+ *
+ *  THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ *  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ *  EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ *  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ *  USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ *  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ *  PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include 
+#include 
+
+static void 	x86emu_intr_raise (struct x86emu *, uint8_t type);
+
+static void	x86emu_exec_one_byte(struct x86emu *);
+static void	x86emu_exec_two_byte(struct x86emu *);
+
+static void	fetch_decode_modrm (struct x86emu *);
+static uint8_t	fetch_byte_imm (struct x86emu *);
+static uint16_t	fetch_word_imm (struct x86emu *);
+static uint32_t	fetch_long_imm (struct x86emu *);
+static uint8_t	fetch_data_byte (struct x86emu *, uint32_t offset);
+static uint8_t	fetch_byte (struct x86emu *, uint segment, uint32_t offset);
+static uint16_t	fetch_data_word (struct x86emu *, uint32_t offset);
+static uint16_t	fetch_word (struct x86emu *, uint32_t segment, uint32_t offset);
+static uint32_t	fetch_data_long (struct x86emu *, uint32_t offset);
+static uint32_t	fetch_long (struct x86emu *, uint32_t segment, uint32_t offset);
+static void	store_data_byte (struct x86emu *, uint32_t offset, uint8_t val);
+static void	store_byte (struct x86emu *, uint32_t segment, uint32_t offset, uint8_t val);
+static void	store_data_word (struct x86emu *, uint32_t offset, uint16_t val);
+static void	store_word (struct x86emu *, uint32_t segment, uint32_t offset, uint16_t val);
+static void	store_data_long (struct x86emu *, uint32_t offset, uint32_t val);
+static void	store_long (struct x86emu *, uint32_t segment, uint32_t offset, uint32_t val);
+static uint8_t*	decode_rl_byte_register(struct x86emu *);
+static uint16_t*	decode_rl_word_register(struct x86emu *);
+static uint32_t* 	decode_rl_long_register(struct x86emu *);
+static uint8_t* 	decode_rh_byte_register(struct x86emu *);
+static uint16_t* 	decode_rh_word_register(struct x86emu *);
+static uint32_t* 	decode_rh_long_register(struct x86emu *);
+static uint16_t* 	decode_rh_seg_register(struct x86emu *);
+static uint32_t	decode_rl_address(struct x86emu *);
+
+static uint8_t 	decode_and_fetch_byte(struct x86emu *);
+static uint16_t 	decode_and_fetch_word(struct x86emu *);
+static uint32_t 	decode_and_fetch_long(struct x86emu *);
+
+static uint8_t 	decode_and_fetch_byte_imm8(struct x86emu *, uint8_t *);
+static uint16_t 	decode_and_fetch_word_imm8(struct x86emu *, uint8_t *);
+static uint32_t 	decode_and_fetch_long_imm8(struct x86emu *, uint8_t *);
+
+static uint16_t 	decode_and_fetch_word_disp(struct x86emu *, int16_t);
+static uint32_t 	decode_and_fetch_long_disp(struct x86emu *, int16_t);
+
+static void	write_back_byte(struct x86emu *, uint8_t);
+static void	write_back_word(struct x86emu *, uint16_t);
+static void	write_back_long(struct x86emu *, uint32_t);
+
+static uint16_t	aaa_word (struct x86emu *, uint16_t d);
+static uint16_t	aas_word (struct x86emu *, uint16_t d);
+static uint16_t	aad_word (struct x86emu *, uint16_t d);
+static uint16_t	aam_word (struct x86emu *, uint8_t d);
+static uint8_t	adc_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	adc_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	adc_long (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	add_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	add_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	add_long (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	and_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	and_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	and_long (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	cmp_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	cmp_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	cmp_long (struct x86emu *, uint32_t d, uint32_t s);
+static void	cmp_byte_no_return (struct x86emu *, uint8_t d, uint8_t s);
+static void	cmp_word_no_return (struct x86emu *, uint16_t d, uint16_t s);
+static void	cmp_long_no_return (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	daa_byte (struct x86emu *, uint8_t d);
+static uint8_t	das_byte (struct x86emu *, uint8_t d);
+static uint8_t	dec_byte (struct x86emu *, uint8_t d);
+static uint16_t	dec_word (struct x86emu *, uint16_t d);
+static uint32_t	dec_long (struct x86emu *, uint32_t d);
+static uint8_t	inc_byte (struct x86emu *, uint8_t d);
+static uint16_t	inc_word (struct x86emu *, uint16_t d);
+static uint32_t	inc_long (struct x86emu *, uint32_t d);
+static uint8_t	or_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	or_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	or_long (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	neg_byte (struct x86emu *, uint8_t s);
+static uint16_t	neg_word (struct x86emu *, uint16_t s);
+static uint32_t	neg_long (struct x86emu *, uint32_t s);
+static uint8_t	rcl_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	rcl_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	rcl_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint8_t	rcr_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	rcr_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	rcr_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint8_t	rol_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	rol_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	rol_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint8_t	ror_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	ror_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	ror_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint8_t	shl_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	shl_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	shl_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint8_t	shr_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	shr_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	shr_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint8_t	sar_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	sar_word (struct x86emu *, uint16_t d, uint8_t s);
+static uint32_t	sar_long (struct x86emu *, uint32_t d, uint8_t s);
+static uint16_t	shld_word (struct x86emu *, uint16_t d, uint16_t fill, uint8_t s);
+static uint32_t	shld_long (struct x86emu *, uint32_t d, uint32_t fill, uint8_t s);
+static uint16_t	shrd_word (struct x86emu *, uint16_t d, uint16_t fill, uint8_t s);
+static uint32_t	shrd_long (struct x86emu *, uint32_t d, uint32_t fill, uint8_t s);
+static uint8_t	sbb_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	sbb_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	sbb_long (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	sub_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	sub_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	sub_long (struct x86emu *, uint32_t d, uint32_t s);
+static void	test_byte (struct x86emu *, uint8_t d, uint8_t s);
+static void	test_word (struct x86emu *, uint16_t d, uint16_t s);
+static void	test_long (struct x86emu *, uint32_t d, uint32_t s);
+static uint8_t	xor_byte (struct x86emu *, uint8_t d, uint8_t s);
+static uint16_t	xor_word (struct x86emu *, uint16_t d, uint16_t s);
+static uint32_t	xor_long (struct x86emu *, uint32_t d, uint32_t s);
+static void	imul_byte (struct x86emu *, uint8_t s);
+static void	imul_word (struct x86emu *, uint16_t s);
+static void	imul_long (struct x86emu *, uint32_t s);
+static void	mul_byte (struct x86emu *, uint8_t s);
+static void	mul_word (struct x86emu *, uint16_t s);
+static void	mul_long (struct x86emu *, uint32_t s);
+static void	idiv_byte (struct x86emu *, uint8_t s);
+static void	idiv_word (struct x86emu *, uint16_t s);
+static void	idiv_long (struct x86emu *, uint32_t s);
+static void	div_byte (struct x86emu *, uint8_t s);
+static void	div_word (struct x86emu *, uint16_t s);
+static void	div_long (struct x86emu *, uint32_t s);
+static void	ins (struct x86emu *, int size);
+static void	outs (struct x86emu *, int size);
+static void	push_word (struct x86emu *, uint16_t w);
+static void	push_long (struct x86emu *, uint32_t w);
+static uint16_t	pop_word (struct x86emu *);
+static uint32_t	pop_long (struct x86emu *);
+
+/*
+ * REMARKS:
+ * Handles any pending asychronous interrupts.
+ */
+static void
+x86emu_intr_dispatch(struct x86emu *emu, uint8_t intno)
+{
+	if (emu->_x86emu_intrTab[intno]) {
+		(*emu->_x86emu_intrTab[intno]) (emu, intno);
+	} else {
+		push_word(emu, (uint16_t) emu->x86.R_FLG);
+		CLEAR_FLAG(F_IF);
+		CLEAR_FLAG(F_TF);
+		push_word(emu, emu->x86.R_CS);
+		emu->x86.R_CS = fetch_word(emu, 0, intno * 4 + 2);
+		push_word(emu, emu->x86.R_IP);
+		emu->x86.R_IP = fetch_word(emu, 0, intno * 4);
+	}
+}
+
+static void 
+x86emu_intr_handle(struct x86emu *emu)
+{
+	uint8_t intno;
+
+	if (emu->x86.intr & INTR_SYNCH) {
+		intno = emu->x86.intno;
+		emu->x86.intr = 0;
+		x86emu_intr_dispatch(emu, intno);
+	}
+}
+
+/*
+ * PARAMETERS:
+ * intrnum - Interrupt number to raise
+ * 
+ * REMARKS:
+ * Raise the specified interrupt to be handled before the execution of the
+ * next instruction.
+ */
+void 
+x86emu_intr_raise(struct x86emu *emu, uint8_t intrnum)
+{
+	emu->x86.intno = intrnum;
+	emu->x86.intr |= INTR_SYNCH;
+}
+
+/*
+ * REMARKS:
+ * Main execution loop for the emulator. We return from here when the system
+ * halts, which is normally caused by a stack fault when we return from the
+ * original real mode call.
+ */
+void 
+x86emu_exec(struct x86emu *emu)
+{
+	emu->x86.intr = 0;
+
+#ifdef _KERNEL
+	if (setjmp(&emu->exec_state))
+		return;
+#else
+	if (setjmp(emu->exec_state))
+		return;
+#endif
+
+	for (;;) {
+		if (emu->x86.intr) {
+			if (((emu->x86.intr & INTR_SYNCH) && (emu->x86.intno == 0 || emu->x86.intno == 2)) ||
+			    !ACCESS_FLAG(F_IF)) {
+				x86emu_intr_handle(emu);
+			}
+		}
+		if (emu->x86.R_CS == 0 && emu->x86.R_IP == 0)
+			return;
+		x86emu_exec_one_byte(emu);
+		++emu->cur_cycles;
+	}
+}
+
+void
+x86emu_exec_call(struct x86emu *emu, uint16_t seg, uint16_t off)
+{
+	push_word(emu, 0);
+	push_word(emu, 0);
+	emu->x86.R_CS = seg;
+	emu->x86.R_IP = off;
+
+	x86emu_exec(emu);
+}
+
+void
+x86emu_exec_intr(struct x86emu *emu, uint8_t intr)
+{
+	push_word(emu, emu->x86.R_FLG);
+	CLEAR_FLAG(F_IF);
+	CLEAR_FLAG(F_TF);
+	push_word(emu, 0);
+	push_word(emu, 0);
+	emu->x86.R_CS = (*emu->emu_rdw)(emu, intr * 4 + 2);
+	emu->x86.R_IP = (*emu->emu_rdw)(emu, intr * 4);
+	emu->x86.intr = 0;
+
+	x86emu_exec(emu);
+}
+
+/*
+ * REMARKS:
+ * Halts the system by setting the halted system flag.
+ */
+void 
+x86emu_halt_sys(struct x86emu *emu)
+{
+#ifdef _KERNEL
+	longjmp(&emu->exec_state);
+#else
+	longjmp(emu->exec_state, 1);
+#endif
+}
+
+/*
+ * PARAMETERS:
+ * mod		- Mod value from decoded byte
+ * regh	- Reg h value from decoded byte
+ * regl	- Reg l value from decoded byte
+ * 
+ * REMARKS:
+ * Raise the specified interrupt to be handled before the execution of the
+ * next instruction.
+ * 
+ * NOTE: Do not inline this function, as (*emu->emu_rdb) is already inline!
+ */
+static void 
+fetch_decode_modrm(struct x86emu *emu)
+{
+	int fetched;
+
+	fetched = fetch_byte_imm(emu);
+	emu->cur_mod = (fetched >> 6) & 0x03;
+	emu->cur_rh = (fetched >> 3) & 0x07;
+	emu->cur_rl = (fetched >> 0) & 0x07;
+}
+
+/*
+ * RETURNS:
+ * Immediate byte value read from instruction queue
+ * 
+ * REMARKS:
+ * This function returns the immediate byte from the instruction queue, and
+ * moves the instruction pointer to the next value.
+ * 
+ * NOTE: Do not inline this function, as (*emu->emu_rdb) is already inline!
+ */
+static uint8_t 
+fetch_byte_imm(struct x86emu *emu)
+{
+	uint8_t fetched;
+
+	fetched = fetch_byte(emu, emu->x86.R_CS, emu->x86.R_IP);
+	emu->x86.R_IP++;
+	return fetched;
+}
+
+/*
+ * RETURNS:
+ * Immediate word value read from instruction queue
+ * 
+ * REMARKS:
+ * This function returns the immediate byte from the instruction queue, and
+ * moves the instruction pointer to the next value.
+ * 
+ * NOTE: Do not inline this function, as (*emu->emu_rdw) is already inline!
+ */
+static uint16_t 
+fetch_word_imm(struct x86emu *emu)
+{
+	uint16_t fetched;
+
+	fetched = fetch_word(emu, emu->x86.R_CS, emu->x86.R_IP);
+	emu->x86.R_IP += 2;
+	return fetched;
+}
+
+/*
+ * RETURNS:
+ * Immediate lone value read from instruction queue
+ * 
+ * REMARKS:
+ * This function returns the immediate byte from the instruction queue, and
+ * moves the instruction pointer to the next value.
+ * 
+ * NOTE: Do not inline this function, as (*emu->emu_rdw) is already inline!
+ */
+static uint32_t 
+fetch_long_imm(struct x86emu *emu)
+{
+	uint32_t fetched;
+
+	fetched = fetch_long(emu, emu->x86.R_CS, emu->x86.R_IP);
+	emu->x86.R_IP += 4;
+	return fetched;
+}
+
+/*
+ * RETURNS:
+ * Value of the default data segment
+ * 
+ * REMARKS:
+ * Inline function that returns the default data segment for the current
+ * instruction.
+ * 
+ * On the x86 processor, the default segment is not always DS if there is
+ * no segment override. Address modes such as -3[BP] or 10[BP+SI] all refer to
+ * addresses relative to SS (ie: on the stack). So, at the minimum, all
+ * decodings of addressing modes would have to set/clear a bit describing
+ * whether the access is relative to DS or SS.  That is the function of the
+ * cpu-state-varible emu->x86.mode. There are several potential states:
+ * 
+ * 	repe prefix seen  (handled elsewhere)
+ * 	repne prefix seen  (ditto)
+ * 
+ * 	cs segment override
+ * 	ds segment override
+ * 	es segment override
+ * 	fs segment override
+ * 	gs segment override
+ * 	ss segment override
+ * 
+ * 	ds/ss select (in absense of override)
+ * 
+ * Each of the above 7 items are handled with a bit in the mode field.
+ */
+static uint32_t 
+get_data_segment(struct x86emu *emu)
+{
+	switch (emu->x86.mode & SYSMODE_SEGMASK) {
+	case 0:		/* default case: use ds register */
+	case SYSMODE_SEGOVR_DS:
+	case SYSMODE_SEGOVR_DS | SYSMODE_SEG_DS_SS:
+		return emu->x86.R_DS;
+	case SYSMODE_SEG_DS_SS:/* non-overridden, use ss register */
+		return emu->x86.R_SS;
+	case SYSMODE_SEGOVR_CS:
+	case SYSMODE_SEGOVR_CS | SYSMODE_SEG_DS_SS:
+		return emu->x86.R_CS;
+	case SYSMODE_SEGOVR_ES:
+	case SYSMODE_SEGOVR_ES | SYSMODE_SEG_DS_SS:
+		return emu->x86.R_ES;
+	case SYSMODE_SEGOVR_FS:
+	case SYSMODE_SEGOVR_FS | SYSMODE_SEG_DS_SS:
+		return emu->x86.R_FS;
+	case SYSMODE_SEGOVR_GS:
+	case SYSMODE_SEGOVR_GS | SYSMODE_SEG_DS_SS:
+		return emu->x86.R_GS;
+	case SYSMODE_SEGOVR_SS:
+	case SYSMODE_SEGOVR_SS | SYSMODE_SEG_DS_SS:
+		return emu->x86.R_SS;
+	}
+	x86emu_halt_sys(emu);
+}
+
+/*
+ * PARAMETERS:
+ * offset	- Offset to load data from
+ * 
+ * RETURNS:
+ * Byte value read from the absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_rdX) is already inline!
+ */
+static uint8_t 
+fetch_data_byte(struct x86emu *emu, uint32_t offset)
+{
+	return fetch_byte(emu, get_data_segment(emu), offset);
+}
+
+/*
+ * PARAMETERS:
+ * offset	- Offset to load data from
+ * 
+ * RETURNS:
+ * Word value read from the absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_rdX) is already inline!
+ */
+static uint16_t 
+fetch_data_word(struct x86emu *emu, uint32_t offset)
+{
+	return fetch_word(emu, get_data_segment(emu), offset);
+}
+
+/*
+ * PARAMETERS:
+ * offset	- Offset to load data from
+ * 
+ * RETURNS:
+ * Long value read from the absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_rdX) is already inline!
+ */
+static uint32_t 
+fetch_data_long(struct x86emu *emu, uint32_t offset)
+{
+	return fetch_long(emu, get_data_segment(emu), offset);
+}
+
+/*
+ * PARAMETERS:
+ * segment	- Segment to load data from
+ * offset	- Offset to load data from
+ * 
+ * RETURNS:
+ * Byte value read from the absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_rdX) is already inline!
+ */
+static uint8_t 
+fetch_byte(struct x86emu *emu, uint32_t segment, uint32_t offset)
+{
+	return (*emu->emu_rdb) (emu, ((uint32_t) segment << 4) + offset);
+}
+
+/*
+ * PARAMETERS:
+ * segment	- Segment to load data from
+ * offset	- Offset to load data from
+ * 
+ * RETURNS:
+ * Word value read from the absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_rdX) is already inline!
+ */
+static uint16_t 
+fetch_word(struct x86emu *emu, uint32_t segment, uint32_t offset)
+{
+	return (*emu->emu_rdw) (emu, ((uint32_t) segment << 4) + offset);
+}
+
+/*
+ * PARAMETERS:
+ * segment	- Segment to load data from
+ * offset	- Offset to load data from
+ * 
+ * RETURNS:
+ * Long value read from the absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_rdX) is already inline!
+ */
+static uint32_t 
+fetch_long(struct x86emu *emu, uint32_t segment, uint32_t offset)
+{
+	return (*emu->emu_rdl) (emu, ((uint32_t) segment << 4) + offset);
+}
+
+/*
+ * PARAMETERS:
+ * offset	- Offset to store data at
+ * val		- Value to store
+ * 
+ * REMARKS:
+ * Writes a word value to an segmented memory location. The segment used is
+ * the current 'default' segment, which may have been overridden.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_wrX) is already inline!
+ */
+static void 
+store_data_byte(struct x86emu *emu, uint32_t offset, uint8_t val)
+{
+	store_byte(emu, get_data_segment(emu), offset, val);
+}
+
+/*
+ * PARAMETERS:
+ * offset	- Offset to store data at
+ * val		- Value to store
+ * 
+ * REMARKS:
+ * Writes a word value to an segmented memory location. The segment used is
+ * the current 'default' segment, which may have been overridden.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_wrX) is already inline!
+ */
+static void 
+store_data_word(struct x86emu *emu, uint32_t offset, uint16_t val)
+{
+	store_word(emu, get_data_segment(emu), offset, val);
+}
+
+/*
+ * PARAMETERS:
+ * offset	- Offset to store data at
+ * val		- Value to store
+ * 
+ * REMARKS:
+ * Writes a long value to an segmented memory location. The segment used is
+ * the current 'default' segment, which may have been overridden.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_wrX) is already inline!
+ */
+static void 
+store_data_long(struct x86emu *emu, uint32_t offset, uint32_t val)
+{
+	store_long(emu, get_data_segment(emu), offset, val);
+}
+
+/*
+ * PARAMETERS:
+ * segment	- Segment to store data at
+ * offset	- Offset to store data at
+ * val		- Value to store
+ * 
+ * REMARKS:
+ * Writes a byte value to an absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_wrX) is already inline!
+ */
+static void 
+store_byte(struct x86emu *emu, uint32_t segment, uint32_t offset, uint8_t val)
+{
+	(*emu->emu_wrb) (emu, ((uint32_t) segment << 4) + offset, val);
+}
+
+/*
+ * PARAMETERS:
+ * segment	- Segment to store data at
+ * offset	- Offset to store data at
+ * val		- Value to store
+ * 
+ * REMARKS:
+ * Writes a word value to an absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_wrX) is already inline!
+ */
+static void 
+store_word(struct x86emu *emu, uint32_t segment, uint32_t offset, uint16_t val)
+{
+	(*emu->emu_wrw) (emu, ((uint32_t) segment << 4) + offset, val);
+}
+
+/*
+ * PARAMETERS:
+ * segment	- Segment to store data at
+ * offset	- Offset to store data at
+ * val		- Value to store
+ * 
+ * REMARKS:
+ * Writes a long value to an absolute memory location.
+ * 
+ * NOTE: Do not inline this function as (*emu->emu_wrX) is already inline!
+ */
+static void 
+store_long(struct x86emu *emu, uint32_t segment, uint32_t offset, uint32_t val)
+{
+	(*emu->emu_wrl) (emu, ((uint32_t) segment << 4) + offset, val);
+}
+
+/*
+ * PARAMETERS:
+ * reg	- Register to decode
+ * 
+ * RETURNS:
+ * Pointer to the appropriate register
+ * 
+ * REMARKS:
+ * Return a pointer to the register given by the R/RM field of the
+ * modrm byte, for byte operands. Also enables the decoding of instructions.
+ */
+static uint8_t *
+decode_rm_byte_register(struct x86emu *emu, int reg)
+{
+	switch (reg) {
+	case 0:
+		return &emu->x86.R_AL;
+	case 1:
+		return &emu->x86.R_CL;
+	case 2:
+		return &emu->x86.R_DL;
+	case 3:
+		return &emu->x86.R_BL;
+	case 4:
+		return &emu->x86.R_AH;
+	case 5:
+		return &emu->x86.R_CH;
+	case 6:
+		return &emu->x86.R_DH;
+	case 7:
+		return &emu->x86.R_BH;
+	default:
+		x86emu_halt_sys(emu);
+	}
+}
+
+static uint8_t *
+decode_rl_byte_register(struct x86emu *emu)
+{
+	return decode_rm_byte_register(emu, emu->cur_rl);
+}
+
+static uint8_t *
+decode_rh_byte_register(struct x86emu *emu)
+{
+	return decode_rm_byte_register(emu, emu->cur_rh);
+}
+
+/*
+ * PARAMETERS:
+ * reg	- Register to decode
+ * 
+ * RETURNS:
+ * Pointer to the appropriate register
+ * 
+ * REMARKS:
+ * Return a pointer to the register given by the R/RM field of the
+ * modrm byte, for word operands.  Also enables the decoding of instructions.
+ */
+static uint16_t *
+decode_rm_word_register(struct x86emu *emu, int reg)
+{
+	switch (reg) {
+	case 0:
+		return &emu->x86.R_AX;
+	case 1:
+		return &emu->x86.R_CX;
+	case 2:
+		return &emu->x86.R_DX;
+	case 3:
+		return &emu->x86.R_BX;
+	case 4:
+		return &emu->x86.R_SP;
+	case 5:
+		return &emu->x86.R_BP;
+	case 6:
+		return &emu->x86.R_SI;
+	case 7:
+		return &emu->x86.R_DI;
+	default:
+		x86emu_halt_sys(emu);
+	}
+}
+
+static uint16_t *
+decode_rl_word_register(struct x86emu *emu)
+{
+	return decode_rm_word_register(emu, emu->cur_rl);
+}
+
+static uint16_t *
+decode_rh_word_register(struct x86emu *emu)
+{
+	return decode_rm_word_register(emu, emu->cur_rh);
+}
+
+/*
+ * PARAMETERS:
+ * reg	- Register to decode
+ * 
+ * RETURNS:
+ * Pointer to the appropriate register
+ * 
+ * REMARKS:
+ * Return a pointer to the register given by the R/RM field of the
+ * modrm byte, for dword operands.  Also enables the decoding of instructions.
+ */
+static uint32_t *
+decode_rm_long_register(struct x86emu *emu, int reg)
+{
+	switch (reg) {
+	case 0:
+		return &emu->x86.R_EAX;
+	case 1:
+		return &emu->x86.R_ECX;
+	case 2:
+		return &emu->x86.R_EDX;
+	case 3:
+		return &emu->x86.R_EBX;
+	case 4:
+		return &emu->x86.R_ESP;
+	case 5:
+		return &emu->x86.R_EBP;
+	case 6:
+		return &emu->x86.R_ESI;
+	case 7:
+		return &emu->x86.R_EDI;
+	default:
+		x86emu_halt_sys(emu);
+	}
+}
+
+static uint32_t *
+decode_rl_long_register(struct x86emu *emu)
+{
+	return decode_rm_long_register(emu, emu->cur_rl);
+}
+
+static uint32_t *
+decode_rh_long_register(struct x86emu *emu)
+{
+	return decode_rm_long_register(emu, emu->cur_rh);
+}
+
+
+/*
+ * PARAMETERS:
+ * reg	- Register to decode
+ * 
+ * RETURNS:
+ * Pointer to the appropriate register
+ * 
+ * REMARKS:
+ * Return a pointer to the register given by the R/RM field of the
+ * modrm byte, for word operands, modified from above for the weirdo
+ * special case of segreg operands.  Also enables the decoding of instructions.
+ */
+static uint16_t *
+decode_rh_seg_register(struct x86emu *emu)
+{
+	switch (emu->cur_rh) {
+	case 0:
+		return &emu->x86.R_ES;
+	case 1:
+		return &emu->x86.R_CS;
+	case 2:
+		return &emu->x86.R_SS;
+	case 3:
+		return &emu->x86.R_DS;
+	case 4:
+		return &emu->x86.R_FS;
+	case 5:
+		return &emu->x86.R_GS;
+	default:
+		x86emu_halt_sys(emu);
+	}
+}
+/*
+ *
+ * return offset from the SIB Byte
+ */
+static uint32_t 
+decode_sib_address(struct x86emu *emu, int sib, int mod)
+{
+	uint32_t base = 0, i = 0, scale = 1;
+
+	switch (sib & 0x07) {
+	case 0:
+		base = emu->x86.R_EAX;
+		break;
+	case 1:
+		base = emu->x86.R_ECX;
+
+		break;
+	case 2:
+		base = emu->x86.R_EDX;
+		break;
+	case 3:
+		base = emu->x86.R_EBX;
+		break;
+	case 4:
+		base = emu->x86.R_ESP;
+		emu->x86.mode |= SYSMODE_SEG_DS_SS;
+		break;
+	case 5:
+		if (mod == 0) {
+			base = fetch_long_imm(emu);
+		} else {
+			base = emu->x86.R_EBP;
+			emu->x86.mode |= SYSMODE_SEG_DS_SS;
+		}
+		break;
+	case 6:
+		base = emu->x86.R_ESI;
+		break;
+	case 7:
+		base = emu->x86.R_EDI;
+		break;
+	}
+	switch ((sib >> 3) & 0x07) {
+	case 0:
+		i = emu->x86.R_EAX;
+		break;
+	case 1:
+		i = emu->x86.R_ECX;
+		break;
+	case 2:
+		i = emu->x86.R_EDX;
+		break;
+	case 3:
+		i = emu->x86.R_EBX;
+		break;
+	case 4:
+		i = 0;
+		break;
+	case 5:
+		i = emu->x86.R_EBP;
+		break;
+	case 6:
+		i = emu->x86.R_ESI;
+		break;
+	case 7:
+		i = emu->x86.R_EDI;
+		break;
+	}
+	scale = 1 << ((sib >> 6) & 0x03);
+	return base + (i * scale);
+}
+
+/*
+ * PARAMETERS:
+ * rm	- RM value to decode
+ * 
+ * RETURNS:
+ * Offset in memory for the address decoding
+ * 
+ * REMARKS:
+ * Return the offset given by mod=00, mod=01 or mod=10 addressing.
+ * Also enables the decoding of instructions.
+ */
+static uint32_t
+decode_rl_address(struct x86emu *emu)
+{
+	if (emu->x86.mode & SYSMODE_PREFIX_ADDR) {
+		uint32_t offset, sib;
+		/* 32-bit addressing */
+		switch (emu->cur_rl) {
+		case 0:
+			offset = emu->x86.R_EAX;
+			break;
+		case 1:
+			offset = emu->x86.R_ECX;
+			break;
+		case 2:
+			offset = emu->x86.R_EDX;
+			break;
+		case 3:
+			offset = emu->x86.R_EBX;
+			break;
+		case 4:
+			sib = fetch_byte_imm(emu);
+			offset = decode_sib_address(emu, sib, 0);
+			break;
+		case 5:
+			if (emu->cur_mod == 0) {
+				offset = fetch_long_imm(emu);
+			} else {
+				emu->x86.mode |= SYSMODE_SEG_DS_SS;
+				offset = emu->x86.R_EBP;
+			}
+			break;
+		case 6:
+			offset = emu->x86.R_ESI;
+			break;
+		case 7:
+			offset = emu->x86.R_EDI;
+			break;
+		default:
+			x86emu_halt_sys(emu);
+		}
+		if (emu->cur_mod == 1)
+			offset += (int8_t)fetch_byte_imm(emu);
+		else if (emu->cur_mod == 2)
+			offset += fetch_long_imm(emu);
+		return offset;
+	} else {
+		uint16_t offset;
+
+		/* 16-bit addressing */
+		switch (emu->cur_rl) {
+		case 0:
+			offset = emu->x86.R_BX + emu->x86.R_SI;
+			break;
+		case 1:
+			offset = emu->x86.R_BX + emu->x86.R_DI;
+			break;
+		case 2:
+			emu->x86.mode |= SYSMODE_SEG_DS_SS;
+			offset = emu->x86.R_BP + emu->x86.R_SI;
+			break;
+		case 3:
+			emu->x86.mode |= SYSMODE_SEG_DS_SS;
+			offset = emu->x86.R_BP + emu->x86.R_DI;
+			break;
+		case 4:
+			offset = emu->x86.R_SI;
+			break;
+		case 5:
+			offset = emu->x86.R_DI;
+			break;
+		case 6:
+			if (emu->cur_mod == 0) {
+				offset = fetch_word_imm(emu);
+			} else {
+				emu->x86.mode |= SYSMODE_SEG_DS_SS;
+				offset = emu->x86.R_BP;
+			}
+			break;
+		case 7:
+			offset = emu->x86.R_BX;
+			break;
+		default:
+			x86emu_halt_sys(emu);
+		}
+		if (emu->cur_mod == 1)
+			offset += (int8_t)fetch_byte_imm(emu);
+		else if (emu->cur_mod == 2)
+			offset += fetch_word_imm(emu);
+		return offset;
+	}
+}
+
+static uint8_t
+decode_and_fetch_byte(struct x86emu *emu)
+{
+	if (emu->cur_mod != 3) {
+		emu->cur_offset = decode_rl_address(emu);
+		return fetch_data_byte(emu, emu->cur_offset);
+	} else {
+		return *decode_rl_byte_register(emu);
+	}
+}
+
+static uint16_t
+decode_and_fetch_word_disp(struct x86emu *emu, int16_t disp)
+{
+	if (emu->cur_mod != 3) {
+		/* TODO: A20 gate emulation */
+		emu->cur_offset = decode_rl_address(emu) + disp;
+		if ((emu->x86.mode & SYSMODE_PREFIX_ADDR) == 0)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 01:16:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 396F9106566B;
	Wed,  9 Sep 2009 01:16:51 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F8648FC0A;
	Wed,  9 Sep 2009 01:16:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n891Gowb067955;
	Wed, 9 Sep 2009 01:16:50 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n891Gote067954;
	Wed, 9 Sep 2009 01:16:50 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090116.n891Gote067954@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 01:16:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor-sys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197008 - vendor-sys/x86emu/4.6
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 01:16:51 -0000

Author: delphij
Date: Wed Sep  9 01:16:50 2009
New Revision: 197008
URL: http://svn.freebsd.org/changeset/base/197008

Log:
  Tag for 4.6 as the code was checked out from OPENBSD_4_6.

Added:
  vendor-sys/x86emu/4.6/
     - copied from r197007, vendor-sys/x86emu/dist/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 01:19:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E5D7106568B;
	Wed,  9 Sep 2009 01:19:26 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 557168FC16;
	Wed,  9 Sep 2009 01:19:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n891JQS7068057;
	Wed, 9 Sep 2009 01:19:26 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n891JQV4068056;
	Wed, 9 Sep 2009 01:19:26 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090119.n891JQV4068056@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 01:19:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197009 - head/sys/contrib/x86emu
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 01:19:26 -0000

Author: delphij
Date: Wed Sep  9 01:19:26 2009
New Revision: 197009
URL: http://svn.freebsd.org/changeset/base/197009

Log:
  Import x86emu from OpenBSD as of OPENBSD_4_6.

Added:
  head/sys/contrib/x86emu/
     - copied from r197008, vendor-sys/x86emu/dist/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 03:36:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D74C106566C;
	Wed,  9 Sep 2009 03:36:44 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 421268FC15;
	Wed,  9 Sep 2009 03:36:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n893aigV071256;
	Wed, 9 Sep 2009 03:36:44 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n893aiiM071255;
	Wed, 9 Sep 2009 03:36:44 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200909090336.n893aiiM071255@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 9 Sep 2009 03:36:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197010 - head/sys/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 03:36:44 -0000

Author: emaste
Date: Wed Sep  9 03:36:43 2009
New Revision: 197010
URL: http://svn.freebsd.org/changeset/base/197010

Log:
  Compare pointer with NULL, not 0.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==============================================================================
--- head/sys/net/if_vlan.c	Wed Sep  9 01:19:26 2009	(r197009)
+++ head/sys/net/if_vlan.c	Wed Sep  9 03:36:43 2009	(r197010)
@@ -1364,7 +1364,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
 			break;
 		}
 		p = ifunit(vlr.vlr_parent);
-		if (p == 0) {
+		if (p == NULL) {
 			error = ENOENT;
 			break;
 		}

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 03:41:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 002CA106566B;
	Wed,  9 Sep 2009 03:41:40 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E23388FC16;
	Wed,  9 Sep 2009 03:41:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n893feDx071379;
	Wed, 9 Sep 2009 03:41:40 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n893feU8071377;
	Wed, 9 Sep 2009 03:41:40 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200909090341.n893feU8071377@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 9 Sep 2009 03:41:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197011 - head/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 03:41:41 -0000

Author: emaste
Date: Wed Sep  9 03:41:40 2009
New Revision: 197011
URL: http://svn.freebsd.org/changeset/base/197011

Log:
  Increase AAC_CMD_TIMEOUT from 30s to 120s to help avoid spurious
  "COMMAND 0x........ TIMEOUT AFTER .. SECONDS" messages.  Any commands
  that get truly stuck will still trigger the warning and the hardware
  health check, just a little bit later.

Modified:
  head/sys/dev/aac/aacvar.h

Modified: head/sys/dev/aac/aacvar.h
==============================================================================
--- head/sys/dev/aac/aacvar.h	Wed Sep  9 03:36:43 2009	(r197010)
+++ head/sys/dev/aac/aacvar.h	Wed Sep  9 03:41:40 2009	(r197011)
@@ -88,7 +88,7 @@
 /*
  * Timeout for normal commands
  */
-#define AAC_CMD_TIMEOUT		30		/* seconds */
+#define AAC_CMD_TIMEOUT		120		/* seconds */
 
 /*
  * Rate at which we periodically check for timed out commands and kick the

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 04:04:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E1D84106566C;
	Wed,  9 Sep 2009 04:04:09 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFD838FC0A;
	Wed,  9 Sep 2009 04:04:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89449mZ072011;
	Wed, 9 Sep 2009 04:04:09 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n894498B072009;
	Wed, 9 Sep 2009 04:04:09 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200909090404.n894498B072009@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 9 Sep 2009 04:04:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197016 - head/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 04:04:10 -0000

Author: emaste
Date: Wed Sep  9 04:04:09 2009
New Revision: 197016
URL: http://svn.freebsd.org/changeset/base/197016

Log:
  Whitespace tweak.
  
  Submitted by:	phk, via accidental commit in r196969.

Modified:
  head/sys/dev/aac/aac.c

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c	Wed Sep  9 03:59:46 2009	(r197015)
+++ head/sys/dev/aac/aac.c	Wed Sep  9 04:04:09 2009	(r197016)
@@ -3556,7 +3556,7 @@ aac_supported_features(struct aac_softc 
 	 * associated with the feature in the data field or perform whatever
 	 * action needed indicates in the data field.
 	 */
-	 if (f.feat.fValue == 0) {
+	if (f.feat.fValue == 0) {
 		f.feat.fBits.largeLBA =
 		    (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0;
 		/* TODO: In the future, add other features state here as well */

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 04:36:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2B18E106566C;
	Wed,  9 Sep 2009 04:36:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 18B648FC15;
	Wed,  9 Sep 2009 04:36:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n894auth072645;
	Wed, 9 Sep 2009 04:36:56 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n894auVG072643;
	Wed, 9 Sep 2009 04:36:56 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200909090436.n894auVG072643@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 9 Sep 2009 04:36:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197017 - head/sys/dev/sound/pci/hda
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 04:36:57 -0000

Author: mav
Date: Wed Sep  9 04:36:56 2009
New Revision: 197017
URL: http://svn.freebsd.org/changeset/base/197017

Log:
  Add Intel 82801JD (one more ICH10) HDA controller ID.
  
  Submitted by:	yongari

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Wed Sep  9 04:04:09 2009	(r197016)
+++ head/sys/dev/sound/pci/hda/hdac.c	Wed Sep  9 04:36:56 2009	(r197017)
@@ -146,7 +146,8 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define HDA_INTEL_82801G	HDA_MODEL_CONSTRUCT(INTEL, 0x27d8)
 #define HDA_INTEL_82801H	HDA_MODEL_CONSTRUCT(INTEL, 0x284b)
 #define HDA_INTEL_82801I	HDA_MODEL_CONSTRUCT(INTEL, 0x293e)
-#define HDA_INTEL_82801J	HDA_MODEL_CONSTRUCT(INTEL, 0x3a3e)
+#define HDA_INTEL_82801JI	HDA_MODEL_CONSTRUCT(INTEL, 0x3a3e)
+#define HDA_INTEL_82801JD	HDA_MODEL_CONSTRUCT(INTEL, 0x3a6e)
 #define HDA_INTEL_PCH		HDA_MODEL_CONSTRUCT(INTEL, 0x3b56)
 #define HDA_INTEL_SCH		HDA_MODEL_CONSTRUCT(INTEL, 0x811b)
 #define HDA_INTEL_ALL		HDA_MODEL_CONSTRUCT(INTEL, 0xffff)
@@ -486,7 +487,8 @@ static const struct {
 	{ HDA_INTEL_82801G,  "Intel 82801G",	0 },
 	{ HDA_INTEL_82801H,  "Intel 82801H",	0 },
 	{ HDA_INTEL_82801I,  "Intel 82801I",	0 },
-	{ HDA_INTEL_82801J,  "Intel 82801J",	0 },
+	{ HDA_INTEL_82801JI, "Intel 82801JI",	0 },
+	{ HDA_INTEL_82801JD, "Intel 82801JD",	0 },
 	{ HDA_INTEL_PCH,     "Intel PCH",	0 },
 	{ HDA_INTEL_SCH,     "Intel SCH",	0 },
 	{ HDA_NVIDIA_MCP51,  "NVidia MCP51",	HDAC_NO_MSI },

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 04:48:42 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 630991065676;
	Wed,  9 Sep 2009 04:48:42 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 50BA18FC12;
	Wed,  9 Sep 2009 04:48:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n894mfjZ072945;
	Wed, 9 Sep 2009 04:48:41 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n894mfWi072943;
	Wed, 9 Sep 2009 04:48:41 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200909090448.n894mfWi072943@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 9 Sep 2009 04:48:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197018 - head/sys/dev/sound/pci/hda
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 04:48:42 -0000

Author: mav
Date: Wed Sep  9 04:48:41 2009
New Revision: 197018
URL: http://svn.freebsd.org/changeset/base/197018

Log:
  Add NVidia MCP89 HDA controller IDs.

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Wed Sep  9 04:36:56 2009	(r197017)
+++ head/sys/dev/sound/pci/hda/hdac.c	Wed Sep  9 04:48:41 2009	(r197018)
@@ -172,6 +172,10 @@ SND_DECLARE_FILE("$FreeBSD$");
 #define HDA_NVIDIA_MCP79_2	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac1)
 #define HDA_NVIDIA_MCP79_3	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac2)
 #define HDA_NVIDIA_MCP79_4	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0ac3)
+#define HDA_NVIDIA_MCP89_1	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0d94)
+#define HDA_NVIDIA_MCP89_2	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0d95)
+#define HDA_NVIDIA_MCP89_3	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0d96)
+#define HDA_NVIDIA_MCP89_4	HDA_MODEL_CONSTRUCT(NVIDIA, 0x0d97)
 #define HDA_NVIDIA_ALL		HDA_MODEL_CONSTRUCT(NVIDIA, 0xffff)
 
 /* ATI */
@@ -509,6 +513,10 @@ static const struct {
 	{ HDA_NVIDIA_MCP79_2, "NVidia MCP79",	0 },
 	{ HDA_NVIDIA_MCP79_3, "NVidia MCP79",	0 },
 	{ HDA_NVIDIA_MCP79_4, "NVidia MCP79",	0 },
+	{ HDA_NVIDIA_MCP89_1, "NVidia MCP89",	0 },
+	{ HDA_NVIDIA_MCP89_2, "NVidia MCP89",	0 },
+	{ HDA_NVIDIA_MCP89_3, "NVidia MCP89",	0 },
+	{ HDA_NVIDIA_MCP89_4, "NVidia MCP89",	0 },
 	{ HDA_ATI_SB450,     "ATI SB450",	0 },
 	{ HDA_ATI_SB600,     "ATI SB600",	0 },
 	{ HDA_ATI_RS600,     "ATI RS600",	0 },

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 05:53:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E2C3106566B;
	Wed,  9 Sep 2009 05:53:26 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8AD1E8FC0C;
	Wed,  9 Sep 2009 05:53:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n895rQIq074207;
	Wed, 9 Sep 2009 05:53:26 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n895rQhv074197;
	Wed, 9 Sep 2009 05:53:26 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090553.n895rQhv074197@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 05:53:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197019 - in head/sys: conf contrib/x86emu modules
	modules/x86emu sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 05:53:26 -0000

Author: delphij
Date: Wed Sep  9 05:53:26 2009
New Revision: 197019
URL: http://svn.freebsd.org/changeset/base/197019

Log:
   - Port x86emu to FreeBSD.
   - Connect x86emu to build.
  
  Tested with:	make universe
  Submitted by:	swell.k at gmail com

Added:
  head/sys/modules/x86emu/
  head/sys/modules/x86emu/Makefile   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/contrib/x86emu/x86emu.c   (contents, props changed)
  head/sys/contrib/x86emu/x86emu.h   (contents, props changed)
  head/sys/contrib/x86emu/x86emu_util.c   (contents, props changed)
  head/sys/modules/Makefile
  head/sys/sys/param.h

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/conf/NOTES	Wed Sep  9 05:53:26 2009	(r197019)
@@ -2756,3 +2756,6 @@ options 	AAC_DEBUG	# Debugging levels:
 ##options 	BKTR_ALLOC_PAGES=(217*4+1)
 options 	BROOKTREE_ALLOC_PAGES=(217*4+1)
 options 	MAXFILES=999
+
+# x86 real mode emulator
+options		X86EMU

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/conf/files	Wed Sep  9 05:53:26 2009	(r197019)
@@ -2826,4 +2826,6 @@ dev/xen/netfront/netfront.c	optional xen
 dev/xen/xenpci/xenpci.c		optional xenpci
 dev/xen/xenpci/evtchn.c         optional xenpci
 dev/xen/xenpci/machine_reboot.c optional xenpci
+contrib/x86emu/x86emu.c		optional x86emu
+contrib/x86emu/x86emu_util.c	optional x86emu
 

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/conf/options	Wed Sep  9 05:53:26 2009	(r197019)
@@ -836,3 +836,5 @@ SND_FEEDER_FULL_MULTIFORMAT	opt_snd.h
 SND_FEEDER_RATE_HP	opt_snd.h
 SND_PCM_64		opt_snd.h
 SND_OLDSTEREO		opt_snd.h
+
+X86EMU

Modified: head/sys/contrib/x86emu/x86emu.c
==============================================================================
--- head/sys/contrib/x86emu/x86emu.c	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/contrib/x86emu/x86emu.c	Wed Sep  9 05:53:26 2009	(r197019)
@@ -1,5 +1,6 @@
 /*	$OpenBSD: x86emu.c,v 1.4 2009/06/18 14:19:21 pirofti Exp $	*/
 /*	$NetBSD: x86emu.c,v 1.7 2009/02/03 19:26:29 joerg Exp $	*/
+/*	$FreeBSD$	*/
 
 /*
  *
@@ -32,8 +33,12 @@
  *
  */
 
-#include 
-#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
 
 static void 	x86emu_intr_raise (struct x86emu *, uint8_t type);
 
@@ -45,7 +50,7 @@ static uint8_t	fetch_byte_imm (struct x8
 static uint16_t	fetch_word_imm (struct x86emu *);
 static uint32_t	fetch_long_imm (struct x86emu *);
 static uint8_t	fetch_data_byte (struct x86emu *, uint32_t offset);
-static uint8_t	fetch_byte (struct x86emu *, uint segment, uint32_t offset);
+static uint8_t	fetch_byte (struct x86emu *, u_int segment, uint32_t offset);
 static uint16_t	fetch_data_word (struct x86emu *, uint32_t offset);
 static uint16_t	fetch_word (struct x86emu *, uint32_t segment, uint32_t offset);
 static uint32_t	fetch_data_long (struct x86emu *, uint32_t offset);
@@ -227,13 +232,8 @@ x86emu_exec(struct x86emu *emu)
 {
 	emu->x86.intr = 0;
 
-#ifdef _KERNEL
-	if (setjmp(&emu->exec_state))
-		return;
-#else
 	if (setjmp(emu->exec_state))
 		return;
-#endif
 
 	for (;;) {
 		if (emu->x86.intr) {
@@ -282,11 +282,7 @@ x86emu_exec_intr(struct x86emu *emu, uin
 void 
 x86emu_halt_sys(struct x86emu *emu)
 {
-#ifdef _KERNEL
-	longjmp(&emu->exec_state);
-#else
 	longjmp(emu->exec_state, 1);
-#endif
 }
 
 /*
@@ -8339,3 +8335,32 @@ pop_long(struct x86emu *emu)
 	emu->x86.R_SP += 4;
 	return res;
 }
+
+static int
+x86emu_modevent(module_t mod __unused, int type, void *data __unused)
+{
+	int err = 0;
+
+	switch (type) {
+	case MOD_LOAD:
+		break;
+
+	case MOD_UNLOAD:
+		break;
+
+	default:
+		err = ENOTSUP;
+		break;
+
+	}
+	return (err);
+}
+
+static moduledata_t x86emu_mod = {
+	"x86emu",
+	x86emu_modevent,
+	NULL,
+};
+
+DECLARE_MODULE(x86emu, x86emu_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
+MODULE_VERSION(x86emu, 1);

Modified: head/sys/contrib/x86emu/x86emu.h
==============================================================================
--- head/sys/contrib/x86emu/x86emu.h	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/contrib/x86emu/x86emu.h	Wed Sep  9 05:53:26 2009	(r197019)
@@ -1,5 +1,6 @@
 /*	$NetBSD: x86emu.h,v 1.1 2007/12/01 20:14:10 joerg Exp $	*/
 /*	$OpenBSD: x86emu.h,v 1.3 2009/06/06 03:45:05 matthieu Exp $ */
+/*	$FreeBSD$	*/
 
 /****************************************************************************
 *
@@ -40,6 +41,7 @@
 
 #ifdef _KERNEL
 #include 
+#include 
 #else
 #include 
 #endif
@@ -140,11 +142,7 @@ struct x86emu {
 	void        		*sys_private;
 	struct x86emu_regs	x86;
 
-#ifdef _KERNEL
-	label_t		exec_state;
-#else
 	jmp_buf		exec_state;
-#endif
 
 	uint64_t	cur_cycles;
 
@@ -179,7 +177,7 @@ void	x86emu_init_default(struct x86emu *
 void 	x86emu_exec(struct x86emu *);
 void	x86emu_exec_call(struct x86emu *, uint16_t, uint16_t);
 void	x86emu_exec_intr(struct x86emu *, uint8_t);
-void 	x86emu_halt_sys(struct x86emu *) __dead;
+void 	x86emu_halt_sys(struct x86emu *) __dead2;
 
 __END_DECLS
 

Modified: head/sys/contrib/x86emu/x86emu_util.c
==============================================================================
--- head/sys/contrib/x86emu/x86emu_util.c	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/contrib/x86emu/x86emu_util.c	Wed Sep  9 05:53:26 2009	(r197019)
@@ -1,5 +1,6 @@
 /*	$OpenBSD: x86emu_util.c,v 1.5 2009/06/18 14:19:21 pirofti Exp $	*/
 /*	$NetBSD: x86emu_util.c,v 1.2 2007/12/04 17:32:22 joerg Exp $	*/
+/*	$FreeBSD$	*/
 
 /*
  *
@@ -35,8 +36,8 @@
 #include 
 #include 
 
-#include 
-#include 
+#include 
+#include 
 
 
 
@@ -82,9 +83,9 @@ rdw(struct x86emu *emu, uint32_t addr)
 		    ((*(a + 1) << 8) & 0xff00);
 		return r;
 	} else
-		return letoh32(*(u_int32_t *)(emu->mem_base + addr));
+		return le32toh(*(u_int32_t *)(emu->mem_base + addr));
 #else
-	return letoh16(*(u_int16_t *)(emu->mem_base + addr));
+	return le16toh(*(u_int16_t *)(emu->mem_base + addr));
 #endif
 }
 
@@ -113,9 +114,9 @@ rdl(struct x86emu *emu, uint32_t addr)
 		    ((*(a + 3) << 24) & 0xff000000);
 		return r;
 	} else
-		return letoh32(*(u_int32_t *)(emu->mem_base + addr));
+		return le32toh(*(u_int32_t *)(emu->mem_base + addr));
 #else
-	return letoh32(*(u_int32_t *)(emu->mem_base + addr));
+	return le32toh(*(u_int32_t *)(emu->mem_base + addr));
 #endif
 }
 

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/modules/Makefile	Wed Sep  9 05:53:26 2009	(r197019)
@@ -298,6 +298,7 @@ SUBDIR=	${_3dfx} \
 	wlan_xauth \
 	${_wpi} \
 	${_wpifw} \
+	x86emu \
 	${_xe} \
 	xfs \
 	xl \

Added: head/sys/modules/x86emu/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/x86emu/Makefile	Wed Sep  9 05:53:26 2009	(r197019)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+.PATH:	${.CURDIR}/../../contrib/x86emu
+
+KMOD=	x86emu
+SRCS=	x86emu.c x86emu_util.c
+
+.include 

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Wed Sep  9 04:48:41 2009	(r197018)
+++ head/sys/sys/param.h	Wed Sep  9 05:53:26 2009	(r197019)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 900000	/* Master, propagated to newvers */
+#define __FreeBSD_version 900001	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 06:49:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2ABC9106566B;
	Wed,  9 Sep 2009 06:49:50 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 198CF8FC13;
	Wed,  9 Sep 2009 06:49:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n896nnKU075338;
	Wed, 9 Sep 2009 06:49:49 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n896nngA075336;
	Wed, 9 Sep 2009 06:49:49 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200909090649.n896nngA075336@svn.freebsd.org>
From: Warner Losh 
Date: Wed, 9 Sep 2009 06:49:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197020 - head/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 06:49:50 -0000

Author: imp
Date: Wed Sep  9 06:49:49 2009
New Revision: 197020
URL: http://svn.freebsd.org/changeset/base/197020

Log:
  kern_execve.c hasn't been around in ages, so update the file(s) where
  a_magic is used instead of the a_midmag....
  
  # maybe we can retire this hack soon...

Modified:
  head/sys/sys/imgact_aout.h

Modified: head/sys/sys/imgact_aout.h
==============================================================================
--- head/sys/sys/imgact_aout.h	Wed Sep  9 05:53:26 2009	(r197019)
+++ head/sys/sys/imgact_aout.h	Wed Sep  9 06:49:49 2009	(r197020)
@@ -119,7 +119,7 @@ struct exec {
      uint32_t	a_trsize;	/* text relocation size */
      uint32_t	a_drsize;	/* data relocation size */
 };
-#define a_magic a_midmag /* XXX Hack to work with current kern_execve.c */
+#define a_magic a_midmag /* XXX Hack to work with imgact_{aout,gzip}.c */
 
 /* a_magic */
 #define	OMAGIC		0407	/* old impure format */

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 07:42:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A2DE1065672;
	Wed,  9 Sep 2009 07:42:05 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 703AF8FC12;
	Wed,  9 Sep 2009 07:42:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n897g5w9076995;
	Wed, 9 Sep 2009 07:42:05 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n897g5A4076994;
	Wed, 9 Sep 2009 07:42:05 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090742.n897g5A4076994@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 07:42:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197021 - head/sys/dev/dpms
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 07:42:05 -0000

Author: delphij
Date: Wed Sep  9 07:42:04 2009
New Revision: 197021
URL: http://svn.freebsd.org/changeset/base/197021

Log:
  Add a directory to hold dpms stuff separated from i386/isa/.

Added:
  head/sys/dev/dpms/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 07:45:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F16981065693;
	Wed,  9 Sep 2009 07:45:08 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF1958FC1A;
	Wed,  9 Sep 2009 07:45:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n897j8L4077121;
	Wed, 9 Sep 2009 07:45:08 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n897j876077117;
	Wed, 9 Sep 2009 07:45:08 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090745.n897j876077117@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 07:45:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197022 - in head/sys/dev: dpms fb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 07:45:09 -0000

Author: delphij
Date: Wed Sep  9 07:45:08 2009
New Revision: 197022
URL: http://svn.freebsd.org/changeset/base/197022

Log:
  Copy the following files to new places, a subsequent commit would remove
  them from the old place.  This commit necessary so that the tree would not
  enter a broken state.
  
  	sys/i386/isa/vesa.c -> dev/fb/vesa.c
  	sys/i386/include/pc/vesa.h -> dev/fb/vesa.h
  	sys/i386/isa/dpms.c -> dev/dpms/dpms.c

Added:
  head/sys/dev/dpms/dpms.c
     - copied unchanged from r197019, head/sys/i386/isa/dpms.c
  head/sys/dev/fb/vesa.c
     - copied unchanged from r197019, head/sys/i386/isa/vesa.c
  head/sys/dev/fb/vesa.h
     - copied unchanged from r197019, head/sys/i386/include/pc/vesa.h

Copied: head/sys/dev/dpms/dpms.c (from r197019, head/sys/i386/isa/dpms.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/dpms/dpms.c	Wed Sep  9 07:45:08 2009	(r197022, copy of r197019, head/sys/i386/isa/dpms.c)
@@ -0,0 +1,230 @@
+/*-
+ * Copyright (c) 2008 Yahoo!, Inc.
+ * All rights reserved.
+ * Written by: John Baldwin 
+ *
+ * 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.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2004 Benjamin Close 
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * Support for managing the display via DPMS for suspend/resume.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * VESA DPMS States 
+ */
+#define DPMS_ON		0x00
+#define DPMS_STANDBY	0x01
+#define DPMS_SUSPEND	0x02
+#define DPMS_OFF	0x04
+#define DPMS_REDUCEDON	0x08
+
+#define	VBE_DPMS_FUNCTION	0x4F10
+#define	VBE_DPMS_GET_SUPPORTED_STATES 0x00
+#define	VBE_DPMS_GET_STATE	0x02
+#define	VBE_DPMS_SET_STATE	0x01
+#define VBE_MAJORVERSION_MASK	0x0F
+#define VBE_MINORVERSION_MASK	0xF0
+
+struct dpms_softc {
+	int	dpms_supported_states;
+	int	dpms_initial_state;
+};
+
+static int	dpms_attach(device_t);
+static int	dpms_detach(device_t);
+static int	dpms_get_supported_states(int *);
+static int	dpms_get_current_state(int *);
+static void	dpms_identify(driver_t *, device_t);
+static int	dpms_probe(device_t);
+static int	dpms_resume(device_t);
+static int	dpms_set_state(int);
+static int	dpms_suspend(device_t);
+
+static device_method_t dpms_methods[] = {
+	DEVMETHOD(device_identify,	dpms_identify),
+	DEVMETHOD(device_probe,		dpms_probe),
+	DEVMETHOD(device_attach,	dpms_attach),
+	DEVMETHOD(device_detach,	dpms_detach),
+	DEVMETHOD(device_suspend,	dpms_suspend),
+	DEVMETHOD(device_resume,	dpms_resume),
+	{ 0, 0 }
+};
+
+static driver_t dpms_driver = {
+	"dpms",
+	dpms_methods,
+	sizeof(struct dpms_softc),
+};
+
+static devclass_t dpms_devclass;
+
+DRIVER_MODULE(dpms, vgapci, dpms_driver, dpms_devclass, NULL, NULL);
+
+static void
+dpms_identify(driver_t *driver, device_t parent)
+{
+
+	/*
+	 * XXX: The DPMS VBE only allows for manipulating a single
+	 * monitor, but we don't know which one.  Just attach to the
+	 * first vgapci(4) device we encounter and hope it is the
+	 * right one.
+	 */
+	if (devclass_get_device(dpms_devclass, 0) == NULL)
+		device_add_child(parent, "dpms", 0);
+}
+
+static int
+dpms_probe(device_t dev)
+{
+	int error, states;
+
+	error = dpms_get_supported_states(&states);
+	if (error)
+		return (error);
+	device_set_desc(dev, "DPMS suspend/resume");
+	device_quiet(dev);
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+dpms_attach(device_t dev)
+{
+	struct dpms_softc *sc;
+	int error;
+
+	sc = device_get_softc(dev);
+	error = dpms_get_supported_states(&sc->dpms_supported_states);
+	if (error)
+		return (error);
+	error = dpms_get_current_state(&sc->dpms_initial_state);
+	return (error);
+}
+
+static int
+dpms_detach(device_t dev)
+{
+
+	return (0);
+}
+
+static int
+dpms_suspend(device_t dev)
+{
+
+	dpms_set_state(DPMS_OFF);
+	return (0);
+}
+
+static int
+dpms_resume(device_t dev)
+{
+	struct dpms_softc *sc;
+
+	sc = device_get_softc(dev);
+	dpms_set_state(sc->dpms_initial_state);
+	return (0);
+}
+
+static int
+dpms_call_bios(int subfunction, int *bh)
+{
+	struct vm86frame vmf;
+	int error;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_ax = VBE_DPMS_FUNCTION;
+	vmf.vmf_bl = subfunction;
+	vmf.vmf_bh = *bh;
+	vmf.vmf_es = 0;
+	vmf.vmf_di = 0;
+	error = vm86_intcall(0x10, &vmf);
+	if (error == 0 && (vmf.vmf_eax & 0xffff) != 0x004f)
+		error = ENXIO;
+	if (error == 0)
+		*bh = vmf.vmf_bh;
+	return (error);
+}
+
+static int
+dpms_get_supported_states(int *states)
+{
+
+	*states = 0;
+	return (dpms_call_bios(VBE_DPMS_GET_SUPPORTED_STATES, states));
+}
+
+static int
+dpms_get_current_state(int *state)
+{
+
+	*state = 0;
+	return (dpms_call_bios(VBE_DPMS_GET_STATE, state));
+}
+
+static int
+dpms_set_state(int state)
+{
+
+	return (dpms_call_bios(VBE_DPMS_SET_STATE, &state));
+}

Copied: head/sys/dev/fb/vesa.c (from r197019, head/sys/i386/isa/vesa.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/fb/vesa.c	Wed Sep  9 07:45:08 2009	(r197022, copy of r197019, head/sys/i386/isa/vesa.c)
@@ -0,0 +1,1696 @@
+/*-
+ * Copyright (c) 1998 Kazutaka YOKOTA and Michael Smith
+ * All rights reserved.
+ *
+ * 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 as
+ *    the first lines of this file unmodified.
+ * 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 AUTHORS ``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 AUTHORS 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_vga.h"
+#include "opt_vesa.h"
+
+#ifndef VGA_NO_MODE_CHANGE
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifndef __i386__
+#include 
+#else
+#include 
+#endif
+
+#define	VESA_VIA_CLE266		"VIA CLE266\r\n"
+
+#ifndef VESA_DEBUG
+#define VESA_DEBUG	0
+#endif
+
+/* VESA video adapter state buffer stub */
+struct adp_state {
+	int		sig;
+#define V_STATE_SIG	0x61736576
+	u_char		regs[1];
+};
+typedef struct adp_state adp_state_t;
+
+/* VESA video adapter */
+static video_adapter_t *vesa_adp = NULL;
+static int vesa_state_buf_size = 0;
+#define VESA_VM86_BUFSIZE	(3 * PAGE_SIZE)
+static void *vesa_vm86_buf;
+
+/* VESA functions */
+#if 0
+static int			vesa_nop(void);
+#endif
+static int			vesa_error(void);
+static vi_probe_t		vesa_probe;
+static vi_init_t		vesa_init;
+static vi_get_info_t		vesa_get_info;
+static vi_query_mode_t		vesa_query_mode;
+static vi_set_mode_t		vesa_set_mode;
+static vi_save_font_t		vesa_save_font;
+static vi_load_font_t		vesa_load_font;
+static vi_show_font_t		vesa_show_font;
+static vi_save_palette_t	vesa_save_palette;
+static vi_load_palette_t	vesa_load_palette;
+static vi_set_border_t		vesa_set_border;
+static vi_save_state_t		vesa_save_state;
+static vi_load_state_t		vesa_load_state;
+static vi_set_win_org_t		vesa_set_origin;
+static vi_read_hw_cursor_t	vesa_read_hw_cursor;
+static vi_set_hw_cursor_t	vesa_set_hw_cursor;
+static vi_set_hw_cursor_shape_t	vesa_set_hw_cursor_shape;
+static vi_blank_display_t	vesa_blank_display;
+static vi_mmap_t		vesa_mmap;
+static vi_ioctl_t		vesa_ioctl;
+static vi_clear_t		vesa_clear;
+static vi_fill_rect_t		vesa_fill_rect;
+static vi_bitblt_t		vesa_bitblt;
+static vi_diag_t		vesa_diag;
+static int			vesa_bios_info(int level);
+static struct vm86context	vesa_vmcontext;
+
+static video_switch_t vesavidsw = {
+	vesa_probe,
+	vesa_init,
+	vesa_get_info,
+	vesa_query_mode,
+	vesa_set_mode,
+	vesa_save_font,
+	vesa_load_font,
+	vesa_show_font,
+	vesa_save_palette,
+	vesa_load_palette,
+	vesa_set_border,
+	vesa_save_state,
+	vesa_load_state,
+	vesa_set_origin,
+	vesa_read_hw_cursor,
+	vesa_set_hw_cursor,
+	vesa_set_hw_cursor_shape,
+	vesa_blank_display,
+	vesa_mmap,
+	vesa_ioctl,
+	vesa_clear,
+	vesa_fill_rect,
+	vesa_bitblt,
+	vesa_error,
+	vesa_error,
+	vesa_diag,
+};
+
+static video_switch_t *prevvidsw;
+
+/* VESA BIOS video modes */
+#define VESA_MAXMODES	64
+#define EOT		(-1)
+#define NA		(-2)
+
+#define MODE_TABLE_DELTA 8
+
+static int vesa_vmode_max = 0;
+static video_info_t vesa_vmode_empty = { EOT };
+static video_info_t *vesa_vmode = &vesa_vmode_empty;
+
+static int vesa_init_done = FALSE;
+static int has_vesa_bios = FALSE;
+static struct vesa_info *vesa_adp_info = NULL;
+static u_int16_t *vesa_vmodetab = NULL;
+static char *vesa_oemstr = NULL;
+static char *vesa_venderstr = NULL;
+static char *vesa_prodstr = NULL;
+static char *vesa_revstr = NULL;
+
+/* local macros and functions */
+#define BIOS_SADDRTOLADDR(p) ((((p) & 0xffff0000) >> 12) + ((p) & 0x0000ffff))
+
+static int int10_set_mode(int mode);
+static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode);
+static int vesa_bios_set_mode(int mode);
+static int vesa_bios_get_dac(void);
+static int vesa_bios_set_dac(int bits);
+static int vesa_bios_save_palette(int start, int colors, u_char *palette,
+				  int bits);
+static int vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g,
+				   u_char *b, int bits);
+static int vesa_bios_load_palette(int start, int colors, u_char *palette,
+				  int bits);
+#ifdef notyet
+static int vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g,
+				   u_char *b, int bits);
+#endif
+#define STATE_SIZE	0
+#define STATE_SAVE	1
+#define STATE_LOAD	2
+#define STATE_HW	(1<<0)
+#define STATE_DATA	(1<<1)
+#define STATE_DAC	(1<<2)
+#define STATE_REG	(1<<3)
+#define STATE_MOST	(STATE_HW | STATE_DATA | STATE_REG)
+#define STATE_ALL	(STATE_HW | STATE_DATA | STATE_DAC | STATE_REG)
+static int vesa_bios_state_buf_size(void);
+static int vesa_bios_save_restore(int code, void *p, size_t size);
+static int vesa_bios_get_line_length(void);
+static int vesa_bios_set_line_length(int pixel, int *bytes, int *lines);
+#if 0
+static int vesa_bios_get_start(int *x, int *y);
+#endif
+static int vesa_bios_set_start(int x, int y);
+static int vesa_map_gen_mode_num(int type, int color, int mode);
+static int vesa_translate_flags(u_int16_t vflags);
+static int vesa_translate_mmodel(u_int8_t vmodel);
+static void *vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, 
+			  u_char *buf);
+static int vesa_bios_init(void);
+static void vesa_clear_modes(video_info_t *info, int color);
+static vm_offset_t vesa_map_buffer(u_int paddr, size_t size);
+static void vesa_unmap_buffer(vm_offset_t vaddr, size_t size);
+
+#if 0
+static int vesa_get_origin(video_adapter_t *adp, off_t *offset);
+#endif
+
+static void
+dump_buffer(u_char *buf, size_t len)
+{
+    int i;
+
+    for(i = 0; i < len;) {
+	printf("%02x ", buf[i]);
+	if ((++i % 16) == 0)
+	    printf("\n");
+    }
+}
+
+/* INT 10 BIOS calls */
+static int
+int10_set_mode(int mode)
+{
+	struct vm86frame vmf;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x0000 | mode;
+	vm86_intcall(0x10, &vmf);
+	return 0;
+}
+
+/* VESA BIOS calls */
+static int
+vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
+{
+	struct vm86frame vmf;
+	u_char *buf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f01; 
+	vmf.vmf_ecx = mode;
+	buf = vesa_vm86_buf;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)buf, &vmf.vmf_es, &vmf.vmf_di);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 1;
+	bcopy(buf, vmode, sizeof(*vmode));
+	return 0;
+}
+
+static int
+vesa_bios_set_mode(int mode)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f02;
+	vmf.vmf_ebx = mode;
+	err = vm86_intcall(0x10, &vmf);
+	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+}
+
+static int
+vesa_bios_get_dac(void)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f08;
+	vmf.vmf_ebx = 1;	/* get DAC width */
+	err = vm86_intcall(0x10, &vmf);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 6;	/* XXX */
+	return ((vmf.vmf_ebx >> 8) & 0x00ff);
+}
+
+static int
+vesa_bios_set_dac(int bits)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f08;
+	vmf.vmf_ebx = (bits << 8);
+	err = vm86_intcall(0x10, &vmf);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 6;	/* XXX */
+	return ((vmf.vmf_ebx >> 8) & 0x00ff);
+}
+
+static int
+vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
+{
+	struct vm86frame vmf;
+	u_char *p;
+	int err;
+	int i;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f09;
+	vmf.vmf_ebx = 1;	/* get primary palette data */
+	vmf.vmf_ecx = colors;
+	vmf.vmf_edx = start;
+	p = vesa_vm86_buf;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 1;
+
+	bits = 8 - bits;
+	for (i = 0; i < colors; ++i) {
+		palette[i*3]     = p[i*4 + 2] << bits;
+		palette[i*3 + 1] = p[i*4 + 1] << bits;
+		palette[i*3 + 2] = p[i*4] << bits;
+	}
+	return 0;
+}
+
+static int
+vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
+			int bits)
+{
+	struct vm86frame vmf;
+	u_char *p;
+	int err;
+	int i;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f09;
+	vmf.vmf_ebx = 1;	/* get primary palette data */
+	vmf.vmf_ecx = colors;
+	vmf.vmf_edx = start;
+	p = vesa_vm86_buf;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 1;
+
+	bits = 8 - bits;
+	for (i = 0; i < colors; ++i) {
+		r[i] = p[i*4 + 2] << bits;
+		g[i] = p[i*4 + 1] << bits;
+		b[i] = p[i*4] << bits;
+	}
+	return 0;
+}
+
+static int
+vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
+{
+	struct vm86frame vmf;
+	u_char *p;
+	int err;
+	int i;
+
+	p = vesa_vm86_buf;
+	bits = 8 - bits;
+	for (i = 0; i < colors; ++i) {
+		p[i*4]	   = palette[i*3 + 2] >> bits;
+		p[i*4 + 1] = palette[i*3 + 1] >> bits;
+		p[i*4 + 2] = palette[i*3] >> bits;
+		p[i*4 + 3] = 0;
+	}
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f09;
+	vmf.vmf_ebx = 0;	/* set primary palette data */
+	vmf.vmf_ecx = colors;
+	vmf.vmf_edx = start;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+}
+
+#ifdef notyet
+static int
+vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
+			int bits)
+{
+	struct vm86frame vmf;
+	u_char *p;
+	int err;
+	int i;
+
+	p = vesa_vm86_buf;
+	bits = 8 - bits;
+	for (i = 0; i < colors; ++i) {
+		p[i*4]	   = b[i] >> bits;
+		p[i*4 + 1] = g[i] >> bits;
+		p[i*4 + 2] = r[i] >> bits;
+		p[i*4 + 3] = 0;
+	}
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f09;
+	vmf.vmf_ebx = 0;	/* set primary palette data */
+	vmf.vmf_ecx = colors;
+	vmf.vmf_edx = start;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+}
+#endif
+
+static int
+vesa_bios_state_buf_size(void)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f04; 
+	vmf.vmf_ecx = STATE_ALL;
+	vmf.vmf_edx = STATE_SIZE;
+	err = vm86_intcall(0x10, &vmf);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 0;
+	return vmf.vmf_bx*64;
+}
+
+static int
+vesa_bios_save_restore(int code, void *p, size_t size)
+{
+	struct vm86frame vmf;
+	u_char *buf;
+	int err;
+
+	if (size > VESA_VM86_BUFSIZE)
+		return (1);
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f04; 
+	vmf.vmf_ecx = STATE_ALL;
+	vmf.vmf_edx = code;	/* STATE_SAVE/STATE_LOAD */
+	buf = vesa_vm86_buf;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)buf, &vmf.vmf_es, &vmf.vmf_bx);
+	bcopy(p, buf, size);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	bcopy(buf, p, size);
+	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+}
+
+static int
+vesa_bios_get_line_length(void)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f06; 
+	vmf.vmf_ebx = 1;	/* get scan line length */
+	err = vm86_intcall(0x10, &vmf);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return -1;
+	return vmf.vmf_bx;	/* line length in bytes */
+}
+
+static int
+vesa_bios_set_line_length(int pixel, int *bytes, int *lines)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f06; 
+	vmf.vmf_ebx = 0;	/* set scan line length in pixel */
+	vmf.vmf_ecx = pixel;
+	err = vm86_intcall(0x10, &vmf);
+#if VESA_DEBUG > 1
+	printf("bx:%d, cx:%d, dx:%d\n", vmf.vmf_bx, vmf.vmf_cx, vmf.vmf_dx); 
+#endif
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 1;
+	if (bytes)
+		*bytes = vmf.vmf_bx;
+	if (lines)
+		*lines = vmf.vmf_dx;
+	return 0;
+}
+
+#if 0
+static int
+vesa_bios_get_start(int *x, int *y)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f07; 
+	vmf.vmf_ebx = 1;	/* get display start */
+	err = vm86_intcall(0x10, &vmf);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+		return 1;
+	*x = vmf.vmf_cx;
+	*y = vmf.vmf_dx;
+	return 0;
+}
+#endif
+
+static int
+vesa_bios_set_start(int x, int y)
+{
+	struct vm86frame vmf;
+	int err;
+
+	bzero(&vmf, sizeof(vmf));
+	vmf.vmf_eax = 0x4f07; 
+	vmf.vmf_ebx = 0x80;	/* set display start */
+	vmf.vmf_edx = y;
+	vmf.vmf_ecx = x;
+	err = vm86_intcall(0x10, &vmf);
+	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+}
+
+/* map a generic video mode to a known mode */
+static int
+vesa_map_gen_mode_num(int type, int color, int mode)
+{
+    static struct {
+	int from;
+	int to;
+    } mode_map[] = {
+	{ M_TEXT_132x25, M_VESA_C132x25 },
+	{ M_TEXT_132x43, M_VESA_C132x43 },
+	{ M_TEXT_132x50, M_VESA_C132x50 },
+	{ M_TEXT_132x60, M_VESA_C132x60 },
+    };
+    int i;
+
+    for (i = 0; i < sizeof(mode_map)/sizeof(mode_map[0]); ++i) {
+        if (mode_map[i].from == mode)
+            return mode_map[i].to;
+    }
+    return mode;
+}
+
+static int
+vesa_translate_flags(u_int16_t vflags)
+{
+	static struct {
+		u_int16_t mask;
+		int set;
+		int reset;
+	} ftable[] = {
+		{ V_MODECOLOR, V_INFO_COLOR, 0 },
+		{ V_MODEGRAPHICS, V_INFO_GRAPHICS, 0 },
+		{ V_MODELFB, V_INFO_LINEAR, 0 },
+	};
+	int flags;
+	int i;
+
+	for (flags = 0, i = 0; i < sizeof(ftable)/sizeof(ftable[0]); ++i) {
+		flags |= (vflags & ftable[i].mask) ? 
+			 ftable[i].set : ftable[i].reset;
+	}
+	return flags;
+}
+
+static int
+vesa_translate_mmodel(u_int8_t vmodel)
+{
+	static struct {
+		u_int8_t vmodel;
+		int mmodel;
+	} mtable[] = {
+		{ V_MMTEXT,	V_INFO_MM_TEXT },
+		{ V_MMCGA,	V_INFO_MM_CGA },
+		{ V_MMHGC,	V_INFO_MM_HGC },
+		{ V_MMEGA,	V_INFO_MM_PLANAR },
+		{ V_MMPACKED,	V_INFO_MM_PACKED },
+		{ V_MMDIRCOLOR,	V_INFO_MM_DIRECT },
+	};
+	int i;
+
+	for (i = 0; mtable[i].mmodel >= 0; ++i) {
+		if (mtable[i].vmodel == vmodel)
+			return mtable[i].mmodel;
+	}
+	return V_INFO_MM_OTHER;
+}
+
+static void
+*vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, u_char *buf)
+{
+	if (p == 0)
+		return NULL;
+	if (((p >> 16) == seg) && ((p & 0xffff) >= off))
+		return (void *)(buf + ((p & 0xffff) - off));
+	else {
+		p = BIOS_SADDRTOLADDR(p);
+		return (void *)BIOS_PADDRTOVADDR(p);
+	}
+}
+
+static int
+vesa_bios_init(void)
+{
+	static u_char buf[512];
+	struct vm86frame vmf;
+	struct vesa_mode vmode;
+	video_info_t *p;
+	u_char *vmbuf;
+	int is_via_cle266;
+	int modes;
+	int err;
+	int i;
+
+	if (vesa_init_done)
+		return 0;
+
+	has_vesa_bios = FALSE;
+	vesa_adp_info = NULL;
+	vesa_vmode_max = 0;
+	vesa_vmode[0].vi_mode = EOT;
+
+	/* Allocate a buffer and add each page to the vm86 context. */
+	vesa_vm86_buf = malloc(VESA_VM86_BUFSIZE, M_DEVBUF, M_WAITOK | M_ZERO);
+	KASSERT(((vm_offset_t)vesa_vm86_buf & PAGE_MASK) == 0,
+	    ("bad vesa_vm86_buf alignment"));
+	for (i = 0; i < howmany(VESA_VM86_BUFSIZE, PAGE_SIZE); i++)
+		vm86_addpage(&vesa_vmcontext, i + 1,
+		    (vm_offset_t)vesa_vm86_buf + PAGE_SIZE * i);
+
+	vmbuf = vesa_vm86_buf;
+	bzero(&vmf, sizeof(vmf));	/* paranoia */
+	bcopy("VBE2", vmbuf, 4);	/* try for VBE2 data */
+	vmf.vmf_eax = 0x4f00;
+	vm86_getptr(&vesa_vmcontext, (vm_offset_t)vmbuf, &vmf.vmf_es, &vmf.vmf_di);
+
+	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	if ((err != 0) || (vmf.vmf_ax != 0x4f) || bcmp("VESA", vmbuf, 4))
+		return 1;
+	bcopy(vmbuf, buf, sizeof(buf));
+	vesa_adp_info = (struct vesa_info *)buf;
+	if (bootverbose) {
+		printf("VESA: information block\n");
+		dump_buffer(buf, 64);
+	}
+	if (vesa_adp_info->v_version < 0x0102) {
+		printf("VESA: VBE version %d.%d is not supported; "
+		       "version 1.2 or later is required.\n",
+		       ((vesa_adp_info->v_version & 0xf000) >> 12) * 10 
+			   + ((vesa_adp_info->v_version & 0x0f00) >> 8),
+		       ((vesa_adp_info->v_version & 0x00f0) >> 4) * 10 
+			   + (vesa_adp_info->v_version & 0x000f));
+		return 1;
+	}
+
+	/* fix string ptrs */
+	vesa_oemstr = (char *)vesa_fix_ptr(vesa_adp_info->v_oemstr,
+					   vmf.vmf_es, vmf.vmf_di, buf);
+	is_via_cle266 = strcmp(vesa_oemstr, VESA_VIA_CLE266) == 0;
+
+	if (vesa_adp_info->v_version >= 0x0200) {
+		vesa_venderstr = 
+		    (char *)vesa_fix_ptr(vesa_adp_info->v_venderstr,
+					 vmf.vmf_es, vmf.vmf_di, buf);
+		vesa_prodstr = 
+		    (char *)vesa_fix_ptr(vesa_adp_info->v_prodstr,
+					 vmf.vmf_es, vmf.vmf_di, buf);
+		vesa_revstr = 
+		    (char *)vesa_fix_ptr(vesa_adp_info->v_revstr,
+					 vmf.vmf_es, vmf.vmf_di, buf);
+	}
+
+	/* obtain video mode information */
+	vesa_vmodetab = (u_int16_t *)vesa_fix_ptr(vesa_adp_info->v_modetable,
+						  vmf.vmf_es, vmf.vmf_di, buf);
+	if (vesa_vmodetab == NULL)
+		return 1;
+	for (i = 0, modes = 0; 
+		(i < (M_VESA_MODE_MAX - M_VESA_BASE + 1))
+		&& (vesa_vmodetab[i] != 0xffff); ++i) {
+		if (vesa_bios_get_mode(vesa_vmodetab[i], &vmode))
+			continue;
+
+		/* reject unsupported modes */
+#if 0
+		if ((vmode.v_modeattr & (V_MODESUPP | V_MODEOPTINFO 
+					| V_MODENONVGA))
+		    != (V_MODESUPP | V_MODEOPTINFO))
+			continue;
+#else
+		if ((vmode.v_modeattr & V_MODEOPTINFO) == 0) {
+#if VESA_DEBUG > 1
+			printf(
+		"Rejecting VESA %s mode: %d x %d x %d bpp  attr = %x\n",
+			    vmode.v_modeattr & V_MODEGRAPHICS ? "graphics" : "text",
+			    vmode.v_width, vmode.v_height, vmode.v_bpp,
+			    vmode.v_modeattr);
+#endif
+			continue;
+		}
+#endif
+
+		/* expand the array if necessary */
+		if (modes >= vesa_vmode_max) {
+			vesa_vmode_max += MODE_TABLE_DELTA;
+			p = malloc(sizeof(*vesa_vmode)*(vesa_vmode_max + 1),
+				   M_DEVBUF, M_WAITOK);
+#if VESA_DEBUG > 1
+			printf("vesa_bios_init(): modes:%d, vesa_mode_max:%d\n",
+			       modes, vesa_vmode_max);
+#endif
+			if (modes > 0) {
+				bcopy(vesa_vmode, p, sizeof(*vesa_vmode)*modes);
+				free(vesa_vmode, M_DEVBUF);
+			}
+			vesa_vmode = p;
+		}
+
+#if VESA_DEBUG > 1
+		printf("Found VESA %s mode: %d x %d x %d bpp\n",
+		    vmode.v_modeattr & V_MODEGRAPHICS ? "graphics" : "text",
+		    vmode.v_width, vmode.v_height, vmode.v_bpp);
+#endif
+		if (is_via_cle266) {
+		    if ((vmode.v_width & 0xff00) >> 8 == vmode.v_height - 1) {
+			vmode.v_width &= 0xff;
+			vmode.v_waseg = 0xb8000 >> 4;
+		    }
+		}
+
+		/* copy some fields */
+		bzero(&vesa_vmode[modes], sizeof(vesa_vmode[modes]));
+		vesa_vmode[modes].vi_mode = vesa_vmodetab[i];
+		vesa_vmode[modes].vi_width = vmode.v_width;
+		vesa_vmode[modes].vi_height = vmode.v_height;
+		vesa_vmode[modes].vi_depth = vmode.v_bpp;
+		vesa_vmode[modes].vi_planes = vmode.v_planes;
+		vesa_vmode[modes].vi_cwidth = vmode.v_cwidth;
+		vesa_vmode[modes].vi_cheight = vmode.v_cheight;
+		vesa_vmode[modes].vi_window = (u_int)vmode.v_waseg << 4;
+		/* XXX window B */
+		vesa_vmode[modes].vi_window_size = vmode.v_wsize*1024;
+		vesa_vmode[modes].vi_window_gran = vmode.v_wgran*1024;
+		if (vmode.v_modeattr & V_MODELFB)
+			vesa_vmode[modes].vi_buffer = vmode.v_lfb;
+		else
+			vesa_vmode[modes].vi_buffer = 0;
+		/* XXX */
+		vesa_vmode[modes].vi_buffer_size
+			= vesa_adp_info->v_memsize*64*1024;
+#if 0
+		if (vmode.v_offscreen > vmode.v_lfb)
+			vesa_vmode[modes].vi_buffer_size
+				= vmode.v_offscreen + vmode.v_offscreensize*1024
+				      - vmode.v_lfb;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 09:17:31 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9DF41106568B;
	Wed,  9 Sep 2009 09:17:31 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 83F918FC22;
	Wed,  9 Sep 2009 09:17:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n899HVnh079025;
	Wed, 9 Sep 2009 09:17:31 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n899HVEC079022;
	Wed, 9 Sep 2009 09:17:31 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200909090917.n899HVEC079022@svn.freebsd.org>
From: Attilio Rao 
Date: Wed, 9 Sep 2009 09:17:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197023 - stable/8/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 09:17:31 -0000

Author: attilio
Date: Wed Sep  9 09:17:31 2009
New Revision: 197023
URL: http://svn.freebsd.org/changeset/base/197023

Log:
  MFC r196772:
  fix adaptive spinning in lockmgr by using correctly GIANT_RESTORE and
  continue statement and improve adaptive spinning for sx lock by just
  doing once GIANT_SAVE.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/kern/   (props changed)
  stable/8/sys/kern/kern_lock.c
  stable/8/sys/kern/kern_sx.c

Modified: stable/8/sys/kern/kern_lock.c
==============================================================================
--- stable/8/sys/kern/kern_lock.c	Wed Sep  9 07:45:08 2009	(r197022)
+++ stable/8/sys/kern/kern_lock.c	Wed Sep  9 09:17:31 2009	(r197023)
@@ -467,7 +467,10 @@ __lockmgr_args(struct lock *lk, u_int fl
 			/*
 			 * If the owner is running on another CPU, spin until
 			 * the owner stops running or the state of the lock
-			 * changes.
+			 * changes.  We need a double-state handle here
+			 * because for a failed acquisition the lock can be
+			 * either held in exclusive mode or shared mode
+			 * (for the writer starvation avoidance technique).
 			 */
 			if (LK_CAN_ADAPT(lk, flags) && (x & LK_SHARE) == 0 &&
 			    LK_HOLDER(x) != LK_KERNPROC) {
@@ -491,8 +494,10 @@ __lockmgr_args(struct lock *lk, u_int fl
 				while (LK_HOLDER(lk->lk_lock) ==
 				    (uintptr_t)owner && TD_IS_RUNNING(owner))
 					cpu_spinwait();
+				GIANT_RESTORE();
+				continue;
 			} else if (LK_CAN_ADAPT(lk, flags) &&
-			    (x & LK_SHARE) !=0 && LK_SHARERS(x) &&
+			    (x & LK_SHARE) != 0 && LK_SHARERS(x) &&
 			    spintries < alk_retries) {
 				if (flags & LK_INTERLOCK) {
 					class->lc_unlock(ilk);
@@ -511,6 +516,7 @@ __lockmgr_args(struct lock *lk, u_int fl
 						break;
 					cpu_spinwait();
 				}
+				GIANT_RESTORE();
 				if (i != alk_loops)
 					continue;
 			}
@@ -704,6 +710,8 @@ __lockmgr_args(struct lock *lk, u_int fl
 				while (LK_HOLDER(lk->lk_lock) ==
 				    (uintptr_t)owner && TD_IS_RUNNING(owner))
 					cpu_spinwait();
+				GIANT_RESTORE();
+				continue;
 			} else if (LK_CAN_ADAPT(lk, flags) &&
 			    (x & LK_SHARE) != 0 && LK_SHARERS(x) &&
 			    spintries < alk_retries) {
@@ -727,6 +735,7 @@ __lockmgr_args(struct lock *lk, u_int fl
 						break;
 					cpu_spinwait();
 				}
+				GIANT_RESTORE();
 				if (i != alk_loops)
 					continue;
 			}

Modified: stable/8/sys/kern/kern_sx.c
==============================================================================
--- stable/8/sys/kern/kern_sx.c	Wed Sep  9 07:45:08 2009	(r197022)
+++ stable/8/sys/kern/kern_sx.c	Wed Sep  9 09:17:31 2009	(r197023)
@@ -531,13 +531,13 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 					continue;
 				}
 			} else if (SX_SHARERS(x) && spintries < asx_retries) {
+				GIANT_SAVE();
 				spintries++;
 				for (i = 0; i < asx_loops; i++) {
 					if (LOCK_LOG_TEST(&sx->lock_object, 0))
 						CTR4(KTR_LOCK,
 				    "%s: shared spinning on %p with %u and %u",
 						    __func__, sx, spintries, i);
-					GIANT_SAVE();
 					x = sx->sx_lock;
 					if ((x & SX_LOCK_SHARED) == 0 ||
 					    SX_SHARERS(x) == 0)

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 09:34:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F7A2106566B;
	Wed,  9 Sep 2009 09:34:13 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5F9128FC1A;
	Wed,  9 Sep 2009 09:34:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n899YDa6079431;
	Wed, 9 Sep 2009 09:34:13 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n899YDP6079427;
	Wed, 9 Sep 2009 09:34:13 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200909090934.n899YDP6079427@svn.freebsd.org>
From: Attilio Rao 
Date: Wed, 9 Sep 2009 09:34:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197024 - stable/8/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 09:34:13 -0000

Author: attilio
Date: Wed Sep  9 09:34:13 2009
New Revision: 197024
URL: http://svn.freebsd.org/changeset/base/197024

Log:
  Adaptive spinning for locking primitives, in read-mode, have some tuning
  SYSCTLs which are inappropriate for a daily use of the machine (mostly
  useful only by a developer which wants to run benchmarks on it).
  Remove them before the release as long as we do not want to ship with
  them in.
  
  Now that the SYSCTLs are gone, instead than use static storage for some
  constants, use real numeric constants in order to avoid eventual compiler
  dumbiness and the risk to share a storage (and then a cache-line) among
  CPUs when doing adaptive spinning together.
  
  Pleasse note that the sys/linker_set.h inclusion in lockmgr and sx lock
  support could have been gone, but re@ preferred them to be in order to
  minimize the risk of problems on future merging.
  
  Please note that this patch is not a MFC, but an 'edge case' as commit
  directly to stable/8, which creates a diverging from HEAD.
  
  Tested by:      Giovanni Trematerra 
  Approved by:	re (kib)

Modified:
  stable/8/sys/kern/kern_lock.c
  stable/8/sys/kern/kern_rwlock.c
  stable/8/sys/kern/kern_sx.c

Modified: stable/8/sys/kern/kern_lock.c
==============================================================================
--- stable/8/sys/kern/kern_lock.c	Wed Sep  9 09:17:31 2009	(r197023)
+++ stable/8/sys/kern/kern_lock.c	Wed Sep  9 09:34:13 2009	(r197024)
@@ -62,6 +62,11 @@ CTASSERT(LK_UNLOCKED == (LK_UNLOCKED &
 #define	SQ_EXCLUSIVE_QUEUE	0
 #define	SQ_SHARED_QUEUE		1
 
+#ifdef ADAPTIVE_LOCKMGRS
+#define	ALK_RETRIES		10
+#define	ALK_LOOPS		10000
+#endif
+
 #ifndef INVARIANTS
 #define	_lockmgr_assert(lk, what, file, line)
 #define	TD_LOCKS_INC(td)
@@ -156,14 +161,6 @@ struct lock_class lock_class_lockmgr = {
 #endif
 };
 
-#ifdef ADAPTIVE_LOCKMGRS
-static u_int alk_retries = 10;
-static u_int alk_loops = 10000;
-SYSCTL_NODE(_debug, OID_AUTO, lockmgr, CTLFLAG_RD, NULL, "lockmgr debugging");
-SYSCTL_UINT(_debug_lockmgr, OID_AUTO, retries, CTLFLAG_RW, &alk_retries, 0, "");
-SYSCTL_UINT(_debug_lockmgr, OID_AUTO, loops, CTLFLAG_RW, &alk_loops, 0, "");
-#endif
-
 static __inline struct thread *
 lockmgr_xholder(struct lock *lk)
 {
@@ -498,14 +495,14 @@ __lockmgr_args(struct lock *lk, u_int fl
 				continue;
 			} else if (LK_CAN_ADAPT(lk, flags) &&
 			    (x & LK_SHARE) != 0 && LK_SHARERS(x) &&
-			    spintries < alk_retries) {
+			    spintries < ALK_RETRIES) {
 				if (flags & LK_INTERLOCK) {
 					class->lc_unlock(ilk);
 					flags &= ~LK_INTERLOCK;
 				}
 				GIANT_SAVE();
 				spintries++;
-				for (i = 0; i < alk_loops; i++) {
+				for (i = 0; i < ALK_LOOPS; i++) {
 					if (LOCK_LOG_TEST(&lk->lock_object, 0))
 						CTR4(KTR_LOCK,
 				    "%s: shared spinning on %p with %u and %u",
@@ -517,7 +514,7 @@ __lockmgr_args(struct lock *lk, u_int fl
 					cpu_spinwait();
 				}
 				GIANT_RESTORE();
-				if (i != alk_loops)
+				if (i != ALK_LOOPS)
 					continue;
 			}
 #endif
@@ -714,7 +711,7 @@ __lockmgr_args(struct lock *lk, u_int fl
 				continue;
 			} else if (LK_CAN_ADAPT(lk, flags) &&
 			    (x & LK_SHARE) != 0 && LK_SHARERS(x) &&
-			    spintries < alk_retries) {
+			    spintries < ALK_RETRIES) {
 				if ((x & LK_EXCLUSIVE_SPINNERS) == 0 &&
 				    !atomic_cmpset_ptr(&lk->lk_lock, x,
 				    x | LK_EXCLUSIVE_SPINNERS))
@@ -725,7 +722,7 @@ __lockmgr_args(struct lock *lk, u_int fl
 				}
 				GIANT_SAVE();
 				spintries++;
-				for (i = 0; i < alk_loops; i++) {
+				for (i = 0; i < ALK_LOOPS; i++) {
 					if (LOCK_LOG_TEST(&lk->lock_object, 0))
 						CTR4(KTR_LOCK,
 				    "%s: shared spinning on %p with %u and %u",
@@ -736,7 +733,7 @@ __lockmgr_args(struct lock *lk, u_int fl
 					cpu_spinwait();
 				}
 				GIANT_RESTORE();
-				if (i != alk_loops)
+				if (i != ALK_LOOPS)
 					continue;
 			}
 #endif

Modified: stable/8/sys/kern/kern_rwlock.c
==============================================================================
--- stable/8/sys/kern/kern_rwlock.c	Wed Sep  9 09:17:31 2009	(r197023)
+++ stable/8/sys/kern/kern_rwlock.c	Wed Sep  9 09:34:13 2009	(r197024)
@@ -56,11 +56,8 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #ifdef ADAPTIVE_RWLOCKS
-static int rowner_retries = 10;
-static int rowner_loops = 10000;
-SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL, "rwlock debugging");
-SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, "");
-SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, "");
+#define	ROWNER_RETRIES	10
+#define	ROWNER_LOOPS	10000
 #endif
 
 #ifdef DDB
@@ -380,15 +377,15 @@ _rw_rlock(struct rwlock *rw, const char 
 				}
 				continue;
 			}
-		} else if (spintries < rowner_retries) {
+		} else if (spintries < ROWNER_RETRIES) {
 			spintries++;
-			for (i = 0; i < rowner_loops; i++) {
+			for (i = 0; i < ROWNER_LOOPS; i++) {
 				v = rw->rw_lock;
 				if ((v & RW_LOCK_READ) == 0 || RW_CAN_READ(v))
 					break;
 				cpu_spinwait();
 			}
-			if (i != rowner_loops)
+			if (i != ROWNER_LOOPS)
 				continue;
 		}
 #endif
@@ -690,7 +687,7 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 			continue;
 		}
 		if ((v & RW_LOCK_READ) && RW_READERS(v) &&
-		    spintries < rowner_retries) {
+		    spintries < ROWNER_RETRIES) {
 			if (!(v & RW_LOCK_WRITE_SPINNER)) {
 				if (!atomic_cmpset_ptr(&rw->rw_lock, v,
 				    v | RW_LOCK_WRITE_SPINNER)) {
@@ -698,15 +695,15 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 				}
 			}
 			spintries++;
-			for (i = 0; i < rowner_loops; i++) {
+			for (i = 0; i < ROWNER_LOOPS; i++) {
 				if ((rw->rw_lock & RW_LOCK_WRITE_SPINNER) == 0)
 					break;
 				cpu_spinwait();
 			}
 #ifdef KDTRACE_HOOKS
-			spin_cnt += rowner_loops - i;
+			spin_cnt += ROWNER_LOOPS - i;
 #endif
-			if (i != rowner_loops)
+			if (i != ROWNER_LOOPS)
 				continue;
 		}
 #endif

Modified: stable/8/sys/kern/kern_sx.c
==============================================================================
--- stable/8/sys/kern/kern_sx.c	Wed Sep  9 09:17:31 2009	(r197023)
+++ stable/8/sys/kern/kern_sx.c	Wed Sep  9 09:34:13 2009	(r197024)
@@ -72,6 +72,11 @@ CTASSERT((SX_NOADAPTIVE & LO_CLASSFLAGS)
 #define	SQ_EXCLUSIVE_QUEUE	0
 #define	SQ_SHARED_QUEUE		1
 
+#ifdef ADAPTIVE_SX
+#define	ASX_RETRIES		10
+#define	ASX_LOOPS		10000
+#endif
+
 /*
  * Variations on DROP_GIANT()/PICKUP_GIANT() for use in this file.  We
  * drop Giant anytime we have to sleep or if we adaptively spin.
@@ -134,14 +139,6 @@ struct lock_class lock_class_sx = {
 #define	_sx_assert(sx, what, file, line)
 #endif
 
-#ifdef ADAPTIVE_SX
-static u_int asx_retries = 10;
-static u_int asx_loops = 10000;
-SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging");
-SYSCTL_INT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, "");
-SYSCTL_INT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
-#endif
-
 void
 assert_sx(struct lock_object *lock, int what)
 {
@@ -530,10 +527,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 					}
 					continue;
 				}
-			} else if (SX_SHARERS(x) && spintries < asx_retries) {
+			} else if (SX_SHARERS(x) && spintries < ASX_RETRIES) {
 				GIANT_SAVE();
 				spintries++;
-				for (i = 0; i < asx_loops; i++) {
+				for (i = 0; i < ASX_LOOPS; i++) {
 					if (LOCK_LOG_TEST(&sx->lock_object, 0))
 						CTR4(KTR_LOCK,
 				    "%s: shared spinning on %p with %u and %u",
@@ -547,7 +544,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 					spin_cnt++;
 #endif
 				}
-				if (i != asx_loops)
+				if (i != ASX_LOOPS)
 					continue;
 			}
 		}

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 09:50:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5987B106566C;
	Wed,  9 Sep 2009 09:50:32 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 469D28FC0A;
	Wed,  9 Sep 2009 09:50:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n899oWTk079780;
	Wed, 9 Sep 2009 09:50:32 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n899oWOC079768;
	Wed, 9 Sep 2009 09:50:32 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909090950.n899oWOC079768@svn.freebsd.org>
From: Xin LI 
Date: Wed, 9 Sep 2009 09:50:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197025 - in head: lib share/man/man4
	share/man/man4/man4.i386 sys/amd64/conf sys/conf sys/dev/dpms
	sys/dev/fb sys/dev/syscons sys/i386/conf sys/i386/include/pc
	sys/i386/isa sys/modules...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 09:50:32 -0000

Author: delphij
Date: Wed Sep  9 09:50:31 2009
New Revision: 197025
URL: http://svn.freebsd.org/changeset/base/197025

Log:
   - Teach vesa(4) and dpms(4) about x86emu. [1]
   - Add vesa kernel options for amd64.
   - Connect libvgl library and splash kernel modules to amd64 build.
   - Connect manual page dpms(4) to amd64 build.
   - Remove old vesa/dpms files.
  
  Submitted by:	paradox  [1], swell k at gmail.com
  		(with some minor tweaks)

Added:
  head/share/man/man4/dpms.4
     - copied unchanged from r197022, head/share/man/man4/man4.i386/dpms.4
Deleted:
  head/share/man/man4/man4.i386/dpms.4
  head/sys/i386/include/pc/vesa.h
  head/sys/i386/isa/dpms.c
  head/sys/i386/isa/vesa.c
Modified:
  head/lib/Makefile
  head/share/man/man4/Makefile
  head/sys/amd64/conf/NOTES
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/options.amd64
  head/sys/dev/dpms/dpms.c
  head/sys/dev/fb/s3_pci.c
  head/sys/dev/fb/vesa.c
  head/sys/dev/fb/vesa.h
  head/sys/dev/fb/vga.c
  head/sys/dev/syscons/scvesactl.c
  head/sys/i386/conf/NOTES
  head/sys/modules/Makefile
  head/sys/modules/dpms/Makefile
  head/sys/modules/vesa/Makefile

Modified: head/lib/Makefile
==============================================================================
--- head/lib/Makefile	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/lib/Makefile	Wed Sep  9 09:50:31 2009	(r197025)
@@ -112,6 +112,7 @@ _libsmb=	libsmb
 _libncp=	libncp
 .endif
 _libsmb=	libsmb
+_libvgl=	libvgl
 .endif
 
 .if ${MACHINE_ARCH} == "powerpc"

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/share/man/man4/Makefile	Wed Sep  9 09:50:31 2009	(r197025)
@@ -85,6 +85,7 @@ MAN=	aac.4 \
 	digi.4 \
 	disc.4 \
 	divert.4 \
+	${_dpms.4} \
 	dpt.4 \
 	dummynet.4 \
 	ed.4 \
@@ -611,6 +612,7 @@ _amdtemp.4=	amdtemp.4
 _asmc.4=	asmc.4
 _coretemp.4=	coretemp.4
 _cpuctl.4=	cpuctl.4
+_dpms.4=	dpms.4
 _hptiop.4=	hptiop.4
 _hptmv.4=	hptmv.4
 _hptrr.4=	hptrr.4

Copied: head/share/man/man4/dpms.4 (from r197022, head/share/man/man4/man4.i386/dpms.4)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/dpms.4	Wed Sep  9 09:50:31 2009	(r197025, copy of r197022, head/share/man/man4/man4.i386/dpms.4)
@@ -0,0 +1,58 @@
+.\" Copyright (c) 2008 Yahoo!, Inc.
+.\" All rights reserved.
+.\" Written by: John Baldwin 
+.\"
+.\" 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.
+.\" 3. Neither the name of the author nor the names of any co-contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" 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$
+.\"
+.Dd August 23, 2008
+.Dt DPMS 4
+.Os
+.Sh NAME
+.Nm dpms
+.Nd VESA BIOS DPMS driver
+.Sh SYNOPSIS
+.Cd "device dpms"
+.Sh DESCRIPTION
+The
+.Nm
+driver uses the VESA BIOS to manage an external display during suspend and
+resume.
+When the machine suspends,
+the
+.Nm
+driver turns the external display off.
+When the machine resumes,
+it restores the display to its state when the driver was first loaded.
+.Sh SEE ALSO
+.Xr acpi_video 4
+.Sh BUGS
+.Pp
+The VESA BIOS DPMS calls do not provide any way to identify a particular
+display or adapter to manipulate.
+As a result,
+this driver may have unexpected results on systems with multiple displays
+and/or adapters.

Modified: head/sys/amd64/conf/NOTES
==============================================================================
--- head/sys/amd64/conf/NOTES	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/amd64/conf/NOTES	Wed Sep  9 09:50:31 2009	(r197025)
@@ -154,6 +154,12 @@ options 	AGP_DEBUG
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION
 
+# To include support for VGA VESA video modes (depends on X86EMU)
+options 	VESA
+
+# Turn on extra debugging checks and output for VESA support.
+options 	VESA_DEBUG
+
 #
 # Optional devices:
 #

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/conf/files.amd64	Wed Sep  9 09:50:31 2009	(r197025)
@@ -162,6 +162,7 @@ dev/atkbdc/atkbdc_subr.c	optional	atkbdc
 dev/atkbdc/psm.c		optional	psm atkbdc
 dev/coretemp/coretemp.c		optional	coretemp
 dev/cpuctl/cpuctl.c		optional	cpuctl
+dev/dpms/dpms.c			optional	dpms x86emu
 # There are no systems with isa slots, so all ed isa entries should go..
 dev/ed/if_ed_3c503.c		optional	ed isa ed_3c503
 dev/ed/if_ed_isa.c		optional	ed isa
@@ -169,6 +170,7 @@ dev/ed/if_ed_wd80x3.c		optional	ed isa
 dev/ed/if_ed_hpp.c		optional	ed isa ed_hpp
 dev/ed/if_ed_sic.c		optional	ed isa ed_sic
 dev/fb/fb.c			optional	fb | vga
+dev/fb/vesa.c			optional	vga vesa x86emu
 dev/fb/vga.c			optional	vga
 dev/ichwd/ichwd.c		optional	ichwd
 dev/if_ndis/if_ndis.c		optional	ndis
@@ -217,6 +219,7 @@ dev/sio/sio_puc.c		optional	sio puc
 dev/speaker/spkr.c		optional	speaker
 dev/syscons/apm/apm_saver.c	optional	apm_saver apm
 dev/syscons/scterm-teken.c	optional	sc
+dev/syscons/scvesactl.c		optional	sc vga vesa x86emu
 dev/syscons/scvgarndr.c		optional	sc vga
 dev/syscons/scvtb.c		optional	sc
 dev/uart/uart_cpu_amd64.c	optional	uart

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/conf/files.i386	Wed Sep  9 09:50:31 2009	(r197025)
@@ -150,12 +150,14 @@ dev/ctau/if_ct.c		optional ctau
 dev/cx/csigma.c			optional cx
 dev/cx/cxddk.c			optional cx
 dev/cx/if_cx.c			optional cx
+dev/dpms/dpms.c			optional dpms x86emu
 dev/ed/if_ed_3c503.c		optional ed isa ed_3c503
 dev/ed/if_ed_isa.c		optional ed isa
 dev/ed/if_ed_wd80x3.c		optional ed isa
 dev/ed/if_ed_hpp.c		optional ed isa ed_hpp
 dev/ed/if_ed_sic.c		optional ed isa ed_sic
 dev/fb/fb.c			optional fb | vga
+dev/fb/vesa.c			optional vga vesa x86emu
 dev/fb/vga.c			optional vga
 dev/fdc/fdc.c			optional fdc
 dev/fdc/fdc_acpi.c		optional fdc
@@ -217,7 +219,7 @@ dev/sio/sio_puc.c		optional sio puc
 dev/speaker/spkr.c		optional speaker
 dev/syscons/apm/apm_saver.c	optional apm_saver apm
 dev/syscons/scterm-teken.c	optional sc
-dev/syscons/scvesactl.c		optional sc vga vesa
+dev/syscons/scvesactl.c		optional sc vga vesa x86emu
 dev/syscons/scvgarndr.c		optional sc vga
 dev/syscons/scvtb.c		optional sc
 dev/uart/uart_cpu_i386.c	optional uart
@@ -329,7 +331,6 @@ i386/isa/clock.c		optional native
 i386/xen/clock.c		optional xen
 i386/xen/xen_clock_util.c	optional xen
 i386/xen/xen_rtc.c		optional xen
-i386/isa/dpms.c			optional dpms
 i386/isa/elcr.c			standard
 i386/isa/elink.c		optional ep | ie
 i386/isa/isa.c			optional isa
@@ -339,7 +340,6 @@ i386/isa/npx.c			optional npx
 i386/isa/pmtimer.c		optional pmtimer
 i386/isa/prof_machdep.c		optional profiling-routine
 i386/isa/spic.c			optional spic
-i386/isa/vesa.c			optional vga vesa
 i386/linux/imgact_linux.c	optional compat_linux
 i386/linux/linux_dummy.c	optional compat_linux
 i386/linux/linux_locore.s	optional compat_linux	\

Modified: head/sys/conf/options.amd64
==============================================================================
--- head/sys/conf/options.amd64	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/conf/options.amd64	Wed Sep  9 09:50:31 2009	(r197025)
@@ -37,6 +37,9 @@ VGA_NO_MODE_CHANGE	opt_vga.h
 VGA_SLOW_IOACCESS	opt_vga.h
 VGA_WIDTH90		opt_vga.h
 
+VESA
+VESA_DEBUG		opt_vesa.h
+
 # AGP debugging support
 AGP_DEBUG		opt_agp.h
 

Modified: head/sys/dev/dpms/dpms.c
==============================================================================
--- head/sys/dev/dpms/dpms.c	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/dev/dpms/dpms.c	Wed Sep  9 09:50:31 2009	(r197025)
@@ -67,7 +67,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
+#include 
+
+#include 
+#include 
 
 /*
  * VESA DPMS States 
@@ -90,6 +94,9 @@ struct dpms_softc {
 	int	dpms_initial_state;
 };
 
+static struct x86emu vesa_emu;
+static unsigned char *emumem = NULL;
+
 static int	dpms_attach(device_t);
 static int	dpms_detach(device_t);
 static int	dpms_get_supported_states(int *);
@@ -119,6 +126,59 @@ static driver_t dpms_driver = {
 static devclass_t dpms_devclass;
 
 DRIVER_MODULE(dpms, vgapci, dpms_driver, dpms_devclass, NULL, NULL);
+MODULE_DEPEND(dpms, x86emu, 1, 1, 1);
+
+static uint8_t
+vm86_emu_inb(struct x86emu *emu, uint16_t port)
+{
+	if (port == 0xb2) /* APM scratch register */
+		return 0;
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return 0;
+	return inb(port);
+}
+
+static uint16_t
+vm86_emu_inw(struct x86emu *emu, uint16_t port)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return 0;
+	return inw(port);
+}
+
+static uint32_t
+vm86_emu_inl(struct x86emu *emu, uint16_t port)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return 0;
+	return inl(port);
+}
+
+static void
+vm86_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val)
+{
+	if (port == 0xb2) /* APM scratch register */
+		return;
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return;
+	outb(port, val);
+}
+
+static void
+vm86_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return;
+	outw(port, val);
+}
+
+static void
+vm86_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return;
+	outl(port, val);
+}
 
 static void
 dpms_identify(driver_t *driver, device_t parent)
@@ -132,6 +192,7 @@ dpms_identify(driver_t *driver, device_t
 	 */
 	if (devclass_get_device(dpms_devclass, 0) == NULL)
 		device_add_child(parent, "dpms", 0);
+
 }
 
 static int
@@ -139,6 +200,21 @@ dpms_probe(device_t dev)
 {
 	int error, states;
 
+	emumem = pmap_mapbios(0x0, 0xc00000);
+
+	memset(&vesa_emu, 0, sizeof(vesa_emu));
+	x86emu_init_default(&vesa_emu);
+
+	vesa_emu.emu_inb = vm86_emu_inb;
+	vesa_emu.emu_inw = vm86_emu_inw;
+	vesa_emu.emu_inl = vm86_emu_inl;
+	vesa_emu.emu_outb = vm86_emu_outb;
+	vesa_emu.emu_outw = vm86_emu_outw;
+	vesa_emu.emu_outl = vm86_emu_outl;
+
+	vesa_emu.mem_base = (char *)emumem;
+	vesa_emu.mem_size = 1024 * 1024;
+
 	error = dpms_get_supported_states(&states);
 	if (error)
 		return (error);
@@ -164,6 +240,8 @@ dpms_attach(device_t dev)
 static int
 dpms_detach(device_t dev)
 {
+	if (emumem)
+		pmap_unmapdev((vm_offset_t)emumem, 0xc00000);
 
 	return (0);
 }
@@ -189,21 +267,19 @@ dpms_resume(device_t dev)
 static int
 dpms_call_bios(int subfunction, int *bh)
 {
-	struct vm86frame vmf;
-	int error;
+	vesa_emu.x86.R_AX = VBE_DPMS_FUNCTION;
+	vesa_emu.x86.R_BL = subfunction;
+	vesa_emu.x86.R_BH = *bh;
+	vesa_emu.x86.R_ES = 0;
+	vesa_emu.x86.R_DI = 0;
+	x86emu_exec_intr(&vesa_emu, 0x10);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_ax = VBE_DPMS_FUNCTION;
-	vmf.vmf_bl = subfunction;
-	vmf.vmf_bh = *bh;
-	vmf.vmf_es = 0;
-	vmf.vmf_di = 0;
-	error = vm86_intcall(0x10, &vmf);
-	if (error == 0 && (vmf.vmf_eax & 0xffff) != 0x004f)
-		error = ENXIO;
-	if (error == 0)
-		*bh = vmf.vmf_bh;
-	return (error);
+	if ((vesa_emu.x86.R_EAX & 0xffff) != 0x004f)
+		return (ENXIO);
+
+	*bh = vesa_emu.x86.R_BH;
+
+	return (0);
 }
 
 static int

Modified: head/sys/dev/fb/s3_pci.c
==============================================================================
--- head/sys/dev/fb/s3_pci.c	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/dev/fb/s3_pci.c	Wed Sep  9 09:50:31 2009	(r197025)
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c	Wed Sep  9 09:34:13 2009	(r197024)
+++ head/sys/dev/fb/vesa.c	Wed Sep  9 09:50:31 2009	(r197025)
@@ -45,19 +45,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
 
-#ifndef __i386__
 #include 
-#else
-#include 
-#endif
+#include 
+
+#include 
+#include 
 
 #define	VESA_VIA_CLE266		"VIA CLE266\r\n"
 
@@ -76,8 +73,7 @@ typedef struct adp_state adp_state_t;
 /* VESA video adapter */
 static video_adapter_t *vesa_adp = NULL;
 static int vesa_state_buf_size = 0;
-#define VESA_VM86_BUFSIZE	(3 * PAGE_SIZE)
-static void *vesa_vm86_buf;
+#define VESA_X86EMU_BUFSIZE	(3 * PAGE_SIZE)
 
 /* VESA functions */
 #if 0
@@ -109,7 +105,8 @@ static vi_fill_rect_t		vesa_fill_rect;
 static vi_bitblt_t		vesa_bitblt;
 static vi_diag_t		vesa_diag;
 static int			vesa_bios_info(int level);
-static struct vm86context	vesa_vmcontext;
+
+static struct x86emu		vesa_emu;
 
 static video_switch_t vesavidsw = {
 	vesa_probe,
@@ -200,8 +197,6 @@ static int vesa_bios_set_start(int x, in
 static int vesa_map_gen_mode_num(int type, int color, int mode);
 static int vesa_translate_flags(u_int16_t vflags);
 static int vesa_translate_mmodel(u_int8_t vmodel);
-static void *vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, 
-			  u_char *buf);
 static int vesa_bios_init(void);
 static void vesa_clear_modes(video_info_t *info, int color);
 static vm_offset_t vesa_map_buffer(u_int paddr, size_t size);
@@ -211,6 +206,77 @@ static void vesa_unmap_buffer(vm_offset_
 static int vesa_get_origin(video_adapter_t *adp, off_t *offset);
 #endif
 
+#define SEG_ADDR(x)	(((x) >> 4) & 0x00F000)
+#define SEG_OFF(x)	((x) & 0x0FFFF)
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define B_O16(x)	(x)
+#define B_O32(x)	(x)
+#else
+#define B_O16(x)	((((x) & 0xff) << 8) | (((x) & 0xff) >> 8))
+#define B_O32(x)	((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
+		| (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
+#endif
+
+#define L_ADD(x)	(B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00)
+#define FARP(p)		(((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff))
+
+#define REALOFF(x)	(x*4096)
+
+static unsigned char *emumem = NULL;
+
+static uint8_t
+vm86_emu_inb(struct x86emu *emu, uint16_t port)
+{
+	if (port == 0xb2) /* APM scratch register */
+		return 0;
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return 0;
+	return inb(port);
+}
+
+static uint16_t
+vm86_emu_inw(struct x86emu *emu, uint16_t port)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return 0;
+	return inw(port);
+}
+
+static uint32_t
+vm86_emu_inl(struct x86emu *emu, uint16_t port)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return 0;
+	return inl(port);
+}
+
+static void
+vm86_emu_outb(struct x86emu *emu, uint16_t port, uint8_t val)
+{
+	if (port == 0xb2) /* APM scratch register */
+		return;
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return;
+	outb(port, val);
+}
+
+static void
+vm86_emu_outw(struct x86emu *emu, uint16_t port, uint16_t val)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return;
+	outw(port, val);
+}
+
+static void
+vm86_emu_outl(struct x86emu *emu, uint16_t port, uint32_t val)
+{
+	if (port >= 0x80 && port < 0x88) /* POST status register */
+		return;
+	outl(port, val);
+}
+
 static void
 dump_buffer(u_char *buf, size_t len)
 {
@@ -227,11 +293,9 @@ dump_buffer(u_char *buf, size_t len)
 static int
 int10_set_mode(int mode)
 {
-	struct vm86frame vmf;
+	vesa_emu.x86.R_EAX = 0x0000 | mode;
+	x86emu_exec_intr(&vesa_emu, 0x10);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x0000 | mode;
-	vm86_intcall(0x10, &vmf);
 	return 0;
 }
 
@@ -239,84 +303,83 @@ int10_set_mode(int mode)
 static int
 vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
 {
-	struct vm86frame vmf;
 	u_char *buf;
-	int err;
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f01; 
-	vmf.vmf_ecx = mode;
-	buf = vesa_vm86_buf;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)buf, &vmf.vmf_es, &vmf.vmf_di);
+	vesa_emu.x86.R_EAX = 0x4f01;
+	vesa_emu.x86.R_ECX = mode;
+
+	buf = (emumem + REALOFF(3));
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(3));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(3));
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
 		return 1;
+
 	bcopy(buf, vmode, sizeof(*vmode));
+
 	return 0;
 }
 
 static int
 vesa_bios_set_mode(int mode)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f02;
+	vesa_emu.x86.R_EBX = mode;
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f02;
-	vmf.vmf_ebx = mode;
-	err = vm86_intcall(0x10, &vmf);
-	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
 }
 
 static int
 vesa_bios_get_dac(void)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f08;
+	vesa_emu.x86.R_EBX = 1;
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
+		return 6;
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f08;
-	vmf.vmf_ebx = 1;	/* get DAC width */
-	err = vm86_intcall(0x10, &vmf);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
-		return 6;	/* XXX */
-	return ((vmf.vmf_ebx >> 8) & 0x00ff);
+	return ((vesa_emu.x86.R_EBX >> 8) & 0x00ff);
 }
 
 static int
 vesa_bios_set_dac(int bits)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f08;
+	vesa_emu.x86.R_EBX = (bits << 8);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f08;
-	vmf.vmf_ebx = (bits << 8);
-	err = vm86_intcall(0x10, &vmf);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
-		return 6;	/* XXX */
-	return ((vmf.vmf_ebx >> 8) & 0x00ff);
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
+		return 6;
+
+	return ((vesa_emu.x86.R_EBX >> 8) & 0x00ff);
 }
 
 static int
 vesa_bios_save_palette(int start, int colors, u_char *palette, int bits)
 {
-	struct vm86frame vmf;
 	u_char *p;
-	int err;
 	int i;
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f09;
-	vmf.vmf_ebx = 1;	/* get primary palette data */
-	vmf.vmf_ecx = colors;
-	vmf.vmf_edx = start;
-	p = vesa_vm86_buf;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+	vesa_emu.x86.R_EAX = 0x4f09;
+	vesa_emu.x86.R_EBX = 1;
+	vesa_emu.x86.R_ECX = colors;
+	vesa_emu.x86.R_EDX = start;
+
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+	p = emumem + REALOFF(2);
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
 		return 1;
 
 	bits = 8 - bits;
@@ -332,21 +395,22 @@ static int
 vesa_bios_save_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
 			int bits)
 {
-	struct vm86frame vmf;
 	u_char *p;
-	int err;
 	int i;
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f09;
-	vmf.vmf_ebx = 1;	/* get primary palette data */
-	vmf.vmf_ecx = colors;
-	vmf.vmf_edx = start;
-	p = vesa_vm86_buf;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+	vesa_emu.x86.R_EAX = 0x4f09;
+	vesa_emu.x86.R_EBX = 1;
+	vesa_emu.x86.R_ECX = colors;
+	vesa_emu.x86.R_EDX = start;
+
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+	p = emumem + REALOFF(2);
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
 		return 1;
 
 	bits = 8 - bits;
@@ -361,12 +425,11 @@ vesa_bios_save_palette2(int start, int c
 static int
 vesa_bios_load_palette(int start, int colors, u_char *palette, int bits)
 {
-	struct vm86frame vmf;
 	u_char *p;
-	int err;
 	int i;
 
-	p = vesa_vm86_buf;
+	p = (emumem + REALOFF(2));
+
 	bits = 8 - bits;
 	for (i = 0; i < colors; ++i) {
 		p[i*4]	   = palette[i*3 + 2] >> bits;
@@ -375,15 +438,17 @@ vesa_bios_load_palette(int start, int co
 		p[i*4 + 3] = 0;
 	}
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f09;
-	vmf.vmf_ebx = 0;	/* set primary palette data */
-	vmf.vmf_ecx = colors;
-	vmf.vmf_edx = start;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+	vesa_emu.x86.R_EAX = 0x4f09;
+	vesa_emu.x86.R_EBX = 0;
+	vesa_emu.x86.R_ECX = colors;
+	vesa_emu.x86.R_EDX = start;
+
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
-	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
 }
 
 #ifdef notyet
@@ -391,12 +456,11 @@ static int
 vesa_bios_load_palette2(int start, int colors, u_char *r, u_char *g, u_char *b,
 			int bits)
 {
-	struct vm86frame vmf;
 	u_char *p;
-	int err;
 	int i;
 
-	p = vesa_vm86_buf;
+	p = (emumem + REALOFF(2));
+
 	bits = 8 - bits;
 	for (i = 0; i < colors; ++i) {
 		p[i*4]	   = b[i] >> bits;
@@ -405,92 +469,94 @@ vesa_bios_load_palette2(int start, int c
 		p[i*4 + 3] = 0;
 	}
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f09;
-	vmf.vmf_ebx = 0;	/* set primary palette data */
-	vmf.vmf_ecx = colors;
-	vmf.vmf_edx = start;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)p, &vmf.vmf_es, &vmf.vmf_di);
+	vesa_emu.x86.R_EAX = 0x4f09;
+	vesa_emu.x86.R_EBX = 0;
+	vesa_emu.x86.R_ECX = colors;
+	vesa_emu.x86.R_EDX = start;
+
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
-	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	return ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
 }
 #endif
 
 static int
 vesa_bios_state_buf_size(void)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f04;
+	vesa_emu.x86.R_ECX = STATE_ALL;
+	vesa_emu.x86.R_EDX = STATE_SIZE;
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f04; 
-	vmf.vmf_ecx = STATE_ALL;
-	vmf.vmf_edx = STATE_SIZE;
-	err = vm86_intcall(0x10, &vmf);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
 		return 0;
-	return vmf.vmf_bx*64;
+
+	return vesa_emu.x86.R_BX*64;
 }
 
 static int
 vesa_bios_save_restore(int code, void *p, size_t size)
 {
-	struct vm86frame vmf;
 	u_char *buf;
-	int err;
 
-	if (size > VESA_VM86_BUFSIZE)
+	if (size > VESA_X86EMU_BUFSIZE)
 		return (1);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f04; 
-	vmf.vmf_ecx = STATE_ALL;
-	vmf.vmf_edx = code;	/* STATE_SAVE/STATE_LOAD */
-	buf = vesa_vm86_buf;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)buf, &vmf.vmf_es, &vmf.vmf_bx);
+	vesa_emu.x86.R_EAX = 0x4f04;
+	vesa_emu.x86.R_ECX = STATE_ALL;
+	vesa_emu.x86.R_EDX = code;
+
+	buf = emumem + REALOFF(2);
+
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
+
 	bcopy(p, buf, size);
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
 	bcopy(buf, p, size);
-	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+
+	return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
 }
 
 static int
 vesa_bios_get_line_length(void)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f06;
+	vesa_emu.x86.R_EBX = 1;
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f06; 
-	vmf.vmf_ebx = 1;	/* get scan line length */
-	err = vm86_intcall(0x10, &vmf);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
 		return -1;
-	return vmf.vmf_bx;	/* line length in bytes */
+	return vesa_emu.x86.R_BX;
 }
 
 static int
 vesa_bios_set_line_length(int pixel, int *bytes, int *lines)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f06;
+	vesa_emu.x86.R_EBX = 0;
+	vesa_emu.x86.R_ECX = pixel;
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f06; 
-	vmf.vmf_ebx = 0;	/* set scan line length in pixel */
-	vmf.vmf_ecx = pixel;
-	err = vm86_intcall(0x10, &vmf);
 #if VESA_DEBUG > 1
-	printf("bx:%d, cx:%d, dx:%d\n", vmf.vmf_bx, vmf.vmf_cx, vmf.vmf_dx); 
+	printf("bx:%d, cx:%d, dx:%d\n", vesa_emu.x86.R_BX, vesa_emu.x86.R_CX, vesa_emu.x86.R_DX);
 #endif
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
-		return 1;
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
+		return -1;
+
 	if (bytes)
-		*bytes = vmf.vmf_bx;
+		*bytes = vesa_emu.x86.R_BX;
 	if (lines)
-		*lines = vmf.vmf_dx;
+		*lines = vesa_emu.x86.R_DX;
+
 	return 0;
 }
 
@@ -498,17 +564,17 @@ vesa_bios_set_line_length(int pixel, int
 static int
 vesa_bios_get_start(int *x, int *y)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f07;
+	vesa_emu.x86.R_EBX = 1;
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if ((vesa_emu.x86.R_AX & 0xff) != 0x4f)
+		return -1;
+
+	*x = vesa_emu.x86.R_CX;
+	*y = vesa_emu.x86.R_DX;
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f07; 
-	vmf.vmf_ebx = 1;	/* get display start */
-	err = vm86_intcall(0x10, &vmf);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f))
-		return 1;
-	*x = vmf.vmf_cx;
-	*y = vmf.vmf_dx;
 	return 0;
 }
 #endif
@@ -516,16 +582,14 @@ vesa_bios_get_start(int *x, int *y)
 static int
 vesa_bios_set_start(int x, int y)
 {
-	struct vm86frame vmf;
-	int err;
+	vesa_emu.x86.R_EAX = 0x4f07;
+	vesa_emu.x86.R_EBX = 0x80;
+	vesa_emu.x86.R_EDX = y;
+	vesa_emu.x86.R_ECX = x;
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
 
-	bzero(&vmf, sizeof(vmf));
-	vmf.vmf_eax = 0x4f07; 
-	vmf.vmf_ebx = 0x80;	/* set display start */
-	vmf.vmf_edx = y;
-	vmf.vmf_ecx = x;
-	err = vm86_intcall(0x10, &vmf);
-	return ((err != 0) || (vmf.vmf_ax != 0x4f));
+	return ((vesa_emu.x86.R_AX & 0xff) != 0x4f);
 }
 
 /* map a generic video mode to a known mode */
@@ -595,30 +659,15 @@ vesa_translate_mmodel(u_int8_t vmodel)
 	return V_INFO_MM_OTHER;
 }
 
-static void
-*vesa_fix_ptr(u_int32_t p, u_int16_t seg, u_int16_t off, u_char *buf)
-{
-	if (p == 0)
-		return NULL;
-	if (((p >> 16) == seg) && ((p & 0xffff) >= off))
-		return (void *)(buf + ((p & 0xffff) - off));
-	else {
-		p = BIOS_SADDRTOLADDR(p);
-		return (void *)BIOS_PADDRTOVADDR(p);
-	}
-}
-
 static int
 vesa_bios_init(void)
 {
-	static u_char buf[512];
-	struct vm86frame vmf;
+	static struct vesa_info buf;
 	struct vesa_mode vmode;
 	video_info_t *p;
 	u_char *vmbuf;
 	int is_via_cle266;
 	int modes;
-	int err;
 	int i;
 
 	if (vesa_init_done)
@@ -629,28 +678,24 @@ vesa_bios_init(void)
 	vesa_vmode_max = 0;
 	vesa_vmode[0].vi_mode = EOT;
 
-	/* Allocate a buffer and add each page to the vm86 context. */
-	vesa_vm86_buf = malloc(VESA_VM86_BUFSIZE, M_DEVBUF, M_WAITOK | M_ZERO);
-	KASSERT(((vm_offset_t)vesa_vm86_buf & PAGE_MASK) == 0,
-	    ("bad vesa_vm86_buf alignment"));
-	for (i = 0; i < howmany(VESA_VM86_BUFSIZE, PAGE_SIZE); i++)
-		vm86_addpage(&vesa_vmcontext, i + 1,
-		    (vm_offset_t)vesa_vm86_buf + PAGE_SIZE * i);
-
-	vmbuf = vesa_vm86_buf;
-	bzero(&vmf, sizeof(vmf));	/* paranoia */
+	vmbuf = (emumem + REALOFF(2));
 	bcopy("VBE2", vmbuf, 4);	/* try for VBE2 data */
-	vmf.vmf_eax = 0x4f00;
-	vm86_getptr(&vesa_vmcontext, (vm_offset_t)vmbuf, &vmf.vmf_es, &vmf.vmf_di);
 
-	err = vm86_datacall(0x10, &vmf, &vesa_vmcontext);
-	if ((err != 0) || (vmf.vmf_ax != 0x4f) || bcmp("VESA", vmbuf, 4))
+	vesa_emu.x86.R_EAX = 0x4f00;
+	vesa_emu.x86.R_ES = SEG_ADDR(REALOFF(2));
+	vesa_emu.x86.R_DI = SEG_OFF(REALOFF(2));
+
+	x86emu_exec_intr(&vesa_emu, 0x10);
+
+	if (((vesa_emu.x86.R_AX & 0xff) != 0x4f) || bcmp("VESA", vmbuf, 4))
 		return 1;
-	bcopy(vmbuf, buf, sizeof(buf));
-	vesa_adp_info = (struct vesa_info *)buf;
+
+	bcopy(vmbuf, &buf, sizeof(buf));
+
+	vesa_adp_info = &buf;
 	if (bootverbose) {
 		printf("VESA: information block\n");
-		dump_buffer(buf, 64);
+		dump_buffer((u_char *)&buf, sizeof(buf));
 	}
 	if (vesa_adp_info->v_version < 0x0102) {
 		printf("VESA: VBE version %d.%d is not supported; "
@@ -662,28 +707,21 @@ vesa_bios_init(void)
 		return 1;
 	}
 
-	/* fix string ptrs */
-	vesa_oemstr = (char *)vesa_fix_ptr(vesa_adp_info->v_oemstr,
-					   vmf.vmf_es, vmf.vmf_di, buf);
+	vesa_oemstr = (char *)(emumem + L_ADD(vesa_adp_info->v_oemstr));
+
 	is_via_cle266 = strcmp(vesa_oemstr, VESA_VIA_CLE266) == 0;
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 10:05:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F2B491065676;
	Wed,  9 Sep 2009 10:05:50 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CAED78FC1E;
	Wed,  9 Sep 2009 10:05:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89A5oW9080184;
	Wed, 9 Sep 2009 10:05:50 GMT (envelope-from nyan@svn.freebsd.org)
Received: (from nyan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89A5oxj080183;
	Wed, 9 Sep 2009 10:05:50 GMT (envelope-from nyan@svn.freebsd.org)
Message-Id: <200909091005.n89A5oxj080183@svn.freebsd.org>
From: Takahashi Yoshihiro 
Date: Wed, 9 Sep 2009 10:05:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197026 - head/sys/pc98/include/pc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 10:05:51 -0000

Author: nyan
Date: Wed Sep  9 10:05:50 2009
New Revision: 197026
URL: http://svn.freebsd.org/changeset/base/197026

Log:
  MFi386: Remove old file.

Deleted:
  head/sys/pc98/include/pc/vesa.h

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 10:31:11 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 432AB1065670;
	Wed,  9 Sep 2009 10:31:10 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 326BD8FC1B;
	Wed,  9 Sep 2009 10:31:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89AVA9d082725;
	Wed, 9 Sep 2009 10:31:10 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89AVA8b082723;
	Wed, 9 Sep 2009 10:31:10 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909091031.n89AVA8b082723@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 9 Sep 2009 10:31:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197028 - stable/8/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 10:31:11 -0000

Author: kib
Date: Wed Sep  9 10:31:09 2009
New Revision: 197028
URL: http://svn.freebsd.org/changeset/base/197028

Log:
  Use traditional td_unusedX names for the padding members.
  
  Suggested by:	julian
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/sys/proc.h

Modified: stable/8/sys/sys/proc.h
==============================================================================
--- stable/8/sys/sys/proc.h	Wed Sep  9 10:13:56 2009	(r197027)
+++ stable/8/sys/sys/proc.h	Wed Sep  9 10:31:09 2009	(r197028)
@@ -267,9 +267,9 @@ struct thread {
 	struct vm_object *td_kstack_obj;/* (a) Kstack object. */
 	vm_offset_t	td_kstack;	/* (a) Kernel VA of kstack. */
 	int		td_kstack_pages; /* (a) Size of the kstack. */
-	void		*td_space1;
-	vm_offset_t	td_space2;
-	int		td_space3;
+	void		*td_unused1;
+	vm_offset_t	td_unused2;
+	int		td_unused3;
 	volatile u_int	td_critnest;	/* (k*) Critical section nest level. */
 	struct mdthread td_md;		/* (k) Any machine-dependent fields. */
 	struct td_sched	*td_sched;	/* (*) Scheduler-specific data. */

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 10:31:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3A5D01065694;
	Wed,  9 Sep 2009 10:31:21 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2AE888FC19;
	Wed,  9 Sep 2009 10:31:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89AVLC4082764;
	Wed, 9 Sep 2009 10:31:21 GMT (envelope-from phk@svn.freebsd.org)
Received: (from phk@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89AVLUQ082762;
	Wed, 9 Sep 2009 10:31:21 GMT (envelope-from phk@svn.freebsd.org)
Message-Id: <200909091031.n89AVLUQ082762@svn.freebsd.org>
From: Poul-Henning Kamp 
Date: Wed, 9 Sep 2009 10:31:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197029 - head/lib/libc/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 10:31:21 -0000

Author: phk
Date: Wed Sep  9 10:31:20 2009
New Revision: 197029
URL: http://svn.freebsd.org/changeset/base/197029

Log:
  Revert r196976, now that  behaves predictably.

Modified:
  head/lib/libc/net/getifaddrs.c

Modified: head/lib/libc/net/getifaddrs.c
==============================================================================
--- head/lib/libc/net/getifaddrs.c	Wed Sep  9 10:31:09 2009	(r197028)
+++ head/lib/libc/net/getifaddrs.c	Wed Sep  9 10:31:20 2009	(r197029)
@@ -33,7 +33,6 @@
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
-#include 
 #include 
 #include 
 #include 

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 10:51:52 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95A771065670;
	Wed,  9 Sep 2009 10:51:52 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8592B8FC17;
	Wed,  9 Sep 2009 10:51:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89AppEt083219;
	Wed, 9 Sep 2009 10:51:51 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89Appfs083217;
	Wed, 9 Sep 2009 10:51:51 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909091051.n89Appfs083217@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 9 Sep 2009 10:51:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197030 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 10:51:52 -0000

Author: kib
Date: Wed Sep  9 10:51:50 2009
New Revision: 197030
URL: http://svn.freebsd.org/changeset/base/197030

Log:
  In vfs_mark_atime(9), be resistent against reclaimed vnodes.
  Assert that neccessary locks are taken, since vop might not be called.
  
  Tested by:	pho
  MFC after:	3 days

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Wed Sep  9 10:31:20 2009	(r197029)
+++ head/sys/kern/vfs_subr.c	Wed Sep  9 10:51:50 2009	(r197030)
@@ -4269,8 +4269,12 @@ vfs_read_dirent(struct vop_readdir_args 
 void
 vfs_mark_atime(struct vnode *vp, struct ucred *cred)
 {
+	struct mount *mp;
 
-	if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
+	mp = vp->v_mount;
+	VFS_ASSERT_GIANT(mp);
+	ASSERT_VOP_LOCKED(vp, "vfs_mark_atime");
+	if (mp != NULL && (mp->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
 		(void)VOP_MARKATIME(vp);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 10:52:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 65CE3106566B;
	Wed,  9 Sep 2009 10:52:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 55E458FC0C;
	Wed,  9 Sep 2009 10:52:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89Aqaq7083269;
	Wed, 9 Sep 2009 10:52:36 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89Aqar0083267;
	Wed, 9 Sep 2009 10:52:36 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909091052.n89Aqar0083267@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 9 Sep 2009 10:52:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197031 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 10:52:36 -0000

Author: kib
Date: Wed Sep  9 10:52:36 2009
New Revision: 197031
URL: http://svn.freebsd.org/changeset/base/197031

Log:
  Unlock the image vnode around the call of pmc PMC_FN_PROCESS_EXEC hook.
  The hook calls vn_fullpath(9), that should not be executed with a vnode
  lock held.
  
  Reported by:	Bruce Cran 
  Tested by:	pho
  MFC after:	3 days

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==============================================================================
--- head/sys/kern/kern_exec.c	Wed Sep  9 10:51:50 2009	(r197030)
+++ head/sys/kern/kern_exec.c	Wed Sep  9 10:52:36 2009	(r197031)
@@ -786,10 +786,12 @@ interpret:
 	 */
 	if (PMC_SYSTEM_SAMPLING_ACTIVE() || PMC_PROC_IS_USING_PMCS(p)) {
 		PROC_UNLOCK(p);
+		VOP_UNLOCK(imgp->vp, 0);
 		pe.pm_credentialschanged = credential_changing;
 		pe.pm_entryaddr = imgp->entry_addr;
 
 		PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC, (void *) &pe);
+		vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
 	} else
 		PROC_UNLOCK(p);
 #else  /* !HWPMC_HOOKS */

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 12:19:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 48597106566B;
	Wed,  9 Sep 2009 12:19:44 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 347328FC08;
	Wed,  9 Sep 2009 12:19:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89CJiVh085371;
	Wed, 9 Sep 2009 12:19:44 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89CJiRP085365;
	Wed, 9 Sep 2009 12:19:44 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200909091219.n89CJiRP085365@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 9 Sep 2009 12:19:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197038 - stable/8/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 12:19:44 -0000

Author: edwin
Date: Wed Sep  9 12:19:43 2009
New Revision: 197038
URL: http://svn.freebsd.org/changeset/base/197038

Log:
  MFC of r196581 r196582 r197000
  Import of tzdata 2009k, 2009l and 2009m
  
  - Changes in Mauritius and Bangladesh
  - No leapsecond at the end of December 2009
  
  - Egypt will go to Wintertime on 21 August 2009
  
  - Samoa will go in DST on 4 October 2009 till 28 March 2010
  - Palestine will go back from DST on 4 September 2009
  
  Approved by:	re (kostik)

Modified:
  stable/8/share/zoneinfo/   (props changed)
  stable/8/share/zoneinfo/africa
  stable/8/share/zoneinfo/asia
  stable/8/share/zoneinfo/australasia
  stable/8/share/zoneinfo/europe
  stable/8/share/zoneinfo/leapseconds

Modified: stable/8/share/zoneinfo/africa
==============================================================================
--- stable/8/share/zoneinfo/africa	Wed Sep  9 11:36:30 2009	(r197037)
+++ stable/8/share/zoneinfo/africa	Wed Sep  9 12:19:43 2009	(r197038)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.21
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct
@@ -502,11 +521,33 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
 # 
 
+# From Steffen Thorsen (2009-06-05):
+# According to several sources, Mauritius will not continue to observe
+# DST the coming summer...
+#
+# Some sources, in French:
+# 
+# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
+# 
+# 
+# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
+# 
+#
+# Our wrap-up:
+# 
+# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# 
+
+# From Arthur David Olson (2009-07-11):
+# The "mauritius-dst-will-not-repeat" wrapup includes this: 
+# "The trial ended on March 29, 2009, when the clocks moved back by one hour
+# at 2am (or 02:00) local time..."
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
+Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
+Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: stable/8/share/zoneinfo/asia
==============================================================================
--- stable/8/share/zoneinfo/asia	Wed Sep  9 11:36:30 2009	(r197037)
+++ stable/8/share/zoneinfo/asia	Wed Sep  9 12:19:43 2009	(r197038)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.35
+# @(#)asia	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,6 +172,12 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
+# From Arthur David Olson (2009-07-11):
+# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
+# can appear in the Dhaka binary file and for the benefit of old glibc
+# reimplementations of the time zone software that mishandle permanent DST.
+# A change will be required once the end date is known.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -180,7 +186,8 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	1:00	BDST	2010
+			6:00	-	BDT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1829,6 +1836,42 @@ Zone	Asia/Karachi	4:28:12 -	LMT	1907
 # http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
 # 
 
+# From Steffen Thorsen (2009-08-31):
+# Palestine's Council of Ministers announced that they will revert back to
+# winter time on Friday, 2009-09-04.
+#
+# One news source:
+# 
+# http://www.safa.ps/ara/?action=showdetail&seid=4158
+# 
+# (Palestinian press agency, Arabic),
+# Google translate: "Decided that the Palestinian government in Ramallah
+# headed by Salam Fayyad, the start of work in time for the winter of
+# 2009, starting on Friday approved the fourth delay Sept. clock sixty
+# minutes per hour as of Friday morning."
+#
+# We are not sure if Gaza will do the same, last year they had a different
+# end date, we will keep this page updated:
+# 
+# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
+# 
+
+# From Alexander Krivenyshev (2009-09-02):
+# Seems that Gaza Strip will go back to Winter Time same date as West Bank.
+#
+# According to Palestinian Ministry Of Interior, West Bank and Gaza Strip plan
+# to change time back to Standard time on September 4, 2009.
+#
+# "Winter time unite the West Bank and Gaza"
+# (from Palestinian National Authority):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
+# 
+
 # The rules for Egypt are stolen from the `africa' file.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -1847,7 +1890,7 @@ Rule Palestine	2006	only	-	Sep	22	0:00	0
 Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
 Rule Palestine	2008	only	-	Aug	lastFri	2:00	0	-
 Rule Palestine	2009	max	-	Mar	lastFri	0:00	1:00	S
-Rule Palestine	2009	max	-	Sep	lastMon	2:00	0	-
+Rule Palestine	2009	max	-	Sep	Fri>=1	2:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct

Modified: stable/8/share/zoneinfo/australasia
==============================================================================
--- stable/8/share/zoneinfo/australasia	Wed Sep  9 11:36:30 2009	(r197037)
+++ stable/8/share/zoneinfo/australasia	Wed Sep  9 12:19:43 2009	(r197038)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.13
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,10 +427,42 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
+# From Steffen Thorsen (2009-08-27):
+# Samoa's parliament passed the Daylight Saving Bill 2009, and will start 
+# daylight saving time on the first Sunday of October 2009 and end on the 
+# last Sunday of March 2010. We hope that the full text will be published 
+# soon, but we believe that the bill is only valid for 2009-2010. Samoa's 
+# Daylight Saving Act 2009 will be enforced as soon as the Head of State 
+# executes a proclamation publicizing this Act.
+#
+# Some background information here, which will be updated once we have 
+# more details:
+# 
+# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time
-			-11:00	-	WST			# Samoa Time
+			-11:00	-	WST	2009 Oct 4
+			-11:00	1:00	WSDT	2010 Mar 28
+			-11:00	-	WST
 
 # Solomon Is
 # excludes Bougainville, for which see Papua New Guinea

Modified: stable/8/share/zoneinfo/europe
==============================================================================
--- stable/8/share/zoneinfo/europe	Wed Sep  9 11:36:30 2009	(r197037)
+++ stable/8/share/zoneinfo/europe	Wed Sep  9 12:19:43 2009	(r197038)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.21
+# @(#)europe	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -459,7 +459,7 @@ Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0
 Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
 Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
 # The most recent directive covers the years starting in 2002.  See:
-# 
+# 
 # Directive 2000/84/EC of the European Parliament and of the Council
 # of 19 January 2001 on summer-time arrangements.
 # 

Modified: stable/8/share/zoneinfo/leapseconds
==============================================================================
--- stable/8/share/zoneinfo/leapseconds	Wed Sep  9 11:36:30 2009	(r197037)
+++ stable/8/share/zoneinfo/leapseconds	Wed Sep  9 12:19:43 2009	(r197038)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.8
+# @(#)leapseconds	8.9
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -58,29 +58,30 @@ Leap	2008	Dec	31	23:59:60	+	S
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 15 January 2009
+# Paris, 4 July 2009
 #
-# Bulletin C 37
+# Bulletin C 38
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# NO positive leap second will be introduced at the end of June 2009.
-# The difference between Coordinated Universal Time UTC and the 
-# International Atomic Time TAI is :             
-#                
-#     from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# INFORMATION ON UTC - TAI
+#
+# NO positive leap second will be introduced at the end of December 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
+#
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
+# Director			
 # Earth Orientation Center of IERS
 # Observatoire de Paris, France

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 12:56:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A89F3106568B;
	Wed,  9 Sep 2009 12:56:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 97A258FC0A;
	Wed,  9 Sep 2009 12:56:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89Cu5e0086132;
	Wed, 9 Sep 2009 12:56:05 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89Cu5Pn086130;
	Wed, 9 Sep 2009 12:56:05 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200909091256.n89Cu5Pn086130@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 9 Sep 2009 12:56:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197039 - head/sys/nfsserver
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 12:56:05 -0000

Author: pjd
Date: Wed Sep  9 12:56:05 2009
New Revision: 197039
URL: http://svn.freebsd.org/changeset/base/197039

Log:
  Fix usecount leak in mknod(2) on file system exported over NFS.
  
  While I'm here, correct typo in comment.
  
  Reviewed by:	kan, kib
  MFC after:	3 days

Modified:
  head/sys/nfsserver/nfs_serv.c

Modified: head/sys/nfsserver/nfs_serv.c
==============================================================================
--- head/sys/nfsserver/nfs_serv.c	Wed Sep  9 12:19:43 2009	(r197038)
+++ head/sys/nfsserver/nfs_serv.c	Wed Sep  9 12:56:05 2009	(r197039)
@@ -1686,7 +1686,7 @@ out:
 	if (dirp) {
 		vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
 		diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
-		VOP_UNLOCK(dirp, 0);
+		vput(drip);
 	}
 ereply:
 	nfsm_reply(NFSX_SRVFH(1) + NFSX_POSTOPATTR(1) + NFSX_WCCDATA(1));
@@ -3825,7 +3825,7 @@ nfsmout:
  *     what the heck.
  *
  * The exception to rule 2 is EPERM. If a file is IMMUTABLE, VOP_ACCESS()
- * will return EPERM instead of EACCESS. EPERM is always an error.
+ * will return EPERM instead of EACCES. EPERM is always an error.
  */
 static int
 nfsrv_access(struct vnode *vp, accmode_t accmode, struct ucred *cred,

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 13:23:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC978106568B;
	Wed,  9 Sep 2009 13:23:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BB9738FC19;
	Wed,  9 Sep 2009 13:23:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89DNQtq086716;
	Wed, 9 Sep 2009 13:23:26 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89DNQ3B086714;
	Wed, 9 Sep 2009 13:23:26 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200909091323.n89DNQ3B086714@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 9 Sep 2009 13:23:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197040 - head/sys/nfsserver
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 13:23:26 -0000

Author: pjd
Date: Wed Sep  9 13:23:26 2009
New Revision: 197040
URL: http://svn.freebsd.org/changeset/base/197040

Log:
  Correct typo after manual patching.
  
  Noticed by:	b. f.

Modified:
  head/sys/nfsserver/nfs_serv.c

Modified: head/sys/nfsserver/nfs_serv.c
==============================================================================
--- head/sys/nfsserver/nfs_serv.c	Wed Sep  9 12:56:05 2009	(r197039)
+++ head/sys/nfsserver/nfs_serv.c	Wed Sep  9 13:23:26 2009	(r197040)
@@ -1686,7 +1686,7 @@ out:
 	if (dirp) {
 		vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY);
 		diraft_ret = VOP_GETATTR(dirp, &diraft, cred);
-		vput(drip);
+		vput(dirp);
 	}
 ereply:
 	nfsm_reply(NFSX_SRVFH(1) + NFSX_POSTOPATTR(1) + NFSX_WCCDATA(1));

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 13:26:19 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31F19106566C;
	Wed,  9 Sep 2009 13:26:19 +0000 (UTC)
	(envelope-from ache@nagual.pp.ru)
Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69])
	by mx1.freebsd.org (Postfix) with ESMTP id 9945C8FC08;
	Wed,  9 Sep 2009 13:26:18 +0000 (UTC)
Received: from nagual.pp.ru (ache@localhost [127.0.0.1])
	by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n89DQGIZ035867;
	Wed, 9 Sep 2009 17:26:17 +0400 (MSD)
	(envelope-from ache@nagual.pp.ru)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru;
	s=default; t=1252502777;
	bh=eRDuSaV2e+ZBpvJCqs/q83VhZqI/2vulKS84wJiWzxc=; l=963;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	Content-Type:In-Reply-To;
	b=S75dtThzO0JPJ9VTrSK3MDfPdw2YOFhOj8RRl+pJ9Zmuz1wTPTqsxQAvb5PQ0zjPt
	gmvJE38fNLJUJFcb98KlsIxosUT6AJcMz6eXg8z7Q03/8SyD89yzxSggjouXlZ2Y5B
	r+UKOrj89j8lYmFgxvkKCvP6X+bUUXsptFYhK15E=
Received: (from ache@localhost)
	by nagual.pp.ru (8.14.3/8.14.3/Submit) id n89DQGST035866;
	Wed, 9 Sep 2009 17:26:16 +0400 (MSD) (envelope-from ache)
Date: Wed, 9 Sep 2009 17:26:16 +0400
From: Andrey Chernov 
To: Roman Divacky 
Message-ID: <20090909132616.GA35808@nagual.pp.ru>
Mail-Followup-To: Andrey Chernov ,
	Roman Divacky , src-committers@FreeBSD.org,
	svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org
References: <200909081555.n88FtDwe052523@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200909081555.n88FtDwe052523@svn.freebsd.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196981 - head/usr.bin/unzip
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 13:26:19 -0000

On Tue, Sep 08, 2009 at 03:55:13PM +0000, Roman Divacky wrote:
> +		 * Detect whether this is a text file.  The correct way to
> +		 * do this is to check the least significant bit of the
> +		 * "internal file attributes" field of the corresponding
> +		 * file header in the central directory, but libarchive
> +		 * does not read the central directory, so we have to
> +		 * guess by looking for non-ASCII characters in the
> +		 * buffer.  Hopefully we won't guess wrong.  If we do
> +		 * guess wrong, we print a warning message later.
> +		 */
> +		if (a_opt && n == 0) {
> +			for (p = buffer; p < end; ++p) {
> +				if (!isascii((unsigned char)*p)) {
> +					text = 0;
> +					break;
> +				}
> +			}
> +		}
> +

If I understand the purpose of this code right, better use
isalnum()+ispunct()+ispace()
combination to count non-ASCII people too.
Also setlocale() call must be added to the main() for that.

-- 
http://ache.pp.ru/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 13:28:19 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4E94710656A9;
	Wed,  9 Sep 2009 13:28:19 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B01C8FC15;
	Wed,  9 Sep 2009 13:28:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89DSJVY086880;
	Wed, 9 Sep 2009 13:28:19 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89DSJkP086878;
	Wed, 9 Sep 2009 13:28:19 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909091328.n89DSJkP086878@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 9 Sep 2009 13:28:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197041 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 13:28:19 -0000

Author: kib
Date: Wed Sep  9 13:28:18 2009
New Revision: 197041
URL: http://svn.freebsd.org/changeset/base/197041

Log:
  MFC r196887:
  In fhopen, vfs_ref() the mount point while vnode is unlocked, to prevent
  vn_start_write(NULL, &mp) from operating on potentially freed or reused
  struct mount *.
  
  Remove unmatched vfs_rel() in cleanup.
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/   (props changed)
  stable/8/sys/kern/vfs_syscalls.c

Modified: stable/8/sys/kern/vfs_syscalls.c
==============================================================================
--- stable/8/sys/kern/vfs_syscalls.c	Wed Sep  9 13:23:26 2009	(r197040)
+++ stable/8/sys/kern/vfs_syscalls.c	Wed Sep  9 13:28:18 2009	(r197041)
@@ -4439,12 +4439,15 @@ fhopen(td, uap)
 			goto bad;
 	}
 	if (fmode & O_TRUNC) {
+		vfs_ref(mp);
 		VOP_UNLOCK(vp, 0);				/* XXX */
 		if ((error = vn_start_write(NULL, &mp, V_WAIT | PCATCH)) != 0) {
 			vrele(vp);
+			vfs_rel(mp);
 			goto out;
 		}
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);	/* XXX */
+		vfs_rel(mp);
 #ifdef MAC
 		/*
 		 * We don't yet have fp->f_cred, so use td->td_ucred, which
@@ -4516,7 +4519,6 @@ fhopen(td, uap)
 
 	VOP_UNLOCK(vp, 0);
 	fdrop(fp, td);
-	vfs_rel(mp);
 	VFS_UNLOCK_GIANT(vfslocked);
 	td->td_retval[0] = indx;
 	return (0);

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 14:17:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 062991065692;
	Wed,  9 Sep 2009 14:17:08 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFF6F8FC1C;
	Wed,  9 Sep 2009 14:17:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89EH7H7087959;
	Wed, 9 Sep 2009 14:17:07 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89EH7RT087958;
	Wed, 9 Sep 2009 14:17:07 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200909091417.n89EH7RT087958@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Wed, 9 Sep 2009 14:17:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197042 - head/share/man/man4/man4.i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 14:17:08 -0000

Author: bz
Date: Wed Sep  9 14:17:07 2009
New Revision: 197042
URL: http://svn.freebsd.org/changeset/base/197042

Log:
  Remove dpms.4 missed in r197025.

Modified:
  head/share/man/man4/man4.i386/Makefile

Modified: head/share/man/man4/man4.i386/Makefile
==============================================================================
--- head/share/man/man4/man4.i386/Makefile	Wed Sep  9 13:28:18 2009	(r197041)
+++ head/share/man/man4/man4.i386/Makefile	Wed Sep  9 14:17:07 2009	(r197042)
@@ -10,7 +10,6 @@ MAN=	aic.4 \
 	cs.4 \
 	ct.4 \
 	ctau.4 \
-	dpms.4 \
 	cx.4 \
 	ep.4 \
 	ex.4 \

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 15:14:33 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E32B106568B;
	Wed,  9 Sep 2009 15:14:33 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 58BC18FC18;
	Wed,  9 Sep 2009 15:14:33 +0000 (UTC)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 5F6EC6D44C;
	Wed,  9 Sep 2009 15:14:32 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 2F65D844A5; Wed,  9 Sep 2009 17:14:32 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Andrey Chernov 
References: <200909081555.n88FtDwe052523@svn.freebsd.org>
	<20090909132616.GA35808@nagual.pp.ru>
Date: Wed, 09 Sep 2009 17:14:32 +0200
In-Reply-To: <20090909132616.GA35808@nagual.pp.ru> (Andrey Chernov's message
	of "Wed, 9 Sep 2009 17:26:16 +0400")
Message-ID: <86d460kv53.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@FreeBSD.org, Roman Divacky ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r196981 - head/usr.bin/unzip
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 15:14:33 -0000

Andrey Chernov  writes:
> If I understand the purpose of this code right, better use
> isalnum()+ispunct()+ispace()
> combination to count non-ASCII people too.

uh, isprint() perhaps?

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 15:16:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2007106566C;
	Wed,  9 Sep 2009 15:16:10 +0000 (UTC)
	(envelope-from kientzle@freebsd.org)
Received: from kientzle.com (kientzle.com [66.166.149.50])
	by mx1.freebsd.org (Postfix) with ESMTP id AEC888FC16;
	Wed,  9 Sep 2009 15:16:10 +0000 (UTC)
Received: (from root@localhost)
	by kientzle.com (8.14.3/8.14.3) id n89FG9BU006546;
	Wed, 9 Sep 2009 08:16:09 -0700 (PDT)
	(envelope-from kientzle@freebsd.org)
Received: from dark.x.kientzle.com (fw2.kientzle.com [10.123.1.2])
	by kientzle.com with SMTP id 594eueahh7fz2ha79fk9dbp7pi;
	Wed, 09 Sep 2009 08:16:09 -0700 (PDT)
	(envelope-from kientzle@freebsd.org)
Message-ID: <4AA7C6B9.1020600@freebsd.org>
Date: Wed, 09 Sep 2009 08:16:09 -0700
From: Tim Kientzle 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
	rv:1.8.1.21) Gecko/20090601 SeaMonkey/1.1.16
MIME-Version: 1.0
To: Andrey Chernov , Roman Divacky , 
	src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
References: <200909081555.n88FtDwe052523@svn.freebsd.org>
	<20090909132616.GA35808@nagual.pp.ru>
In-Reply-To: <20090909132616.GA35808@nagual.pp.ru>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: 
Subject: Re: svn commit: r196981 - head/usr.bin/unzip
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 15:16:11 -0000

Andrey Chernov wrote:
> On Tue, Sep 08, 2009 at 03:55:13PM +0000, Roman Divacky wrote:
>> +	 * Detect whether this is a text file.  ...  but libarchive
>> +	 * does not read the central directory, so we have to
>> +	 * guess ...
>> +	 */
>> +	if (a_opt && n == 0) {
>> +		for (p = buffer; p < end; ++p) {
>> +			if (!isascii((unsigned char)*p)) {
>> +				text = 0;
>> +				break;
>> +			}
>> +		}
>> +	}
>> +
> 
> If I understand the purpose of this code right, better use
> isalnum()+ispunct()+ispace()
> combination to count non-ASCII people too.
> Also setlocale() call must be added to the main() for that.

Personally, I would rather see unzip just ignore the -a
option entirely, but I suppose that's probably infeasible.

Since this is only to support -a (which does end-of-line
conversions), I would suggest using a rather different
set of heuristics that examines end-of-line sequences
and control characters only:
   * Any byte value <31 that's not CR or LF: not text
   * LF not preceded by CR: not text
   * CR not followed by LF: not text (or at least, not DOS text)
   * Otherwise, it is text.

At a minimum, this dodges the locale issue.

Someday, I'll get around to filling in the seek support
that libarchive needs for reading central directories,
then unzip can look at the "text file" bit (which
is no more reliable than anything described above) and
this code can just go away.

Tim

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 16:31:50 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 809E6106568B;
	Wed,  9 Sep 2009 16:31:50 +0000 (UTC)
	(envelope-from ache@nagual.pp.ru)
Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69])
	by mx1.freebsd.org (Postfix) with ESMTP id E839C8FC21;
	Wed,  9 Sep 2009 16:31:49 +0000 (UTC)
Received: from nagual.pp.ru (ache@localhost [127.0.0.1])
	by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n89GVk9F037949;
	Wed, 9 Sep 2009 20:31:46 +0400 (MSD)
	(envelope-from ache@nagual.pp.ru)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru;
	s=default; t=1252513906;
	bh=S2R/iQ+02gUbhQyx4VYVVjqWSgY3mS1RjnLx+K3vz58=; l=475;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	Content-Type:In-Reply-To;
	b=seYHdT7KkxESk7NvwJugUaeNZibHYwVKGKipEvO2JQf3TDCLvEg4lNOk2WJr5g56G
	VPKyPNH0fShsu2yhZ2g4Dnt47sAS2/GgMy0dpbrFd3tyyc7BOewvmcY8y/4Ve8Y6Wp
	rAktagIVu71wHj0xOG3hz7dJbmnxyRkYvQLCUoX0=
Received: (from ache@localhost)
	by nagual.pp.ru (8.14.3/8.14.3/Submit) id n89GVj9m037948;
	Wed, 9 Sep 2009 20:31:45 +0400 (MSD) (envelope-from ache)
Date: Wed, 9 Sep 2009 20:31:44 +0400
From: Andrey Chernov 
To: Dag-Erling Sm??rgrav 
Message-ID: <20090909163144.GA37924@nagual.pp.ru>
Mail-Followup-To: Andrey Chernov ,
	Dag-Erling Sm??rgrav ,
	Roman Divacky , src-committers@FreeBSD.org,
	svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org
References: <200909081555.n88FtDwe052523@svn.freebsd.org>
	<20090909132616.GA35808@nagual.pp.ru> <86d460kv53.fsf@ds4.des.no>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <86d460kv53.fsf@ds4.des.no>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@FreeBSD.org, Roman Divacky ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r196981 - head/usr.bin/unzip
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 16:31:50 -0000

On Wed, Sep 09, 2009 at 05:14:32PM +0200, Dag-Erling Sm??rgrav wrote:
> Andrey Chernov  writes:
> > If I understand the purpose of this code right, better use
> > isalnum()+ispunct()+ispace()
> > combination to count non-ASCII people too.
> 
> uh, isprint() perhaps?

In some charsets there are a lots of printable characters which are rarely 
part of the regular text, i.e. pseudographics. isprint() looks too greedy.

-- 
http://ache.pp.ru/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 16:39:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 48CC4106566C;
	Wed,  9 Sep 2009 16:39:41 +0000 (UTC)
	(envelope-from ache@nagual.pp.ru)
Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69])
	by mx1.freebsd.org (Postfix) with ESMTP id AA2F78FC08;
	Wed,  9 Sep 2009 16:39:40 +0000 (UTC)
Received: from nagual.pp.ru (ache@localhost [127.0.0.1])
	by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n89GdclN038032;
	Wed, 9 Sep 2009 20:39:38 +0400 (MSD)
	(envelope-from ache@nagual.pp.ru)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru;
	s=default; t=1252514379;
	bh=JtZZS2WskHvWFhxx/DQ23psRjF/XOqhJDRmJaBxGZCg=; l=440;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	Content-Type:In-Reply-To;
	b=YZFqW6JjCiSjnlRoQpI4qcLMxMXwiW8OwfjuoskDlfQTGECpT9BChVuEN3/eerkAY
	Ta8sSvHcLqDcoYaJg8d/qyQVYAXAHY+O947EeDCzPAZ9S1EHrU2w8aNWMk9ukd3jE4
	7V9DXYdDctbpK073l7iRawBHWI8L5MYjhIdHslYs=
Received: (from ache@localhost)
	by nagual.pp.ru (8.14.3/8.14.3/Submit) id n89GdcCU038031;
	Wed, 9 Sep 2009 20:39:38 +0400 (MSD) (envelope-from ache)
Date: Wed, 9 Sep 2009 20:39:37 +0400
From: Andrey Chernov 
To: Tim Kientzle 
Message-ID: <20090909163937.GB37924@nagual.pp.ru>
Mail-Followup-To: Andrey Chernov ,
	Tim Kientzle ,
	Roman Divacky , src-committers@freebsd.org,
	svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <200909081555.n88FtDwe052523@svn.freebsd.org>
	<20090909132616.GA35808@nagual.pp.ru>
	<4AA7C6B9.1020600@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4AA7C6B9.1020600@freebsd.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@freebsd.org, Roman Divacky ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r196981 - head/usr.bin/unzip
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 16:39:41 -0000

On Wed, Sep 09, 2009 at 08:16:09AM -0700, Tim Kientzle wrote:
> Since this is only to support -a (which does end-of-line
> conversions), I would suggest using a rather different
> set of heuristics that examines end-of-line sequences
> and control characters only:
>    * Any byte value <31 that's not CR or LF: not text

More carefully - <32, TAB and ^Z (MSDOS EOT) must be 
allowed too and perhaps ^L.

-- 
http://ache.pp.ru/

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 18:55:18 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7069E1065679;
	Wed,  9 Sep 2009 18:55:18 +0000 (UTC) (envelope-from np@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5FC4A8FC17;
	Wed,  9 Sep 2009 18:55:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89ItIaB093952;
	Wed, 9 Sep 2009 18:55:18 GMT (envelope-from np@svn.freebsd.org)
Received: (from np@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89ItIe8093950;
	Wed, 9 Sep 2009 18:55:18 GMT (envelope-from np@svn.freebsd.org)
Message-Id: <200909091855.n89ItIe8093950@svn.freebsd.org>
From: Navdeep Parhar 
Date: Wed, 9 Sep 2009 18:55:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197043 - head/sys/dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 18:55:18 -0000

Author: np
Date: Wed Sep  9 18:55:18 2009
New Revision: 197043
URL: http://svn.freebsd.org/changeset/base/197043

Log:
  There is no need to log anything for a ctrlq stall or restart.  These are
  normal events.
  
  Approved by:	gnn (mentor)
  MFC after:	1 month

Modified:
  head/sys/dev/cxgb/cxgb_sge.c

Modified: head/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_sge.c	Wed Sep  9 14:17:07 2009	(r197042)
+++ head/sys/dev/cxgb/cxgb_sge.c	Wed Sep  9 18:55:18 2009	(r197043)
@@ -1942,7 +1942,6 @@ again:	reclaim_completed_tx_imm(q);
 	if (__predict_false(ret)) {
 		if (ret == 1) {
 			TXQ_UNLOCK(qs);
-			log(LOG_ERR, "no desc available\n");
 			return (ENOSPC);
 		}
 		goto again;
@@ -1955,6 +1954,7 @@ again:	reclaim_completed_tx_imm(q);
 		q->gen ^= 1;
 	}
 	TXQ_UNLOCK(qs);
+	wmb();
 	t3_write_reg(adap, A_SG_KDOORBELL,
 		     F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id));
 	return (0);
@@ -1975,8 +1975,6 @@ restart_ctrlq(void *data, int npending)
 	struct sge_txq *q = &qs->txq[TXQ_CTRL];
 	adapter_t *adap = qs->port->adapter;
 
-	log(LOG_WARNING, "Restart_ctrlq in_use=%d\n", q->in_use);
-	
 	TXQ_LOCK(qs);
 again:	reclaim_completed_tx_imm(q);
 
@@ -2928,9 +2926,9 @@ handle_rsp_cntrl_info(struct sge_qset *q
 	credits = G_RSPD_TXQ0_CR(flags);
 	if (credits) 
 		qs->txq[TXQ_ETH].processed += credits;
-	
+
 	credits = G_RSPD_TXQ2_CR(flags);
-	if (credits) 
+	if (credits)
 		qs->txq[TXQ_CTRL].processed += credits;
 
 # if USE_GTS
@@ -3133,12 +3131,9 @@ process_responses(adapter_t *adap, struc
 		check_ring_db(adap, qs, sleeping);
 
 	mb();  /* commit Tx queue processed updates */
-	if (__predict_false(qs->txq_stopped > 1)) {
-		printf("restarting tx on %p\n", qs);
-		
+	if (__predict_false(qs->txq_stopped > 1))
 		restart_tx(qs);
-	}
-	
+
 	__refill_fl_lt(adap, &qs->fl[0], 512);
 	__refill_fl_lt(adap, &qs->fl[1], 512);
 	budget -= budget_left;

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 19:06:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D14A1106568F;
	Wed,  9 Sep 2009 19:06:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C0CB68FC20;
	Wed,  9 Sep 2009 19:06:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89J61CG094278;
	Wed, 9 Sep 2009 19:06:01 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89J61nd094276;
	Wed, 9 Sep 2009 19:06:01 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200909091906.n89J61nd094276@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Wed, 9 Sep 2009 19:06:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197044 - head/sbin/geom/class/mirror
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 19:06:01 -0000

Author: pjd
Date: Wed Sep  9 19:06:01 2009
New Revision: 197044
URL: http://svn.freebsd.org/changeset/base/197044

Log:
  Actually component with the greatest priority is used by the prefer balance
  algorithm.

Modified:
  head/sbin/geom/class/mirror/gmirror.8

Modified: head/sbin/geom/class/mirror/gmirror.8
==============================================================================
--- head/sbin/geom/class/mirror/gmirror.8	Wed Sep  9 18:55:18 2009	(r197043)
+++ head/sbin/geom/class/mirror/gmirror.8	Wed Sep  9 19:06:01 2009	(r197044)
@@ -122,7 +122,7 @@ indicates an action to be performed:
 Create a mirror.
 The order of components is important, because a component's priority is based on its position
 (starting from 0 to 255).
-The component with the biggest priority (the lowest number) is used by the
+The component with the biggest priority is used by the
 .Cm prefer
 balance algorithm
 and is also used as a master component when resynchronization is needed,

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 19:38:20 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2E44A106568D;
	Wed,  9 Sep 2009 19:38:20 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1DA318FC12;
	Wed,  9 Sep 2009 19:38:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89JcKTs094974;
	Wed, 9 Sep 2009 19:38:20 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89JcJnM094972;
	Wed, 9 Sep 2009 19:38:19 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200909091938.n89JcJnM094972@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 9 Sep 2009 19:38:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197045 - head/lib/libc/stdio
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 19:38:20 -0000

Author: ed
Date: Wed Sep  9 19:38:19 2009
New Revision: 197045
URL: http://svn.freebsd.org/changeset/base/197045

Log:
  Make the description of `b' a little better.
  
  If you have a one-byte sequence, `w', `b' is the second character. Not
  the third.
  
  Submitted by:	Christoph Mallon

Modified:
  head/lib/libc/stdio/fopen.3

Modified: head/lib/libc/stdio/fopen.3
==============================================================================
--- head/lib/libc/stdio/fopen.3	Wed Sep  9 19:06:01 2009	(r197044)
+++ head/lib/libc/stdio/fopen.3	Wed Sep  9 19:38:19 2009	(r197045)
@@ -96,7 +96,7 @@ or similar.
 .Pp
 The
 .Fa mode
-string can also include the letter ``b'' either as a third character or
+string can also include the letter ``b'' either as last character or
 as a character between the characters in any of the two-character strings
 described above.
 This is strictly for compatibility with

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 19:40:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7B47106566C;
	Wed,  9 Sep 2009 19:40:54 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D75028FC0C;
	Wed,  9 Sep 2009 19:40:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89JesAc095065;
	Wed, 9 Sep 2009 19:40:54 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89Jessi095063;
	Wed, 9 Sep 2009 19:40:54 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909091940.n89Jessi095063@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 9 Sep 2009 19:40:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197046 - head/sys/i386/xen
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 19:40:55 -0000

Author: kib
Date: Wed Sep  9 19:40:54 2009
New Revision: 197046
URL: http://svn.freebsd.org/changeset/base/197046

Log:
  As was done in r196643 for i386 and amd64, swap the start/end virtual
  addresses in pmap_invalidate_cache_range().
  
  Reported by:	Vincent Hoffman 
  Reviewed by:	jhb
  MFC after:	3 days

Modified:
  head/sys/i386/xen/pmap.c

Modified: head/sys/i386/xen/pmap.c
==============================================================================
--- head/sys/i386/xen/pmap.c	Wed Sep  9 19:38:19 2009	(r197045)
+++ head/sys/i386/xen/pmap.c	Wed Sep  9 19:40:54 2009	(r197046)
@@ -1004,8 +1004,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 		 * coherence domain.
 		 */
 		mfence();
-		for (; eva < sva; eva += cpu_clflush_line_size)
-			clflush(eva);
+		for (; sva < eva; sva += cpu_clflush_line_size)
+			clflush(sva);
 		mfence();
 	} else {
 

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 20:28:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A3FB6106566B;
	Wed,  9 Sep 2009 20:28:58 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 92F098FC08;
	Wed,  9 Sep 2009 20:28:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89KSwrp096256;
	Wed, 9 Sep 2009 20:28:58 GMT (envelope-from brooks@svn.freebsd.org)
Received: (from brooks@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89KSw1N096254;
	Wed, 9 Sep 2009 20:28:58 GMT (envelope-from brooks@svn.freebsd.org)
Message-Id: <200909092028.n89KSw1N096254@svn.freebsd.org>
From: Brooks Davis 
Date: Wed, 9 Sep 2009 20:28:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197047 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 20:28:58 -0000

Author: brooks
Date: Wed Sep  9 20:28:58 2009
New Revision: 197047
URL: http://svn.freebsd.org/changeset/base/197047

Log:
  Mention that a few ed(4) devices don't emit link state change notices
  and a workaround for dhclient.
  
  Reviewed by:	 thierry
  MFC after:	3 days

Modified:
  head/share/man/man4/ed.4

Modified: head/share/man/man4/ed.4
==============================================================================
--- head/share/man/man4/ed.4	Wed Sep  9 19:40:54 2009	(r197046)
+++ head/share/man/man4/ed.4	Wed Sep  9 20:28:58 2009	(r197047)
@@ -425,3 +425,21 @@ driver is slow by today's standards.
 .Pp
 PC Card attachment supports the D-Link DMF650TX LAN/Modem card's Ethernet
 port only at this time.
+.Pp
+Some devices supported by
+.Nm
+do no generate the link state change events used by
+.Xr devd 8
+to start
+.Xr dhclinet 8 .
+If you have problems with
+.Xr dhclient 8
+not starting and the device is always attached to the network it may
+be possible to work around this by changing
+.Dq Li DHCP
+to
+.Dq Li SYNCDHCP
+in the
+.Va ifconfig_ed0
+entry in
+.Pa /etc/rc.conf .

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 20:37:49 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C09A61065672;
	Wed,  9 Sep 2009 20:37:49 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A7F318FC12;
	Wed,  9 Sep 2009 20:37:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89Kbn1M096786;
	Wed, 9 Sep 2009 20:37:49 GMT (envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89Kbnwi096782;
	Wed, 9 Sep 2009 20:37:49 GMT (envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200909092037.n89Kbnwi096782@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 9 Sep 2009 20:37:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197048 - in head/sys: fs/nfsclient nfsclient
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 20:37:49 -0000

Author: rmacklem
Date: Wed Sep  9 20:37:49 2009
New Revision: 197048
URL: http://svn.freebsd.org/changeset/base/197048

Log:
  Add LK_NOWITNESS to the vn_lock() calls done on newly created nfs
  vnodes, since these nodes are not linked into the mount queue and,
  as such, the vn_lock() cannot cause a deadlock so LORs are harmless.
  
  Suggested by:	kib
  Approved by:	kib (mentor)
  MFC after:	3 days

Modified:
  head/sys/fs/nfsclient/nfs_clnode.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/nfsclient/nfs_node.c

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnode.c	Wed Sep  9 20:28:58 2009	(r197047)
+++ head/sys/fs/nfsclient/nfs_clnode.c	Wed Sep  9 20:37:49 2009	(r197048)
@@ -157,7 +157,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
 	    M_NFSFH, M_WAITOK);
 	bcopy(fhp, np->n_fhp->nfh_fh, fhsize);
 	np->n_fhp->nfh_len = fhsize;
-	lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
+	lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
 	error = insmntque(vp, mntp);
 	if (error != 0) {
 		*npp = NULL;

Modified: head/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clport.c	Wed Sep  9 20:28:58 2009	(r197047)
+++ head/sys/fs/nfsclient/nfs_clport.c	Wed Sep  9 20:37:49 2009	(r197048)
@@ -232,7 +232,7 @@ nfscl_nget(struct mount *mntp, struct vn
 	 */
 	VN_LOCK_AREC(vp);
 	VN_LOCK_ASHARE(vp);
-	lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
+	lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
 	error = insmntque(vp, mntp);
 	if (error != 0) {
 		*npp = NULL;

Modified: head/sys/nfsclient/nfs_node.c
==============================================================================
--- head/sys/nfsclient/nfs_node.c	Wed Sep  9 20:28:58 2009	(r197047)
+++ head/sys/nfsclient/nfs_node.c	Wed Sep  9 20:37:49 2009	(r197048)
@@ -158,7 +158,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh
 		np->n_fhp = &np->n_fh;
 	bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize);
 	np->n_fhsize = fhsize;
-	lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
+	lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
 	error = insmntque(vp, mntp);
 	if (error != 0) {
 		*npp = NULL;

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 20:59:02 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0DB0F10656A3;
	Wed,  9 Sep 2009 20:59:02 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EFDC28FC26;
	Wed,  9 Sep 2009 20:59:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89Kx1TV097296;
	Wed, 9 Sep 2009 20:59:01 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89Kx1Oh097291;
	Wed, 9 Sep 2009 20:59:01 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909092059.n89Kx1Oh097291@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 9 Sep 2009 20:59:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197049 - in head/sys: compat/freebsd32 compat/linux
	kern sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 20:59:02 -0000

Author: kib
Date: Wed Sep  9 20:59:01 2009
New Revision: 197049
URL: http://svn.freebsd.org/changeset/base/197049

Log:
  kern_select(9) copies fd_set in and out of userspace in quantities of
  longs. Since 32bit processes longs are 4 bytes, 64bit kernel may copy in
  or out 4 bytes more then the process expected.
  
  Calculate the amount of bytes to copy taking into account size of fd_set
  for the current process ABI.
  
  Diagnosed and tested by:	Peter Jeremy 
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/linux/linux_misc.c
  head/sys/kern/sys_generic.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Wed Sep  9 20:37:49 2009	(r197048)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Wed Sep  9 20:59:01 2009	(r197049)
@@ -589,7 +589,8 @@ freebsd32_select(struct thread *td, stru
 	 * XXX big-endian needs to convert the fd_sets too.
 	 * XXX Do pointers need PTRIN()?
 	 */
-	return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp));
+	return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp,
+	    sizeof(int32_t) * 8));
 }
 
 /*

Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c	Wed Sep  9 20:37:49 2009	(r197048)
+++ head/sys/compat/linux/linux_misc.c	Wed Sep  9 20:59:01 2009	(r197049)
@@ -522,7 +522,7 @@ linux_select(struct thread *td, struct l
 		tvp = NULL;
 
 	error = kern_select(td, args->nfds, args->readfds, args->writefds,
-	    args->exceptfds, tvp);
+	    args->exceptfds, tvp, sizeof(l_int) * 8);
 
 #ifdef DEBUG
 	if (ldebug(select))

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Wed Sep  9 20:37:49 2009	(r197048)
+++ head/sys/kern/sys_generic.c	Wed Sep  9 20:59:01 2009	(r197049)
@@ -774,12 +774,13 @@ select(td, uap)
 	} else
 		tvp = NULL;
 
-	return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp));
+	return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp,
+	    NFDBITS));
 }
 
 int
 kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
-    fd_set *fd_ex, struct timeval *tvp)
+    fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits)
 {
 	struct filedesc *fdp;
 	/*
@@ -792,7 +793,7 @@ kern_select(struct thread *td, int nd, f
 	fd_mask *ibits[3], *obits[3], *selbits, *sbp;
 	struct timeval atv, rtv, ttv;
 	int error, timo;
-	u_int nbufbytes, ncpbytes, nfdbits;
+	u_int nbufbytes, ncpbytes, ncpubytes, nfdbits;
 
 	if (nd < 0)
 		return (EINVAL);
@@ -806,6 +807,7 @@ kern_select(struct thread *td, int nd, f
 	 */
 	nfdbits = roundup(nd, NFDBITS);
 	ncpbytes = nfdbits / NBBY;
+	ncpubytes = roundup(nd, abi_nfdbits) / NBBY;
 	nbufbytes = 0;
 	if (fd_in != NULL)
 		nbufbytes += 2 * ncpbytes;
@@ -832,9 +834,11 @@ kern_select(struct thread *td, int nd, f
 			ibits[x] = sbp + nbufbytes / 2 / sizeof *sbp;	\
 			obits[x] = sbp;					\
 			sbp += ncpbytes / sizeof *sbp;			\
-			error = copyin(name, ibits[x], ncpbytes);	\
+			error = copyin(name, ibits[x], ncpubytes);	\
 			if (error != 0)					\
 				goto done;				\
+			bzero((char *)ibits[x] + ncpubytes,		\
+			    ncpbytes - ncpubytes);			\
 		}							\
 	} while (0)
 	getbits(fd_in, 0);
@@ -888,7 +892,7 @@ done:
 	if (error == EWOULDBLOCK)
 		error = 0;
 #define	putbits(name, x) \
-	if (name && (error2 = copyout(obits[x], name, ncpbytes))) \
+	if (name && (error2 = copyout(obits[x], name, ncpubytes))) \
 		error = error2;
 	if (error == 0) {
 		int error2;

Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h	Wed Sep  9 20:37:49 2009	(r197048)
+++ head/sys/sys/syscallsubr.h	Wed Sep  9 20:59:01 2009	(r197049)
@@ -170,7 +170,7 @@ int	kern_sched_rr_get_interval(struct th
 int	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
 	    union semun *arg, register_t *rval);
 int	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
-	    fd_set *fd_ex, struct timeval *tvp);
+	    fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits);
 int	kern_sendfile(struct thread *td, struct sendfile_args *uap,
 	    struct uio *hdr_uio, struct uio *trl_uio, int compat);
 int	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,

From owner-svn-src-all@FreeBSD.ORG  Wed Sep  9 21:51:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3589E1065672;
	Wed,  9 Sep 2009 21:51:55 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24CC78FC0C;
	Wed,  9 Sep 2009 21:51:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n89Lps0E098471;
	Wed, 9 Sep 2009 21:51:54 GMT (envelope-from brooks@svn.freebsd.org)
Received: (from brooks@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n89LpsIr098469;
	Wed, 9 Sep 2009 21:51:54 GMT (envelope-from brooks@svn.freebsd.org)
Message-Id: <200909092151.n89LpsIr098469@svn.freebsd.org>
From: Brooks Davis 
Date: Wed, 9 Sep 2009 21:51:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197050 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 09 Sep 2009 21:51:55 -0000

Author: brooks
Date: Wed Sep  9 21:51:54 2009
New Revision: 197050
URL: http://svn.freebsd.org/changeset/base/197050

Log:
  Change one no to not in r197047
  
  Submitted by:	John Nielsen 

Modified:
  head/share/man/man4/ed.4

Modified: head/share/man/man4/ed.4
==============================================================================
--- head/share/man/man4/ed.4	Wed Sep  9 20:59:01 2009	(r197049)
+++ head/share/man/man4/ed.4	Wed Sep  9 21:51:54 2009	(r197050)
@@ -428,7 +428,7 @@ port only at this time.
 .Pp
 Some devices supported by
 .Nm
-do no generate the link state change events used by
+do not generate the link state change events used by
 .Xr devd 8
 to start
 .Xr dhclinet 8 .

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 00:47:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 245AC106566B;
	Thu, 10 Sep 2009 00:47:33 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 138578FC19;
	Thu, 10 Sep 2009 00:47:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8A0lWxV002370;
	Thu, 10 Sep 2009 00:47:32 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8A0lWwR002368;
	Thu, 10 Sep 2009 00:47:32 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200909100047.n8A0lWwR002368@svn.freebsd.org>
From: Warner Losh 
Date: Thu, 10 Sep 2009 00:47:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197051 - head/usr.sbin/btxld
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 00:47:33 -0000

Author: imp
Date: Thu Sep 10 00:47:32 2009
New Revision: 197051
URL: http://svn.freebsd.org/changeset/base/197051

Log:
  The boot loader is a FreeBSD a.out binary for x86, not a VAX binary.
  Rather than writing out a MID of '0', write a MID of 0x86 (aka
  MID_I386) so that file gets it right.
  
  This is a nop for boot2.  It just checks the MAGIC part of the field,
  ignoring the MID.  boot2 is the only thing that loads this file, and
  only on x86 so the MID_i386 is always the right value (the rest of the
  code is already x86 specific).
  
  Reviewed by:	bde@, jhb@
  MFC after:	8.0 is out the door :)

Modified:
  head/usr.sbin/btxld/btxld.c

Modified: head/usr.sbin/btxld/btxld.c
==============================================================================
--- head/usr.sbin/btxld/btxld.c	Wed Sep  9 21:51:54 2009	(r197050)
+++ head/usr.sbin/btxld/btxld.c	Thu Sep 10 00:47:32 2009	(r197051)
@@ -407,7 +407,7 @@ puthdr(int fd, struct hdr *hdr)
     switch (hdr->fmt) {
     case F_AOUT:
 	memset(&ex, 0, sizeof(ex));
-	N_SETMAGIC(ex, ZMAGIC, MID_ZERO, 0);
+	N_SETMAGIC(ex, ZMAGIC, MID_I386, 0);
 	hdr->text = N_ALIGN(ex, hdr->text);
 	ex.a_text = htole32(hdr->text);
 	hdr->data = N_ALIGN(ex, hdr->data);

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 01:26:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E82081065672;
	Thu, 10 Sep 2009 01:26:45 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D6D008FC0A;
	Thu, 10 Sep 2009 01:26:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8A1QjaR003233;
	Thu, 10 Sep 2009 01:26:45 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8A1Qj2q003231;
	Thu, 10 Sep 2009 01:26:45 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200909100126.n8A1Qj2q003231@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 10 Sep 2009 01:26:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197052 - head/release/doc/en_US.ISO8859-1/relnotes
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 01:26:46 -0000

Author: edwin
Date: Thu Sep 10 01:26:45 2009
New Revision: 197052
URL: http://svn.freebsd.org/changeset/base/197052

Log:
  Mention update to tzdata2009m.

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.sgml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml
==============================================================================
--- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Thu Sep 10 00:47:32 2009	(r197051)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Thu Sep 10 01:26:45 2009	(r197052)
@@ -472,7 +472,7 @@
 
     The timezone database has been updated from
       the tzdata2008h release to
-      the tzdata2009j release.
+      the tzdata2009m release.
 
     The stdtime part of libc, &man.zdump.8 and &man.zic.8
       have been updated from the tzcode2004a

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 03:47:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA1411065692;
	Thu, 10 Sep 2009 03:47:29 +0000 (UTC)
	(envelope-from kientzle@freebsd.org)
Received: from kientzle.com (kientzle.com [66.166.149.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B22E8FC13;
	Thu, 10 Sep 2009 03:47:29 +0000 (UTC)
Received: (from root@localhost)
	by kientzle.com (8.14.3/8.14.3) id n8A3lSiA013324;
	Wed, 9 Sep 2009 20:47:28 -0700 (PDT)
	(envelope-from kientzle@freebsd.org)
Received: from dark.x.kientzle.com (fw2.kientzle.com [10.123.1.2])
	by kientzle.com with SMTP id sdgit8xmmpxmeqygrpbdaew6fa;
	Wed, 09 Sep 2009 20:47:28 -0700 (PDT)
	(envelope-from kientzle@freebsd.org)
Message-ID: <4AA876CF.8000903@freebsd.org>
Date: Wed, 09 Sep 2009 20:47:27 -0700
From: Tim Kientzle 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
	rv:1.8.1.21) Gecko/20090601 SeaMonkey/1.1.16
MIME-Version: 1.0
To: Andrey Chernov , Roman Divacky , 
	src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
References: <200909081555.n88FtDwe052523@svn.freebsd.org>
	<20090909132616.GA35808@nagual.pp.ru>
	<4AA7C6B9.1020600@freebsd.org>
	<20090909163937.GB37924@nagual.pp.ru>
In-Reply-To: <20090909163937.GB37924@nagual.pp.ru>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: 
Subject: Re: svn commit: r196981 - head/usr.bin/unzip
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 03:47:29 -0000

Andrey Chernov wrote:
> On Wed, Sep 09, 2009 at 08:16:09AM -0700, Tim Kientzle wrote:
>> Since this is only to support -a (which does end-of-line
>> conversions), I would suggest using a rather different
>> set of heuristics that examines end-of-line sequences
>> and control characters only:
>>    * Any byte value <31 that's not CR or LF: not text
> 
> More carefully - <32, TAB and ^Z (MSDOS EOT) must be 
> allowed too and perhaps ^L.

Yes, but be careful.  Remember that -a processing
is destructive; it's better to err on the side of
marking something binary.

Tim


From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 07:37:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59E171065672;
	Thu, 10 Sep 2009 07:37:37 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 494F68FC13;
	Thu, 10 Sep 2009 07:37:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8A7bajF010803;
	Thu, 10 Sep 2009 07:37:36 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8A7baad010801;
	Thu, 10 Sep 2009 07:37:36 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200909100737.n8A7baad010801@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Thu, 10 Sep 2009 07:37:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197056 - head
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 07:37:37 -0000

Author: des
Date: Thu Sep 10 07:37:36 2009
New Revision: 197056
URL: http://svn.freebsd.org/changeset/base/197056

Log:
  Fix comment about KERNFAST.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Thu Sep 10 02:23:55 2009	(r197055)
+++ head/Makefile.inc1	Thu Sep 10 07:37:36 2009	(r197056)
@@ -5,7 +5,7 @@
 #	-DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
 #	-DNO_CLEAN do not clean at all
 #	-DNO_SHARE do not go into share subdir
-#	-DKERNFAST define NO_KERNELCONFIG, NO_KERNELCLEAN and NO_KERNELCONFIG
+#	-DKERNFAST define NO_KERNELCONFIG, NO_KERNELCLEAN and NO_KERNELDEPEND
 #	-DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
 #	-DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
 #	-DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 08:33:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A640410656AA;
	Thu, 10 Sep 2009 08:33:28 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9518E8FC14;
	Thu, 10 Sep 2009 08:33:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8A8XSHb011877;
	Thu, 10 Sep 2009 08:33:28 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8A8XSIc011874;
	Thu, 10 Sep 2009 08:33:28 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200909100833.n8A8XSIc011874@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Thu, 10 Sep 2009 08:33:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197057 - in head/sys: compat/freebsd32 sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 08:33:28 -0000

Author: des
Date: Thu Sep 10 08:33:28 2009
New Revision: 197057
URL: http://svn.freebsd.org/changeset/base/197057

Log:
  If a certain feature that was present in FreeBSD 7 was removed or changed in
  FreeBSD 8, the compatibility shims should be built not just when FreeBSD 7
  compatibility is requested, but also when compatibility with any older
  FreeBSD version where that feature was present is requested.o
  
  Without this patch, a kernel config that sets COMPAT_FREEBSD6 but not *7
  would fail to build due to inconsistencies between the declaration of the
  compatibility shims and their use in the SysV code.
  
  There are similar errors in other *proto.h headers in the tree.
  
  MFC after:	3 weeks

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/sys/sysproto.h

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_proto.h	Thu Sep 10 07:37:36 2009	(r197056)
+++ head/sys/compat/freebsd32/freebsd32_proto.h	Thu Sep 10 08:33:28 2009	(r197057)
@@ -626,7 +626,8 @@ int	freebsd4_freebsd32_sigreturn(struct 
 #endif /* COMPAT_FREEBSD4 */
 
 
-#ifdef COMPAT_FREEBSD6
+#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
+	defined(COMPAT_FREEBSD6)
 
 struct freebsd6_freebsd32_pread_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
@@ -680,10 +681,11 @@ int	freebsd6_freebsd32_lseek(struct thre
 int	freebsd6_freebsd32_truncate(struct thread *, struct freebsd6_freebsd32_truncate_args *);
 int	freebsd6_freebsd32_ftruncate(struct thread *, struct freebsd6_freebsd32_ftruncate_args *);
 
-#endif /* COMPAT_FREEBSD6 */
+#endif /* COMPAT_FREEBSD[456] */
 
 
-#ifdef COMPAT_FREEBSD7
+#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
+	defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
 
 struct freebsd7_freebsd32_semctl_args {
 	char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];
@@ -705,7 +707,7 @@ int	freebsd7_freebsd32_semctl(struct thr
 int	freebsd7_freebsd32_msgctl(struct thread *, struct freebsd7_freebsd32_msgctl_args *);
 int	freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_args *);
 
-#endif /* COMPAT_FREEBSD7 */
+#endif /* COMPAT_FREEBSD[4567] */
 
 #define	FREEBSD32_SYS_AUE_freebsd32_wait4	AUE_WAIT4
 #define	FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat	AUE_GETFSSTAT

Modified: head/sys/sys/sysproto.h
==============================================================================
--- head/sys/sys/sysproto.h	Thu Sep 10 07:37:36 2009	(r197056)
+++ head/sys/sys/sysproto.h	Thu Sep 10 08:33:28 2009	(r197057)
@@ -2233,13 +2233,21 @@ int	freebsd4_sigreturn(struct thread *, 
 #endif /* COMPAT_FREEBSD4 */
 
 
-#ifdef COMPAT_FREEBSD6
+#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5)
 
 
-#endif /* COMPAT_FREEBSD6 */
+#endif /* COMPAT_FREEBSD[45] */
 
 
-#ifdef COMPAT_FREEBSD7
+#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
+	defined(COMPAT_FREEBSD6)
+
+
+#endif /* COMPAT_FREEBSD[456] */
+
+
+#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
+	defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
 
 struct freebsd7___semctl_args {
 	char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];
@@ -2261,7 +2269,7 @@ int	freebsd7___semctl(struct thread *, s
 int	freebsd7_msgctl(struct thread *, struct freebsd7_msgctl_args *);
 int	freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *);
 
-#endif /* COMPAT_FREEBSD7 */
+#endif /* COMPAT_FREEBSD[4567] */
 
 #define	SYS_AUE_syscall	AUE_NULL
 #define	SYS_AUE_exit	AUE_EXIT

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 11:27:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60F4610656C1;
	Thu, 10 Sep 2009 11:27:07 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 500378FC12;
	Thu, 10 Sep 2009 11:27:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ABR7k2018060;
	Thu, 10 Sep 2009 11:27:07 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ABR76M018057;
	Thu, 10 Sep 2009 11:27:07 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200909101127.n8ABR76M018057@svn.freebsd.org>
From: Attilio Rao 
Date: Thu, 10 Sep 2009 11:27:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197058 - stable/8/contrib/gdtoa
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 11:27:07 -0000

Author: attilio
Date: Thu Sep 10 11:27:07 2009
New Revision: 197058
URL: http://svn.freebsd.org/changeset/base/197058

Log:
  MFC r196916:
  Fix a list overrun.
  
  Sponsored by:	Sandvine Incorporated
  Approved by:	re (kib)

Modified:
  stable/8/contrib/gdtoa/gdtoaimp.h
  stable/8/contrib/gdtoa/misc.c

Modified: stable/8/contrib/gdtoa/gdtoaimp.h
==============================================================================
--- stable/8/contrib/gdtoa/gdtoaimp.h	Thu Sep 10 08:33:28 2009	(r197057)
+++ stable/8/contrib/gdtoa/gdtoaimp.h	Thu Sep 10 11:27:07 2009	(r197058)
@@ -485,7 +485,7 @@ extern pthread_mutex_t __gdtoa_locks[2];
 		_pthread_mutex_unlock(&__gdtoa_locks[n]);	\
 } while(0)
 
-#define Kmax 15
+#define Kmax 9
 
  struct
 Bigint {

Modified: stable/8/contrib/gdtoa/misc.c
==============================================================================
--- stable/8/contrib/gdtoa/misc.c	Thu Sep 10 08:33:28 2009	(r197057)
+++ stable/8/contrib/gdtoa/misc.c	Thu Sep 10 11:27:07 2009	(r197058)
@@ -55,7 +55,9 @@ Balloc
 #endif
 
 	ACQUIRE_DTOA_LOCK(0);
-	if ( (rv = freelist[k]) !=0) {
+	/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
+	/* but this case seems very unlikely. */
+	if (k <= Kmax && (rv = freelist[k]) !=0) {
 		freelist[k] = rv->next;
 		}
 	else {
@@ -65,7 +67,7 @@ Balloc
 #else
 		len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
 			/sizeof(double);
-		if (pmem_next - private_mem + len <= PRIVATE_mem) {
+		if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
 			rv = (Bigint*)pmem_next;
 			pmem_next += len;
 			}
@@ -89,10 +91,14 @@ Bfree
 #endif
 {
 	if (v) {
-		ACQUIRE_DTOA_LOCK(0);
-		v->next = freelist[v->k];
-		freelist[v->k] = v;
-		FREE_DTOA_LOCK(0);
+		if (v->k > Kmax)
+			free((void*)v);
+		else {
+			ACQUIRE_DTOA_LOCK(0);
+			v->next = freelist[v->k];
+			freelist[v->k] = v;
+			FREE_DTOA_LOCK(0);
+			}
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 11:44:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A0A13106566C;
	Thu, 10 Sep 2009 11:44:51 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F6448FC0A;
	Thu, 10 Sep 2009 11:44:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ABiptb018457;
	Thu, 10 Sep 2009 11:44:51 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ABipTW018454;
	Thu, 10 Sep 2009 11:44:51 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200909101144.n8ABipTW018454@svn.freebsd.org>
From: Attilio Rao 
Date: Thu, 10 Sep 2009 11:44:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197059 - stable/7/contrib/gdtoa
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 11:44:51 -0000

Author: attilio
Date: Thu Sep 10 11:44:51 2009
New Revision: 197059
URL: http://svn.freebsd.org/changeset/base/197059

Log:
  MFC r196916:
  Fix a list overrun.
  
  Sponsored by: Sandvine Incorporated

Modified:
  stable/7/contrib/gdtoa/gdtoaimp.h
  stable/7/contrib/gdtoa/misc.c

Modified: stable/7/contrib/gdtoa/gdtoaimp.h
==============================================================================
--- stable/7/contrib/gdtoa/gdtoaimp.h	Thu Sep 10 11:27:07 2009	(r197058)
+++ stable/7/contrib/gdtoa/gdtoaimp.h	Thu Sep 10 11:44:51 2009	(r197059)
@@ -472,7 +472,7 @@ extern pthread_mutex_t __gdtoa_locks[2];
 		_pthread_mutex_unlock(&__gdtoa_locks[n]);	\
 } while(0)
 
-#define Kmax 15
+#define Kmax 9
 
  struct
 Bigint {

Modified: stable/7/contrib/gdtoa/misc.c
==============================================================================
--- stable/7/contrib/gdtoa/misc.c	Thu Sep 10 11:27:07 2009	(r197058)
+++ stable/7/contrib/gdtoa/misc.c	Thu Sep 10 11:44:51 2009	(r197059)
@@ -55,7 +55,9 @@ Balloc
 #endif
 
 	ACQUIRE_DTOA_LOCK(0);
-	if ( (rv = freelist[k]) !=0) {
+	/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
+	/* but this case seems very unlikely. */
+	if (k <= Kmax && (rv = freelist[k]) !=0) {
 		freelist[k] = rv->next;
 		}
 	else {
@@ -65,7 +67,7 @@ Balloc
 #else
 		len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
 			/sizeof(double);
-		if (pmem_next - private_mem + len <= PRIVATE_mem) {
+		if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
 			rv = (Bigint*)pmem_next;
 			pmem_next += len;
 			}
@@ -89,10 +91,14 @@ Bfree
 #endif
 {
 	if (v) {
-		ACQUIRE_DTOA_LOCK(0);
-		v->next = freelist[v->k];
-		freelist[v->k] = v;
-		FREE_DTOA_LOCK(0);
+		if (v->k > Kmax)
+			free((void*)v);
+		else {
+			ACQUIRE_DTOA_LOCK(0);
+			v->next = freelist[v->k];
+			freelist[v->k] = v;
+			FREE_DTOA_LOCK(0);
+			}
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 12:42:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2EAF106566C;
	Thu, 10 Sep 2009 12:42:36 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFEC78FC0A;
	Thu, 10 Sep 2009 12:42:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ACga72019701;
	Thu, 10 Sep 2009 12:42:36 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ACga1H019699;
	Thu, 10 Sep 2009 12:42:36 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909101242.n8ACga1H019699@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 10 Sep 2009 12:42:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197060 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci fs/pseudofs kern ufs/ffs
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 12:42:37 -0000

Author: kib
Date: Thu Sep 10 12:42:36 2009
New Revision: 197060
URL: http://svn.freebsd.org/changeset/base/197060

Log:
  MFC r196920:
  insmntque_stddtr() clears vp->v_data and resets vp->v_op to
  dead_vnodeops before calling vgone(). Revert r189706 and corresponding
  part of the r186560.
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/pseudofs/pseudofs_vncache.c
  stable/8/sys/kern/   (props changed)
  stable/8/sys/ufs/ffs/ffs_vfsops.c

Modified: stable/8/sys/fs/pseudofs/pseudofs_vncache.c
==============================================================================
--- stable/8/sys/fs/pseudofs/pseudofs_vncache.c	Thu Sep 10 11:44:51 2009	(r197059)
+++ stable/8/sys/fs/pseudofs/pseudofs_vncache.c	Thu Sep 10 12:42:36 2009	(r197060)
@@ -193,6 +193,7 @@ retry:
 	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
 	error = insmntque(*vpp, mp);
 	if (error != 0) {
+		free(pvd, M_PFSVNCACHE);
 		*vpp = NULLVP;
 		return (error);
 	}

Modified: stable/8/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/8/sys/ufs/ffs/ffs_vfsops.c	Thu Sep 10 11:44:51 2009	(r197059)
+++ stable/8/sys/ufs/ffs/ffs_vfsops.c	Thu Sep 10 12:42:36 2009	(r197060)
@@ -1467,6 +1467,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
 		vp->v_vflag |= VV_FORCEINSMQ;
 	error = insmntque(vp, mp);
 	if (error != 0) {
+		uma_zfree(uma_inode, ip);
 		*vpp = NULL;
 		return (error);
 	}

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 12:48:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37AF7106568F;
	Thu, 10 Sep 2009 12:48:30 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 08D998FC25;
	Thu, 10 Sep 2009 12:48:30 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id AF47946B06;
	Thu, 10 Sep 2009 08:48:29 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id D45CF8A01F;
	Thu, 10 Sep 2009 08:48:28 -0400 (EDT)
From: John Baldwin 
To: Dag-Erling Smorgrav 
Date: Thu, 10 Sep 2009 08:33:21 -0400
User-Agent: KMail/1.9.7
References: <200909100833.n8A8XSIc011874@svn.freebsd.org>
In-Reply-To: <200909100833.n8A8XSIc011874@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909100833.22353.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 10 Sep 2009 08:48:28 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197057 - in head/sys: compat/freebsd32 sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 12:48:30 -0000

On Thursday 10 September 2009 4:33:28 am Dag-Erling Smorgrav wrote:
> Author: des
> Date: Thu Sep 10 08:33:28 2009
> New Revision: 197057
> URL: http://svn.freebsd.org/changeset/base/197057
> 
> Log:
>   If a certain feature that was present in FreeBSD 7 was removed or changed 
in
>   FreeBSD 8, the compatibility shims should be built not just when FreeBSD 7
>   compatibility is requested, but also when compatibility with any older
>   FreeBSD version where that feature was present is requested.o
>   
>   Without this patch, a kernel config that sets COMPAT_FREEBSD6 but not *7
>   would fail to build due to inconsistencies between the declaration of the
>   compatibility shims and their use in the SysV code.
>   
>   There are similar errors in other *proto.h headers in the tree.
>   
>   MFC after:	3 weeks

These are auto-generated files.  Please revert.  If you want to try to fix 
this, you will have to patch makesyscalls.sh.  However, this is rather 
complicated.  The SYSV IPC case is simpler because the system calls aren't 
enabled in init_sysent.c but use SYSCALL_MODULE() instead.  However, other 
compat syscalls are enabled in init_sysent.c.

One possible fix is that makesyscalls.sh could be futher extended so that 
compat system calls can be tagged with multiple compat versions perhaps such 
as 'COMPAT4|COMPAT5'.  However, this would not be a trivial change to 
makesyscalls.sh.

When this issue first came up, the consensus among other developers I talked 
to was that it was ok to simply mandate that 'COMPAT_FREEBSD[456]' 
require 'COMPAT_FREEBSD7' which has been noted in src/UPDATING.

I could take a look at the makesyscalls.sh changes perhaps.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 12:55:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5BF69106566C;
	Thu, 10 Sep 2009 12:55:09 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A6958FC19;
	Thu, 10 Sep 2009 12:55:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ACt9mu020014;
	Thu, 10 Sep 2009 12:55:09 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ACt9EO020011;
	Thu, 10 Sep 2009 12:55:09 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200909101255.n8ACt9EO020011@svn.freebsd.org>
From: Attilio Rao 
Date: Thu, 10 Sep 2009 12:55:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197061 - stable/6/contrib/gdtoa
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 12:55:09 -0000

Author: attilio
Date: Thu Sep 10 12:55:09 2009
New Revision: 197061
URL: http://svn.freebsd.org/changeset/base/197061

Log:
  MFC r196916:
  Fix a list overrun.
  
  Sponsored by: Sandvine Incorporated

Modified:
  stable/6/contrib/gdtoa/gdtoaimp.h
  stable/6/contrib/gdtoa/misc.c

Modified: stable/6/contrib/gdtoa/gdtoaimp.h
==============================================================================
--- stable/6/contrib/gdtoa/gdtoaimp.h	Thu Sep 10 12:42:36 2009	(r197060)
+++ stable/6/contrib/gdtoa/gdtoaimp.h	Thu Sep 10 12:55:09 2009	(r197061)
@@ -479,7 +479,7 @@ extern pthread_mutex_t __gdtoa_locks[2];
 		_pthread_mutex_unlock(&__gdtoa_locks[n]);	\
 } while(0)
 
-#define Kmax 15
+#define Kmax 9
 
  struct
 Bigint {

Modified: stable/6/contrib/gdtoa/misc.c
==============================================================================
--- stable/6/contrib/gdtoa/misc.c	Thu Sep 10 12:42:36 2009	(r197060)
+++ stable/6/contrib/gdtoa/misc.c	Thu Sep 10 12:55:09 2009	(r197061)
@@ -61,7 +61,9 @@ Balloc
 #endif
 
 	ACQUIRE_DTOA_LOCK(0);
-	if ( (rv = freelist[k]) !=0) {
+	/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
+	/* but this case seems very unlikely. */
+	if (k <= Kmax && (rv = freelist[k]) !=0) {
 		freelist[k] = rv->next;
 		}
 	else {
@@ -71,7 +73,7 @@ Balloc
 #else
 		len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
 			/sizeof(double);
-		if (pmem_next - private_mem + len <= PRIVATE_mem) {
+		if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
 			rv = (Bigint*)pmem_next;
 			pmem_next += len;
 			}
@@ -95,10 +97,14 @@ Bfree
 #endif
 {
 	if (v) {
-		ACQUIRE_DTOA_LOCK(0);
-		v->next = freelist[v->k];
-		freelist[v->k] = v;
-		FREE_DTOA_LOCK(0);
+		if (v->k > Kmax)
+			free((void*)v);
+		else {
+			ACQUIRE_DTOA_LOCK(0);
+			v->next = freelist[v->k];
+			freelist[v->k] = v;
+			FREE_DTOA_LOCK(0);
+			}
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 12:58:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 888731065670;
	Thu, 10 Sep 2009 12:58:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 77CCA8FC14;
	Thu, 10 Sep 2009 12:58:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ACwcep020100;
	Thu, 10 Sep 2009 12:58:38 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ACwcqC020098;
	Thu, 10 Sep 2009 12:58:38 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200909101258.n8ACwcqC020098@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 10 Sep 2009 12:58:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197062 - head/sys/dev/syscons/daemon
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 12:58:38 -0000

Author: jhb
Date: Thu Sep 10 12:58:37 2009
New Revision: 197062
URL: http://svn.freebsd.org/changeset/base/197062

Log:
  Don't malloc a buffer while holding the prison0 mutex.  Instead, use a loop
  where we figure out the hostname length under the lock, malloc the buffer
  with the lock dropped, then recheck the length under the lock and loop again
  if the buffer is now too small.
  
  Tested by:	Norbert Koch  nkoch  demig de
  MFC after:	3 days

Modified:
  head/sys/dev/syscons/daemon/daemon_saver.c

Modified: head/sys/dev/syscons/daemon/daemon_saver.c
==============================================================================
--- head/sys/dev/syscons/daemon/daemon_saver.c	Thu Sep 10 12:55:09 2009	(r197061)
+++ head/sys/dev/syscons/daemon/daemon_saver.c	Thu Sep 10 12:58:37 2009	(r197062)
@@ -351,11 +351,23 @@ daemon_saver(video_adapter_t *adp, int b
 static int
 daemon_init(video_adapter_t *adp)
 {
+	size_t hostlen;
 
 	mtx_lock(&prison0.pr_mtx);
-	messagelen = strlen(prison0.pr_hostname) + 3 + strlen(ostype) + 1 + 
-	    strlen(osrelease);
-	message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
+	for (;;) {
+		hostlen = strlen(prison0.pr_hostname);
+		mtx_unlock(&prison0.pr_mtx);
+	
+		messagelen = hostlen + 3 + strlen(ostype) + 1 +
+		    strlen(osrelease);
+		message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
+		mtx_lock(&prison0.pr_mtx);
+		if (hostlen < strlen(prison0.pr_hostname)) {
+			free(message, M_DEVBUF);
+			continue;
+		}
+		break;
+	}
 	sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease);
 	mtx_unlock(&prison0.pr_mtx);
 	blanked = 0;

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 13:01:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EA73106566B;
	Thu, 10 Sep 2009 13:01:23 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7C8CA8FC0A;
	Thu, 10 Sep 2009 13:01:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AD1NW6020221;
	Thu, 10 Sep 2009 13:01:23 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AD1NDW020218;
	Thu, 10 Sep 2009 13:01:23 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909101301.n8AD1NDW020218@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 10 Sep 2009 13:01:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197063 - in stable/7/sys: . contrib/pf fs/pseudofs net
	ufs/ffs
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 13:01:23 -0000

Author: kib
Date: Thu Sep 10 13:01:23 2009
New Revision: 197063
URL: http://svn.freebsd.org/changeset/base/197063

Log:
  MFC r196920:
  insmntque_stddtr() clears vp->v_data and resets vp->v_op to
  dead_vnodeops before calling vgone(). Revert r189706 and corresponding
  part of the r186560.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/fs/pseudofs/pseudofs_vncache.c
  stable/7/sys/net/   (props changed)
  stable/7/sys/ufs/ffs/ffs_vfsops.c

Modified: stable/7/sys/fs/pseudofs/pseudofs_vncache.c
==============================================================================
--- stable/7/sys/fs/pseudofs/pseudofs_vncache.c	Thu Sep 10 12:58:37 2009	(r197062)
+++ stable/7/sys/fs/pseudofs/pseudofs_vncache.c	Thu Sep 10 13:01:23 2009	(r197063)
@@ -193,6 +193,7 @@ retry:
 	vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
 	error = insmntque(*vpp, mp);
 	if (error != 0) {
+		free(pvd, M_PFSVNCACHE);
 		*vpp = NULLVP;
 		return (error);
 	}

Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_vfsops.c	Thu Sep 10 12:58:37 2009	(r197062)
+++ stable/7/sys/ufs/ffs/ffs_vfsops.c	Thu Sep 10 13:01:23 2009	(r197063)
@@ -1466,6 +1466,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
 		vp->v_vflag |= VV_FORCEINSMQ;
 	error = insmntque(vp, mp);
 	if (error != 0) {
+		uma_zfree(uma_inode, ip);
 		*vpp = NULL;
 		return (error);
 	}

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 13:20:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 86204106566B;
	Thu, 10 Sep 2009 13:20:27 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B0DA8FC14;
	Thu, 10 Sep 2009 13:20:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ADKRaK020674;
	Thu, 10 Sep 2009 13:20:27 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ADKRp0020669;
	Thu, 10 Sep 2009 13:20:27 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200909101320.n8ADKRp0020669@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Thu, 10 Sep 2009 13:20:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197064 - in head/sys: amd64/linux32 compat/svr4
	i386/ibcs2 i386/linux
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 13:20:27 -0000

Author: des
Date: Thu Sep 10 13:20:27 2009
New Revision: 197064
URL: http://svn.freebsd.org/changeset/base/197064

Log:
  As jhb@ pointed out to me, r197057 was incorrect, not least because these
  are generated files.

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/compat/svr4/svr4_proto.h
  head/sys/i386/ibcs2/ibcs2_proto.h
  head/sys/i386/linux/linux_proto.h

Modified: head/sys/amd64/linux32/linux32_proto.h
==============================================================================
--- head/sys/amd64/linux32/linux32_proto.h	Thu Sep 10 13:01:23 2009	(r197063)
+++ head/sys/amd64/linux32/linux32_proto.h	Thu Sep 10 13:20:27 2009	(r197064)
@@ -1257,6 +1257,13 @@ int	linux_vmsplice(struct thread *, stru
 
 #endif /* COMPAT_FREEBSD6 */
 
+
+#ifdef COMPAT_FREEBSD7
+
+#define	nosys	linux_nosys
+
+#endif /* COMPAT_FREEBSD7 */
+
 #define	LINUX_SYS_AUE_linux_fork	AUE_FORK
 #define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
 #define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4

Modified: head/sys/compat/svr4/svr4_proto.h
==============================================================================
--- head/sys/compat/svr4/svr4_proto.h	Thu Sep 10 13:01:23 2009	(r197063)
+++ head/sys/compat/svr4/svr4_proto.h	Thu Sep 10 13:20:27 2009	(r197064)
@@ -503,6 +503,12 @@ int	svr4_sys_sendto(struct thread *, str
 
 #endif /* COMPAT_FREEBSD6 */
 
+
+#ifdef COMPAT_FREEBSD7
+
+
+#endif /* COMPAT_FREEBSD7 */
+
 #define	SVR4_SYS_AUE_svr4_sys_open	AUE_NULL
 #define	SVR4_SYS_AUE_svr4_sys_wait	AUE_NULL
 #define	SVR4_SYS_AUE_svr4_sys_creat	AUE_NULL

Modified: head/sys/i386/ibcs2/ibcs2_proto.h
==============================================================================
--- head/sys/i386/ibcs2/ibcs2_proto.h	Thu Sep 10 13:01:23 2009	(r197063)
+++ head/sys/i386/ibcs2/ibcs2_proto.h	Thu Sep 10 13:20:27 2009	(r197064)
@@ -345,6 +345,12 @@ int	ibcs2_isc(struct thread *, struct ib
 
 #endif /* COMPAT_FREEBSD6 */
 
+
+#ifdef COMPAT_FREEBSD7
+
+
+#endif /* COMPAT_FREEBSD7 */
+
 #define	IBCS2_SYS_AUE_ibcs2_read	AUE_NULL
 #define	IBCS2_SYS_AUE_ibcs2_open	AUE_OPEN_RWTC
 #define	IBCS2_SYS_AUE_ibcs2_wait	AUE_WAIT4

Modified: head/sys/i386/linux/linux_proto.h
==============================================================================
--- head/sys/i386/linux/linux_proto.h	Thu Sep 10 13:01:23 2009	(r197063)
+++ head/sys/i386/linux/linux_proto.h	Thu Sep 10 13:20:27 2009	(r197064)
@@ -1277,6 +1277,13 @@ int	linux_vmsplice(struct thread *, stru
 
 #endif /* COMPAT_FREEBSD6 */
 
+
+#ifdef COMPAT_FREEBSD7
+
+#define	nosys	linux_nosys
+
+#endif /* COMPAT_FREEBSD7 */
+
 #define	LINUX_SYS_AUE_linux_fork	AUE_FORK
 #define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
 #define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 13:21:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62F8A10656A5;
	Thu, 10 Sep 2009 13:21:21 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 211638FC0C;
	Thu, 10 Sep 2009 13:21:21 +0000 (UTC)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 515556D44E;
	Thu, 10 Sep 2009 13:21:20 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 1DBA5844D2; Thu, 10 Sep 2009 15:21:20 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: John Baldwin 
References: <200909100833.n8A8XSIc011874@svn.freebsd.org>
	<200909100833.22353.jhb@freebsd.org>
Date: Thu, 10 Sep 2009 15:21:20 +0200
In-Reply-To: <200909100833.22353.jhb@freebsd.org> (John Baldwin's message of
	"Thu, 10 Sep 2009 08:33:21 -0400")
Message-ID: <86eiqflyun.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197057 - in head/sys: compat/freebsd32 sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 13:21:21 -0000

John Baldwin  writes:
> These are auto-generated files.  Please revert.

Done.  Next time, I will try to remember to turn my brain on before
committing...

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 14:04:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 777611065670;
	Thu, 10 Sep 2009 14:04:01 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62F9D8FC0A;
	Thu, 10 Sep 2009 14:04:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AE41e4021597;
	Thu, 10 Sep 2009 14:04:01 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AE41C6021588;
	Thu, 10 Sep 2009 14:04:01 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200909101404.n8AE41C6021588@svn.freebsd.org>
From: Ken Smith 
Date: Thu, 10 Sep 2009 14:04:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 14:04:01 -0000

Author: kensmith
Date: Thu Sep 10 14:04:00 2009
New Revision: 197065
URL: http://svn.freebsd.org/changeset/base/197065

Log:
  Remove extra debugging support that is turned on for head but turned off
  for stable branches:
  
  	- shift to MALLOC_PRODUCTION
  	- turn off automatic crash dumps
  	- Remove kernel debuggers, INVARIANTS*[1], WITNESS* from
  	  GENERIC kernel config files[2]
  
  [1] INVARIANTS* left on for ia64 by request marcel
  [2] sun4v was left as-is
  
  Reviewed by:	marcel, kib
  Approved by:	re (implicit)

Modified:
  stable/8/etc/defaults/rc.conf
  stable/8/lib/libc/stdlib/malloc.c
  stable/8/sys/amd64/conf/GENERIC
  stable/8/sys/i386/conf/GENERIC
  stable/8/sys/ia64/conf/GENERIC
  stable/8/sys/pc98/conf/GENERIC
  stable/8/sys/powerpc/conf/GENERIC
  stable/8/sys/sparc64/conf/GENERIC

Modified: stable/8/etc/defaults/rc.conf
==============================================================================
--- stable/8/etc/defaults/rc.conf	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/etc/defaults/rc.conf	Thu Sep 10 14:04:00 2009	(r197065)
@@ -549,7 +549,7 @@ lpd_flags=""		# Flags to lpd (if enabled
 nscd_enable="NO"	# Run the nsswitch caching daemon.
 chkprintcap_enable="NO"	# Run chkprintcap(8) before running lpd.
 chkprintcap_flags="-d"	# Create missing directories by default.
-dumpdev="AUTO"		# Device to crashdump to (device name, AUTO, or NO).
+dumpdev="NO"		# Device to crashdump to (device name, AUTO, or NO).
 dumpdir="/var/crash"	# Directory where crash dumps are to be stored
 savecore_flags=""	# Used if dumpdev is enabled above, and present.
 crashinfo_enable="YES"	# Automatically generate crash dump summary.

Modified: stable/8/lib/libc/stdlib/malloc.c
==============================================================================
--- stable/8/lib/libc/stdlib/malloc.c	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/lib/libc/stdlib/malloc.c	Thu Sep 10 14:04:00 2009	(r197065)
@@ -114,7 +114,7 @@
  * defaults the A and J runtime options to off.  These settings are appropriate
  * for production systems.
  */
-/* #define	MALLOC_PRODUCTION */
+#define	MALLOC_PRODUCTION
 
 #ifndef MALLOC_PRODUCTION
    /*

Modified: stable/8/sys/amd64/conf/GENERIC
==============================================================================
--- stable/8/sys/amd64/conf/GENERIC	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/sys/amd64/conf/GENERIC	Thu Sep 10 14:04:00 2009	(r197065)
@@ -76,15 +76,6 @@ options		FLOWTABLE		# per-cpu routing ca
 #options 	KDTRACE_FRAME		# Ensure frames are compiled in
 #options 	KDTRACE_HOOKS		# Kernel DTrace hooks
 
-# Debugging for use in -current
-options 	KDB			# Enable kernel debugger support.
-options 	DDB			# Support DDB.
-options 	GDB			# Support remote GDB.
-options 	INVARIANTS		# Enable calls of extra sanity checking
-options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
-options 	WITNESS			# Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
-
 # Make an SMP-capable kernel by default
 options 	SMP			# Symmetric MultiProcessor Kernel
 

Modified: stable/8/sys/i386/conf/GENERIC
==============================================================================
--- stable/8/sys/i386/conf/GENERIC	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/sys/i386/conf/GENERIC	Thu Sep 10 14:04:00 2009	(r197065)
@@ -76,15 +76,6 @@ options 	MAC			# TrustedBSD MAC Framewor
 options		FLOWTABLE		# per-cpu routing cache
 #options 	KDTRACE_HOOKS		# Kernel DTrace hooks
 
-# Debugging for use in -current
-options 	KDB			# Enable kernel debugger support.
-options 	DDB			# Support DDB.
-options 	GDB			# Support remote GDB.
-options 	INVARIANTS		# Enable calls of extra sanity checking
-options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
-options 	WITNESS			# Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
-
 # To make an SMP kernel, the next two lines are needed
 options 	SMP			# Symmetric MultiProcessor Kernel
 device		apic			# I/O APIC

Modified: stable/8/sys/ia64/conf/GENERIC
==============================================================================
--- stable/8/sys/ia64/conf/GENERIC	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/sys/ia64/conf/GENERIC	Thu Sep 10 14:04:00 2009	(r197065)
@@ -30,15 +30,12 @@ options 	CD9660		# ISO 9660 Filesystem
 options 	COMPAT_43TTY	# BSD 4.3 TTY compat (sgtty)
 options 	COMPAT_FREEBSD6	# Compatible with FreeBSD6
 options 	COMPAT_FREEBSD7	# Compatible with FreeBSD7
-options 	DDB		# Support DDB
 options 	FFS		# Berkeley Fast Filesystem
-options 	GDB		# Support remote GDB
 options 	GEOM_LABEL	# Provides labelization
 options 	INET		# InterNETworking
 options 	INET6		# IPv6 communications protocols
 options 	INVARIANTS	# Enable calls of extra sanity checking
 options 	INVARIANT_SUPPORT # required by INVARIANTS
-options 	KDB		# Enable kernel debugger support
 options 	KTRACE		# ktrace(1) syscall trace support
 options 	MAC			# TrustedBSD MAC Framework
 options 	MD_ROOT		# MD usable as root device
@@ -62,8 +59,6 @@ options 	P1003_1B_SEMAPHORES	# POSIX-sty
 options 	UFS_ACL		# Support for access control lists
 options 	UFS_DIRHASH	# Hash-based directory lookup scheme
 options 	UFS_GJOURNAL	# Enable gjournal-based UFS journaling
-options 	WITNESS		# Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
 options 	_KPOSIX_PRIORITY_SCHEDULING	# Posix P1003_1B RT extensions
 options 	HWPMC_HOOKS		# Necessary kernel hooks for hwpmc(4)
 

Modified: stable/8/sys/pc98/conf/GENERIC
==============================================================================
--- stable/8/sys/pc98/conf/GENERIC	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/sys/pc98/conf/GENERIC	Thu Sep 10 14:04:00 2009	(r197065)
@@ -76,15 +76,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	MAC			# TrustedBSD MAC Framework
 
-# Debugging for use in -current
-options 	KDB			# Enable kernel debugger support.
-options 	DDB			# Support DDB.
-options 	GDB			# Support remote GDB.
-options 	INVARIANTS		# Enable calls of extra sanity checking
-options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
-options 	WITNESS			# Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
-
 # To make an SMP kernel, the next two lines are needed
 #options 	SMP			# Symmetric MultiProcessor Kernel
 #device		apic			# I/O APIC

Modified: stable/8/sys/powerpc/conf/GENERIC
==============================================================================
--- stable/8/sys/powerpc/conf/GENERIC	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/sys/powerpc/conf/GENERIC	Thu Sep 10 14:04:00 2009	(r197065)
@@ -67,14 +67,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	MAC			# TrustedBSD MAC Framework
 
-# Debugging for use in -current
-options 	KDB			#Enable the kernel debugger
-options 	DDB			#Support DDB
-options 	INVARIANTS		#Enable calls of extra sanity checking
-options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
-options 	WITNESS			#Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
-
 # To make an SMP kernel, the next line is needed
 #options 	SMP			# Symmetric MultiProcessor Kernel
 

Modified: stable/8/sys/sparc64/conf/GENERIC
==============================================================================
--- stable/8/sys/sparc64/conf/GENERIC	Thu Sep 10 13:20:27 2009	(r197064)
+++ stable/8/sys/sparc64/conf/GENERIC	Thu Sep 10 14:04:00 2009	(r197065)
@@ -72,15 +72,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	MAC			# TrustedBSD MAC Framework
 
-# Debugging for use in -current
-options 	KDB			# Enable kernel debugger support.
-options 	DDB			# Support DDB.
-options 	GDB			# Support remote GDB.
-options 	INVARIANTS		# Enable calls of extra sanity checking
-options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
-options 	WITNESS			# Enable checks to detect deadlocks and cycles
-options 	WITNESS_SKIPSPIN	# Don't run witness on spinlocks for speed
-
 # Make an SMP-capable kernel by default
 options 	SMP			# Symmetric MultiProcessor Kernel
 

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 14:08:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D09A7106566C;
	Thu, 10 Sep 2009 14:08:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A4FFB8FC08;
	Thu, 10 Sep 2009 14:08:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AE8Snf021756;
	Thu, 10 Sep 2009 14:08:28 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AE8Skq021754;
	Thu, 10 Sep 2009 14:08:28 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200909101408.n8AE8Skq021754@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 10 Sep 2009 14:08:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197066 - stable/7/share/man/man7
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 14:08:28 -0000

Author: jhb
Date: Thu Sep 10 14:08:28 2009
New Revision: 197066
URL: http://svn.freebsd.org/changeset/base/197066

Log:
  MFC 196337 and 196356:
  Document SVN* and MAKE_DVD variables.

Modified:
  stable/7/share/man/man7/   (props changed)
  stable/7/share/man/man7/release.7

Modified: stable/7/share/man/man7/release.7
==============================================================================
--- stable/7/share/man/man7/release.7	Thu Sep 10 14:04:00 2009	(r197065)
+++ stable/7/share/man/man7/release.7	Thu Sep 10 14:08:28 2009	(r197066)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2006
+.Dd August 17, 2009
 .Dt RELEASE 7
 .Os
 .Sh NAME
@@ -332,6 +332,10 @@ patch file.
 A script that will be run in the
 .Xr chroot 8
 environment immediately after any local patches are applied.
+.It Va MAKE_DVD
+If defined, build a bootable ISO DVD image in the CD-ROM
+stage directory.
+This option may not be available for all architectures.
 .It Va MAKE_ISOS
 If defined, bootable ISO CD-ROM images will be created from the
 contents of the CD-ROM stage directory.
@@ -390,6 +394,35 @@ of the CVS tree
 .It Va SEPARATE_LIVEFS
 Store the live file system on its own CD-ROM image rather than placing it on
 the first disc.
+.It Va SVNCMDARGS
+Additional arguments for svn
+.Ic checkout
+and
+.Ic switch
+commands.
+.It Va SVNROOT
+The location of the FreeBSD SVN source repository.
+If this variable is set,
+then the source tree will be extracted using Subversion rather than
+CVS.
+.It Va SVNBRANCH
+The branch to check out from a SVN source repository.
+It is specified as a path such as
+.Pa head
+or
+.Pa stable/7 .
+If this variable is not set,
+then the branch that corresponds to the current value of
+.Va RELEASETAG
+will be used.
+If neither
+.Va SVNBRANCH
+nor
+.Va RELEASETAG
+are set,
+then the
+.Pa head
+branch will be used.
 .It Va TARGET_ARCH
 The target machine processor architecture.
 This is analogous to the
@@ -474,6 +507,7 @@ make release CHROOTDIR=/local3/release B
 .Xr install 1 ,
 .Xr make 1 ,
 .Xr patch 1 ,
+.Xr svn 1 Pq Pa ports/devel/subversion-freebsd ,
 .Xr uname 1 ,
 .Xr md 4 ,
 .Xr make.conf 5 ,
@@ -511,7 +545,7 @@ effort was spent getting
 into a shape where it could at least automate most of the tediousness
 of building a release in a sterile environment.
 .Pp
-With its almost 1000 revisions spread over multiple branches, the
+At near 1000 revisions spread over multiple branches, the
 .Xr cvs 1
 log of
 .Pa src/release/Makefile

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 14:16:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AF69F1065676;
	Thu, 10 Sep 2009 14:16:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D09B8FC0C;
	Thu, 10 Sep 2009 14:16:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AEG52C021984;
	Thu, 10 Sep 2009 14:16:05 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AEG5jf021981;
	Thu, 10 Sep 2009 14:16:05 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200909101416.n8AEG5jf021981@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 10 Sep 2009 14:16:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197067 - stable/7/release
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 14:16:05 -0000

Author: jhb
Date: Thu Sep 10 14:16:05 2009
New Revision: 197067
URL: http://svn.freebsd.org/changeset/base/197067

Log:
  MFC 196221:
  Add the ability to build a release from an SVN checkout instead of a CVS
  checkout.  If SVNROOT is specified, then the source tree will be checked
  out from that SVN repository instead of using CVS.  ports and docs still
  use CVS.  If SVNROOT is not specified, then the source tree will be checked
  out using CVS.  An explicit SVN branch can be specified using SVNBRANCH
  (e.g. SVNBRANCH=stable/8).  If SVNBRANCH is not set but RELEASETAG is set
  to a CVS branch (such as RELENG_8) the appropriate SVN branch will be
  inferred from the CVS branch using svnbranch.awk.

Added:
  stable/7/release/svnbranch.awk
     - copied unchanged from r196221, head/release/svnbranch.awk
Modified:
  stable/7/release/   (props changed)
  stable/7/release/Makefile

Modified: stable/7/release/Makefile
==============================================================================
--- stable/7/release/Makefile	Thu Sep 10 14:08:28 2009	(r197066)
+++ stable/7/release/Makefile	Thu Sep 10 14:16:05 2009	(r197067)
@@ -1,7 +1,8 @@
 # $FreeBSD$
 #
 # make release [BUILDNAME=somename] CHROOTDIR=/some/dir CVSROOT=/cvs/dir \
-#     [RELEASETAG=tag]
+#     [RELEASETAG=tag] [SVNROOT=svn://svn.freebsd.org/base] \
+#     [SVNBRANCH=some/branch]
 #
 # Where "/some/dir" is the pathname of a directory on a some filesystem with
 # at least 1000MB of free space, "somename" is what you want the release to
@@ -9,6 +10,11 @@
 # which CVS "tag" name should be used when checking out the sources to build
 # the release (default is HEAD).
 #
+# Please note the support for building from SVN is preliminary and there
+# are still questions about things like how to handle updates of
+# /usr/src on production systems (csup(1) replacement).  It is a work
+# in progress and may change as the other issues get worked out.
+#
 # Please note: the md(4) driver must be present in the kernel
 # (either by being compiled in or available as a kld(4) module),
 # otherwise the target 'release.8' and possibly others will fail.
@@ -45,12 +51,25 @@ BUILDNAME?=${BASE}-${DATE}-SNAP
 # To add other options to the CVS command, set
 #CVSARGS="-lfq"
 #
-# To prefix the cvs command
+# To prefix the CVS command
 #CVSPREFIX="/usr/bin/time"
 #
 # Where the CVS repository is
 #CVSROOT="/home/ncvs"
 #
+# To add other options to the Subversion subcommands (co,up), set
+#SVNCMDARGS="-r '{ 01/01/2002 00:00:00 UTC }'"
+#
+# To prefix the Subversion command
+#SVNPREFIX="/usr/bin/time"
+#
+# Where the Subversion repository is
+#SVNROOT=svn://svn.freebsd.org/base
+#
+# Subversion branch to build for src.  If this is not set then it is
+# automatically computed from RELEASETAG.
+#SVNBRANCH=stable/7
+#
 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
 # are building an official release.  Otherwise, we are building for
 # a branch.
@@ -64,6 +83,16 @@ PORTSRELEASETAG?=	${AUXRELEASETAG}
 .endif
 .endif
 
+# Determine the Subversion source branch that corresponds to the requested
+# RELEASETAG.
+.if !defined(SVNBRANCH)
+.if defined(RELEASETAG)
+SVNBRANCH!=	echo "${RELEASETAG}" | awk -f ${.CURDIR}/svnbranch.awk
+.else
+SVNBRANCH=	head
+.endif
+.endif
+
 # If you want to pass flags to the world build such as -j X, use
 # WORLD_FLAGS.  Similarly, you can specify make flags for kernel
 # builds via KERNEL_FLAGS.
@@ -342,8 +371,17 @@ CVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
 WORLDDIR?=	${.CURDIR}/..
 
 release rerelease:
-.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
-	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
+.if !defined(CHROOTDIR) || !defined(BUILDNAME)
+	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
+.endif
+.if !defined(NOPORTSATALL) && !defined(EXTPORTSDIR) && !defined(CVSROOT)
+	@echo "Building ports requires CVSROOT or EXTPORTSDIR" && false
+.endif
+.if !defined(NODOC) && !defined(EXTDOCDIR) && !defined(CVSROOT)
+	@echo "Building docs requires CVSROOT or EXTDOCDIR" && false
+.endif
+.if !defined(EXTSRCDIR) && !defined(CVSROOT) && !defined(SVNROOT)
+	@echo "The source tree requires SVNROOT, CVSROOT, or EXTSRCDIR" && false
 .endif
 .if defined(NOPORTSATALL) && !defined(NODOC)
 	@echo "Ports are required for building the docs.  Either set NODOC or"
@@ -388,6 +426,10 @@ release rerelease:
 .if defined(EXTSRCDIR)
 	cd ${CHROOTDIR}/usr && \
 	    cp -R -H ${EXTSRCDIR} src
+.elif defined(SVNROOT)
+	cd ${CHROOTDIR}/usr && \
+	    ${SVNPREFIX} svn co ${SVNCMDARGS} ${SVNROOT}/${SVNBRANCH} \
+	    ${RELEASESRCMODULE} 
 .else
 	cd ${CHROOTDIR}/usr && \
 	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
@@ -433,7 +475,10 @@ release rerelease:
 .endif
 .if make(rerelease)
 .if !defined(RELEASENOUPDATE) && !defined(EXTSRCDIR)
-.if !defined(RELEASETAG)
+.if defined(SVNROOT)
+	cd ${CHROOTDIR}/usr/src && ${SVNPREFIX} svn switch ${SVNCMDARGS} \
+	    ${SVNROOT}/${SVNBRANCH}
+.elif !defined(RELEASETAG)
 	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
 	    update ${CVSCMDARGS} -P -d -A
 .else

Copied: stable/7/release/svnbranch.awk (from r196221, head/release/svnbranch.awk)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/release/svnbranch.awk	Thu Sep 10 14:16:05 2009	(r197067, copy of r196221, head/release/svnbranch.awk)
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+BEGIN {
+	FS = "_"
+}
+
+/RELENG_.*_RELEASE/ {
+	if (NF == 5) {
+		printf "release/%s.%s.%s", $2, $3, $4
+		exit
+	}
+}
+
+/RELENG_.*/ {
+	if (NF == 3) {
+		printf "releng/%s.%s", $2, $3
+		exit
+	}
+
+	if (NF == 2) {
+		printf "stable/%s", $2
+		exit
+	}
+}
+
+// {
+	printf "unknown_branch"
+}

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 14:23:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31B86106566B;
	Thu, 10 Sep 2009 14:23:50 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id F40998FC0A;
	Thu, 10 Sep 2009 14:23:49 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 9F59546B2C;
	Thu, 10 Sep 2009 10:23:49 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id EAD708A01B;
	Thu, 10 Sep 2009 10:23:48 -0400 (EDT)
From: John Baldwin 
To: Ken Smith 
Date: Thu, 10 Sep 2009 10:23:44 -0400
User-Agent: KMail/1.9.7
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
In-Reply-To: <200909101404.n8AE41C6021588@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909101023.44913.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 10 Sep 2009 10:23:48 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 14:23:50 -0000

On Thursday 10 September 2009 10:04:00 am Ken Smith wrote:
> Author: kensmith
> Date: Thu Sep 10 14:04:00 2009
> New Revision: 197065
> URL: http://svn.freebsd.org/changeset/base/197065
> 
> Log:
>   Remove extra debugging support that is turned on for head but turned off
>   for stable branches:
>   
>   	- shift to MALLOC_PRODUCTION
>   	- turn off automatic crash dumps
>   	- Remove kernel debuggers, INVARIANTS*[1], WITNESS* from
>   	  GENERIC kernel config files[2]
>   
>   [1] INVARIANTS* left on for ia64 by request marcel
>   [2] sun4v was left as-is
>   
>   Reviewed by:	marcel, kib
>   Approved by:	re (implicit)
> 
> Modified:
>   stable/8/etc/defaults/rc.conf
>   stable/8/lib/libc/stdlib/malloc.c
>   stable/8/sys/amd64/conf/GENERIC
>   stable/8/sys/i386/conf/GENERIC
>   stable/8/sys/ia64/conf/GENERIC
>   stable/8/sys/pc98/conf/GENERIC
>   stable/8/sys/powerpc/conf/GENERIC
>   stable/8/sys/sparc64/conf/GENERIC
> 
> Modified: stable/8/etc/defaults/rc.conf
> 
==============================================================================
> --- stable/8/etc/defaults/rc.conf	Thu Sep 10 13:20:27 2009	(r197064)
> +++ stable/8/etc/defaults/rc.conf	Thu Sep 10 14:04:00 2009	(r197065)
> @@ -549,7 +549,7 @@ lpd_flags=""		# Flags to lpd (if enabled
>  nscd_enable="NO"	# Run the nsswitch caching daemon.
>  chkprintcap_enable="NO"	# Run chkprintcap(8) before running lpd.
>  chkprintcap_flags="-d"	# Create missing directories by default.
> -dumpdev="AUTO"		# Device to crashdump to (device name, AUTO, or NO).
> +dumpdev="NO"		# Device to crashdump to (device name, AUTO, or NO).
>  dumpdir="/var/crash"	# Directory where crash dumps are to be stored
>  savecore_flags=""	# Used if dumpdev is enabled above, and present.
>  crashinfo_enable="YES"	# Automatically generate crash dump summary.

Are we sure we want to change this?  It is set to "AUTO" in stable/7.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 14:24:11 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E5C1B106574D;
	Thu, 10 Sep 2009 14:24:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D2F268FC1D;
	Thu, 10 Sep 2009 14:24:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AEOBZu022230;
	Thu, 10 Sep 2009 14:24:11 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AEOB4s022229;
	Thu, 10 Sep 2009 14:24:11 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200909101424.n8AEOB4s022229@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 10 Sep 2009 14:24:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197068 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 14:24:12 -0000

Author: jhb
Date: Thu Sep 10 14:24:11 2009
New Revision: 197068
URL: http://svn.freebsd.org/changeset/base/197068

Log:
  Move mergeinfo for 196772 up to sys/.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 14:32:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1307B1065672;
	Thu, 10 Sep 2009 14:32:39 +0000 (UTC)
	(envelope-from kensmith@cse.Buffalo.EDU)
Received: from phoebe.cse.buffalo.edu (phoebe.cse.buffalo.edu [128.205.32.89])
	by mx1.freebsd.org (Postfix) with ESMTP id C01348FC1E;
	Thu, 10 Sep 2009 14:32:38 +0000 (UTC)
Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76])
	(authenticated bits=0)
	by phoebe.cse.buffalo.edu (8.14.1/8.13.7) with ESMTP id n8AEWWQv037042
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 10 Sep 2009 10:32:38 -0400 (EDT)
	(envelope-from kensmith@cse.buffalo.edu)
From: Ken Smith 
To: John Baldwin 
In-Reply-To: <200909101023.44913.jhb@freebsd.org>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
Content-Type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature";
	boundary="=-p89po3VOkzyAQyzrNtiE"
Organization: U. Buffalo CSE Department
Date: Thu, 10 Sep 2009 10:32:29 -0400
Message-Id: <1252593149.75144.18.camel@bauer.cse.buffalo.edu>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port 
X-DCC--Metrics: phoebe.cse.buffalo.edu 1335; Body=0 Fuz1=0 Fuz2=0
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults
 lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 14:32:39 -0000


--=-p89po3VOkzyAQyzrNtiE
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Thu, 2009-09-10 at 10:23 -0400, John Baldwin wrote:
> > --- stable/8/etc/defaults/rc.conf     Thu Sep 10 13:20:27 2009        (=
r197064)
> > +++ stable/8/etc/defaults/rc.conf     Thu Sep 10 14:04:00 2009        (=
r197065)
> > @@ -549,7 +549,7 @@ lpd_flags=3D""              # Flags to lpd (if enab=
led
> >  nscd_enable=3D"NO"     # Run the nsswitch caching daemon.
> >  chkprintcap_enable=3D"NO"      # Run chkprintcap(8) before running lpd=
.
> >  chkprintcap_flags=3D"-d"       # Create missing directories by default=
.
> > -dumpdev=3D"AUTO"               # Device to crashdump to (device name, =
AUTO, or NO).
> > +dumpdev=3D"NO"         # Device to crashdump to (device name, AUTO, or=
 NO).
> >  dumpdir=3D"/var/crash" # Directory where crash dumps are to be stored
> >  savecore_flags=3D""    # Used if dumpdev is enabled above, and present=
.
> >  crashinfo_enable=3D"YES"       # Automatically generate crash dump sum=
mary.
>=20
> Are we sure we want to change this?  It is set to "AUTO" in stable/7.

It has been pointed out to me on the mailing lists that leaving it on
for stable/7 was an oversight, it is off on previous branches.

I can understand the motivation for it.  In a data center full of
production machines crash dumps cause reboots to take longer and
potentially cause disk space issues.  In those sorts of environments
it's best if by *default* the crash dumps don't happen and if an admin
finds they need it they turn it on.

This is one of those "There is no right answer" things...

--=20
                                                Ken Smith
- From there to here, from here to      |       kensmith@cse.buffalo.edu
  there, funny things are everywhere.   |
                      - Theodore Geisel |


--=-p89po3VOkzyAQyzrNtiE
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEABECAAYFAkqpDf0ACgkQ/G14VSmup/Z6uACaArSRA3xuAlaSgzkJnnLuo4Hf
9GYAn3J0nrqpE7ylVH/u2Wh0BS0gB3AP
=D9Fc
-----END PGP SIGNATURE-----

--=-p89po3VOkzyAQyzrNtiE--


From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:00:42 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31EE8106568D;
	Thu, 10 Sep 2009 15:00:42 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from mail-gw2.york.ac.uk (mail-gw2.york.ac.uk [144.32.128.247])
	by mx1.freebsd.org (Postfix) with ESMTP id B6CF88FC13;
	Thu, 10 Sep 2009 15:00:41 +0000 (UTC)
Received: from mail-gw6.york.ac.uk (mail-gw6.york.ac.uk [144.32.129.26])
	by mail-gw2.york.ac.uk (8.13.6/8.13.6) with ESMTP id n8AETCEG003595;
	Thu, 10 Sep 2009 15:29:12 +0100 (BST)
Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk)
	by mail-gw6.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68)
	(envelope-from )
	id 1Mlke8-0001OY-3O; Thu, 10 Sep 2009 15:29:12 +0100
Received: from buffy.york.ac.uk (localhost [127.0.0.1])
	by buffy.york.ac.uk (8.14.3/8.14.3) with ESMTP id n8AETBBY069401;
	Thu, 10 Sep 2009 15:29:11 +0100 (BST)
	(envelope-from gavin@FreeBSD.org)
Received: (from ga9@localhost)
	by buffy.york.ac.uk (8.14.3/8.14.3/Submit) id n8AETBMn069400;
	Thu, 10 Sep 2009 15:29:11 +0100 (BST)
	(envelope-from gavin@FreeBSD.org)
X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to
	gavin@FreeBSD.org using -f
From: Gavin Atkinson 
To: Ken Smith 
In-Reply-To: <200909101404.n8AE41C6021588@svn.freebsd.org>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Date: Thu, 10 Sep 2009 15:29:11 +0100
Message-Id: <1252592951.49151.3.camel@buffy.york.ac.uk>
Mime-Version: 1.0
X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port 
X-York-MailScanner: Found to be clean
X-York-MailScanner-From: gavin@freebsd.org
Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults
	lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf
	sys/pc98/conf sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:00:42 -0000

On Thu, 2009-09-10 at 14:04 +0000, Ken Smith wrote:
> Author: kensmith
> Date: Thu Sep 10 14:04:00 2009
> New Revision: 197065
> URL: http://svn.freebsd.org/changeset/base/197065
> 
> Log:
>   Remove extra debugging support that is turned on for head but turned off
>   for stable branches:
>   
[...]
>   	- turn off automatic crash dumps
[...]
> 
> Modified: stable/8/etc/defaults/rc.conf
> ==============================================================================
> --- stable/8/etc/defaults/rc.conf	Thu Sep 10 13:20:27 2009	(r197064)
> +++ stable/8/etc/defaults/rc.conf	Thu Sep 10 14:04:00 2009	(r197065)
> @@ -549,7 +549,7 @@ lpd_flags=""		# Flags to lpd (if enabled
>  nscd_enable="NO"	# Run the nsswitch caching daemon.
>  chkprintcap_enable="NO"	# Run chkprintcap(8) before running lpd.
>  chkprintcap_flags="-d"	# Create missing directories by default.
> -dumpdev="AUTO"		# Device to crashdump to (device name, AUTO, or NO).
> +dumpdev="NO"		# Device to crashdump to (device name, AUTO, or NO).
>  dumpdir="/var/crash"	# Directory where crash dumps are to be stored
>  savecore_flags=""	# Used if dumpdev is enabled above, and present.
>  crashinfo_enable="YES"	# Automatically generate crash dump summary.

This seems like a step backwards to me: crash dumps have been left
enabled in 7.x and have proved very useful from the point of view of
improved quality of received PRs.  I'm not aware of any problems
relating to leaving them enabled.

I'd appreciate it if this decision was reconsidered.

Gavin

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:05:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D23B51065672;
	Thu, 10 Sep 2009 15:05:45 +0000 (UTC)
	(envelope-from ivoras@gmail.com)
Received: from mail-ew0-f208.google.com (mail-ew0-f208.google.com
	[209.85.219.208])
	by mx1.freebsd.org (Postfix) with ESMTP id F19D78FC18;
	Thu, 10 Sep 2009 15:05:44 +0000 (UTC)
Received: by ewy4 with SMTP id 4so194886ewy.36
	for ; Thu, 10 Sep 2009 08:05:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:from:date:x-google-sender-auth:message-id:subject:to:cc
	:content-type:content-transfer-encoding;
	bh=Quf+yuqcxNb2w1HRgAhAS1HMW2gTAYVU0R4UDISe0J8=;
	b=ZWmSuSgRmwLBhWHfBHJ77d0OpZe2SYKmqiREqoFguEsgG2elLg7UTMlUWNwlWVhw2+
	b1BzaWbhUhRM72+89ZxUCNu5Q8sidiVPOduoyOt9PifbMdQUH57P8V8we2io6lyPBVKB
	FcUAgk7hVbIK675RIAQFxeiWUngVan4iNKCQ4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type
	:content-transfer-encoding;
	b=nujie3Tho5UJL0grefJeZoaFHF3j0T5tlQb6VNHTFbRKKjiMMH9dG45VHiGnSn0TQO
	BdButVjkliAAzXi5fHkA0CUwn/NtB4+MpznMn1pFHlG3jR7AKSA2EQ5rX9PIoyrIg0FZ
	1wtgAKEJXabRK4cCisguuGoQCYNk+u3vQ77H8=
MIME-Version: 1.0
Sender: ivoras@gmail.com
Received: by 10.216.89.80 with SMTP id b58mr436145wef.73.1252595142430; Thu, 
	10 Sep 2009 08:05:42 -0700 (PDT)
In-Reply-To: <1252592951.49151.3.camel@buffy.york.ac.uk>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<1252592951.49151.3.camel@buffy.york.ac.uk>
From: Ivan Voras 
Date: Thu, 10 Sep 2009 17:05:22 +0200
X-Google-Sender-Auth: 401e01abca55aebc
Message-ID: <9bbcef730909100805w279153e4nb304fd0d0c6c7d9c@mail.gmail.com>
To: Gavin Atkinson 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:05:45 -0000

2009/9/10 Gavin Atkinson :

> This seems like a step backwards to me: crash dumps have been left
> enabled in 7.x and have proved very useful from the point of view of
> improved quality of received PRs. =C2=A0I'm not aware of any problems
> relating to leaving them enabled.
>
> I'd appreciate it if this decision was reconsidered.

+1

Kernel symbols and crash dumps in 7 were useful.


--=20
f+rEnSIBITAhITAhLR1nM9F4cIs5KJrhbcsVtUIt7K1MhWJy1A=3D=3D

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:17:22 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12BD9106566C;
	Thu, 10 Sep 2009 15:17:22 +0000 (UTC)
	(envelope-from kensmith@cse.Buffalo.EDU)
Received: from phoebe.cse.buffalo.edu (phoebe.cse.buffalo.edu [128.205.32.89])
	by mx1.freebsd.org (Postfix) with ESMTP id D28FC8FC13;
	Thu, 10 Sep 2009 15:17:21 +0000 (UTC)
Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76])
	(authenticated bits=0)
	by phoebe.cse.buffalo.edu (8.14.1/8.13.7) with ESMTP id n8AFHJum037159
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 10 Sep 2009 11:17:21 -0400 (EDT)
	(envelope-from kensmith@cse.buffalo.edu)
From: Ken Smith 
To: Gavin Atkinson 
In-Reply-To: <1252592951.49151.3.camel@buffy.york.ac.uk>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<1252592951.49151.3.camel@buffy.york.ac.uk>
Content-Type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature";
	boundary="=-upvYi8cf+Hhp+xMBOJcS"
Organization: U. Buffalo CSE Department
Date: Thu, 10 Sep 2009 11:17:19 -0400
Message-Id: <1252595839.75144.26.camel@bauer.cse.buffalo.edu>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port 
X-DCC-Buffalo.EDU-Metrics: phoebe.cse.buffalo.edu 1335; Body=0 Fuz1=0 Fuz2=0
Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults
 lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:17:22 -0000


--=-upvYi8cf+Hhp+xMBOJcS
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Thu, 2009-09-10 at 15:29 +0100, Gavin Atkinson wrote:
> On Thu, 2009-09-10 at 14:04 +0000, Ken Smith wrote:
> > Author: kensmith
> > Date: Thu Sep 10 14:04:00 2009
> > New Revision: 197065
> > URL: http://svn.freebsd.org/changeset/base/197065
> >=20
> > Log:
> >   Remove extra debugging support that is turned on for head but turned =
off
> >   for stable branches:
> >  =20
> [...]
> >   	- turn off automatic crash dumps
> [...]
> >=20
> > Modified: stable/8/etc/defaults/rc.conf
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- stable/8/etc/defaults/rc.conf	Thu Sep 10 13:20:27 2009	(r197064)
> > +++ stable/8/etc/defaults/rc.conf	Thu Sep 10 14:04:00 2009	(r197065)
> > @@ -549,7 +549,7 @@ lpd_flags=3D""		# Flags to lpd (if enabled
> >  nscd_enable=3D"NO"	# Run the nsswitch caching daemon.
> >  chkprintcap_enable=3D"NO"	# Run chkprintcap(8) before running lpd.
> >  chkprintcap_flags=3D"-d"	# Create missing directories by default.
> > -dumpdev=3D"AUTO"		# Device to crashdump to (device name, AUTO, or NO).
> > +dumpdev=3D"NO"		# Device to crashdump to (device name, AUTO, or NO).
> >  dumpdir=3D"/var/crash"	# Directory where crash dumps are to be stored
> >  savecore_flags=3D""	# Used if dumpdev is enabled above, and present.
> >  crashinfo_enable=3D"YES"	# Automatically generate crash dump summary.
>=20
> This seems like a step backwards to me: crash dumps have been left
> enabled in 7.x and have proved very useful from the point of view of
> improved quality of received PRs.  I'm not aware of any problems
> relating to leaving them enabled.
>=20
> I'd appreciate it if this decision was reconsidered.
>=20

Unfortunately as I said before there is no "Right answer" for this one.
If there is (a lot) more push-back on this we'll reconsider it.  But the
AUTO setting is only appropriate for machines that are "actively being
watched over".  In -stable branches we start to have people using it for
large data centers full of machines that are only "partially watched
over" at best as well as machines stuffed in phone closets in remote
locations, etc.  Having the AUTO setting for situations like that can
mean increased time for a reboot to happen, there is extra risk of the
machine wedging and not rebooting at all (requiring manual intervention
to get it back up), there is risk of disk space issues, etc.

Having the default be NO and the user needing to do something to turn it
on is more appropriate for those environments and helps insure that if
crash dumps are being generated someone is actually interested in them.

Typically this is something that's beneficial to us as you very
correctly point out above but it's not necessarily beneficial to the
end-users...

--=20
                                                Ken Smith
- From there to here, from here to      |       kensmith@cse.buffalo.edu
  there, funny things are everywhere.   |
                      - Theodore Geisel |


--=-upvYi8cf+Hhp+xMBOJcS
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEABECAAYFAkqpGH8ACgkQ/G14VSmup/b7bACfYaoh+W45ZFr/liqUEr7592AQ
RPkAn3EtMsxZa9bcoHsd8J3AIbIf1eTS
=2aqK
-----END PGP SIGNATURE-----

--=-upvYi8cf+Hhp+xMBOJcS--


From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:18:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1F58710656DF;
	Thu, 10 Sep 2009 15:18:48 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id DFD748FC29;
	Thu, 10 Sep 2009 15:18:47 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 3D26546B52;
	Thu, 10 Sep 2009 11:18:47 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 881468A01B;
	Thu, 10 Sep 2009 11:18:46 -0400 (EDT)
From: John Baldwin 
To: Ken Smith 
Date: Thu, 10 Sep 2009 11:18:21 -0400
User-Agent: KMail/1.9.7
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
In-Reply-To: <1252593149.75144.18.camel@bauer.cse.buffalo.edu>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909101118.22525.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 10 Sep 2009 11:18:46 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:18:48 -0000

On Thursday 10 September 2009 10:32:29 am Ken Smith wrote:
> On Thu, 2009-09-10 at 10:23 -0400, John Baldwin wrote:
> > > --- stable/8/etc/defaults/rc.conf     Thu Sep 10 13:20:27 2009        
(r197064)
> > > +++ stable/8/etc/defaults/rc.conf     Thu Sep 10 14:04:00 2009        
(r197065)
> > > @@ -549,7 +549,7 @@ lpd_flags=""              # Flags to lpd (if enabled
> > >  nscd_enable="NO"     # Run the nsswitch caching daemon.
> > >  chkprintcap_enable="NO"      # Run chkprintcap(8) before running lpd.
> > >  chkprintcap_flags="-d"       # Create missing directories by default.
> > > -dumpdev="AUTO"               # Device to crashdump to (device name, 
AUTO, or NO).
> > > +dumpdev="NO"         # Device to crashdump to (device name, AUTO, or 
NO).
> > >  dumpdir="/var/crash" # Directory where crash dumps are to be stored
> > >  savecore_flags=""    # Used if dumpdev is enabled above, and present.
> > >  crashinfo_enable="YES"       # Automatically generate crash dump 
summary.
> > 
> > Are we sure we want to change this?  It is set to "AUTO" in stable/7.
> 
> It has been pointed out to me on the mailing lists that leaving it on
> for stable/7 was an oversight, it is off on previous branches.
> 
> I can understand the motivation for it.  In a data center full of
> production machines crash dumps cause reboots to take longer and
> potentially cause disk space issues.  In those sorts of environments
> it's best if by *default* the crash dumps don't happen and if an admin
> finds they need it they turn it on.
> 
> This is one of those "There is no right answer" things...

Hmm, I thought the crashdumps were a conscious descision as part of another 
change in 7.x (shipping with debug symbols enabled by default) to try to make 
it easier to get more useful crash reports from stock kernels.  Having the 
debug symbols present is probably enough for that though since it is fairly 
easy to enable crashdumps in rc.conf vs. having to build a new kernel just to 
get debug symbols.  Should we change the default behavior in 7?

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:24:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D20351065695;
	Thu, 10 Sep 2009 15:24:14 +0000 (UTC)
	(envelope-from kensmith@cse.Buffalo.EDU)
Received: from phoebe.cse.buffalo.edu (phoebe.cse.buffalo.edu [128.205.32.89])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F3F18FC1A;
	Thu, 10 Sep 2009 15:24:14 +0000 (UTC)
Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76])
	(authenticated bits=0)
	by phoebe.cse.buffalo.edu (8.14.1/8.13.7) with ESMTP id n8AFO7c5037180
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 10 Sep 2009 11:24:13 -0400 (EDT)
	(envelope-from kensmith@cse.buffalo.edu)
From: Ken Smith 
To: John Baldwin 
In-Reply-To: <200909101118.22525.jhb@freebsd.org>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
Content-Type: multipart/signed; micalg="pgp-sha1";
	protocol="application/pgp-signature";
	boundary="=-RPLxmuc3Ffg6rfHMXyCa"
Organization: U. Buffalo CSE Department
Date: Thu, 10 Sep 2009 11:24:07 -0400
Message-Id: <1252596247.75144.29.camel@bauer.cse.buffalo.edu>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port 
X-DCC-Buffalo.EDU-Metrics: phoebe.cse.buffalo.edu 1335; Body=0 Fuz1=0 Fuz2=0
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults
 lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:24:14 -0000


--=-RPLxmuc3Ffg6rfHMXyCa
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Thu, 2009-09-10 at 11:18 -0400, John Baldwin wrote:
> Having the=20
> debug symbols present is probably enough for that though since it is fair=
ly=20
> easy to enable crashdumps in rc.conf vs. having to build a new kernel jus=
t to=20
> get debug symbols.  Should we change the default behavior in 7?

I was waffling over that since it's a user-visible change in an already
established -stable branch...  :-(

There is another user-visible change coming (after 8.X is out I'll shift
stable/7 over to using TCP by default for NFS; we decided to go ahead
with that a while ago).  I could change the default behavior for crash
dumps as part of doing that saying it was an oversight on my part that
it didn't happen when stable/7 was first set up.

--=20
                                                Ken Smith
- From there to here, from here to      |       kensmith@cse.buffalo.edu
  there, funny things are everywhere.   |
                      - Theodore Geisel |


--=-RPLxmuc3Ffg6rfHMXyCa
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEABECAAYFAkqpGhcACgkQ/G14VSmup/YUZgCcC9/zJeEknk7OA5+AR2urpxLQ
QRkAnAg7AoySYJskX0BVaBOaMeiKGcdU
=Go2e
-----END PGP SIGNATURE-----

--=-RPLxmuc3Ffg6rfHMXyCa--


From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:37:19 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B6FD106568D;
	Thu, 10 Sep 2009 15:37:19 +0000 (UTC)
	(envelope-from ivoras@gmail.com)
Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26])
	by mx1.freebsd.org (Postfix) with ESMTP id ABD588FC28;
	Thu, 10 Sep 2009 15:37:17 +0000 (UTC)
Received: by ey-out-2122.google.com with SMTP id 4so80173eyf.9
	for ; Thu, 10 Sep 2009 08:37:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:from:date:x-google-sender-auth:message-id:subject:to:cc
	:content-type:content-transfer-encoding;
	bh=Yeg2iHVA9rDtTmaZmvW+fzoDtbnSDW2j1xj4NYeuJ7U=;
	b=B49vyiZ+irSXAZS7Ac3yzapMIhqIwnJacwiNTaBDCQfZsbSSo/YhbK9crF2Z+5wOP/
	4FrKHWtfkQNUEf4MOlS3Kt2SBYLqyBlHizM/u8Ic9x4VILQztcexPsr6IpnzUeER/r3R
	afcMycgOWE+YdAwnQPooIKXw46pkmC1D0s2AA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type
	:content-transfer-encoding;
	b=vUlFpOGJ6wjMpSFmvisC4SN2PeBIcZIjHNarIAFUFp5TtuC1J2pCnknFO0zh+DoURh
	6+Lg3j1tStfUf8mf12VKGxmylFM6JnaZMjN/dk2Ew26tpS4yoSd+tGq5TFM4RE5fiUR1
	ZlKk7s2/5CDs9TgoCAK1P58G9KVAUSRugz+Mc=
MIME-Version: 1.0
Sender: ivoras@gmail.com
Received: by 10.216.7.212 with SMTP id 62mr494977wep.92.1252597036478; Thu, 10 
	Sep 2009 08:37:16 -0700 (PDT)
In-Reply-To: <1252595839.75144.26.camel@bauer.cse.buffalo.edu>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<1252592951.49151.3.camel@buffy.york.ac.uk> 
	<1252595839.75144.26.camel@bauer.cse.buffalo.edu>
From: Ivan Voras 
Date: Thu, 10 Sep 2009 17:36:56 +0200
X-Google-Sender-Auth: 0da9531aab6da75e
Message-ID: <9bbcef730909100836l3835825cy83082a2cfe4da0c3@mail.gmail.com>
To: Ken Smith 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: stable@freebsd.org, src-committers@freebsd.org, svn-src-stable@freebsd.org,
	svn-src-all@freebsd.org, Gavin Atkinson ,
	svn-src-stable-8@freebsd.org, Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:37:19 -0000

2009/9/10 Ken Smith :
> On Thu, 2009-09-10 at 15:29 +0100, Gavin Atkinson wrote:

>> This seems like a step backwards to me: crash dumps have been left
>> enabled in 7.x and have proved very useful from the point of view of
>> improved quality of received PRs. =C2=A0I'm not aware of any problems
>> relating to leaving them enabled.
>>
>> I'd appreciate it if this decision was reconsidered.
>>
>
> Unfortunately as I said before there is no "Right answer" for this one.

No, but there is an "80% right" one, based on the question: did the
change in 7 cause known problems for any significant number of users
(or one of two big users - that should be enough).

After all, if users were fine with crashdumps & symbols being enabled
in 7, they should be find with them being enabled in 8.

> If there is (a lot) more push-back on this we'll reconsider it.  But the
> AUTO setting is only appropriate for machines that are "actively being
> watched over".  In -stable branches we start to have people using it for
> large data centers full of machines that are only "partially watched
> over" at best as well as machines stuffed in phone closets in remote
> locations, etc.  Having the AUTO setting for situations like that can
> mean increased time for a reboot to happen, there is extra risk of the
> machine wedging and not rebooting at all (requiring manual intervention
> to get it back up), there is risk of disk space issues, etc.

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:40:15 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB6661065670;
	Thu, 10 Sep 2009 15:40:15 +0000 (UTC)
	(envelope-from freebsd@nagilum.org)
Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10])
	by mx1.freebsd.org (Postfix) with ESMTP id 5FB418FC1A;
	Thu, 10 Sep 2009 15:40:15 +0000 (UTC)
Received: from cakebox.homeunix.net (p5B2F11A5.dip0.t-ipconnect.de
	[91.47.17.165])
	by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis)
	id 0MKsym-1MllYE1HmW-000llO; Thu, 10 Sep 2009 17:27:11 +0200
Received: from cakebox.homeunix.net (localhost [127.0.0.1])
	by cakebox.homeunix.net (Postfix) with ESMTP id 3F769689AE;
	Thu, 10 Sep 2009 17:26:19 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on cakebox.tis
X-Spam-Level: 
X-Spam-Status: No, score=-3.9 required=2.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
Received: by cakebox.homeunix.net (Postfix, from userid 80)
	id 1F4D7689AD; Thu, 10 Sep 2009 17:26:17 +0200 (CEST)
Received: from internal-host.emea.hpqcorp.net
	(internal-host.emea.hpqcorp.net [15.197.221.71]) by
	cakebox.homeunix.net
	(Horde Framework) with HTTP; Thu, 10 Sep 2009 17:26:15 +0200
Message-ID: <20090910172615.10546acbv5w0uykg@cakebox.homeunix.net>
Date: Thu, 10 Sep 2009 17:26:15 +0200
From: Alexander 
To: Ken Smith 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<1252592951.49151.3.camel@buffy.york.ac.uk>
	<1252595839.75144.26.camel@bauer.cse.buffalo.edu>
In-Reply-To: <1252595839.75144.26.camel@bauer.cse.buffalo.edu>
MIME-Version: 1.0
Content-Type: text/plain;
 charset=ISO-8859-2;
 DelSp="Yes";
 format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.2)
X-Provags-ID: V01U2FsdGVkX18OO29mwIt/da9bqgL1ReTn2Gl24+oU3nYUPwp
	HOsLpoy7qegZu7TQFZag83oZSrU5Iz91jKLF8GsMUNcp3vvvJG
	xnjGAMZ+dFspeFWMFEXbhtMWHpWHxpr
Cc: src-committers@FreeBSD.org, svn-src-stable@FreeBSD.org,
	svn-src-all@FreeBSD.org, Gavin Atkinson ,
	svn-src-stable-8@FreeBSD.org, Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults
 lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:40:15 -0000


----- Message from kensmith@cse.Buffalo.EDU ---------
     Date: Thu, 10 Sep 2009 11:17:19 -0400
     From: Ken Smith 
  Subject: Re: svn commit: r197065 - in stable/8: etc/defaults  
lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf  
sys/pc98/conf sys/powerpc/conf sys/sparc64/conf
       To: Gavin Atkinson 
       Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org,  
src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org, Ken Smith  



> On Thu, 2009-09-10 at 15:29 +0100, Gavin Atkinson wrote:
>> On Thu, 2009-09-10 at 14:04 +0000, Ken Smith wrote:
>> > Author: kensmith
>> > Date: Thu Sep 10 14:04:00 2009
>> > New Revision: 197065
>> > URL: http://svn.freebsd.org/changeset/base/197065
>> >
>> > Log:
>> >   Remove extra debugging support that is turned on for head but turned off
>> >   for stable branches:
>> >
>> [...]
>> >   	- turn off automatic crash dumps
>> [...]
>> >
>> > Modified: stable/8/etc/defaults/rc.conf
>> >  
>> ==============================================================================
>> > --- stable/8/etc/defaults/rc.conf	Thu Sep 10 13:20:27 2009	(r197064)
>> > +++ stable/8/etc/defaults/rc.conf	Thu Sep 10 14:04:00 2009	(r197065)
>> > @@ -549,7 +549,7 @@ lpd_flags=""		# Flags to lpd (if enabled
>> >  nscd_enable="NO"	# Run the nsswitch caching daemon.
>> >  chkprintcap_enable="NO"	# Run chkprintcap(8) before running lpd.
>> >  chkprintcap_flags="-d"	# Create missing directories by default.
>> > -dumpdev="AUTO"		# Device to crashdump to (device name, AUTO, or NO).
>> > +dumpdev="NO"		# Device to crashdump to (device name, AUTO, or NO).
>> >  dumpdir="/var/crash"	# Directory where crash dumps are to be stored
>> >  savecore_flags=""	# Used if dumpdev is enabled above, and present.
>> >  crashinfo_enable="YES"	# Automatically generate crash dump summary.
>>

Since it's a change in default behaviour I think it should be noted in  
/usr/src/UPDATING.


> --
>                                                 Ken Smith
> - From there to here, from here to      |       kensmith@cse.buffalo.edu
>   there, funny things are everywhere.   |
>                       - Theodore Geisel |
>
>


----- End message from kensmith@cse.Buffalo.EDU -----




----------------------------------------------------------------
cakebox.homeunix.net - all the machine one needs..

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 15:43:35 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C462B106566B;
	Thu, 10 Sep 2009 15:43:35 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 97B798FC15;
	Thu, 10 Sep 2009 15:43:35 +0000 (UTC)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id 4213A46B53;
	Thu, 10 Sep 2009 11:43:35 -0400 (EDT)
Date: Thu, 10 Sep 2009 16:43:35 +0100 (BST)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: John Baldwin 
In-Reply-To: <200909101118.22525.jhb@freebsd.org>
Message-ID: 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: src-committers@freebsd.org, svn-src-stable@freebsd.org,
	svn-src-all@freebsd.org, svn-src-stable-8@freebsd.org,
	Ken Smith , Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
 sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 15:43:35 -0000


On Thu, 10 Sep 2009, John Baldwin wrote:

>> It has been pointed out to me on the mailing lists that leaving it on for 
>> stable/7 was an oversight, it is off on previous branches.
>>
>> I can understand the motivation for it.  In a data center full of 
>> production machines crash dumps cause reboots to take longer and 
>> potentially cause disk space issues.  In those sorts of environments it's 
>> best if by *default* the crash dumps don't happen and if an admin finds 
>> they need it they turn it on.
>>
>> This is one of those "There is no right answer" things...
>
> Hmm, I thought the crashdumps were a conscious descision as part of another 
> change in 7.x (shipping with debug symbols enabled by default) to try to 
> make it easier to get more useful crash reports from stock kernels.  Having 
> the debug symbols present is probably enough for that though since it is 
> fairly easy to enable crashdumps in rc.conf vs. having to build a new kernel 
> just to get debug symbols.  Should we change the default behavior in 7?

I wonder if we could teach libkvm how to work directly from a crashdump in 
situ in the swap partition?  This would not fix "slower reboot times" but it 
would help a lot with the "running out of disk space" thing.  I see no reason 
at all we shouldn't be logging things like panics/stack traces for every crash 
in our normal logs -- in fact, that was much of the motivation for text dumps 
(and crashinfo too, no doubt): capture critical crash information in a compact 
way that can be e-maile around, etc, without the overhead of multi-gig dumps. 
Teaching libkvm how to work on crash dump partitions would let us avoid having 
the crashdump reside in the file system and help a lot with that problem.

Robert N M Watson
Computer Laboratory
University of Cambridge

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 16:03:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 539511065670;
	Thu, 10 Sep 2009 16:03:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 279B18FC19;
	Thu, 10 Sep 2009 16:03:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AG3CLG024373;
	Thu, 10 Sep 2009 16:03:12 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AG3CTS024372;
	Thu, 10 Sep 2009 16:03:12 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200909101603.n8AG3CTS024372@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 10 Sep 2009 16:03:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197069 - in stable/7/sys: . contrib/pf net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 16:03:12 -0000

Author: jhb
Date: Thu Sep 10 16:03:11 2009
New Revision: 197069
URL: http://svn.freebsd.org/changeset/base/197069

Log:
  Hoist some mergeinfo up from sys/net to sys/.
  
  Reported by:	kib

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/net/   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 16:10:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D0A41065676;
	Thu, 10 Sep 2009 16:10:12 +0000 (UTC) (envelope-from avg@freebsd.org)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id 801268FC08;
	Thu, 10 Sep 2009 16:10:10 +0000 (UTC)
Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua
	[212.40.38.101])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA24801;
	Thu, 10 Sep 2009 19:10:08 +0300 (EEST)
	(envelope-from avg@freebsd.org)
Message-ID: <4AA924DF.7080009@freebsd.org>
Date: Thu, 10 Sep 2009 19:10:07 +0300
From: Andriy Gapon 
User-Agent: Thunderbird 2.0.0.22 (X11/20090724)
MIME-Version: 1.0
To: John Baldwin 
References: <200909101603.n8AG3CTS024372@svn.freebsd.org>
In-Reply-To: <200909101603.n8AG3CTS024372@svn.freebsd.org>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r197069 - in stable/7/sys: . contrib/pf net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 16:10:12 -0000

on 10/09/2009 19:03 John Baldwin said the following:
> Author: jhb
> Date: Thu Sep 10 16:03:11 2009
> New Revision: 197069
> URL: http://svn.freebsd.org/changeset/base/197069
> 
> Log:
>   Hoist some mergeinfo up from sys/net to sys/.
>   
>   Reported by:	kib

Perhaps it's possible to develop a commit hook that would reject mergeinfo being
set on some entities? E.g. individual files, or directories under sys.

-- 
Andriy Gapon

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 16:57:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DECE11065670;
	Thu, 10 Sep 2009 16:57:10 +0000 (UTC)
	(envelope-from remko@elvandar.org)
Received: from websrv01.jr-hosting.nl (websrv01.jr-hosting.nl [78.47.69.233])
	by mx1.freebsd.org (Postfix) with ESMTP id 934048FC17;
	Thu, 10 Sep 2009 16:57:10 +0000 (UTC)
Received: from a83-163-38-147.adsl.xs4all.nl ([83.163.38.147] helo=[10.0.2.66])
	by websrv01.jr-hosting.nl with esmtpsa (TLSv1:AES128-SHA:128)
	(Exim 4.69 (FreeBSD)) (envelope-from )
	id 1MlmxJ-0001T4-4P; Thu, 10 Sep 2009 18:57:09 +0200
Mime-Version: 1.0 (Apple Message framework v1075.2)
Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
From: Remko Lodder 
In-Reply-To: 
Date: Thu, 10 Sep 2009 18:57:07 +0200
Content-Transfer-Encoding: 7bit
Message-Id: 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
	
To: Robert Watson 
X-Mailer: Apple Mail (2.1075.2)
Cc: src-committers@freebsd.org, John Baldwin ,
	svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable-8@freebsd.org, Ken Smith ,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 16:57:11 -0000


On Sep 10, 2009, at 5:43 PM, Robert Watson wrote:

>
> On Thu, 10 Sep 2009, John Baldwin wrote:
>
>>> It has been pointed out to me on the mailing lists that leaving it  
>>> on for stable/7 was an oversight, it is off on previous branches.
>>>
>>> I can understand the motivation for it.  In a data center full of  
>>> production machines crash dumps cause reboots to take longer and  
>>> potentially cause disk space issues.  In those sorts of  
>>> environments it's best if by *default* the crash dumps don't  
>>> happen and if an admin finds they need it they turn it on.
>>>
>>> This is one of those "There is no right answer" things...
>>
>> Hmm, I thought the crashdumps were a conscious descision as part of  
>> another change in 7.x (shipping with debug symbols enabled by  
>> default) to try to make it easier to get more useful crash reports  
>> from stock kernels.  Having the debug symbols present is probably  
>> enough for that though since it is fairly easy to enable crashdumps  
>> in rc.conf vs. having to build a new kernel just to get debug  
>> symbols.  Should we change the default behavior in 7?
>
> I wonder if we could teach libkvm how to work directly from a  
> crashdump in situ in the swap partition?  This would not fix "slower  
> reboot times" but it would help a lot with the "running out of disk  
> space" thing.  I see no reason at all we shouldn't be logging things  
> like panics/stack traces for every crash in our normal logs -- in  
> fact, that was much of the motivation for text dumps (and crashinfo  
> too, no doubt): capture critical crash information in a compact way  
> that can be e-maile around, etc, without the overhead of multi-gig  
> dumps. Teaching libkvm how to work on crash dump partitions would  
> let us avoid having the crashdump reside in the file system and help  
> a lot with that problem.
>
> Robert N M Watson
> Computer Laboratory
> University of Cambridge

I agree with that; it would (!) help the bugbusting team in gathering  
required information. If there is an way to automate crashdumps and  
proper reporting and stick that in /var/crash/crash.$date or something  
and tell people that
they can report their problems on the bugs list where needed, we have  
information upfront. I still remember the time where we had to chase  
people to get this information, sometimes never being able to properly  
get the information.
If it is there by default, it will help.

Please consider keeping it enabled..

Thanks,
Remko

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 17:00:31 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 87D231065693;
	Thu, 10 Sep 2009 17:00:31 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 57BCF8FC36;
	Thu, 10 Sep 2009 17:00:31 +0000 (UTC)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id D11C646B03;
	Thu, 10 Sep 2009 13:00:30 -0400 (EDT)
Date: Thu, 10 Sep 2009 18:00:30 +0100 (BST)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Remko Lodder 
In-Reply-To: 
Message-ID: 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
	
	
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: src-committers@freebsd.org, John Baldwin ,
	svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable-8@freebsd.org, Ken Smith ,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
 sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 17:00:31 -0000


On Thu, 10 Sep 2009, Remko Lodder wrote:

> I agree with that; it would (!) help the bugbusting team in gathering 
> required information. If there is an way to automate crashdumps and proper 
> reporting and stick that in /var/crash/crash.$date or something and tell 
> people that they can report their problems on the bugs list where needed, we 
> have information upfront. I still remember the time where we had to chase 
> people to get this information, sometimes never being able to properly get 
> the information. If it is there by default, it will help.
>
> Please consider keeping it enabled..

Well, John's crashinfo(8) tool from Yahoo! does all this, the only "problem" 
is that it requires extracting the crashdump to a local file system.  It seems 
like we have a lot of the right ingredients, maybe we can have a 
brain-storming session on distributed diagnostics and debugging at the 
Devsummit on how to find some better middle grounds here.

Robert N M Watson
Computer Laboratory
University of Cambridge

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 17:27:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC8FD106568F;
	Thu, 10 Sep 2009 17:27:36 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D9F778FC1F;
	Thu, 10 Sep 2009 17:27:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AHRaJJ026110;
	Thu, 10 Sep 2009 17:27:36 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AHRa8L026099;
	Thu, 10 Sep 2009 17:27:36 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909101727.n8AHRa8L026099@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 10 Sep 2009 17:27:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197070 - in head/sys: amd64/amd64 amd64/include
	i386/cpufreq i386/i386 i386/include i386/xen
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 17:27:37 -0000

Author: jkim
Date: Thu Sep 10 17:27:36 2009
New Revision: 197070
URL: http://svn.freebsd.org/changeset/base/197070

Log:
  Consolidate CPUID to CPU family/model macros for amd64 and i386 to reduce
  unnecessary #ifdef's for shared code between them.

Modified:
  head/sys/amd64/amd64/identcpu.c
  head/sys/amd64/amd64/initcpu.c
  head/sys/amd64/amd64/msi.c
  head/sys/amd64/include/specialreg.h
  head/sys/i386/cpufreq/hwpstate.c
  head/sys/i386/i386/identcpu.c
  head/sys/i386/i386/msi.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/include/specialreg.h
  head/sys/i386/xen/pmap.c

Modified: head/sys/amd64/amd64/identcpu.c
==============================================================================
--- head/sys/amd64/amd64/identcpu.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/amd64/amd64/identcpu.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -371,21 +371,21 @@ printcpuinfo(void)
 			switch (cpu_vendor_id) {
 			case CPU_VENDOR_AMD:
 				if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
-				    AMD64_CPU_FAMILY(cpu_id) >= 0x10 ||
+				    CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
 				    cpu_id == 0x60fb2)
 					tsc_is_invariant = 1;
 				break;
 			case CPU_VENDOR_INTEL:
 				if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
-				    (AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
-				    AMD64_CPU_MODEL(cpu_id) >= 0xe) ||
-				    (AMD64_CPU_FAMILY(cpu_id) == 0xf &&
-				    AMD64_CPU_MODEL(cpu_id) >= 0x3))
+				    (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+				    CPUID_TO_MODEL(cpu_id) >= 0xe) ||
+				    (CPUID_TO_FAMILY(cpu_id) == 0xf &&
+				    CPUID_TO_MODEL(cpu_id) >= 0x3))
 					tsc_is_invariant = 1;
 				break;
 			case CPU_VENDOR_CENTAUR:
-				if (AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
-				    AMD64_CPU_MODEL(cpu_id) >= 0xf &&
+				if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+				    CPUID_TO_MODEL(cpu_id) >= 0xf &&
 				    (rdmsr(0x1203) & 0x100000000ULL) == 0)
 					tsc_is_invariant = 1;
 				break;

Modified: head/sys/amd64/amd64/initcpu.c
==============================================================================
--- head/sys/amd64/amd64/initcpu.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/amd64/amd64/initcpu.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -154,8 +154,8 @@ initializecpu(void)
 		pg_nx = PG_NX;
 	}
 	if (cpu_vendor_id == CPU_VENDOR_CENTAUR &&
-	    AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
-	    AMD64_CPU_MODEL(cpu_id) >= 0xf)
+	    CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+	    CPUID_TO_MODEL(cpu_id) >= 0xf)
 		init_via();
 
 	/*

Modified: head/sys/amd64/amd64/msi.c
==============================================================================
--- head/sys/amd64/amd64/msi.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/amd64/amd64/msi.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -275,8 +275,8 @@ msi_init(void)
 	case CPU_VENDOR_AMD:
 		break;
 	case CPU_VENDOR_CENTAUR:
-		if (AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
-		    AMD64_CPU_MODEL(cpu_id) >= 0xf)
+		if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+		    CPUID_TO_MODEL(cpu_id) >= 0xf)
 			break;
 		/* FALLTHROUGH */
 	default:

Modified: head/sys/amd64/include/specialreg.h
==============================================================================
--- head/sys/amd64/include/specialreg.h	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/amd64/include/specialreg.h	Thu Sep 10 17:27:36 2009	(r197070)
@@ -168,10 +168,10 @@
 #define	CPUID_FAMILY		0x00000f00
 #define	CPUID_EXT_MODEL		0x000f0000
 #define	CPUID_EXT_FAMILY	0x0ff00000
-#define	AMD64_CPU_MODEL(id) \
+#define	CPUID_TO_MODEL(id) \
     ((((id) & CPUID_MODEL) >> 4) | \
     (((id) & CPUID_EXT_MODEL) >> 12))
-#define	AMD64_CPU_FAMILY(id) \
+#define	CPUID_TO_FAMILY(id) \
     ((((id) & CPUID_FAMILY) >> 8) + \
     (((id) & CPUID_EXT_FAMILY) >> 20))
 

Modified: head/sys/i386/cpufreq/hwpstate.c
==============================================================================
--- head/sys/i386/cpufreq/hwpstate.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/i386/cpufreq/hwpstate.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -83,12 +83,6 @@ __FBSDID("$FreeBSD$");
 #define	AMD_10H_11H_CUR_DID(msr)		(((msr) >> 6) & 0x07)
 #define	AMD_10H_11H_CUR_FID(msr)		((msr) & 0x3F)
 
-#if defined(__amd64__)
-#define CPU_FAMILY(id)	AMD64_CPU_FAMILY(id)
-#elif defined(__i386__)
-#define CPU_FAMILY(id)	I386_CPU_FAMILY(id)
-#endif
-
 #define	HWPSTATE_DEBUG(dev, msg...)			\
 	do{						\
 		if(hwpstate_verbose)			\
@@ -302,7 +296,7 @@ hwpstate_identify(driver_t *driver, devi
 	if (device_find_child(parent, "hwpstate", -1) != NULL)
 		return;
 
-	if (cpu_vendor_id != CPU_VENDOR_AMD || CPU_FAMILY(cpu_id) < 0x10)
+	if (cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10)
 		return;
 
 	/*
@@ -405,7 +399,7 @@ hwpstate_get_info_from_msr(device_t dev)
 	uint64_t msr;
 	int family, i, fid, did;
 
-	family = CPU_FAMILY(cpu_id);
+	family = CPUID_TO_FAMILY(cpu_id);
 	sc = device_get_softc(dev);
 	/* Get pstate count */
 	msr = rdmsr(MSR_AMD_10H_11H_LIMIT);

Modified: head/sys/i386/i386/identcpu.c
==============================================================================
--- head/sys/i386/i386/identcpu.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/i386/i386/identcpu.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -858,21 +858,21 @@ printcpuinfo(void)
 			switch (cpu_vendor_id) {
 			case CPU_VENDOR_AMD:
 				if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
-				    I386_CPU_FAMILY(cpu_id) >= 0x10 ||
+				    CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
 				    cpu_id == 0x60fb2)
 					tsc_is_invariant = 1;
 				break;
 			case CPU_VENDOR_INTEL:
 				if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
-				    (I386_CPU_FAMILY(cpu_id) == 0x6 &&
-				    I386_CPU_MODEL(cpu_id) >= 0xe) ||
-				    (I386_CPU_FAMILY(cpu_id) == 0xf &&
-				    I386_CPU_MODEL(cpu_id) >= 0x3))
+				    (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+				    CPUID_TO_MODEL(cpu_id) >= 0xe) ||
+				    (CPUID_TO_FAMILY(cpu_id) == 0xf &&
+				    CPUID_TO_MODEL(cpu_id) >= 0x3))
 					tsc_is_invariant = 1;
 				break;
 			case CPU_VENDOR_CENTAUR:
-				if (I386_CPU_FAMILY(cpu_id) == 0x6 &&
-				    I386_CPU_MODEL(cpu_id) >= 0xf &&
+				if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+				    CPUID_TO_MODEL(cpu_id) >= 0xf &&
 				    (rdmsr(0x1203) & 0x100000000ULL) == 0)
 					tsc_is_invariant = 1;
 				break;
@@ -1106,8 +1106,8 @@ finishidentcpu(void)
 	 * XXX This is only done on the BSP package.
 	 */
 	if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4 &&
-	    ((I386_CPU_FAMILY(cpu_id) == 0xf && I386_CPU_MODEL(cpu_id) >= 0x3) ||
-	    (I386_CPU_FAMILY(cpu_id) == 0x6 && I386_CPU_MODEL(cpu_id) >= 0xe))) {
+	    ((CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x3) ||
+	    (CPUID_TO_FAMILY(cpu_id) == 0x6 && CPUID_TO_MODEL(cpu_id) >= 0xe))) {
 		uint64_t msr;
 		msr = rdmsr(MSR_IA32_MISC_ENABLE);
 		if ((msr & 0x400000ULL) != 0) {

Modified: head/sys/i386/i386/msi.c
==============================================================================
--- head/sys/i386/i386/msi.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/i386/i386/msi.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -275,8 +275,8 @@ msi_init(void)
 	case CPU_VENDOR_AMD:
 		break;
 	case CPU_VENDOR_CENTAUR:
-		if (I386_CPU_FAMILY(cpu_id) == 0x6 &&
-		    I386_CPU_MODEL(cpu_id) >= 0xf)
+		if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+		    CPUID_TO_MODEL(cpu_id) >= 0xf)
 			break;
 		/* FALLTHROUGH */
 	default:

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/i386/i386/pmap.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -501,8 +501,8 @@ pmap_init_pat(void)
 	 */
 	if (!pat_tested) {
 		if (cpu_vendor_id != CPU_VENDOR_INTEL ||
-		    (I386_CPU_FAMILY(cpu_id) == 6 &&
-		    I386_CPU_MODEL(cpu_id) >= 0xe)) {
+		    (CPUID_TO_FAMILY(cpu_id) == 6 &&
+		    CPUID_TO_MODEL(cpu_id) >= 0xe)) {
 			pat_works = 1;
 			sysenv = getenv("smbios.system.product");
 			if (sysenv != NULL) {

Modified: head/sys/i386/include/specialreg.h
==============================================================================
--- head/sys/i386/include/specialreg.h	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/i386/include/specialreg.h	Thu Sep 10 17:27:36 2009	(r197070)
@@ -165,11 +165,11 @@
 #define	CPUID_FAMILY		0x00000f00
 #define	CPUID_EXT_MODEL		0x000f0000
 #define	CPUID_EXT_FAMILY	0x0ff00000
-#define	I386_CPU_MODEL(id) \
+#define	CPUID_TO_MODEL(id) \
     ((((id) & CPUID_MODEL) >> 4) | \
     ((((id) & CPUID_FAMILY) >= 0x600) ? \
     (((id) & CPUID_EXT_MODEL) >> 12) : 0))
-#define	I386_CPU_FAMILY(id) \
+#define	CPUID_TO_FAMILY(id) \
     ((((id) & CPUID_FAMILY) >> 8) + \
     ((((id) & CPUID_FAMILY) == 0xf00) ? \
     (((id) & CPUID_EXT_FAMILY) >> 20) : 0))

Modified: head/sys/i386/xen/pmap.c
==============================================================================
--- head/sys/i386/xen/pmap.c	Thu Sep 10 16:03:11 2009	(r197069)
+++ head/sys/i386/xen/pmap.c	Thu Sep 10 17:27:36 2009	(r197070)
@@ -517,7 +517,7 @@ pmap_init_pat(void)
 		return;
 
 	if (cpu_vendor_id != CPU_VENDOR_INTEL ||
-	    (I386_CPU_FAMILY(cpu_id) == 6 && I386_CPU_MODEL(cpu_id) >= 0xe)) {
+	    (CPUID_TO_FAMILY(cpu_id) == 6 && CPUID_TO_MODEL(cpu_id) >= 0xe)) {
 		/*
 		 * Leave the indices 0-3 at the default of WB, WT, UC, and UC-.
 		 * Program 4 and 5 as WP and WC.

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 17:58:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 882B81065670;
	Thu, 10 Sep 2009 17:58:00 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 56DF68FC19;
	Thu, 10 Sep 2009 17:58:00 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 07B3246B06;
	Thu, 10 Sep 2009 13:58:00 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 6A9D98A01B;
	Thu, 10 Sep 2009 13:57:59 -0400 (EDT)
From: John Baldwin 
To: Andriy Gapon 
Date: Thu, 10 Sep 2009 13:27:22 -0400
User-Agent: KMail/1.9.7
References: <200909101603.n8AG3CTS024372@svn.freebsd.org>
	<4AA924DF.7080009@freebsd.org>
In-Reply-To: <4AA924DF.7080009@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909101327.23113.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 10 Sep 2009 13:57:59 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r197069 - in stable/7/sys: . contrib/pf net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 17:58:00 -0000

On Thursday 10 September 2009 12:10:07 pm Andriy Gapon wrote:
> on 10/09/2009 19:03 John Baldwin said the following:
> > Author: jhb
> > Date: Thu Sep 10 16:03:11 2009
> > New Revision: 197069
> > URL: http://svn.freebsd.org/changeset/base/197069
> > 
> > Log:
> >   Hoist some mergeinfo up from sys/net to sys/.
> >   
> >   Reported by:	kib
> 
> Perhaps it's possible to develop a commit hook that would reject mergeinfo being
> set on some entities? E.g. individual files, or directories under sys.

In some cases it is valid to add the mergeinfo, though that is probably
restricted to certain subdirectories (contrib, cddl, crypto).  I don't know
enough of the SVN internals to look at doing that.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 18:24:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BAA251065693;
	Thu, 10 Sep 2009 18:24:59 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A9B118FC0C;
	Thu, 10 Sep 2009 18:24:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AIOxvx027280;
	Thu, 10 Sep 2009 18:24:59 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AIOxJI027277;
	Thu, 10 Sep 2009 18:24:59 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200909101824.n8AIOxJI027277@svn.freebsd.org>
From: Nick Hibma 
Date: Thu, 10 Sep 2009 18:24:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197071 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 18:24:59 -0000

Author: n_hibma
Date: Thu Sep 10 18:24:59 2009
New Revision: 197071
URL: http://svn.freebsd.org/changeset/base/197071

Log:
  Add a comment on the consequences of reducing the poweroff delay

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Thu Sep 10 17:27:36 2009	(r197070)
+++ head/sys/kern/kern_shutdown.c	Thu Sep 10 18:24:59 2009	(r197071)
@@ -581,6 +581,10 @@ panic(const char *fmt, ...)
 
 /*
  * Support for poweroff delay.
+ *
+ * Please note that setting this delay too short might power off your machine
+ * before the write cache on your hard disk has been flushed, leading to
+ * soft-updates inconsistencies.
  */
 #ifndef POWEROFF_DELAY
 # define POWEROFF_DELAY 5000

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 18:33:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 009641065679;
	Thu, 10 Sep 2009 18:33:09 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA1BA8FC1A;
	Thu, 10 Sep 2009 18:33:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AIX8JO027490;
	Thu, 10 Sep 2009 18:33:08 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AIX8p6027487;
	Thu, 10 Sep 2009 18:33:08 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200909101833.n8AIX8p6027487@svn.freebsd.org>
From: Nick Hibma 
Date: Thu, 10 Sep 2009 18:33:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197072 - in head/sys: dev/ichwd netsmb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 18:33:09 -0000

Author: n_hibma
Date: Thu Sep 10 18:33:08 2009
New Revision: 197072
URL: http://svn.freebsd.org/changeset/base/197072

Log:
  Don't print out a message on loading a module.  'kldload -v' and 'kldstat
  | grep ' can be used instead.
  
  Put a message behind bootverbose as
  
  	ichwd0:  on isa0
  	ichwd0: Intel ICH6M watchdog timer (ICH6 or equivalent)
  
  does not make a lot of sense.
  
  MFC after:	1 week

Modified:
  head/sys/dev/ichwd/ichwd.c
  head/sys/netsmb/smb_dev.c

Modified: head/sys/dev/ichwd/ichwd.c
==============================================================================
--- head/sys/dev/ichwd/ichwd.c	Thu Sep 10 18:24:59 2009	(r197071)
+++ head/sys/dev/ichwd/ichwd.c	Thu Sep 10 18:33:08 2009	(r197072)
@@ -465,7 +465,7 @@ ichwd_attach(device_t dev)
 	if (ichwd_clear_noreboot(sc) != 0)
 		goto fail;
 
-	device_printf(dev, "%s (ICH%d or equivalent)\n",
+	ichwd_verbose_printf(dev, "%s (ICH%d or equivalent)\n",
 	    device_get_desc(dev), sc->ich_version);
 
 	/*
@@ -553,23 +553,4 @@ static driver_t ichwd_driver = {
 	sizeof(struct ichwd_softc),
 };
 
-static int
-ichwd_modevent(module_t mode, int type, void *data)
-{
-	int error = 0;
-
-	switch (type) {
-	case MOD_LOAD:
-		printf("ichwd module loaded\n");
-		break;
-	case MOD_UNLOAD:
-		printf("ichwd module unloaded\n");
-		break;
-	case MOD_SHUTDOWN:
-		printf("ichwd module shutting down\n");
-		break;
-	}
-	return (error);
-}
-
-DRIVER_MODULE(ichwd, isa, ichwd_driver, ichwd_devclass, ichwd_modevent, NULL);
+DRIVER_MODULE(ichwd, isa, ichwd_driver, ichwd_devclass, NULL, NULL);

Modified: head/sys/netsmb/smb_dev.c
==============================================================================
--- head/sys/netsmb/smb_dev.c	Thu Sep 10 18:24:59 2009	(r197071)
+++ head/sys/netsmb/smb_dev.c	Thu Sep 10 18:33:08 2009	(r197072)
@@ -352,7 +352,6 @@ nsmb_dev_load(module_t mod, int cmd, voi
 		}
 		clone_setup(&nsmb_clones);
 		nsmb_dev_tag = EVENTHANDLER_REGISTER(dev_clone, nsmb_dev_clone, 0, 1000);
-		printf("netsmb_dev: loaded\n");
 		break;
 	    case MOD_UNLOAD:
 		smb_iod_done();
@@ -363,7 +362,6 @@ nsmb_dev_load(module_t mod, int cmd, voi
 		drain_dev_clone_events();
 		clone_cleanup(&nsmb_clones);
 		destroy_dev_drain(&nsmb_cdevsw);
-		printf("netsmb_dev: unloaded\n");
 		break;
 	    default:
 		error = EINVAL;

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 18:39:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FB57106568B;
	Thu, 10 Sep 2009 18:39:58 +0000 (UTC) (envelope-from avg@freebsd.org)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A0FF8FC14;
	Thu, 10 Sep 2009 18:39:56 +0000 (UTC)
Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua
	[212.40.38.100])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA26841;
	Thu, 10 Sep 2009 21:39:55 +0300 (EEST)
	(envelope-from avg@freebsd.org)
Received: from localhost.topspin.kiev.ua ([127.0.0.1])
	by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD))
	id 1MloYl-0009gt-9u; Thu, 10 Sep 2009 21:39:55 +0300
Message-ID: <4AA947FA.8040404@freebsd.org>
Date: Thu, 10 Sep 2009 21:39:54 +0300
From: Andriy Gapon 
User-Agent: Thunderbird 2.0.0.23 (X11/20090823)
MIME-Version: 1.0
To: Nick Hibma 
References: <200909101833.n8AIX8p6027487@svn.freebsd.org>
In-Reply-To: <200909101833.n8AIX8p6027487@svn.freebsd.org>
X-Enigmail-Version: 0.96.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197072 - in head/sys: dev/ichwd netsmb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 18:39:59 -0000

on 10/09/2009 21:33 Nick Hibma said the following:
> Author: n_hibma
> Date: Thu Sep 10 18:33:08 2009
> New Revision: 197072
> URL: http://svn.freebsd.org/changeset/base/197072
> 
> Log:
>   Don't print out a message on loading a module.  'kldload -v' and 'kldstat
>   | grep ' can be used instead.
>   
>   Put a message behind bootverbose as
>   
>   	ichwd0:  on isa0
>   	ichwd0: Intel ICH6M watchdog timer (ICH6 or equivalent)
>   
>   does not make a lot of sense.
>   
>   MFC after:	1 week

Looks like you have committed an unrelated change in netsmb.


-- 
Andriy Gapon

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 18:53:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C5C4C106566C;
	Thu, 10 Sep 2009 18:53:34 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B52808FC08;
	Thu, 10 Sep 2009 18:53:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AIrYnE028059;
	Thu, 10 Sep 2009 18:53:34 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AIrYpb028056;
	Thu, 10 Sep 2009 18:53:34 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <200909101853.n8AIrYpb028056@svn.freebsd.org>
From: Jack F Vogel 
Date: Thu, 10 Sep 2009 18:53:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197073 - head/sys/dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 18:53:34 -0000

Author: jfv
Date: Thu Sep 10 18:53:34 2009
New Revision: 197073
URL: http://svn.freebsd.org/changeset/base/197073

Log:
  Fix for pr 138516
  An mbuf is not requeued when a xmit fails.
  
  MFC: 3 days

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Thu Sep 10 18:33:08 2009	(r197072)
+++ head/sys/dev/e1000/if_em.c	Thu Sep 10 18:53:34 2009	(r197073)
@@ -1034,9 +1034,10 @@ em_mq_start_locked(struct ifnet *ifp, st
 		return (error);
 	} else if (drbr_empty(ifp, adapter->br) &&
 	    (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) {
-		if (em_xmit(adapter, &m)) {
-			if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0)
-				return (error);
+		if (error = em_xmit(adapter, &m)) {
+			if (m != NULL)
+				error = drbr_enqueue(ifp, adapter->br, m);
+			return (error);
 		} else {
 			/*
 			 * We've bypassed the buf ring so we need to update
@@ -1063,8 +1064,12 @@ process:
                 next = drbr_dequeue(ifp, adapter->br);
                 if (next == NULL)
                         break;
-                if (em_xmit(adapter, &next))
+                if (error = em_xmit(adapter, &next)) {
+			if (next != NULL)
+				error = drbr_enqueue(ifp, adapter->br, next);
                         break;
+		}
+		drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
                 ETHER_BPF_MTAP(ifp, next);
                 /* Set the watchdog */
                 adapter->watchdog_timer = EM_TX_TIMEOUT;
@@ -1073,7 +1078,7 @@ process:
         if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD)
                 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 
-	return (0);
+	return (error);
 }
 
 /*

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 18:56:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D042B1065672;
	Thu, 10 Sep 2009 18:56:45 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BFA0B8FC14;
	Thu, 10 Sep 2009 18:56:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AIuj8c028174;
	Thu, 10 Sep 2009 18:56:45 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AIujec028172;
	Thu, 10 Sep 2009 18:56:45 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <200909101856.n8AIujec028172@svn.freebsd.org>
From: Jack F Vogel 
Date: Thu, 10 Sep 2009 18:56:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197074 - head/sys/dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 18:56:45 -0000

Author: jfv
Date: Thu Sep 10 18:56:45 2009
New Revision: 197074
URL: http://svn.freebsd.org/changeset/base/197074

Log:
  Fix an xmit mbuf leak, when transmit failed but you
  still have an mbuf it was not being requeued.
  
  MFC: 3 days

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c	Thu Sep 10 18:53:34 2009	(r197073)
+++ head/sys/dev/e1000/if_igb.c	Thu Sep 10 18:56:45 2009	(r197074)
@@ -854,9 +854,10 @@ igb_mq_start_locked(struct ifnet *ifp, s
 
 	/* If nothing queued go right to xmit */
 	if (drbr_empty(ifp, txr->br)) {
-		if (igb_xmit(txr, &m)) {
-			if (m && (err = drbr_enqueue(ifp, txr->br, m)) != 0)
-                                return (err);
+		if (err = igb_xmit(txr, &m)) {
+			if (m != NULL)
+				err = drbr_enqueue(ifp, txr->br, m);
+			return (err);
 		} else {
 			/* Success, update stats */
 			drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags);
@@ -880,8 +881,12 @@ process:
 		next = drbr_dequeue(ifp, txr->br);
 		if (next == NULL)
 			break;
-		if (igb_xmit(txr, &next))
+		if (err = igb_xmit(txr, &next)) {
+			if (next != NULL)
+				err = drbr_enqueue(ifp, txr->br, next);
 			break;
+		}
+		drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
 		ETHER_BPF_MTAP(ifp, next);
 		/* Set the watchdog */
 		txr->watchdog_timer = IGB_TX_TIMEOUT;
@@ -1531,8 +1536,11 @@ igb_update_aim(struct rx_ring *rxr)
 	if (olditr != newitr) {
 		/* Change interrupt rate */
 		rxr->eitr_setting = newitr;
-		E1000_WRITE_REG(&adapter->hw, E1000_EITR(rxr->me),
-		    newitr | (newitr << 16));
+		if (adapter->hw.mac.type == e1000_82575)
+			newitr |= newitr << 16;
+		else
+			newitr |= 0x8000000;
+		E1000_WRITE_REG(&adapter->hw, E1000_EITR(rxr->me), newitr);
 	}
 
 	rxr->bytes = 0;

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 19:11:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1657E10656C7;
	Thu, 10 Sep 2009 19:11:24 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id C371E8FC17;
	Thu, 10 Sep 2009 19:11:23 +0000 (UTC)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id E0BDD6D44E;
	Thu, 10 Sep 2009 19:11:21 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id B9A25844E0; Thu, 10 Sep 2009 21:11:21 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Nick Hibma 
References: <200909101833.n8AIX8p6027487@svn.freebsd.org>
Date: Thu, 10 Sep 2009 21:11:21 +0200
In-Reply-To: <200909101833.n8AIX8p6027487@svn.freebsd.org> (Nick Hibma's
	message of "Thu, 10 Sep 2009 18:33:08 +0000 (UTC)")
Message-ID: <86iqfq8vja.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197072 - in head/sys: dev/ichwd netsmb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 19:11:24 -0000

Nick Hibma  writes:
> Log:
>   Don't print out a message on loading a module.  'kldload -v' and 'kldst=
at
>   | grep ' can be used instead.
>=20=20=20
>   Put a message behind bootverbose as
>=20=20=20
>   	ichwd0:  on isa0
>   	ichwd0: Intel ICH6M watchdog timer (ICH6 or equivalent)
>=20=20=20
>   does not make a lot of sense.

Why doesn't it make sense?  Every other device announces itself when it
attaches; why shouldn't ichwd0 do so?

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 19:12:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 374AE1065679;
	Thu, 10 Sep 2009 19:12:09 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 267C58FC19;
	Thu, 10 Sep 2009 19:12:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AJC9x7028557;
	Thu, 10 Sep 2009 19:12:09 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AJC9mq028555;
	Thu, 10 Sep 2009 19:12:09 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200909101912.n8AJC9mq028555@svn.freebsd.org>
From: Nick Hibma 
Date: Thu, 10 Sep 2009 19:12:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197075 - head/sys/modules/dtrace/lockstat
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 19:12:09 -0000

Author: n_hibma
Date: Thu Sep 10 19:12:08 2009
New Revision: 197075
URL: http://svn.freebsd.org/changeset/base/197075

Log:
  Missing opt_*.h file reference for make depend in sys/modules
  
  MFC after:	1 week

Modified:
  head/sys/modules/dtrace/lockstat/Makefile

Modified: head/sys/modules/dtrace/lockstat/Makefile
==============================================================================
--- head/sys/modules/dtrace/lockstat/Makefile	Thu Sep 10 18:56:45 2009	(r197074)
+++ head/sys/modules/dtrace/lockstat/Makefile	Thu Sep 10 19:12:08 2009	(r197075)
@@ -5,7 +5,7 @@
 KMOD=		lockstat
 SRCS=		lockstat.c 
 
-SRCS+=		vnode_if.h
+SRCS+=		vnode_if.h opt_kdtrace.h
 
 CFLAGS+=	-I${.CURDIR}/../../../cddl/compat/opensolaris \
 		-I${.CURDIR}/../../../cddl/contrib/opensolaris/uts/common \

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 19:15:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 73E041065672;
	Thu, 10 Sep 2009 19:15:26 +0000 (UTC) (envelope-from avg@freebsd.org)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C59A8FC14;
	Thu, 10 Sep 2009 19:15:24 +0000 (UTC)
Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua
	[212.40.38.100])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA27298;
	Thu, 10 Sep 2009 22:15:22 +0300 (EEST)
	(envelope-from avg@freebsd.org)
Received: from localhost.topspin.kiev.ua ([127.0.0.1])
	by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD))
	id 1Mlp74-0009kn-DF; Thu, 10 Sep 2009 22:15:22 +0300
Message-ID: <4AA95049.4090104@freebsd.org>
Date: Thu, 10 Sep 2009 22:15:21 +0300
From: Andriy Gapon 
User-Agent: Thunderbird 2.0.0.23 (X11/20090823)
MIME-Version: 1.0
To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= 
References: <200909101833.n8AIX8p6027487@svn.freebsd.org>
	<86iqfq8vja.fsf@ds4.des.no>
In-Reply-To: <86iqfq8vja.fsf@ds4.des.no>
X-Enigmail-Version: 0.96.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Nick Hibma 
Subject: Re: svn commit: r197072 - in head/sys: dev/ichwd netsmb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 19:15:26 -0000

on 10/09/2009 22:11 Dag-Erling Smørgrav said the following:
> Nick Hibma  writes:
>> Log:
>>   Don't print out a message on loading a module.  'kldload -v' and 'kldstat
>>   | grep ' can be used instead.
>>   
>>   Put a message behind bootverbose as
>>   
>>   	ichwd0:  on isa0

I think the above line is printed by newbus code automatically.

>>   	ichwd0: Intel ICH6M watchdog timer (ICH6 or equivalent)

And this line kind of duplicates it.

>>   does not make a lot of sense.
> 
> Why doesn't it make sense?  Every other device announces itself when it
> attaches; why shouldn't ichwd0 do so?

So, a possible answer is above :)

-- 
Andriy Gapon

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 19:24:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E21EB1065692;
	Thu, 10 Sep 2009 19:24:46 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D169E8FC1C;
	Thu, 10 Sep 2009 19:24:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AJOkoa028850;
	Thu, 10 Sep 2009 19:24:46 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AJOkKB028848;
	Thu, 10 Sep 2009 19:24:46 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200909101924.n8AJOkKB028848@svn.freebsd.org>
From: Nick Hibma 
Date: Thu, 10 Sep 2009 19:24:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197076 - head/sys/dev/agp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 19:24:47 -0000

Author: n_hibma
Date: Thu Sep 10 19:24:46 2009
New Revision: 197076
URL: http://svn.freebsd.org/changeset/base/197076

Log:
  Move the printing of aperture size and stolen memory behind bootverbose.
  None of the other AGP drivers actually displays this information at all,
  
  MFC after:	1 week

Modified:
  head/sys/dev/agp/agp_i810.c

Modified: head/sys/dev/agp/agp_i810.c
==============================================================================
--- head/sys/dev/agp/agp_i810.c	Thu Sep 10 19:12:08 2009	(r197075)
+++ head/sys/dev/agp/agp_i810.c	Thu Sep 10 19:24:46 2009	(r197076)
@@ -474,12 +474,6 @@ agp_i810_attach(device_t dev)
 				agp_generic_detach(dev);
 				return EINVAL;
 		}
-		if (sc->stolen > 0) {
-			device_printf(dev, "detected %dk stolen memory\n",
-			    sc->stolen * 4);
-		}
-		device_printf(dev, "aperture size is %dM\n",
-		    sc->initial_aperture / 1024 / 1024);
 
 		/* GATT address is already in there, make sure it's enabled */
 		pgtblctl = bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL);
@@ -664,9 +658,6 @@ agp_i810_attach(device_t dev)
 		gtt_size += 4;
 
 		sc->stolen = (stolen - gtt_size) * 1024 / 4096;
-		if (sc->stolen > 0)
-			device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4);
-		device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024);
 
 		/* GATT address is already in there, make sure it's enabled */
 		pgtblctl = bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL);
@@ -676,6 +667,15 @@ agp_i810_attach(device_t dev)
 		gatt->ag_physical = pgtblctl & ~1;
 	}
 
+	if (bootverbose) {
+		device_printf(dev, "aperture size is %dM",
+		    sc->initial_aperture / 1024 / 1024);
+		if (sc->stolen > 0)
+			printf(", detected %dk stolen memory\n", sc->stolen * 4);
+		else
+			printf("\n");
+	}
+
 	if (0)
 		agp_i810_dump_regs(dev);
 

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 19:27:53 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2F92106566B;
	Thu, 10 Sep 2009 19:27:53 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C2B448FC08;
	Thu, 10 Sep 2009 19:27:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AJRrO1028939;
	Thu, 10 Sep 2009 19:27:53 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AJRraJ028936;
	Thu, 10 Sep 2009 19:27:53 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200909101927.n8AJRraJ028936@svn.freebsd.org>
From: Andriy Gapon 
Date: Thu, 10 Sep 2009 19:27:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197077 - head/sys/dev/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 19:27:53 -0000

Author: avg
Date: Thu Sep 10 19:27:53 2009
New Revision: 197077
URL: http://svn.freebsd.org/changeset/base/197077

Log:
  pci: remove definitions of duplicate constants
  
  Suggested by:	jhb
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/sys/dev/pci/pcireg.h
  head/sys/dev/pci/pcivar.h

Modified: head/sys/dev/pci/pcireg.h
==============================================================================
--- head/sys/dev/pci/pcireg.h	Thu Sep 10 19:24:46 2009	(r197076)
+++ head/sys/dev/pci/pcireg.h	Thu Sep 10 19:27:53 2009	(r197077)
@@ -39,11 +39,11 @@
  */
 
 /* some PCI bus constants */
-
-#define	PCI_BUSMAX	255
-#define	PCI_SLOTMAX	31
-#define	PCI_FUNCMAX	7
-#define	PCI_REGMAX	255
+#define	PCI_DOMAINMAX	65535	/* highest supported domain number */
+#define	PCI_BUSMAX	255	/* highest supported bus number */
+#define	PCI_SLOTMAX	31	/* highest supported slot number */
+#define	PCI_FUNCMAX	7	/* highest supported function number */
+#define	PCI_REGMAX	255	/* highest supported config register addr. */
 #define	PCI_MAXHDRTYPE	2
 
 /* PCI config header registers for all devices */

Modified: head/sys/dev/pci/pcivar.h
==============================================================================
--- head/sys/dev/pci/pcivar.h	Thu Sep 10 19:24:46 2009	(r197076)
+++ head/sys/dev/pci/pcivar.h	Thu Sep 10 19:27:53 2009	(r197077)
@@ -33,13 +33,6 @@
 #include 
 
 /* some PCI bus constants */
-
-#define	PCI_DOMAINMAX	65535	/* highest supported domain number */
-#define	PCI_BUSMAX	255	/* highest supported bus number */
-#define	PCI_SLOTMAX	31	/* highest supported slot number */
-#define	PCI_FUNCMAX	7	/* highest supported function number */
-#define	PCI_REGMAX	255	/* highest supported config register addr. */
-
 #define	PCI_MAXMAPS_0	6	/* max. no. of memory/port maps */
 #define	PCI_MAXMAPS_1	2	/* max. no. of maps for PCI to PCI bridge */
 #define	PCI_MAXMAPS_2	1	/* max. no. of maps for CardBus bridge */

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 19:31:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E6981065679;
	Thu, 10 Sep 2009 19:31:55 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E6358FC1B;
	Thu, 10 Sep 2009 19:31:54 +0000 (UTC)
Received: from [192.168.1.4] (adsl-241-169-177.bna.bellsouth.net
	[74.241.169.177]) (authenticated bits=0)
	by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n8AJVqkc064784
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 10 Sep 2009 15:31:53 -0400 (EDT)
	(envelope-from rnoland@FreeBSD.org)
From: Robert Noland 
To: Nick Hibma 
In-Reply-To: <200909101924.n8AJOkKB028848@svn.freebsd.org>
References: <200909101924.n8AJOkKB028848@svn.freebsd.org>
Content-Type: text/plain
Organization: FreeBSD
Date: Thu, 10 Sep 2009 14:31:47 -0500
Message-Id: <1252611107.1899.10.camel@balrog.2hip.net>
Mime-Version: 1.0
X-Mailer: Evolution 2.26.3 FreeBSD GNOME Team Port 
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL,
	RDNS_DYNAMIC,SPF_SOFTFAIL autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197076 - head/sys/dev/agp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 19:31:55 -0000

On Thu, 2009-09-10 at 19:24 +0000, Nick Hibma wrote:
> Author: n_hibma
> Date: Thu Sep 10 19:24:46 2009
> New Revision: 197076
> URL: http://svn.freebsd.org/changeset/base/197076
> 
> Log:
>   Move the printing of aperture size and stolen memory behind bootverbose.
>   None of the other AGP drivers actually displays this information at all,

None of the agp drivers are quite as special as agp_i810.  Please revert
this change.

robert.

>   MFC after:	1 week
> 
> Modified:
>   head/sys/dev/agp/agp_i810.c
> 
> Modified: head/sys/dev/agp/agp_i810.c
> ==============================================================================
> --- head/sys/dev/agp/agp_i810.c	Thu Sep 10 19:12:08 2009	(r197075)
> +++ head/sys/dev/agp/agp_i810.c	Thu Sep 10 19:24:46 2009	(r197076)
> @@ -474,12 +474,6 @@ agp_i810_attach(device_t dev)
>  				agp_generic_detach(dev);
>  				return EINVAL;
>  		}
> -		if (sc->stolen > 0) {
> -			device_printf(dev, "detected %dk stolen memory\n",
> -			    sc->stolen * 4);
> -		}
> -		device_printf(dev, "aperture size is %dM\n",
> -		    sc->initial_aperture / 1024 / 1024);
>  
>  		/* GATT address is already in there, make sure it's enabled */
>  		pgtblctl = bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL);
> @@ -664,9 +658,6 @@ agp_i810_attach(device_t dev)
>  		gtt_size += 4;
>  
>  		sc->stolen = (stolen - gtt_size) * 1024 / 4096;
> -		if (sc->stolen > 0)
> -			device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4);
> -		device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024);
>  
>  		/* GATT address is already in there, make sure it's enabled */
>  		pgtblctl = bus_read_4(sc->sc_res[0], AGP_I810_PGTBL_CTL);
> @@ -676,6 +667,15 @@ agp_i810_attach(device_t dev)
>  		gatt->ag_physical = pgtblctl & ~1;
>  	}
>  
> +	if (bootverbose) {
> +		device_printf(dev, "aperture size is %dM",
> +		    sc->initial_aperture / 1024 / 1024);
> +		if (sc->stolen > 0)
> +			printf(", detected %dk stolen memory\n", sc->stolen * 4);
> +		else
> +			printf("\n");
> +	}
> +
>  	if (0)
>  		agp_i810_dump_regs(dev);
>  
-- 
Robert Noland 
FreeBSD


From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 20:09:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8B681065670;
	Thu, 10 Sep 2009 20:09:48 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 9AA378FC0C;
	Thu, 10 Sep 2009 20:09:48 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 3990C46B06;
	Thu, 10 Sep 2009 16:09:48 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 67C748A01B;
	Thu, 10 Sep 2009 16:09:47 -0400 (EDT)
From: John Baldwin 
To: Nick Hibma 
Date: Thu, 10 Sep 2009 16:06:53 -0400
User-Agent: KMail/1.9.7
References: <200909101924.n8AJOkKB028848@svn.freebsd.org>
In-Reply-To: <200909101924.n8AJOkKB028848@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909101606.54441.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 10 Sep 2009 16:09:47 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197076 - head/sys/dev/agp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 20:09:48 -0000

On Thursday 10 September 2009 3:24:46 pm Nick Hibma wrote:
> Author: n_hibma
> Date: Thu Sep 10 19:24:46 2009
> New Revision: 197076
> URL: http://svn.freebsd.org/changeset/base/197076
> 
> Log:
>   Move the printing of aperture size and stolen memory behind bootverbose.
>   None of the other AGP drivers actually displays this information at all,

Note that agp_i810 is different in that it is used for the on-board integrated 
Intel graphics and attaches to the display adapter (vgapciX) not to the AGP 
bridge (hostbX).  That is why other AGP drivers do not display the 
information; it is not relevant since AGP bridge drivers do not "steal" 
system RAM for a video frame buffer.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 20:31:34 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5026710656AA;
	Thu, 10 Sep 2009 20:31:34 +0000 (UTC)
	(envelope-from brooks@lor.one-eyed-alien.net)
Received: from lor.one-eyed-alien.net (cl-162.ewr-01.us.sixxs.net
	[IPv6:2001:4830:1200:a1::2])
	by mx1.freebsd.org (Postfix) with ESMTP id A19D18FC08;
	Thu, 10 Sep 2009 20:31:33 +0000 (UTC)
Received: from lor.one-eyed-alien.net (localhost [127.0.0.1])
	by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n8AKVuXk056518; 
	Thu, 10 Sep 2009 15:31:56 -0500 (CDT)
	(envelope-from brooks@lor.one-eyed-alien.net)
Received: (from brooks@localhost)
	by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n8AKVuU7056517;
	Thu, 10 Sep 2009 15:31:56 -0500 (CDT) (envelope-from brooks)
Date: Thu, 10 Sep 2009 15:31:56 -0500
From: Brooks Davis 
To: Ivan Voras 
Message-ID: <20090910203156.GA55545@lor.one-eyed-alien.net>
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<1252592951.49151.3.camel@buffy.york.ac.uk>
	<1252595839.75144.26.camel@bauer.cse.buffalo.edu>
	<9bbcef730909100836l3835825cy83082a2cfe4da0c3@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL"
Content-Disposition: inline
In-Reply-To: <9bbcef730909100836l3835825cy83082a2cfe4da0c3@mail.gmail.com>
User-Agent: Mutt/1.5.17 (2007-11-01)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0
	(lor.one-eyed-alien.net [127.0.0.1]);
	Thu, 10 Sep 2009 15:31:57 -0500 (CDT)
Cc: stable@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable@FreeBSD.org,
	svn-src-all@FreeBSD.org, Gavin Atkinson ,
	svn-src-stable-8@FreeBSD.org, Ken Smith ,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults
	lib/libc/stdlib sys/amd64/conf sys/i386/conf sys/ia64/conf
	sys/pc98/conf sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 20:31:34 -0000


--vtzGhvizbBRQ85DL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 10, 2009 at 05:36:56PM +0200, Ivan Voras wrote:
> 2009/9/10 Ken Smith :
> > On Thu, 2009-09-10 at 15:29 +0100, Gavin Atkinson wrote:
>=20
> >> This seems like a step backwards to me: crash dumps have been left
> >> enabled in 7.x and have proved very useful from the point of view of
> >> improved quality of received PRs. ??I'm not aware of any problems
> >> relating to leaving them enabled.
> >>
> >> I'd appreciate it if this decision was reconsidered.
> >>
> >
> > Unfortunately as I said before there is no "Right answer" for this one.
>=20
> No, but there is an "80% right" one, based on the question: did the
> change in 7 cause known problems for any significant number of users
> (or one of two big users - that should be enough).

Given that we've shipped three releases with it this way we should have
an answer here.  If we can't identify real problem instances by now,
there probably aren't significant ones in practice.  IMO, we have always
gone too far in disabling debugging.

-- Brooks

--vtzGhvizbBRQ85DL
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFKqWI7XY6L6fI4GtQRApVRAJ9lNRRakKrMBkKAk7k86/LTCDc8FgCglCMY
UU+/Ic0xHH2niGUX7iXKafs=
=Mye5
-----END PGP SIGNATURE-----

--vtzGhvizbBRQ85DL--

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 20:37:06 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B6413106566C;
	Thu, 10 Sep 2009 20:37:06 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 733E58FC17;
	Thu, 10 Sep 2009 20:37:06 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n8AKXRML004985;
	Thu, 10 Sep 2009 14:33:27 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Thu, 10 Sep 2009 14:33:27 -0600 (MDT)
Message-Id: <20090910.143327.74744740.imp@bsdimp.com>
To: brooks@FreeBSD.org
From: Warner Losh 
In-Reply-To: <200909092028.n89KSw1N096254@svn.freebsd.org>
References: <200909092028.n89KSw1N096254@svn.freebsd.org>
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r197047 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 20:37:06 -0000

From: Brooks Davis 
Subject: svn commit: r197047 - head/share/man/man4
Date: Wed, 9 Sep 2009 20:28:58 +0000 (UTC)

> Author: brooks
> Date: Wed Sep  9 20:28:58 2009
> New Revision: 197047
> URL: http://svn.freebsd.org/changeset/base/197047
> 
> Log:
>   Mention that a few ed(4) devices don't emit link state change notices
>   and a workaround for dhclient.

I thought that I'd made it so that we report the link as active always
for those devices that don't support reporting the link status in the
hardware.  Is this really necessary still?

Warner

>   Reviewed by:	 thierry
>   MFC after:	3 days
> 
> Modified:
>   head/share/man/man4/ed.4
> 
> Modified: head/share/man/man4/ed.4
> ==============================================================================
> --- head/share/man/man4/ed.4	Wed Sep  9 19:40:54 2009	(r197046)
> +++ head/share/man/man4/ed.4	Wed Sep  9 20:28:58 2009	(r197047)
> @@ -425,3 +425,21 @@ driver is slow by today's standards.
>  .Pp
>  PC Card attachment supports the D-Link DMF650TX LAN/Modem card's Ethernet
>  port only at this time.
> +.Pp
> +Some devices supported by
> +.Nm
> +do no generate the link state change events used by
> +.Xr devd 8
> +to start
> +.Xr dhclinet 8 .
> +If you have problems with
> +.Xr dhclient 8
> +not starting and the device is always attached to the network it may
> +be possible to work around this by changing
> +.Dq Li DHCP
> +to
> +.Dq Li SYNCDHCP
> +in the
> +.Va ifconfig_ed0
> +entry in
> +.Pa /etc/rc.conf .
> 

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 20:42:27 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E001B1065693;
	Thu, 10 Sep 2009 20:42:27 +0000 (UTC)
	(envelope-from brooks@lor.one-eyed-alien.net)
Received: from lor.one-eyed-alien.net (cl-162.ewr-01.us.sixxs.net
	[IPv6:2001:4830:1200:a1::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 6076C8FC1F;
	Thu, 10 Sep 2009 20:42:27 +0000 (UTC)
Received: from lor.one-eyed-alien.net (localhost [127.0.0.1])
	by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n8AKgnW2056634; 
	Thu, 10 Sep 2009 15:42:49 -0500 (CDT)
	(envelope-from brooks@lor.one-eyed-alien.net)
Received: (from brooks@localhost)
	by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n8AKgnNM056633;
	Thu, 10 Sep 2009 15:42:49 -0500 (CDT) (envelope-from brooks)
Date: Thu, 10 Sep 2009 15:42:49 -0500
From: Brooks Davis 
To: Warner Losh 
Message-ID: <20090910204249.GB55545@lor.one-eyed-alien.net>
References: <200909092028.n89KSw1N096254@svn.freebsd.org>
	<20090910.143327.74744740.imp@bsdimp.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="EuxKj2iCbKjpUGkD"
Content-Disposition: inline
In-Reply-To: <20090910.143327.74744740.imp@bsdimp.com>
User-Agent: Mutt/1.5.17 (2007-11-01)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0
	(lor.one-eyed-alien.net [127.0.0.1]);
	Thu, 10 Sep 2009 15:42:49 -0500 (CDT)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r197047 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 20:42:28 -0000


--EuxKj2iCbKjpUGkD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 10, 2009 at 02:33:27PM -0600, Warner Losh wrote:
> From: Brooks Davis 
> Subject: svn commit: r197047 - head/share/man/man4
> Date: Wed, 9 Sep 2009 20:28:58 +0000 (UTC)
>=20
> > Author: brooks
> > Date: Wed Sep  9 20:28:58 2009
> > New Revision: 197047
> > URL: http://svn.freebsd.org/changeset/base/197047
> >=20
> > Log:
> >   Mention that a few ed(4) devices don't emit link state change notices
> >   and a workaround for dhclient.
>=20
> I thought that I'd made it so that we report the link as active always
> for those devices that don't support reporting the link status in the
> hardware.  Is this really necessary still?

That fixes the case where dhclient never sees a link, but apparently
doesn't deal with the fact that in 8.0 dhclient never starts without
a link-up event.  It may be that we need to generate a single link-up
event at startup to provide an equivalent workaround.

-- Brooks

> Warner
>=20
> >   Reviewed by:	 thierry
> >   MFC after:	3 days
> >=20
> > Modified:
> >   head/share/man/man4/ed.4
> >=20
> > Modified: head/share/man/man4/ed.4
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/share/man/man4/ed.4	Wed Sep  9 19:40:54 2009	(r197046)
> > +++ head/share/man/man4/ed.4	Wed Sep  9 20:28:58 2009	(r197047)
> > @@ -425,3 +425,21 @@ driver is slow by today's standards.
> >  .Pp
> >  PC Card attachment supports the D-Link DMF650TX LAN/Modem card's Ether=
net
> >  port only at this time.
> > +.Pp
> > +Some devices supported by
> > +.Nm
> > +do no generate the link state change events used by
> > +.Xr devd 8
> > +to start
> > +.Xr dhclinet 8 .
> > +If you have problems with
> > +.Xr dhclient 8
> > +not starting and the device is always attached to the network it may
> > +be possible to work around this by changing
> > +.Dq Li DHCP
> > +to
> > +.Dq Li SYNCDHCP
> > +in the
> > +.Va ifconfig_ed0
> > +entry in
> > +.Pa /etc/rc.conf .
> >=20
>=20

--EuxKj2iCbKjpUGkD
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFKqWTIXY6L6fI4GtQRArGpAJ9u8i6eKgeejQNkdjIh2hrcQDjMNQCfUtig
on6U4Pepc3vtzn1MPuynP5w=
=I8ga
-----END PGP SIGNATURE-----

--EuxKj2iCbKjpUGkD--

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 21:14:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E660F106566B;
	Thu, 10 Sep 2009 21:14:55 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D5A768FC18;
	Thu, 10 Sep 2009 21:14:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ALEtxL031326;
	Thu, 10 Sep 2009 21:14:55 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ALEtAr031324;
	Thu, 10 Sep 2009 21:14:55 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <200909102114.n8ALEtAr031324@svn.freebsd.org>
From: Jack F Vogel 
Date: Thu, 10 Sep 2009 21:14:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197078 - head/sys/dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 21:14:56 -0000

Author: jfv
Date: Thu Sep 10 21:14:55 2009
New Revision: 197078
URL: http://svn.freebsd.org/changeset/base/197078

Log:
  Fix build complaint from previous checkin

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Thu Sep 10 19:27:53 2009	(r197077)
+++ head/sys/dev/e1000/if_em.c	Thu Sep 10 21:14:55 2009	(r197078)
@@ -1034,7 +1034,7 @@ em_mq_start_locked(struct ifnet *ifp, st
 		return (error);
 	} else if (drbr_empty(ifp, adapter->br) &&
 	    (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) {
-		if (error = em_xmit(adapter, &m)) {
+		if ((error = em_xmit(adapter, &m)) != 0) {
 			if (m != NULL)
 				error = drbr_enqueue(ifp, adapter->br, m);
 			return (error);
@@ -1064,7 +1064,7 @@ process:
                 next = drbr_dequeue(ifp, adapter->br);
                 if (next == NULL)
                         break;
-                if (error = em_xmit(adapter, &next)) {
+                if ((error = em_xmit(adapter, &next)) != 0) {
 			if (next != NULL)
 				error = drbr_enqueue(ifp, adapter->br, next);
                         break;

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 21:16:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5FB20106568F;
	Thu, 10 Sep 2009 21:16:26 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4F0DF8FC17;
	Thu, 10 Sep 2009 21:16:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ALGQZx031397;
	Thu, 10 Sep 2009 21:16:26 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ALGQ64031395;
	Thu, 10 Sep 2009 21:16:26 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <200909102116.n8ALGQ64031395@svn.freebsd.org>
From: Jack F Vogel 
Date: Thu, 10 Sep 2009 21:16:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197079 - head/sys/dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 21:16:26 -0000

Author: jfv
Date: Thu Sep 10 21:16:26 2009
New Revision: 197079
URL: http://svn.freebsd.org/changeset/base/197079

Log:
  Fix build issue with last commit.

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c	Thu Sep 10 21:14:55 2009	(r197078)
+++ head/sys/dev/e1000/if_igb.c	Thu Sep 10 21:16:26 2009	(r197079)
@@ -854,7 +854,7 @@ igb_mq_start_locked(struct ifnet *ifp, s
 
 	/* If nothing queued go right to xmit */
 	if (drbr_empty(ifp, txr->br)) {
-		if (err = igb_xmit(txr, &m)) {
+		if ((err = igb_xmit(txr, &m)) != 0) {
 			if (m != NULL)
 				err = drbr_enqueue(ifp, txr->br, m);
 			return (err);
@@ -881,7 +881,7 @@ process:
 		next = drbr_dequeue(ifp, txr->br);
 		if (next == NULL)
 			break;
-		if (err = igb_xmit(txr, &next)) {
+		if ((err = igb_xmit(txr, &next)) != 0) {
 			if (next != NULL)
 				err = drbr_enqueue(ifp, txr->br, next);
 			break;

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 21:25:06 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3AB54106568F;
	Thu, 10 Sep 2009 21:25:06 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 29AB58FC13;
	Thu, 10 Sep 2009 21:25:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ALP6kK031636;
	Thu, 10 Sep 2009 21:25:06 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ALP6j4031634;
	Thu, 10 Sep 2009 21:25:06 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200909102125.n8ALP6j4031634@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Thu, 10 Sep 2009 21:25:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197080 - head/sys/powerpc/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 21:25:06 -0000

Author: nwhitehorn
Date: Thu Sep 10 21:25:05 2009
New Revision: 197080
URL: http://svn.freebsd.org/changeset/base/197080

Log:
  Add a few SCSI controllers to GENERIC that can be found on Powermacs.
  This allows installation onto SCSI disks as shipped, for example,
  with the Powermac G3.
  
  PR:		powerpc/138543
  Obtained from:	sparc64
  MFC after:	3 days

Modified:
  head/sys/powerpc/conf/GENERIC

Modified: head/sys/powerpc/conf/GENERIC
==============================================================================
--- head/sys/powerpc/conf/GENERIC	Thu Sep 10 21:16:26 2009	(r197079)
+++ head/sys/powerpc/conf/GENERIC	Thu Sep 10 21:25:05 2009	(r197080)
@@ -91,6 +91,16 @@ device		atapicd		# ATAPI CDROM drives
 #device		atapifd		# ATAPI floppy drives
 #device		atapist		# ATAPI tape drives
 
+# SCSI Controllers
+device		ahc		# AHA2940 and onboard AIC7xxx devices
+options 	AHC_ALLOW_MEMIO	# Attempt to use memory mapped I/O
+options 	AHC_REG_PRETTY_PRINT	# Print register bitfields in debug
+					# output.  Adds ~128k to driver.
+device		isp		# Qlogic family
+device		ispfw		# Firmware module for Qlogic host adapters
+device		mpt		# LSI-Logic MPT-Fusion
+device		sym		# NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D
+
 # SCSI peripherals
 device		scbus		# SCSI bus (required for SCSI)
 device		da		# Direct Access (disks)
@@ -127,6 +137,7 @@ device		md		# Memory "disks"
 device		ofwd		# Open Firmware disks
 device		gif		# IPv6 and IPv4 tunneling
 device		faith		# IPv6-to-IPv4 relaying/(translation)
+device		firmware	# firmware assist module
 
 # The `bpf' device enables the Berkeley Packet Filter.
 # Be aware of the administrative consequences of enabling this!

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 21:42:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 69A63106566B;
	Thu, 10 Sep 2009 21:42:00 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 590648FC14;
	Thu, 10 Sep 2009 21:42:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ALg0ZA032089;
	Thu, 10 Sep 2009 21:42:00 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ALg0lV032087;
	Thu, 10 Sep 2009 21:42:00 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909102142.n8ALg0lV032087@svn.freebsd.org>
From: Xin LI 
Date: Thu, 10 Sep 2009 21:42:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197081 - head
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 21:42:00 -0000

Author: delphij
Date: Thu Sep 10 21:42:00 2009
New Revision: 197081
URL: http://svn.freebsd.org/changeset/base/197081

Log:
  Add entries for moved files during vesa/dpms promotion.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Thu Sep 10 21:25:05 2009	(r197080)
+++ head/ObsoleteFiles.inc	Thu Sep 10 21:42:00 2009	(r197081)
@@ -14,6 +14,9 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20090909: vesa and dpms promoted to be i386/amd64 common
+OLD_FILES+=usr/include/machine/pc/vesa.h
+OLD_FILES+=usr/share/man/man4/i386/dpms.4.gz
 # 20090904: remove lukemftpd
 OLD_FILES+=usr/libexec/lukemftpd
 OLD_FILES+=usr/share/man/man5/ftpd.conf.5.gz

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 22:05:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 28FDC106566B;
	Thu, 10 Sep 2009 22:05:44 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 17E428FC0C;
	Thu, 10 Sep 2009 22:05:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8AM5hhL032717;
	Thu, 10 Sep 2009 22:05:43 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8AM5hT5032715;
	Thu, 10 Sep 2009 22:05:43 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200909102205.n8AM5hT5032715@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 10 Sep 2009 22:05:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197082 - head/sys/boot/i386/libi386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 22:05:44 -0000

Author: emaste
Date: Thu Sep 10 22:05:43 2009
New Revision: 197082
URL: http://svn.freebsd.org/changeset/base/197082

Log:
  If the pxe client is told to use / as the root path, honour that rather
  of trying to mount /pxeroot instead.
  
  PR:		i386/106493
  Submitted by:	Andrey Russev
  MFC after:	1 month

Modified:
  head/sys/boot/i386/libi386/pxe.c

Modified: head/sys/boot/i386/libi386/pxe.c
==============================================================================
--- head/sys/boot/i386/libi386/pxe.c	Thu Sep 10 21:42:00 2009	(r197081)
+++ head/sys/boot/i386/libi386/pxe.c	Thu Sep 10 22:05:43 2009	(r197082)
@@ -282,7 +282,7 @@ pxe_open(struct open_file *f, ...)
 		bootp(pxe_sock, BOOTP_PXE);
 		if (rootip.s_addr == 0)
 			rootip.s_addr = bootplayer.sip;
-		if (!rootpath[1])
+		if (!rootpath[0])
 			strcpy(rootpath, PXENFSROOTPATH);
 
 		for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)

From owner-svn-src-all@FreeBSD.ORG  Thu Sep 10 23:30:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5B81F106566C;
	Thu, 10 Sep 2009 23:30:13 +0000 (UTC)
	(envelope-from emax@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A7C98FC14;
	Thu, 10 Sep 2009 23:30:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8ANUDcQ034539;
	Thu, 10 Sep 2009 23:30:13 GMT (envelope-from emax@svn.freebsd.org)
Received: (from emax@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8ANUDWt034537;
	Thu, 10 Sep 2009 23:30:13 GMT (envelope-from emax@svn.freebsd.org)
Message-Id: <200909102330.n8ANUDWt034537@svn.freebsd.org>
From: Maksim Yevmenkin 
Date: Thu, 10 Sep 2009 23:30:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197083 - head/sys/netgraph/bluetooth/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 10 Sep 2009 23:30:13 -0000

Author: emax
Date: Thu Sep 10 23:30:13 2009
New Revision: 197083
URL: http://svn.freebsd.org/changeset/base/197083

Log:
  Get those pesky RFCOMM RPM data bits right. This is likely a noop.
  
  MFC after:	1 month

Modified:
  head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h

Modified: head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
==============================================================================
--- head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h	Thu Sep 10 22:05:43 2009	(r197082)
+++ head/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h	Thu Sep 10 23:30:13 2009	(r197083)
@@ -85,8 +85,8 @@
 
 /* RPN parameters - data bits */
 #define RFCOMM_RPN_DATA_5		0x0
-#define RFCOMM_RPN_DATA_6		0x1
-#define RFCOMM_RPN_DATA_7		0x2
+#define RFCOMM_RPN_DATA_6		0x2
+#define RFCOMM_RPN_DATA_7		0x1
 #define RFCOMM_RPN_DATA_8		0x3
 
 /* RPN parameters - stop bit */

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 00:00:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 971AC1065676;
	Fri, 11 Sep 2009 00:00:23 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 865378FC08;
	Fri, 11 Sep 2009 00:00:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8B00Nh8035178;
	Fri, 11 Sep 2009 00:00:23 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8B00N5C035175;
	Fri, 11 Sep 2009 00:00:23 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <200909110000.n8B00N5C035175@svn.freebsd.org>
From: Jack F Vogel 
Date: Fri, 11 Sep 2009 00:00:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197084 - head/sys/dev/ixgbe
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 00:00:23 -0000

Author: jfv
Date: Fri Sep 11 00:00:23 2009
New Revision: 197084
URL: http://svn.freebsd.org/changeset/base/197084

Log:
  Stats missed packet handling was still not quite
  right, thanks to Dmitrij Tejblum for the correction,
  need a variable with scope only within the for loop
  for all queues.
  
  MFC: 3 days

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c	Thu Sep 10 23:30:13 2009	(r197083)
+++ head/sys/dev/ixgbe/ixgbe.c	Fri Sep 11 00:00:23 2009	(r197084)
@@ -4480,9 +4480,11 @@ ixgbe_update_stats_counters(struct adapt
 	adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
 
 	for (int i = 0; i < 8; i++) {
+		u32 mp;
+		mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
 		/* missed_rx tallies misses for the gprc workaround */
-		missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(i));
-        	adapter->stats.mpc[i] += missed_rx;
+		missed_rx += mp;
+        	adapter->stats.mpc[i] += mp;
 		/* Running comprehensive total for stats display */
 		total_missed_rx += adapter->stats.mpc[i];
 		if (hw->mac.type == ixgbe_mac_82598EB)

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 02:07:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4E55F106566C;
	Fri, 11 Sep 2009 02:07:25 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3CDC98FC08;
	Fri, 11 Sep 2009 02:07:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8B27P6g037762;
	Fri, 11 Sep 2009 02:07:25 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8B27PjH037758;
	Fri, 11 Sep 2009 02:07:25 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909110207.n8B27PjH037758@svn.freebsd.org>
From: Xin LI 
Date: Fri, 11 Sep 2009 02:07:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197085 - in head: share/man/man4 sys/dev/syscons
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 02:07:25 -0000

Author: delphij
Date: Fri Sep 11 02:07:24 2009
New Revision: 197085
URL: http://svn.freebsd.org/changeset/base/197085

Log:
  Extend the usage of sc(4)'s hint variable 'flag'.  Bit 0x80 now means
  "set vesa mode" and higher 16bits of the flag would be the desired mode.
  
  One can now set, for instance, hint.sc.0.flags=0x01680180, which means
  that the system should set VESA mode 0x168 upon boot.
  
  Submitted by:	paradox , swell k at gmail.com with
  		some minor changes.

Modified:
  head/share/man/man4/syscons.4
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h

Modified: head/share/man/man4/syscons.4
==============================================================================
--- head/share/man/man4/syscons.4	Fri Sep 11 00:00:23 2009	(r197084)
+++ head/share/man/man4/syscons.4	Fri Sep 11 02:07:24 2009	(r197085)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2006
+.Dd September 10, 2009
 .Dt SYSCONS 4
 .Os
 .Sh NAME
@@ -325,7 +325,7 @@ This mode is useful on some laptop compu
 most other systems, and it adds substantial amount of code to syscons.
 If this option is NOT defined, you can reduce the kernel size a lot.
 See the
-.Dv VESA800X600
+.Dv VESAMODE
 flag below.
 .It Dv SC_TWOBUTTON_MOUSE
 If you have a two button mouse, you may want to add this option
@@ -426,15 +426,15 @@ or else at the loader prompt (see
 .\".It bit 6 (QUIET_BELL)
 .\"This option suppresses the bell, whether audible or visual,
 .\"if it is rung in a background virtual terminal.
-.It 0x0080 (VESA800X600)
-This option puts the video card in the VESA 800x600 pixel, 16 color
-mode.
-It may be useful for laptop computers for which the 800x600 mode
-is otherwise unsupported by the X server.
+.It 0x0080 (VESAMODE)
+This option puts the video card in the VESA mode specified by higher
+16 bits of the flags during kernel initialization.
 Note that in order for this flag to work, the kernel must be
 compiled with the
 .Dv SC_PIXEL_MODE
 option explained above.
+A list of the available mode can be obtained via
+.Xr vidcontrol 1 .
 .\"Note also that the ``copy-and-paste'' function is not currently supported
 .\"in this mode and the mouse pointer will not be displayed.
 .It 0x0100 (AUTODETECT_KBD)

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Fri Sep 11 00:00:23 2009	(r197084)
+++ head/sys/dev/syscons/syscons.c	Fri Sep 11 02:07:24 2009	(r197085)
@@ -352,6 +352,7 @@ sc_attach_unit(int unit, int flags)
 #endif
     int vc;
     struct cdev *dev;
+    u_int16_t vmode;
 
     flags &= ~SC_KERNEL_CONSOLE;
 
@@ -372,16 +373,20 @@ sc_attach_unit(int unit, int flags)
     if (sc_console == NULL)	/* sc_console_unit < 0 */
 	sc_console = scp;
 
+    vmode = (flags >> 16) & 0x1fff;
+    if (vmode < M_VESA_BASE || vmode > M_VESA_MODE_MAX)
+	vmode = M_VESA_FULL_800;
+
 #ifdef SC_PIXEL_MODE
-    if ((sc->config & SC_VESA800X600)
-	&& (vidd_get_info(sc->adp, M_VESA_800x600, &info) == 0)) {
+    if ((sc->config & SC_VESAMODE)
+	&& (vidd_get_info(sc->adp, vmode, &info) == 0)) {
 #ifdef DEV_SPLASH
 	if (sc->flags & SC_SPLASH_SCRN)
 	    splash_term(sc->adp);
 #endif
-	sc_set_graphics_mode(scp, NULL, M_VESA_800x600);
-	sc_set_pixel_mode(scp, NULL, COL, ROW, 16, 8);
-	sc->initial_mode = M_VESA_800x600;
+	sc_set_graphics_mode(scp, NULL, vmode);
+	sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8);
+	sc->initial_mode = vmode;
 #ifdef DEV_SPLASH
 	/* put up the splash again! */
 	if (sc->flags & SC_SPLASH_SCRN)
@@ -517,7 +522,7 @@ sctty_open(struct tty *tp)
     if (scp == NULL) {
 	scp = SC_STAT(tp) = alloc_scp(sc, SC_VTY(tp));
 	if (ISGRAPHSC(scp))
-	    sc_set_pixel_mode(scp, NULL, COL, ROW, 16, 8);
+	    sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8);
     }
     if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) {
 	tp->t_winsize.ws_col = scp->xsize;
@@ -2995,6 +3000,8 @@ init_scp(sc_softc_t *sc, int vty, scr_st
 	scp->ysize = info.vi_height;
 	scp->xpixel = scp->xsize*info.vi_cwidth;
 	scp->ypixel = scp->ysize*info.vi_cheight;
+    }
+
 	scp->font_size = info.vi_cheight;
 	scp->font_width = info.vi_cwidth;
 	if (info.vi_cheight < 14) {
@@ -3016,7 +3023,7 @@ init_scp(sc_softc_t *sc, int vty, scr_st
 	    scp->font = NULL;
 #endif
 	}
-    }
+
     sc_vtb_init(&scp->vtb, VTB_MEMORY, 0, 0, NULL, FALSE);
 #ifndef __sparc64__
     sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, 0, 0, NULL, FALSE);

Modified: head/sys/dev/syscons/syscons.h
==============================================================================
--- head/sys/dev/syscons/syscons.h	Fri Sep 11 00:00:23 2009	(r197084)
+++ head/sys/dev/syscons/syscons.h	Fri Sep 11 02:07:24 2009	(r197085)
@@ -191,7 +191,7 @@ struct tty;
 typedef struct sc_softc {
 	int		unit;			/* unit # */
 	int		config;			/* configuration flags */
-#define SC_VESA800X600	(1 << 7)
+#define SC_VESAMODE	(1 << 7)
 #define SC_AUTODETECT_KBD (1 << 8)
 #define SC_KERNEL_CONSOLE (1 << 9)
 

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 06:27:06 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E56A81065670;
	Fri, 11 Sep 2009 06:27:05 +0000 (UTC)
	(envelope-from jasonh@DataIX.net)
Received: from www6.pairlite.com (www6.pairlite.com [64.130.10.16])
	by mx1.freebsd.org (Postfix) with ESMTP id B3B218FC1B;
	Fri, 11 Sep 2009 06:27:05 +0000 (UTC)
Received: from firewall.5p.local (unknown [99.19.41.238])
	by www6.pairlite.com (Postfix) with ESMTP id 69213B827;
	Fri, 11 Sep 2009 02:01:00 -0400 (EDT)
Date: Fri, 11 Sep 2009 02:00:58 -0400
From: "Jason J. Hellenthal" 
To: Robert Watson 
In-Reply-To: 
Message-ID: 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
	
	
	
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
X-OpenPGP-Key-ID: 0x691411AC
X-OpenPGP-Key-Fingerprint: 6F56 3B10 D8AD 1D33 96E7  5946 E3B6 2768 6914 11AC
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: Remko Lodder , John Baldwin ,
	svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-8@freebsd.org,
	Ken Smith , Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
 sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: "Jason J. Hellenthal" 
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 06:27:06 -0000

On Thu, 10 Sep 2009 13:00 -0000, rwatson wrote:

>
> On Thu, 10 Sep 2009, Remko Lodder wrote:
>
>> I agree with that; it would (!) help the bugbusting team in gathering 
>> required information. If there is an way to automate crashdumps and proper 
>> reporting and stick that in /var/crash/crash.$date or something and tell 
>> people that they can report their problems on the bugs list where needed, 
>> we have information upfront. I still remember the time where we had to 
>> chase people to get this information, sometimes never being able to 
>> properly get the information. If it is there by default, it will help.
>> 
>> Please consider keeping it enabled..
>
> Well, John's crashinfo(8) tool from Yahoo! does all this, the only "problem" 
> is that it requires extracting the crashdump to a local file system.  It 
> seems like we have a lot of the right ingredients, maybe we can have a 
> brain-storming session on distributed diagnostics and debugging at the 
> Devsummit on how to find some better middle grounds here.
>
> Robert N M Watson
> Computer Laboratory
> University of Cambridge
> 
>

If I may, I would like to introduce a distributed targeting system to this 
conversation in addition to crashinfo. Given with the above conversations I cant 
help but think that in a case like this it would be helpful to setup a central 
database for collection of information and write a little bit more code into 
crashinfo for uuencoding a blob to send through email or maybe another way so 
data can be collected, sorted & analyzed with statistics spilled out into a web 
page for review.

A rough overview of enabling this would be done through a rcvar that would 
auto-enable crash dumps, crashinfo & the reporting system together. As for the 
client ( does not exist yet. or maybe there is something similar ). But this 
would be just a opt-in type of rcvar that should be enabled by default for 
-CURRENT possibly -STABLE but off for all -RELEASE.

I would like to think that something like this would certainly improve 
development by help programmers focus specifically on areas that need attention 
while not having to hunt down core dumps for specific circumstances. And mostly 
amazing at the number of people that are willing to turn these things on.

RFC???

Best regards

PS: I most certainly would love to volunteer whatever I could do to make this 
happen.

-- 

  Jason J. Hellenthal
  http://www.DataIX.net/
  jasonh@DataIX.net
  0x691411AC

  - (2^(N-1))

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 07:09:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BA931106568B;
	Fri, 11 Sep 2009 07:09:30 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D27E8FC08;
	Fri, 11 Sep 2009 07:09:29 +0000 (UTC)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 37F796D44C;
	Fri, 11 Sep 2009 07:09:29 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 10D27844A4; Fri, 11 Sep 2009 09:09:29 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Andriy Gapon 
References: <200909101833.n8AIX8p6027487@svn.freebsd.org>
	<86iqfq8vja.fsf@ds4.des.no> <4AA95049.4090104@freebsd.org>
Date: Fri, 11 Sep 2009 09:09:28 +0200
In-Reply-To: <4AA95049.4090104@freebsd.org> (Andriy Gapon's message of "Thu,
	10 Sep 2009 22:15:21 +0300")
Message-ID: <86eiqe7yaf.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Nick Hibma 
Subject: Re: svn commit: r197072 - in head/sys: dev/ichwd netsmb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 07:09:30 -0000

Andriy Gapon  writes:
> Dag-Erling Sm=C3=B8rgrav  writes:
>> Nick Hibma  writes:
>>>   Put a message behind bootverbose as
>>>=20=20=20
>>>   	ichwd0:  on isa0
>
> I think the above line is printed by newbus code automatically.
>
>>>   	ichwd0: Intel ICH6M watchdog timer (ICH6 or equivalent)
>
> And this line kind of duplicates it.

Thanks, that explains it.  Nick: might as well remove that printf
altogether...

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 07:22:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62CF31065670;
	Fri, 11 Sep 2009 07:22:34 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 124A68FC17;
	Fri, 11 Sep 2009 07:22:33 +0000 (UTC)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 154116D452;
	Fri, 11 Sep 2009 07:22:33 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id E8678844C4; Fri, 11 Sep 2009 09:22:32 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: "Jason J. Hellenthal" 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
	
	
	
	
Date: Fri, 11 Sep 2009 09:22:32 +0200
In-Reply-To:  (Jason
	J. Hellenthal's message of "Fri, 11 Sep 2009 02:00:58 -0400")
Message-ID: <86tyza6j47.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailman-Approved-At: Fri, 11 Sep 2009 11:12:37 +0000
Cc: Remko Lodder , John Baldwin ,
	svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson ,
	svn-src-stable-8@freebsd.org, Ken Smith ,
	Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 07:22:34 -0000

"Jason J. Hellenthal"  writes:
> If I may, I would like to introduce a distributed targeting system to
> this conversation in addition to crashinfo. Given with the above
> conversations I cant help but think that in a case like this it would
> be helpful to setup a central database for collection of information
> and write a little bit more code into crashinfo for uuencoding a blob
> to send through email or maybe another way so data can be collected,
> sorted & analyzed with statistics spilled out into a web page for
> review.

It's a good idea in principle, but I'm worried that such a system might
get flooded with crash reports from people running old -STABLE versions
and / or local patches.  There is no way we can control that, neither in
the client script nor at the receiving end.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 11:42:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50F97106566B;
	Fri, 11 Sep 2009 11:42:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FAFC8FC17;
	Fri, 11 Sep 2009 11:42:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BBgvtZ051121;
	Fri, 11 Sep 2009 11:42:57 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BBgvIV051117;
	Fri, 11 Sep 2009 11:42:57 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200909111142.n8BBgvIV051117@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 11 Sep 2009 11:42:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197086 - head/lib/libradius
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 11:42:57 -0000

Author: mav
Date: Fri Sep 11 11:42:56 2009
New Revision: 197086
URL: http://svn.freebsd.org/changeset/base/197086

Log:
  Add simple embedded RADIUS server support to libradius, by extending existing
  API, keeping backward compatibility.
  
  First consumer for this functionality is going to become forthcoming MPD-5.4,
  supporting CoA and DR of RFC 3576: Dynamic Authorization Extensions to RADIUS.
  
  MFC after:	1 month

Modified:
  head/lib/libradius/libradius.3
  head/lib/libradius/radlib.c
  head/lib/libradius/radlib.h
  head/lib/libradius/radlib_private.h

Modified: head/lib/libradius/libradius.3
==============================================================================
--- head/lib/libradius/libradius.3	Fri Sep 11 02:07:24 2009	(r197085)
+++ head/lib/libradius/libradius.3	Fri Sep 11 11:42:56 2009	(r197086)
@@ -1,4 +1,5 @@
 .\" Copyright 1998 Juniper Networks, Inc.
+.\" Copyright 2009 Alexander Motin .
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,12 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2004
+.Dd August 5, 2009
 .Dt LIBRADIUS 3
 .Os
 .Sh NAME
 .Nm libradius
-.Nd RADIUS client library
+.Nd RADIUS client/server library
 .Sh SYNOPSIS
 .In radlib.h
 .Ft "struct rad_handle *"
@@ -46,6 +47,8 @@
 .Fn rad_continue_send_request "struct rad_handle *h" "int selected" "int *fd" "struct timeval *tv"
 .Ft int
 .Fn rad_create_request "struct rad_handle *h" "int code"
+.Ft int
+.Fn rad_create_response "struct rad_handle *h" "int code"
 .Ft "struct in_addr"
 .Fn rad_cvt_addr "const void *data"
 .Ft u_int32_t
@@ -79,7 +82,13 @@
 .Ft ssize_t
 .Fn rad_request_authenticator "struct rad_handle *h" "char *buf" "size_t len"
 .Ft int
+.Fn rad_receive_request "struct rad_handle *h"
+.Ft int
 .Fn rad_send_request "struct rad_handle *h"
+.Ft int
+.Fn rad_send_response "struct rad_handle *h"
+.Ft "struct rad_handle *"
+.Fn rad_server_open "int fd"
 .Ft "const char *"
 .Fn rad_server_secret "struct rad_handle *h"
 .Ft u_char *
@@ -91,16 +100,17 @@
 .Sh DESCRIPTION
 The
 .Nm
-library implements the client side of the Remote Authentication Dial
-In User Service (RADIUS).
+library implements the Remote Authentication Dial In User Service (RADIUS).
 RADIUS, defined in RFCs 2865 and 2866,
 allows clients to perform authentication and accounting by means of
 network requests to remote servers.
 .Ss Initialization
 To use the library, an application must first call
 .Fn rad_auth_open
-or
+,
 .Fn rad_acct_open
+or
+.Fn rad_server_open
 to obtain a
 .Vt "struct rad_handle *" ,
 which provides the context for subsequent operations.
@@ -108,8 +118,10 @@ The former function is used for RADIUS a
 latter is used for RADIUS accounting.
 Calls to
 .Fn rad_auth_open
-and
+,
 .Fn rad_acct_open
+and
+.Fn rad_server_open
 always succeed unless insufficient virtual memory is available.
 If
 the necessary memory cannot be allocated, the functions return
@@ -451,6 +463,25 @@ subsequent library calls using the same 
 .Ss Cleanup
 To free the resources used by the RADIUS library, call
 .Fn rad_close .
+.Ss Server operation
+Server mode operates much alike to client mode, except packet send and receieve
+steps are swapped. To operate as server you should obtain server context with
+.Fn rad_server_open
+function, passing opened and bound UDP socket file descriptor as argument.
+You should define allowed clients and their secrets using
+.Fn rad_add_server
+function. port, timeout and max_tries arguments are ignored in server mode.
+You should call
+.Fn rad_receive_request
+function to receive request from client. If you do not want to block on socket
+read, you are free to use any poll(), select() or non-blocking sockets for
+the socket.
+Received request can be parsed with same parsing functions as for client.
+To respond to the request you should call
+.Fn rad_create_response
+and fill response content with same packet writing functions as for client.
+When packet is ready, it should be sent with
+.Fn rad_send_response
 .Sh RETURN VALUES
 The following functions return a non-negative value on success.
 If
@@ -466,6 +497,8 @@ which can be retrieved using
 .It
 .Fn rad_create_request
 .It
+.Fn rad_create_response
+.It
 .Fn rad_get_attr
 .It
 .Fn rad_put_addr
@@ -483,6 +516,8 @@ which can be retrieved using
 .Fn rad_continue_send_request
 .It
 .Fn rad_send_request
+.It
+.Fn rad_send_response
 .El
 .Pp
 The following functions return a
@@ -499,6 +534,8 @@ without recording an error message.
 .It
 .Fn rad_auth_open
 .It
+.Fn rad_server_open
+.It
 .Fn rad_cvt_string
 .El
 .Pp
@@ -553,3 +590,5 @@ subsequently added the ability to perfor
 accounting.
 Later additions and changes by
 .An Michael Bretterklieber .
+Server mode support was added by
+.An Alexander Motin .

Modified: head/lib/libradius/radlib.c
==============================================================================
--- head/lib/libradius/radlib.c	Fri Sep 11 02:07:24 2009	(r197085)
+++ head/lib/libradius/radlib.c	Fri Sep 11 11:42:56 2009	(r197086)
@@ -103,7 +103,7 @@ insert_scrambled_password(struct rad_han
 	srvp = &h->servers[srv];
 	padded_len = h->pass_len == 0 ? 16 : (h->pass_len+15) & ~0xf;
 
-	memcpy(md5, &h->request[POS_AUTH], LEN_AUTH);
+	memcpy(md5, &h->out[POS_AUTH], LEN_AUTH);
 	for (pos = 0;  pos < padded_len;  pos += 16) {
 		int i;
 
@@ -120,49 +120,55 @@ insert_scrambled_password(struct rad_han
 		 * in calculating the scrambler for next time.
 		 */
 		for (i = 0;  i < 16;  i++)
-			h->request[h->pass_pos + pos + i] =
+			h->out[h->pass_pos + pos + i] =
 			    md5[i] ^= h->pass[pos + i];
 	}
 }
 
 static void
-insert_request_authenticator(struct rad_handle *h, int srv)
+insert_request_authenticator(struct rad_handle *h, int resp)
 {
 	MD5_CTX ctx;
 	const struct rad_server *srvp;
 
-	srvp = &h->servers[srv];
+	srvp = &h->servers[h->srv];
 
 	/* Create the request authenticator */
 	MD5Init(&ctx);
-	MD5Update(&ctx, &h->request[POS_CODE], POS_AUTH - POS_CODE);
-	MD5Update(&ctx, memset(&h->request[POS_AUTH], 0, LEN_AUTH), LEN_AUTH);
-	MD5Update(&ctx, &h->request[POS_ATTRS], h->req_len - POS_ATTRS);
+	MD5Update(&ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);
+	if (resp)
+	    MD5Update(&ctx, &h->in[POS_AUTH], LEN_AUTH);
+	else
+	    MD5Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+	MD5Update(&ctx, &h->out[POS_ATTRS], h->out_len - POS_ATTRS);
 	MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
-	MD5Final(&h->request[POS_AUTH], &ctx);
+	MD5Final(&h->out[POS_AUTH], &ctx);
 }
 
 static void
-insert_message_authenticator(struct rad_handle *h, int srv)
+insert_message_authenticator(struct rad_handle *h, int resp)
 {
 #ifdef WITH_SSL
 	u_char md[EVP_MAX_MD_SIZE];
 	u_int md_len;
 	const struct rad_server *srvp;
 	HMAC_CTX ctx;
-	srvp = &h->servers[srv];
+	srvp = &h->servers[h->srv];
 
 	if (h->authentic_pos != 0) {
 		HMAC_CTX_init(&ctx);
 		HMAC_Init(&ctx, srvp->secret, strlen(srvp->secret), EVP_md5());
-		HMAC_Update(&ctx, &h->request[POS_CODE], POS_AUTH - POS_CODE);
-		HMAC_Update(&ctx, &h->request[POS_AUTH], LEN_AUTH);
-		HMAC_Update(&ctx, &h->request[POS_ATTRS],
-		    h->req_len - POS_ATTRS);
+		HMAC_Update(&ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);
+		if (resp)
+		    HMAC_Update(&ctx, &h->in[POS_AUTH], LEN_AUTH);
+		else
+		    HMAC_Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+		HMAC_Update(&ctx, &h->out[POS_ATTRS],
+		    h->out_len - POS_ATTRS);
 		HMAC_Final(&ctx, md, &md_len);
 		HMAC_CTX_cleanup(&ctx);
 		HMAC_cleanup(&ctx);
-		memcpy(&h->request[h->authentic_pos + 2], md, md_len);
+		memcpy(&h->out[h->authentic_pos + 2], md, md_len);
 	}
 #endif
 }
@@ -195,20 +201,20 @@ is_valid_response(struct rad_handle *h, 
 		return 0;
 
 	/* Check the message length */
-	if (h->resp_len < POS_ATTRS)
+	if (h->in_len < POS_ATTRS)
 		return 0;
-	len = h->response[POS_LENGTH] << 8 | h->response[POS_LENGTH+1];
-	if (len > h->resp_len)
+	len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1];
+	if (len > h->in_len)
 		return 0;
 
 	/* Check the response authenticator */
 	MD5Init(&ctx);
-	MD5Update(&ctx, &h->response[POS_CODE], POS_AUTH - POS_CODE);
-	MD5Update(&ctx, &h->request[POS_AUTH], LEN_AUTH);
-	MD5Update(&ctx, &h->response[POS_ATTRS], len - POS_ATTRS);
+	MD5Update(&ctx, &h->in[POS_CODE], POS_AUTH - POS_CODE);
+	MD5Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+	MD5Update(&ctx, &h->in[POS_ATTRS], len - POS_ATTRS);
 	MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
 	MD5Final(md5, &ctx);
-	if (memcmp(&h->response[POS_AUTH], md5, sizeof md5) != 0)
+	if (memcmp(&h->in[POS_AUTH], md5, sizeof md5) != 0)
 		return 0;
 
 #ifdef WITH_SSL
@@ -216,42 +222,111 @@ is_valid_response(struct rad_handle *h, 
 	 * For non accounting responses check the message authenticator,
 	 * if any.
 	 */
-	if (h->response[POS_CODE] != RAD_ACCOUNTING_RESPONSE) {
+	if (h->in[POS_CODE] != RAD_ACCOUNTING_RESPONSE) {
 
-		memcpy(resp, h->response, MSGSIZE);
+		memcpy(resp, h->in, MSGSIZE);
 		pos = POS_ATTRS;
 
 		/* Search and verify the Message-Authenticator */
 		while (pos < len - 2) {
 
-			if (h->response[pos] == RAD_MESSAGE_AUTHENTIC) {
+			if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
 				/* zero fill the Message-Authenticator */
 				memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH);
 
 				HMAC_CTX_init(&hctx);
 				HMAC_Init(&hctx, srvp->secret,
 				    strlen(srvp->secret), EVP_md5());
-				HMAC_Update(&hctx, &h->response[POS_CODE],
+				HMAC_Update(&hctx, &h->in[POS_CODE],
 				    POS_AUTH - POS_CODE);
-				HMAC_Update(&hctx, &h->request[POS_AUTH],
+				HMAC_Update(&hctx, &h->out[POS_AUTH],
 				    LEN_AUTH);
 				HMAC_Update(&hctx, &resp[POS_ATTRS],
-				    h->resp_len - POS_ATTRS);
+				    h->in_len - POS_ATTRS);
 				HMAC_Final(&hctx, md, &md_len);
 				HMAC_CTX_cleanup(&hctx);
 				HMAC_cleanup(&hctx);
-				if (memcmp(md, &h->response[pos + 2],
+				if (memcmp(md, &h->in[pos + 2],
 				    MD5_DIGEST_LENGTH) != 0)
 					return 0;
 				break;
 			}
-			pos += h->response[pos + 1];
+			pos += h->in[pos + 1];
 		}
 	}
 #endif
 	return 1;
 }
 
+/*
+ * Return true if the current request is valid for the specified server.
+ */
+static int
+is_valid_request(struct rad_handle *h)
+{
+	MD5_CTX ctx;
+	unsigned char md5[MD5_DIGEST_LENGTH];
+	const struct rad_server *srvp;
+	int len;
+#ifdef WITH_SSL
+	HMAC_CTX hctx;
+	u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE];
+	u_int md_len;
+	int pos;
+#endif
+
+	srvp = &h->servers[h->srv];
+
+	/* Check the message length */
+	if (h->in_len < POS_ATTRS)
+		return (0);
+	len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1];
+	if (len > h->in_len)
+		return (0);
+
+	if (h->in[POS_CODE] != RAD_ACCESS_REQUEST) {
+		uint32_t zeroes[4] = { 0, 0, 0, 0 };
+		/* Check the request authenticator */
+		MD5Init(&ctx);
+		MD5Update(&ctx, &h->in[POS_CODE], POS_AUTH - POS_CODE);
+		MD5Update(&ctx, zeroes, LEN_AUTH);
+		MD5Update(&ctx, &h->in[POS_ATTRS], len - POS_ATTRS);
+		MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
+		MD5Final(md5, &ctx);
+		if (memcmp(&h->in[POS_AUTH], md5, sizeof md5) != 0)
+			return (0);
+	}
+
+#ifdef WITH_SSL
+	/* Search and verify the Message-Authenticator */
+	pos = POS_ATTRS;
+	while (pos < len - 2) {
+		if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
+			memcpy(resp, h->in, MSGSIZE);
+			/* zero fill the Request-Authenticator */
+			if (h->in[POS_CODE] != RAD_ACCESS_REQUEST)
+				memset(&resp[POS_AUTH], 0, LEN_AUTH);
+			/* zero fill the Message-Authenticator */
+			memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH);
+
+			HMAC_CTX_init(&hctx);
+			HMAC_Init(&hctx, srvp->secret,
+			    strlen(srvp->secret), EVP_md5());
+			HMAC_Update(&hctx, resp, h->in_len);
+			HMAC_Final(&hctx, md, &md_len);
+			HMAC_CTX_cleanup(&hctx);
+			HMAC_cleanup(&hctx);
+			if (memcmp(md, &h->in[pos + 2],
+			    MD5_DIGEST_LENGTH) != 0)
+				return (0);
+			break;
+		}
+		pos += h->in[pos + 1];
+	}
+#endif
+	return (1);
+}
+
 static int
 put_password_attr(struct rad_handle *h, int type, const void *value, size_t len)
 {
@@ -273,7 +348,7 @@ put_password_attr(struct rad_handle *h, 
 	 */
 	clear_password(h);
 	put_raw_attr(h, type, h->pass, padded_len);
-	h->pass_pos = h->req_len - padded_len;
+	h->pass_pos = h->out_len - padded_len;
 
 	/* Save the cleartext password, padded as necessary */
 	memcpy(h->pass, value, len);
@@ -289,14 +364,14 @@ put_raw_attr(struct rad_handle *h, int t
 		generr(h, "Attribute too long");
 		return -1;
 	}
-	if (h->req_len + 2 + len > MSGSIZE) {
+	if (h->out_len + 2 + len > MSGSIZE) {
 		generr(h, "Maximum message length exceeded");
 		return -1;
 	}
-	h->request[h->req_len++] = type;
-	h->request[h->req_len++] = len + 2;
-	memcpy(&h->request[h->req_len], value, len);
-	h->req_len += len;
+	h->out[h->out_len++] = type;
+	h->out[h->out_len++] = len + 2;
+	memcpy(&h->out[h->out_len], value, len);
+	h->out_len += len;
 	return 0;
 }
 
@@ -523,22 +598,26 @@ rad_continue_send_request(struct rad_han
 {
 	int n;
 
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
 	if (selected) {
 		struct sockaddr_in from;
 		socklen_t fromlen;
 
 		fromlen = sizeof from;
-		h->resp_len = recvfrom(h->fd, h->response,
+		h->in_len = recvfrom(h->fd, h->in,
 		    MSGSIZE, MSG_WAITALL, (struct sockaddr *)&from, &fromlen);
-		if (h->resp_len == -1) {
+		if (h->in_len == -1) {
 			generr(h, "recvfrom: %s", strerror(errno));
 			return -1;
 		}
 		if (is_valid_response(h, h->srv, &from)) {
-			h->resp_len = h->response[POS_LENGTH] << 8 |
-			    h->response[POS_LENGTH+1];
-			h->resp_pos = POS_ATTRS;
-			return h->response[POS_CODE];
+			h->in_len = h->in[POS_LENGTH] << 8 |
+			    h->in[POS_LENGTH+1];
+			h->in_pos = POS_ATTRS;
+			return h->in[POS_CODE];
 		}
 	}
 
@@ -556,21 +635,22 @@ rad_continue_send_request(struct rad_han
 		if (++h->srv >= h->num_servers)
 			h->srv = 0;
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST)
-		/* Insert the request authenticator into the request */
-		insert_request_authenticator(h, h->srv);
-	else
+	if (h->out[POS_CODE] == RAD_ACCESS_REQUEST) {
 		/* Insert the scrambled password into the request */
 		if (h->pass_pos != 0)
 			insert_scrambled_password(h, h->srv);
-
-	insert_message_authenticator(h, h->srv);
+	}
+	insert_message_authenticator(h, 0);
+	if (h->out[POS_CODE] != RAD_ACCESS_REQUEST) {
+		/* Insert the request authenticator into the request */
+		insert_request_authenticator(h, h->srv);
+	}
 
 	/* Send the request */
-	n = sendto(h->fd, h->request, h->req_len, 0,
+	n = sendto(h->fd, h->out, h->out_len, 0,
 	    (const struct sockaddr *)&h->servers[h->srv].addr,
 	    sizeof h->servers[h->srv].addr);
-	if (n != h->req_len) {
+	if (n != h->out_len) {
 		if (n == -1)
 			generr(h, "sendto: %s", strerror(errno));
 		else
@@ -588,22 +668,117 @@ rad_continue_send_request(struct rad_han
 }
 
 int
+rad_receive_request(struct rad_handle *h)
+{
+	struct sockaddr_in from;
+	socklen_t fromlen;
+	int n;
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	h->srv = -1;
+	fromlen = sizeof(from);
+	h->in_len = recvfrom(h->fd, h->in,
+	    MSGSIZE, MSG_WAITALL, (struct sockaddr *)&from, &fromlen);
+	if (h->in_len == -1) {
+		generr(h, "recvfrom: %s", strerror(errno));
+		return (-1);
+	}
+	for (n = 0; n < h->num_servers; n++) {
+		if (h->servers[n].addr.sin_addr.s_addr == from.sin_addr.s_addr) {
+			h->servers[n].addr.sin_port = from.sin_port;
+			h->srv = n;
+			break;
+		}
+	}
+	if (h->srv == -1)
+		return (-2);
+	if (is_valid_request(h)) {
+		h->in_len = h->in[POS_LENGTH] << 8 |
+		    h->in[POS_LENGTH+1];
+		h->in_pos = POS_ATTRS;
+		return (h->in[POS_CODE]);
+	}
+	return (-3);
+}
+
+int
+rad_send_response(struct rad_handle *h)
+{
+	int n;
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	/* Fill in the length field in the message */
+	h->out[POS_LENGTH] = h->out_len >> 8;
+	h->out[POS_LENGTH+1] = h->out_len;
+
+	insert_message_authenticator(h,
+	    (h->in[POS_CODE] == RAD_ACCESS_REQUEST) ? 1 : 0);
+	insert_request_authenticator(h, 1);
+
+	/* Send the request */
+	n = sendto(h->fd, h->out, h->out_len, 0,
+	    (const struct sockaddr *)&h->servers[h->srv].addr,
+	    sizeof h->servers[h->srv].addr);
+	if (n != h->out_len) {
+		if (n == -1)
+			generr(h, "sendto: %s", strerror(errno));
+		else
+			generr(h, "sendto: short write");
+		return -1;
+	}
+
+	return 0;
+}
+
+int
 rad_create_request(struct rad_handle *h, int code)
 {
 	int i;
 
-	h->request[POS_CODE] = code;
-	h->request[POS_IDENT] = ++h->ident;
-	/* Create a random authenticator */
-	for (i = 0;  i < LEN_AUTH;  i += 2) {
-		long r;
-		r = random();
-		h->request[POS_AUTH+i] = (u_char)r;
-		h->request[POS_AUTH+i+1] = (u_char)(r >> 8);
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	h->out[POS_CODE] = code;
+	h->out[POS_IDENT] = ++h->ident;
+	if (code == RAD_ACCESS_REQUEST) {
+		/* Create a random authenticator */
+		for (i = 0;  i < LEN_AUTH;  i += 2) {
+			long r;
+			r = random();
+			h->out[POS_AUTH+i] = (u_char)r;
+			h->out[POS_AUTH+i+1] = (u_char)(r >> 8);
+		}
+	} else
+		memset(&h->out[POS_AUTH], 0, LEN_AUTH);
+	h->out_len = POS_ATTRS;
+	clear_password(h);
+	h->authentic_pos = 0;
+	h->out_created = 1;
+	return 0;
+}
+
+int
+rad_create_response(struct rad_handle *h, int code)
+{
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
 	}
-	h->req_len = POS_ATTRS;
+	h->out[POS_CODE] = code;
+	h->out[POS_IDENT] = h->in[POS_IDENT];
+	memset(&h->out[POS_AUTH], 0, LEN_AUTH);
+	h->out_len = POS_ATTRS;
 	clear_password(h);
-	h->request_created = 1;
+	h->authentic_pos = 0;
+	h->out_created = 1;
 	return 0;
 }
 
@@ -647,20 +822,20 @@ rad_get_attr(struct rad_handle *h, const
 {
 	int type;
 
-	if (h->resp_pos >= h->resp_len)
+	if (h->in_pos >= h->in_len)
 		return 0;
-	if (h->resp_pos + 2 > h->resp_len) {
+	if (h->in_pos + 2 > h->in_len) {
 		generr(h, "Malformed attribute in response");
 		return -1;
 	}
-	type = h->response[h->resp_pos++];
-	*len = h->response[h->resp_pos++] - 2;
-	if (h->resp_pos + (int)*len > h->resp_len) {
+	type = h->in[h->in_pos++];
+	*len = h->in[h->in_pos++] - 2;
+	if (h->in_pos + (int)*len > h->in_len) {
 		generr(h, "Malformed attribute in response");
 		return -1;
 	}
-	*value = &h->response[h->resp_pos];
-	h->resp_pos += *len;
+	*value = &h->in[h->in_pos];
+	h->in_pos += *len;
 	return type;
 }
 
@@ -672,6 +847,10 @@ rad_init_send_request(struct rad_handle 
 {
 	int srv;
 
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
 	/* Make sure we have a socket to use */
 	if (h->fd == -1) {
 		struct sockaddr_in sin;
@@ -694,7 +873,7 @@ rad_init_send_request(struct rad_handle 
 		}
 	}
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] != RAD_ACCESS_REQUEST) {
 		/* Make sure no password given */
 		if (h->pass_pos || h->chap_pass) {
 			generr(h, "User or Chap Password"
@@ -718,8 +897,8 @@ rad_init_send_request(struct rad_handle 
 	}
 
 	/* Fill in the length field in the message */
-	h->request[POS_LENGTH] = h->req_len >> 8;
-	h->request[POS_LENGTH+1] = h->req_len;
+	h->out[POS_LENGTH] = h->out_len >> 8;
+	h->out[POS_LENGTH+1] = h->out_len;
 
 	/*
 	 * Count the total number of tries we will make, and zero the
@@ -763,7 +942,7 @@ rad_auth_open(void)
 		h->chap_pass = 0;
 		h->authentic_pos = 0;
 		h->type = RADIUS_AUTH;
-		h->request_created = 0;
+		h->out_created = 0;
 		h->eap_msg = 0;
 	}
 	return h;
@@ -781,6 +960,19 @@ rad_acct_open(void)
 }
 
 struct rad_handle *
+rad_server_open(int fd)
+{
+	struct rad_handle *h;
+
+	h = rad_open();
+	if (h != NULL) {
+	        h->type = RADIUS_SERVER;
+	        h->fd = fd;
+	}
+	return h;
+}
+
+struct rad_handle *
 rad_open(void)
 {
     return rad_auth_open();
@@ -797,13 +989,13 @@ rad_put_attr(struct rad_handle *h, int t
 {
 	int result;
 
-	if (!h->request_created) {
+	if (!h->out_created) {
 		generr(h, "Please call rad_create_request()"
 		    " before putting attributes");
 		return -1;
 	}
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
 		if (type == RAD_EAP_MESSAGE) {
 			generr(h, "EAP-Message attribute is not valid"
 			    " in accounting requests");
@@ -858,14 +1050,14 @@ rad_put_message_authentic(struct rad_han
 #ifdef WITH_SSL
 	u_char md_zero[MD5_DIGEST_LENGTH];
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
 		generr(h, "Message-Authenticator is not valid"
 		    " in accounting requests");
 		return -1;
 	}
 
 	if (h->authentic_pos == 0) {
-		h->authentic_pos = h->req_len;
+		h->authentic_pos = h->out_len;
 		memset(md_zero, 0, sizeof(md_zero));
 		return (put_raw_attr(h, RAD_MESSAGE_AUTHENTIC, md_zero,
 		    sizeof(md_zero)));
@@ -1041,7 +1233,7 @@ rad_put_vendor_attr(struct rad_handle *h
 	struct vendor_attribute *attr;
 	int res;
 
-	if (!h->request_created) {
+	if (!h->out_created) {
 		generr(h, "Please call rad_create_request()"
 		    " before putting attributes");
 		return -1;
@@ -1088,7 +1280,7 @@ rad_request_authenticator(struct rad_han
 {
 	if (len < LEN_AUTH)
 		return (-1);
-	memcpy(buf, h->request + POS_AUTH, LEN_AUTH);
+	memcpy(buf, h->out + POS_AUTH, LEN_AUTH);
 	if (len > LEN_AUTH)
 		buf[LEN_AUTH] = '\0';
 	return (LEN_AUTH);

Modified: head/lib/libradius/radlib.h
==============================================================================
--- head/lib/libradius/radlib.h	Fri Sep 11 02:07:24 2009	(r197085)
+++ head/lib/libradius/radlib.h	Fri Sep 11 11:42:56 2009	(r197086)
@@ -42,6 +42,12 @@
 #define RAD_ACCOUNTING_REQUEST		4
 #define RAD_ACCOUNTING_RESPONSE		5
 #define RAD_ACCESS_CHALLENGE		11
+#define RAD_DISCONNECT_REQUEST		40
+#define RAD_DISCONNECT_ACK		41
+#define RAD_DISCONNECT_NAK		42
+#define RAD_COA_REQUEST			43
+#define RAD_COA_ACK			44
+#define RAD_COA_NAK			45
 
 /* Attribute types and values */
 #define RAD_USER_NAME			1	/* String */
@@ -179,6 +185,8 @@
 #define	RAD_ACCT_MULTI_SESSION_ID	50	/* String */
 #define	RAD_ACCT_LINK_COUNT		51	/* Integer */
 
+#define	RAD_ERROR_CAUSE			101	/* Integer */
+
 struct rad_handle;
 struct timeval;
 
@@ -192,6 +200,7 @@ int			 rad_config(struct rad_handle *, c
 int			 rad_continue_send_request(struct rad_handle *, int,
 			    int *, struct timeval *);
 int			 rad_create_request(struct rad_handle *, int);
+int			 rad_create_response(struct rad_handle *, int);
 struct in_addr		 rad_cvt_addr(const void *);
 u_int32_t		 rad_cvt_int(const void *);
 char			*rad_cvt_string(const void *, size_t);
@@ -209,7 +218,10 @@ int			 rad_put_string(struct rad_handle 
 int			 rad_put_message_authentic(struct rad_handle *);
 ssize_t			 rad_request_authenticator(struct rad_handle *, char *,
 			    size_t);
+int			 rad_receive_request(struct rad_handle *);
 int			 rad_send_request(struct rad_handle *);
+int			 rad_send_response(struct rad_handle *);
+struct rad_handle	*rad_server_open(int fd);
 const char		*rad_server_secret(struct rad_handle *);
 const char		*rad_strerror(struct rad_handle *);
 u_char			*rad_demangle(struct rad_handle *, const void *,

Modified: head/lib/libradius/radlib_private.h
==============================================================================
--- head/lib/libradius/radlib_private.h	Fri Sep 11 02:07:24 2009	(r197085)
+++ head/lib/libradius/radlib_private.h	Fri Sep 11 11:42:56 2009	(r197086)
@@ -38,6 +38,7 @@
 /* Handle types */
 #define RADIUS_AUTH		0   /* RADIUS authentication, default */
 #define RADIUS_ACCT		1   /* RADIUS accounting */
+#define RADIUS_SERVER		2   /* RADIUS server */
 
 /* Defaults */
 #define MAXTRIES		3
@@ -75,18 +76,18 @@ struct rad_handle {
 	int		 num_servers;	/* Number of valid server entries */
 	int		 ident;		/* Current identifier value */
 	char		 errmsg[ERRSIZE];	/* Most recent error message */
-	unsigned char	 request[MSGSIZE];	/* Request to send */
-	char	 	 request_created; /* rad_create_request() called? */
-	int		 req_len;	/* Length of request */
+	unsigned char	 out[MSGSIZE];	/* Request to send */
+	char		 out_created;	/* rad_create_request() called? */
+	int		 out_len;	/* Length of request */
 	char		 pass[PASSSIZE];	/* Cleartext password */
 	int		 pass_len;	/* Length of cleartext password */
 	int		 pass_pos;	/* Position of scrambled password */
-	char	 	 chap_pass;	/* Have we got a CHAP_PASSWORD ? */
+	char		 chap_pass;	/* Have we got a CHAP_PASSWORD ? */
 	int		 authentic_pos;	/* Position of message authenticator */
 	char		 eap_msg;	/* Are we an EAP Proxy? */
-	unsigned char	 response[MSGSIZE];	/* Response received */
-	int		 resp_len;	/* Length of response */
-	int		 resp_pos;	/* Current position scanning attrs */
+	unsigned char	 in[MSGSIZE];	/* Response received */
+	int		 in_len;	/* Length of response */
+	int		 in_pos;	/* Current position scanning attrs */
 	int		 total_tries;	/* How many requests we'll send */
 	int		 try;		/* How many requests we've sent */
 	int		 srv;		/* Server number we did last */

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 12:56:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 47316106566C;
	Fri, 11 Sep 2009 12:56:14 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 355658FC13;
	Fri, 11 Sep 2009 12:56:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BCuDgF052682;
	Fri, 11 Sep 2009 12:56:13 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BCuD0X052680;
	Fri, 11 Sep 2009 12:56:13 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909111256.n8BCuD0X052680@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 11 Sep 2009 12:56:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197087 - in stable/8/sys: . amd64/include/xen
	cddl/compat/opensolaris/kern cddl/contrib/opensolaris
	contrib/dev/acpica contrib/pf dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 12:56:14 -0000

Author: kib
Date: Fri Sep 11 12:56:13 2009
New Revision: 197087
URL: http://svn.freebsd.org/changeset/base/197087

Log:
  MFC r196966:
  Lock Giant around vn_open_cred().
  Remove innocent unnecessary call to NDFREE().
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
==============================================================================
--- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	Fri Sep 11 11:42:56 2009	(r197086)
+++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c	Fri Sep 11 12:56:13 2009	(r197087)
@@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file)
 	struct thread *td = curthread;
 	struct filedesc *fd;
 	struct nameidata nd;
-	int error, flags;
+	int error, flags, vfslocked;
 
 	fd = td->td_proc->p_fd;
 	FILEDESC_XLOCK(fd);
@@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file)
 	flags = FREAD | O_NOFOLLOW;
 	NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
 	error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
-	NDFREE(&nd, NDF_ONLY_PNBUF);
 	if (error != 0)
 		return (NULL);
+	vfslocked = NDHASGIANT(&nd);
+	NDFREE(&nd, NDF_ONLY_PNBUF);
 	/* We just unlock so we hold a reference. */
 	VOP_UNLOCK(nd.ni_vp, 0);
+	VFS_UNLOCK_GIANT(vfslocked);
 	return (nd.ni_vp);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 13:46:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A520E1065679;
	Fri, 11 Sep 2009 13:46:28 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 934F58FC0C;
	Fri, 11 Sep 2009 13:46:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BDkSn9053691;
	Fri, 11 Sep 2009 13:46:28 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BDkSDe053689;
	Fri, 11 Sep 2009 13:46:28 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200909111346.n8BDkSDe053689@svn.freebsd.org>
From: Ken Smith 
Date: Fri, 11 Sep 2009 13:46:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197088 - in stable/8/release: . doc scripts
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 13:46:28 -0000

Author: kensmith
Date: Fri Sep 11 13:46:28 2009
New Revision: 197088
URL: http://svn.freebsd.org/changeset/base/197088

Log:
  MFC r196942:
  > Bring the layout of package-split.py more in line with where we're going
  > with packages on the release media.  It looks like we'll be putting just
  > the doc packages on the new "memory stick" image as well as disc1.  There
  > will be no other packages on the CDROM-sized media.  The DVD sized media
  > will include the doc packages plus whatever other packages we decide to
  > make part of the release.
  >
  > This commit just brings the basic structure in line with being able to
  > do this.  We still need to discuss with various people exactly which
  > packages will be included on the DVD.
  >
  > If the environement variable "PKG_DVD" is set a tree suitable for the
  > DVD media is generated.  Otherwise a tree suitable for the "memory stick"
  > and disc1 is generated.
  
  Approved by:	re (kib)

Modified:
  stable/8/release/   (props changed)
  stable/8/release/doc/   (props changed)
  stable/8/release/scripts/package-split.py

Modified: stable/8/release/scripts/package-split.py
==============================================================================
--- stable/8/release/scripts/package-split.py	Fri Sep 11 12:56:13 2009	(r197087)
+++ stable/8/release/scripts/package-split.py	Fri Sep 11 13:46:28 2009	(r197088)
@@ -23,71 +23,14 @@ if 'PKG_VERBOSE' in os.environ:
 else:
     verbose = 0
 
-# List of packages for disc1.  This just includes packages sysinstall can
-# install as a distribution
-def disc1_packages():
-    pkgs = ['lang/perl5.8']
-    pkgs.extend(['x11/xorg',
-                 'devel/imake'])
-    if arch == 'i386':
-        pkgs.append('emulators/linux_base-fc4')
-    return pkgs
-
-# List of packages for disc2.  This includes packages that the X desktop
-# menu depends on (if it still exists) and other "nice to have" packages.
-# For architectures that use a separate livefs, this is actually disc3.
-def disc2_packages():
-            # X Desktops
-    if arch == 'ia64':
-	pkgs = ['x11/gnome2-lite',
-		'x11/kde-lite']
-    else:
-	pkgs = ['x11/gnome2',
-		'x11/kde3']
-    pkgs.extend(['x11-wm/afterstep',
-            'x11-wm/windowmaker',
-            'x11-wm/fvwm2',
-            # "Nice to have"
-            'archivers/unzip',
-            'astro/xearth',                 
-            'devel/gmake',
-            'editors/emacs',
-            'editors/vim-lite',
-            'emulators/mtools',
-            'graphics/png',
-            'graphics/xv',
-            'irc/xchat',
-            'mail/exim',
-            'mail/fetchmail',
-            'mail/mutt',
-            'mail/pine4',
-            'mail/popd',
-            'mail/xfmail',
-            'mail/postfix',
-            'net/cvsup-without-gui',
-            'net/rsync',
-            'net/samba3',
-            'news/slrn',
-            'news/tin',
-            'ports-mgmt/portupgrade',
-            'print/a2ps-letter',
-            'print/apsfilter',
-            'print/ghostscript-gnu-nox11',
-            'print/gv',
-            'print/psutils-letter',
-            'shells/bash',
-            'shells/pdksh',
-            'shells/zsh',
-            'security/sudo',
-            'www/links',
-            'www/lynx',
-            'x11/rxvt',
-            # Formerly on disc3
-            'ports-mgmt/portaudit'])
-    return pkgs
+if 'PKG_DVD' in os.environ:
+    doing_dvd = 1
+else:
+    doing_dvd = 0
 
-def docs_packages():
-    pkgs = ['misc/freebsd-doc-bn',
+# List of packages for disc1.
+def disc1_packages():
+    pkgs = ['misc/freebsd-doc-bn', 
 	    'misc/freebsd-doc-da',
 	    'misc/freebsd-doc-de',
 	    'misc/freebsd-doc-el',
@@ -106,14 +49,58 @@ def docs_packages():
 	    'misc/freebsd-doc-tr',
 	    'misc/freebsd-doc-zh_cn',
 	    'misc/freebsd-doc-zh_tw']
+
+    if doing_dvd:
+	pkgs.extend(['lang/perl5.8',
+	    'x11/xorg',
+	    'devel/imake',
+	    'emulators/linux_base-fc4',
+	    'x11/gnome2',
+	    'x11/kde4',
+	    'x11-wm/afterstep',
+	    'x11-wm/windowmaker',
+	    'x11-wm/fvwm2',
+	    'archivers/unzip',
+	    'astro/xearth',
+	    'devel/gmake',
+	    'editors/emacs',
+	    'editors/vim-lite',
+	    'emulators/mtools',
+	    'graphics/png',
+	    'graphics/xv',
+	    'irc/xchat',
+	    'mail/exim',
+	    'mail/fetchmail',
+	    'mail/mutt',
+	    'mail/alpine',
+	    'mail/popd',
+	    'mail/xfmail',
+	    'mail/postfix',
+	    'net/cvsup-without-gui',
+	    'net/rsync',
+	    'net/samba3',
+	    'news/slrn',
+	    'news/tin',
+	    'ports-mgmt/portupgrade',
+	    'print/a2ps-letter',
+	    'print/apsfilter',
+	    'print/ghostscript7-nox11',
+	    'print/gv',
+	    'print/psutils-letter',
+	    'shells/bash',
+	    'shells/pdksh',
+	    'shells/zsh',
+	    'security/sudo',
+	    'www/links',
+	    'www/lynx',
+	    'x11/rxvt',
+	    'ports-mgmt/portaudit'])
     return pkgs
 
 # The list of desired packages
 def desired_packages():
     disc1 = disc1_packages()
-    disc2 = disc2_packages()
-    docs = docs_packages()
-    return [disc1, disc2, docs]
+    return [disc1]
 
 # Suck the entire INDEX file into a two different dictionaries.  The first
 # dictionary maps port names (origins) to package names.  The second

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 14:56:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFE8D106568B;
	Fri, 11 Sep 2009 14:56:21 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id C1C4F8FC0A;
	Fri, 11 Sep 2009 14:56:21 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 5BED746B03;
	Fri, 11 Sep 2009 10:56:21 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 49F358A01B;
	Fri, 11 Sep 2009 10:56:20 -0400 (EDT)
From: John Baldwin 
To: Xin LI 
Date: Fri, 11 Sep 2009 10:55:14 -0400
User-Agent: KMail/1.9.7
References: <200909110207.n8B27PjH037758@svn.freebsd.org>
In-Reply-To: <200909110207.n8B27PjH037758@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909111055.14845.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Fri, 11 Sep 2009 10:56:20 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r197085 - in head: share/man/man4 sys/dev/syscons
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 14:56:22 -0000

On Thursday 10 September 2009 10:07:25 pm Xin LI wrote:
> Author: delphij
> Date: Fri Sep 11 02:07:24 2009
> New Revision: 197085
> URL: http://svn.freebsd.org/changeset/base/197085
> 
> Log:
>   Extend the usage of sc(4)'s hint variable 'flag'.  Bit 0x80 now means
>   "set vesa mode" and higher 16bits of the flag would be the desired mode.
>   
>   One can now set, for instance, hint.sc.0.flags=0x01680180, which means
>   that the system should set VESA mode 0x168 upon boot.
>   
>   Submitted by:	paradox , swell k at gmail.com with
>   		some minor changes.

Ugh, I don't like overloading flags this much.  The historical usage of flags 
was due to userconfig only letting one set a single flags property for a 
given device.  Since moving to hints we now support free-form text 
properties.  I would much prefer this be implemented by 
setting 'hint.sc.0.vesa_mode=XXX' instead.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 15:07:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BAC0C106568D;
	Fri, 11 Sep 2009 15:07:36 +0000 (UTC)
	(envelope-from syrinx@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A92898FC26;
	Fri, 11 Sep 2009 15:07:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BF7aUO055392;
	Fri, 11 Sep 2009 15:07:36 GMT (envelope-from syrinx@svn.freebsd.org)
Received: (from syrinx@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BF7aWI055390;
	Fri, 11 Sep 2009 15:07:36 GMT (envelope-from syrinx@svn.freebsd.org)
Message-Id: <200909111507.n8BF7aWI055390@svn.freebsd.org>
From: Shteryana Shopova 
Date: Fri, 11 Sep 2009 15:07:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197089 - stable/8/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 15:07:36 -0000

Author: syrinx
Date: Fri Sep 11 15:07:36 2009
New Revision: 197089
URL: http://svn.freebsd.org/changeset/base/197089

Log:
  MFC r196932:
  
  When joining a multicast group, the inp_lookup_mcast_ifp call
  does a KASSERT that the group address is multicast, so the
  check if this is indeed true and eventually return a EINVAL if not,
  should be done before calling inp_lookup_mcast_ifp. This fixes a kernel
  crash when calling setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,...)
  with invalid group address.
  
  Reviewed by:	bms
  Approved by:	re (kib)

Modified:
  stable/8/sys/netinet/in_mcast.c

Modified: stable/8/sys/netinet/in_mcast.c
==============================================================================
--- stable/8/sys/netinet/in_mcast.c	Fri Sep 11 13:46:28 2009	(r197088)
+++ stable/8/sys/netinet/in_mcast.c	Fri Sep 11 15:07:36 2009	(r197089)
@@ -1899,6 +1899,9 @@ inp_join_group(struct inpcb *inp, struct
 			ssa->sin.sin_addr = mreqs.imr_sourceaddr;
 		}
 
+		if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
+			return (EINVAL);
+
 		ifp = inp_lookup_mcast_ifp(inp, &gsa->sin,
 		    mreqs.imr_interface);
 		CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p",
@@ -1936,6 +1939,9 @@ inp_join_group(struct inpcb *inp, struct
 			ssa->sin.sin_port = 0;
 		}
 
+		if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
+			return (EINVAL);
+
 		if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface)
 			return (EADDRNOTAVAIL);
 		ifp = ifnet_byindex(gsr.gsr_interface);
@@ -1948,9 +1954,6 @@ inp_join_group(struct inpcb *inp, struct
 		break;
 	}
 
-	if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
-		return (EINVAL);
-
 	if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0)
 		return (EADDRNOTAVAIL);
 

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 15:19:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11CE61065670;
	Fri, 11 Sep 2009 15:19:30 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id D10A48FC19;
	Fri, 11 Sep 2009 15:19:29 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 7360946B2A;
	Fri, 11 Sep 2009 11:19:29 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 8D4488A020;
	Fri, 11 Sep 2009 11:19:28 -0400 (EDT)
From: John Baldwin 
To: "Jason J. Hellenthal" 
Date: Fri, 11 Sep 2009 11:11:51 -0400
User-Agent: KMail/1.9.7
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	
	
In-Reply-To: 
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200909111111.52627.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Fri, 11 Sep 2009 11:19:28 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: Remko Lodder , svn-src-stable@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Robert Watson , svn-src-stable-8@freebsd.org,
	Ken Smith , Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
	sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
	sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 15:19:30 -0000

On Friday 11 September 2009 2:00:58 am Jason J. Hellenthal wrote:
> On Thu, 10 Sep 2009 13:00 -0000, rwatson wrote:
> 
> >
> > On Thu, 10 Sep 2009, Remko Lodder wrote:
> >
> >> I agree with that; it would (!) help the bugbusting team in gathering 
> >> required information. If there is an way to automate crashdumps and proper 
> >> reporting and stick that in /var/crash/crash.$date or something and tell 
> >> people that they can report their problems on the bugs list where needed, 
> >> we have information upfront. I still remember the time where we had to 
> >> chase people to get this information, sometimes never being able to 
> >> properly get the information. If it is there by default, it will help.
> >> 
> >> Please consider keeping it enabled..
> >
> > Well, John's crashinfo(8) tool from Yahoo! does all this, the only "problem" 
> > is that it requires extracting the crashdump to a local file system.  It 
> > seems like we have a lot of the right ingredients, maybe we can have a 
> > brain-storming session on distributed diagnostics and debugging at the 
> > Devsummit on how to find some better middle grounds here.
> >
> > Robert N M Watson
> > Computer Laboratory
> > University of Cambridge
> > 
> >
> 
> If I may, I would like to introduce a distributed targeting system to this 
> conversation in addition to crashinfo. Given with the above conversations I cant 
> help but think that in a case like this it would be helpful to setup a central 
> database for collection of information and write a little bit more code into 
> crashinfo for uuencoding a blob to send through email or maybe another way so 
> data can be collected, sorted & analyzed with statistics spilled out into a web 
> page for review.

My previous job actually stored the output of a crashinfo-like script for
each panic into a database along with metadata such as a one-line summary
(it even had some limited ability to auto-tag known panics).  However, it
required a good chunk of time *every* day to check new panics received each
day to see if any were not previously seen before, or new variants on an old
panic, etc.  The time was non-trivial and I do not think would scale well to
the all-FreeBSD-users universe.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 16:53:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D24AB1065695;
	Fri, 11 Sep 2009 16:53:12 +0000 (UTC) (envelope-from jfv@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BF6A88FC19;
	Fri, 11 Sep 2009 16:53:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BGrCn2057725;
	Fri, 11 Sep 2009 16:53:12 GMT (envelope-from jfv@svn.freebsd.org)
Received: (from jfv@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BGrCd3057722;
	Fri, 11 Sep 2009 16:53:12 GMT (envelope-from jfv@svn.freebsd.org)
Message-Id: <200909111653.n8BGrCd3057722@svn.freebsd.org>
From: Jack F Vogel 
Date: Fri, 11 Sep 2009 16:53:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197093 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/e1000 dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 16:53:13 -0000

Author: jfv
Date: Fri Sep 11 16:53:12 2009
New Revision: 197093
URL: http://svn.freebsd.org/changeset/base/197093

Log:
  This fixes kern/138516, an mbuf leak in both the em
  and igb driver, when a transmit fails the packet/mbuf
  was not being requeued. Thanks to those that pointed
  this problem out.
  
  Approved by:  re

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/if_em.c
  stable/8/sys/dev/e1000/if_igb.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/e1000/if_em.c
==============================================================================
--- stable/8/sys/dev/e1000/if_em.c	Fri Sep 11 15:38:27 2009	(r197092)
+++ stable/8/sys/dev/e1000/if_em.c	Fri Sep 11 16:53:12 2009	(r197093)
@@ -1034,9 +1034,10 @@ em_mq_start_locked(struct ifnet *ifp, st
 		return (error);
 	} else if (drbr_empty(ifp, adapter->br) &&
 	    (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) {
-		if (em_xmit(adapter, &m)) {
-			if (m && (error = drbr_enqueue(ifp, adapter->br, m)) != 0)
-				return (error);
+		if ((error = em_xmit(adapter, &m)) != 0) {
+			if (m != NULL)
+				error = drbr_enqueue(ifp, adapter->br, m);
+			return (error);
 		} else {
 			/*
 			 * We've bypassed the buf ring so we need to update
@@ -1063,8 +1064,12 @@ process:
                 next = drbr_dequeue(ifp, adapter->br);
                 if (next == NULL)
                         break;
-                if (em_xmit(adapter, &next))
+                if ((error = em_xmit(adapter, &next)) != 0) {
+			if (next != NULL)
+				error = drbr_enqueue(ifp, adapter->br, next);
                         break;
+		}
+		drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
                 ETHER_BPF_MTAP(ifp, next);
                 /* Set the watchdog */
                 adapter->watchdog_timer = EM_TX_TIMEOUT;
@@ -1073,7 +1078,7 @@ process:
         if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD)
                 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 
-	return (0);
+	return (error);
 }
 
 /*

Modified: stable/8/sys/dev/e1000/if_igb.c
==============================================================================
--- stable/8/sys/dev/e1000/if_igb.c	Fri Sep 11 15:38:27 2009	(r197092)
+++ stable/8/sys/dev/e1000/if_igb.c	Fri Sep 11 16:53:12 2009	(r197093)
@@ -854,9 +854,10 @@ igb_mq_start_locked(struct ifnet *ifp, s
 
 	/* If nothing queued go right to xmit */
 	if (drbr_empty(ifp, txr->br)) {
-		if (igb_xmit(txr, &m)) {
-			if (m && (err = drbr_enqueue(ifp, txr->br, m)) != 0)
-                                return (err);
+		if ((err = igb_xmit(txr, &m)) != 0) {
+			if (m != NULL)
+				err = drbr_enqueue(ifp, txr->br, m);
+			return (err);
 		} else {
 			/* Success, update stats */
 			drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags);
@@ -880,8 +881,12 @@ process:
 		next = drbr_dequeue(ifp, txr->br);
 		if (next == NULL)
 			break;
-		if (igb_xmit(txr, &next))
+		if ((err = igb_xmit(txr, &next)) != 0) {
+			if (next != NULL)
+				err = drbr_enqueue(ifp, txr->br, next);
 			break;
+		}
+		drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
 		ETHER_BPF_MTAP(ifp, next);
 		/* Set the watchdog */
 		txr->watchdog_timer = IGB_TX_TIMEOUT;
@@ -1531,8 +1536,11 @@ igb_update_aim(struct rx_ring *rxr)
 	if (olditr != newitr) {
 		/* Change interrupt rate */
 		rxr->eitr_setting = newitr;
-		E1000_WRITE_REG(&adapter->hw, E1000_EITR(rxr->me),
-		    newitr | (newitr << 16));
+		if (adapter->hw.mac.type == e1000_82575)
+			newitr |= newitr << 16;
+		else
+			newitr |= 0x8000000;
+		E1000_WRITE_REG(&adapter->hw, E1000_EITR(rxr->me), newitr);
 	}
 
 	rxr->bytes = 0;

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 17:12:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 730FC106566C;
	Fri, 11 Sep 2009 17:12:44 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 618998FC14;
	Fri, 11 Sep 2009 17:12:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BHCium058174;
	Fri, 11 Sep 2009 17:12:44 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BHCikr058172;
	Fri, 11 Sep 2009 17:12:44 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200909111712.n8BHCikr058172@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 11 Sep 2009 17:12:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197094 - in stable/7/sys: . contrib/pf dev/mii
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 17:12:44 -0000

Author: yongari
Date: Fri Sep 11 17:12:43 2009
New Revision: 197094
URL: http://svn.freebsd.org/changeset/base/197094

Log:
  MFC r196366:
    Backout r193289. r193289 restored page select bits to previous
    value instead of blindly resetting it to 0. However, it seems page
    select bits of some 88E1116 PHY is initialized to invalid one such
    that restoring page select bits after programming broke MII
    register access. The correct solution would be reset page select
    bits to 0 in PHY attach stage but it would require more testing.
    Since we're in BETA stage such a change would be dangerous so just
    back it out.
    This change should fix nfe(4) breakage on NVIDIA MCP55.
  
    Reported by:	Ryan Rogers < webmaster <> doghouserepair dot com >
  		Sam Fourman Jr. < sfourman <> gmail dot com >
    Tested by:	Ryan Rogers < webmaster <> doghouserepair dot com >
  		Sam Fourman Jr. < sfourman <> gmail dot com >

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/mii/e1000phy.c

Modified: stable/7/sys/dev/mii/e1000phy.c
==============================================================================
--- stable/7/sys/dev/mii/e1000phy.c	Fri Sep 11 16:53:12 2009	(r197093)
+++ stable/7/sys/dev/mii/e1000phy.c	Fri Sep 11 17:12:43 2009	(r197094)
@@ -239,13 +239,11 @@ e1000phy_reset(struct mii_softc *sc)
 
 		if (esc->mii_model == MII_MODEL_MARVELL_E1116 ||
 		    esc->mii_model == MII_MODEL_MARVELL_E1149) {
-			page = PHY_READ(sc, E1000_EADR);
-			/* Select page 2, MAC specific control register. */
 			PHY_WRITE(sc, E1000_EADR, 2);
 			reg = PHY_READ(sc, E1000_SCR);
 			reg |= E1000_SCR_RGMII_POWER_UP;
 			PHY_WRITE(sc, E1000_SCR, reg);
-			PHY_WRITE(sc, E1000_EADR, page);
+			PHY_WRITE(sc, E1000_EADR, 0);
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 17:15:18 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DBF6F1065676;
	Fri, 11 Sep 2009 17:15:18 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B214B8FC1D;
	Fri, 11 Sep 2009 17:15:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BHFI8v058285;
	Fri, 11 Sep 2009 17:15:18 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BHFIgW058282;
	Fri, 11 Sep 2009 17:15:18 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200909111715.n8BHFIgW058282@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 11 Sep 2009 17:15:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197095 - in stable/7/sys: . contrib/pf dev/re pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 17:15:19 -0000

Author: yongari
Date: Fri Sep 11 17:15:18 2009
New Revision: 197095
URL: http://svn.freebsd.org/changeset/base/197095

Log:
  MFC r196516:
    Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to
    the description of RTL8168D as RL_HWREV_8168D can be either
    RTL8168D or RTL8111D.
  
    PR:	kern/137672

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/re/if_re.c
  stable/7/sys/pci/if_rlreg.h

Modified: stable/7/sys/dev/re/if_re.c
==============================================================================
--- stable/7/sys/dev/re/if_re.c	Fri Sep 11 17:12:43 2009	(r197094)
+++ stable/7/sys/dev/re/if_re.c	Fri Sep 11 17:15:18 2009	(r197095)
@@ -174,8 +174,8 @@ static struct rl_type re_devs[] = {
 	{ RT_VENDORID, RT_DEVICEID_8101E, 0,
 	    "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" },
 	{ RT_VENDORID, RT_DEVICEID_8168, 0,
-	    "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe "
-	    "Gigabit Ethernet" },
+	    "RealTek 8168/8168B/8168C/8168CP/8168D/8168DP/"
+	    "8111B/8111C/8111CP/8111DP PCIe Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169, 0,
 	    "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169SC, 0,
@@ -216,7 +216,8 @@ static struct rl_hwrev re_hwrevs[] = {
 	{ RL_HWREV_8168C, RL_8169, "8168C/8111C"},
 	{ RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"},
 	{ RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"},
-	{ RL_HWREV_8168D, RL_8169, "8168D"},
+	{ RL_HWREV_8168D, RL_8169, "8168D/8111D"},
+	{ RL_HWREV_8168DP, RL_8169, "8168DP/8111DP"},
 	{ 0, 0, NULL }
 };
 
@@ -1280,6 +1281,7 @@ re_attach(device_t dev)
 		/* FALLTHROUGH */
 	case RL_HWREV_8168CP:
 	case RL_HWREV_8168D:
+	case RL_HWREV_8168DP:
 		sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
 		    RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP;
 		/*

Modified: stable/7/sys/pci/if_rlreg.h
==============================================================================
--- stable/7/sys/pci/if_rlreg.h	Fri Sep 11 17:12:43 2009	(r197094)
+++ stable/7/sys/pci/if_rlreg.h	Fri Sep 11 17:15:18 2009	(r197095)
@@ -160,6 +160,7 @@
 #define RL_HWREV_8169_8110SC	0x18000000
 #define RL_HWREV_8102EL		0x24800000
 #define RL_HWREV_8168D		0x28000000
+#define RL_HWREV_8168DP		0x28800000
 #define RL_HWREV_8168_SPIN1	0x30000000
 #define RL_HWREV_8100E		0x30800000
 #define RL_HWREV_8101E		0x34000000

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 17:18:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F4B31065698;
	Fri, 11 Sep 2009 17:18:08 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E5758FC13;
	Fri, 11 Sep 2009 17:18:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BHI8Ao058384;
	Fri, 11 Sep 2009 17:18:08 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BHI83b058382;
	Fri, 11 Sep 2009 17:18:08 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200909111718.n8BHI83b058382@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 11 Sep 2009 17:18:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197096 - in stable/7/sys: . contrib/pf dev/alc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 17:18:08 -0000

Author: yongari
Date: Fri Sep 11 17:18:08 2009
New Revision: 197096
URL: http://svn.freebsd.org/changeset/base/197096

Log:
  MFC r195989:
    Free allocated Rx ring dma memory/tags.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/alc/if_alc.c

Modified: stable/7/sys/dev/alc/if_alc.c
==============================================================================
--- stable/7/sys/dev/alc/if_alc.c	Fri Sep 11 17:15:18 2009	(r197095)
+++ stable/7/sys/dev/alc/if_alc.c	Fri Sep 11 17:18:08 2009	(r197096)
@@ -1501,6 +1501,21 @@ alc_dma_free(struct alc_softc *sc)
 		bus_dma_tag_destroy(sc->alc_cdata.alc_tx_ring_tag);
 		sc->alc_cdata.alc_tx_ring_tag = NULL;
 	}
+	/* Rx ring. */
+	if (sc->alc_cdata.alc_rx_ring_tag != NULL) {
+		if (sc->alc_cdata.alc_rx_ring_map != NULL)
+			bus_dmamap_unload(sc->alc_cdata.alc_rx_ring_tag,
+			    sc->alc_cdata.alc_rx_ring_map);
+		if (sc->alc_cdata.alc_rx_ring_map != NULL &&
+		    sc->alc_rdata.alc_rx_ring != NULL)
+			bus_dmamem_free(sc->alc_cdata.alc_rx_ring_tag,
+			    sc->alc_rdata.alc_rx_ring,
+			    sc->alc_cdata.alc_rx_ring_map);
+		sc->alc_rdata.alc_rx_ring = NULL;
+		sc->alc_cdata.alc_rx_ring_map = NULL;
+		bus_dma_tag_destroy(sc->alc_cdata.alc_rx_ring_tag);
+		sc->alc_cdata.alc_rx_ring_tag = NULL;
+	}
 	/* Rx return ring. */
 	if (sc->alc_cdata.alc_rr_ring_tag != NULL) {
 		if (sc->alc_cdata.alc_rr_ring_map != NULL)

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 17:20:11 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4378106566B;
	Fri, 11 Sep 2009 17:20:11 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C5BF58FC1C;
	Fri, 11 Sep 2009 17:20:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BHKB3u058478;
	Fri, 11 Sep 2009 17:20:11 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BHKBCn058476;
	Fri, 11 Sep 2009 17:20:11 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200909111720.n8BHKBCn058476@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 11 Sep 2009 17:20:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197097 - in stable/7/sys: . contrib/pf dev/alc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 17:20:12 -0000

Author: yongari
Date: Fri Sep 11 17:20:11 2009
New Revision: 197097
URL: http://svn.freebsd.org/changeset/base/197097

Log:
  MFC r196517:
    Don't try to power down PHY when alc(4) failed to map the device.
    This fixes system crash when mapping alc(4) device failed in device
    attach.
  
    Reported by:	Jim < stapleton.41 <> gmail DOT com >

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/alc/if_alc.c

Modified: stable/7/sys/dev/alc/if_alc.c
==============================================================================
--- stable/7/sys/dev/alc/if_alc.c	Fri Sep 11 17:18:08 2009	(r197096)
+++ stable/7/sys/dev/alc/if_alc.c	Fri Sep 11 17:20:11 2009	(r197097)
@@ -858,7 +858,8 @@ alc_detach(device_t dev)
 			sc->alc_intrhand[i] = NULL;
 		}
 	}
-	alc_phy_down(sc);
+	if (sc->alc_res[0] != NULL)
+		alc_phy_down(sc);
 	bus_release_resources(dev, sc->alc_irq_spec, sc->alc_irq);
 	if ((sc->alc_flags & (ALC_FLAG_MSI | ALC_FLAG_MSIX)) != 0)
 		pci_release_msi(dev);

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 17:25:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1206F1065694;
	Fri, 11 Sep 2009 17:25:25 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 00B9E8FC15;
	Fri, 11 Sep 2009 17:25:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BHPOE8058645;
	Fri, 11 Sep 2009 17:25:24 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BHPOQt058643;
	Fri, 11 Sep 2009 17:25:24 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200909111725.n8BHPOQt058643@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 11 Sep 2009 17:25:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197098 - in stable/7/sys: . contrib/pf dev/txp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 17:25:25 -0000

Author: yongari
Date: Fri Sep 11 17:25:24 2009
New Revision: 197098
URL: http://svn.freebsd.org/changeset/base/197098

Log:
  MFC r196721:
    Make sure rx descriptor ring align on 16 bytes. I guess the
    alignment requirement could be multiple of 4 bytes but I think
    using descriptor size would make intention clearer.
    Previously the size of rx descriptor was not power of 2 so it
    caused panic in bus_dmamem_alloc(9).
  
    Reported by:	Jeff Blank (jb000003 <> mr-happy dot com)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/txp/if_txp.c

Modified: stable/7/sys/dev/txp/if_txp.c
==============================================================================
--- stable/7/sys/dev/txp/if_txp.c	Fri Sep 11 17:20:11 2009	(r197097)
+++ stable/7/sys/dev/txp/if_txp.c	Fri Sep 11 17:25:24 2009	(r197098)
@@ -1389,7 +1389,8 @@ txp_alloc_rings(struct txp_softc *sc)
 
 	/* High priority rx ring. */
 	error = txp_dma_alloc(sc, "hi priority rx ring",
-	    &sc->sc_cdata.txp_rxhiring_tag, sizeof(struct txp_rx_desc), 0,
+	    &sc->sc_cdata.txp_rxhiring_tag,
+	    roundup(sizeof(struct txp_rx_desc), 16), 0,
 	    &sc->sc_cdata.txp_rxhiring_map, (void **)&sc->sc_ldata.txp_rxhiring,
 	    sizeof(struct txp_rx_desc) * RX_ENTRIES,
 	    &sc->sc_ldata.txp_rxhiring_paddr);
@@ -1409,7 +1410,8 @@ txp_alloc_rings(struct txp_softc *sc)
 
 	/* Low priority rx ring. */
 	error = txp_dma_alloc(sc, "low priority rx ring",
-	    &sc->sc_cdata.txp_rxloring_tag, sizeof(struct txp_rx_desc), 0,
+	    &sc->sc_cdata.txp_rxloring_tag,
+	    roundup(sizeof(struct txp_rx_desc), 16), 0,
 	    &sc->sc_cdata.txp_rxloring_map, (void **)&sc->sc_ldata.txp_rxloring,
 	    sizeof(struct txp_rx_desc) * RX_ENTRIES,
 	    &sc->sc_ldata.txp_rxloring_paddr);

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 18:48:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46B691065679;
	Fri, 11 Sep 2009 18:48:50 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 365168FC14;
	Fri, 11 Sep 2009 18:48:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BImn8o060316;
	Fri, 11 Sep 2009 18:48:49 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BImnRM060314;
	Fri, 11 Sep 2009 18:48:49 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200909111848.n8BImnRM060314@svn.freebsd.org>
From: Andriy Gapon 
Date: Fri, 11 Sep 2009 18:48:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197099 - head/sys/dev/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 18:48:50 -0000

Author: avg
Date: Fri Sep 11 18:48:49 2009
New Revision: 197099
URL: http://svn.freebsd.org/changeset/base/197099

Log:
  pci(4): don't perform maximum register number check
  
  Different sub-kinds of PCI buses may have different rules and
  thus it is up for the bus backends to do proper input checks.
  For example, PCIe allows configuration register numbers < 0x1000,
  while for PCI proper the limit is 0x100.
  And, in fact, the buses already do the checks.
  
  Reviewed by:	jhb
  MFC after:	1 week
  X-ToDo:		add check for negative value to bus backends
  X-ToDo:		use named constant for maximum PCIe register

Modified:
  head/sys/dev/pci/pci_user.c

Modified: head/sys/dev/pci/pci_user.c
==============================================================================
--- head/sys/dev/pci/pci_user.c	Fri Sep 11 17:25:24 2009	(r197098)
+++ head/sys/dev/pci/pci_user.c	Fri Sep 11 18:48:49 2009	(r197099)
@@ -605,9 +605,8 @@ getconfexit:
 		case 4:
 		case 2:
 		case 1:
-			/* Make sure register is in bounds and aligned. */
+			/* Make sure register is not negative and aligned. */
 			if (io->pi_reg < 0 ||
-			    io->pi_reg + io->pi_width > PCI_REGMAX + 1 ||
 			    io->pi_reg & (io->pi_width - 1)) {
 				error = EINVAL;
 				break;

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 18:52:49 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D053A106566B;
	Fri, 11 Sep 2009 18:52:49 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 737528FC13;
	Fri, 11 Sep 2009 18:52:49 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n8BImVZx021294;
	Fri, 11 Sep 2009 12:48:31 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Fri, 11 Sep 2009 12:50:02 -0600 (MDT)
Message-Id: <20090911.125002.-108775446.imp@bsdimp.com>
To: brooks@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <20090910204249.GB55545@lor.one-eyed-alien.net>
References: <200909092028.n89KSw1N096254@svn.freebsd.org>
	<20090910.143327.74744740.imp@bsdimp.com>
	<20090910204249.GB55545@lor.one-eyed-alien.net>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r197047 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 18:52:49 -0000

In message: <20090910204249.GB55545@lor.one-eyed-alien.net>
            Brooks Davis  writes:
: On Thu, Sep 10, 2009 at 02:33:27PM -0600, Warner Losh wrote:
: > From: Brooks Davis 
: > Subject: svn commit: r197047 - head/share/man/man4
: > Date: Wed, 9 Sep 2009 20:28:58 +0000 (UTC)
: > 
: > > Author: brooks
: > > Date: Wed Sep  9 20:28:58 2009
: > > New Revision: 197047
: > > URL: http://svn.freebsd.org/changeset/base/197047
: > > 
: > > Log:
: > >   Mention that a few ed(4) devices don't emit link state change notices
: > >   and a workaround for dhclient.
: > 
: > I thought that I'd made it so that we report the link as active always
: > for those devices that don't support reporting the link status in the
: > hardware.  Is this really necessary still?
: 
: That fixes the case where dhclient never sees a link, but apparently
: doesn't deal with the fact that in 8.0 dhclient never starts without
: a link-up event.  It may be that we need to generate a single link-up
: event at startup to provide an equivalent workaround.

I thought the way that I did it does this...  How is it not doing that?

Warner


: > Warner
: > 
: > >   Reviewed by:	 thierry
: > >   MFC after:	3 days
: > > 
: > > Modified:
: > >   head/share/man/man4/ed.4
: > > 
: > > Modified: head/share/man/man4/ed.4
: > > ==============================================================================
: > > --- head/share/man/man4/ed.4	Wed Sep  9 19:40:54 2009	(r197046)
: > > +++ head/share/man/man4/ed.4	Wed Sep  9 20:28:58 2009	(r197047)
: > > @@ -425,3 +425,21 @@ driver is slow by today's standards.
: > >  .Pp
: > >  PC Card attachment supports the D-Link DMF650TX LAN/Modem card's Ethernet
: > >  port only at this time.
: > > +.Pp
: > > +Some devices supported by
: > > +.Nm
: > > +do no generate the link state change events used by
: > > +.Xr devd 8
: > > +to start
: > > +.Xr dhclinet 8 .
: > > +If you have problems with
: > > +.Xr dhclient 8
: > > +not starting and the device is always attached to the network it may
: > > +be possible to work around this by changing
: > > +.Dq Li DHCP
: > > +to
: > > +.Dq Li SYNCDHCP
: > > +in the
: > > +.Va ifconfig_ed0
: > > +entry in
: > > +.Pa /etc/rc.conf .
: > > 
: > 

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 21:09:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A35A71065670;
	Fri, 11 Sep 2009 21:09:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 926548FC20;
	Fri, 11 Sep 2009 21:09:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BL9x3M063584;
	Fri, 11 Sep 2009 21:09:59 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BL9xbb063582;
	Fri, 11 Sep 2009 21:09:59 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200909112109.n8BL9xbb063582@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 11 Sep 2009 21:09:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197101 - stable/7/release
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 21:09:59 -0000

Author: jhb
Date: Fri Sep 11 21:09:59 2009
New Revision: 197101
URL: http://svn.freebsd.org/changeset/base/197101

Log:
  MFC part of 180012:
  Changes to exclude .svn directories when building tarballs during release
  builds (not documented in the original commit to HEAD).

Modified:
  stable/7/release/   (props changed)
  stable/7/release/Makefile

Modified: stable/7/release/Makefile
==============================================================================
--- stable/7/release/Makefile	Fri Sep 11 19:23:11 2009	(r197100)
+++ stable/7/release/Makefile	Fri Sep 11 21:09:59 2009	(r197101)
@@ -731,7 +731,7 @@ release.6:
 	@rm -rf ${RD}/dists/ports/ports*
 	@mkdir -p ${RD}/dists/ports
 	@echo rolling ports/ports tarball
-	@tar --exclude CVS --exclude 'ports/distfiles/*' \
+	@tar --exclude CVS --exclude .svn --exclude 'ports/distfiles/*' \
 	  -czf ${RD}/dists/ports/ports.tgz -C /usr ports
 	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
 	@(cd ${RD}/dists/ports; \
@@ -834,7 +834,8 @@ release.8:
 .if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
 	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
 .endif
-	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
+	@tar --exclude CVS --exclude .svn -cf - \
+		-C ${.CURDIR}/../usr.sbin/sysinstall help | \
 		tar xf - -C ${RD}/mfsfd/stand
 	@mkdir -p ${RD}/mfsroot
 	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
@@ -1232,7 +1233,7 @@ doTARBALL:
 	@( cd ${SD} && \
 		tn=`echo ${TN} | tr 'A-Z' 'a-z'` && \
 		echo rolling ${TD}/$$tn tarball &&\
-		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
+		tar --exclude CVS --exclude .svn --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
 		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
 		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
 		    > ${RD}/dists/${TD}/$$tn.inf && \

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 21:47:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27DE41065672;
	Fri, 11 Sep 2009 21:47:45 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 165AB8FC08;
	Fri, 11 Sep 2009 21:47:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BLli3K064390;
	Fri, 11 Sep 2009 21:47:44 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BLlind064388;
	Fri, 11 Sep 2009 21:47:44 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909112147.n8BLlind064388@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 11 Sep 2009 21:47:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197102 - head/sys/dev/amdtemp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 21:47:45 -0000

Author: jkim
Date: Fri Sep 11 21:47:44 2009
New Revision: 197102
URL: http://svn.freebsd.org/changeset/base/197102

Log:
  Improve amdtemp(4) significantly:
  
  - Improve newer AMD processor support (Family 0Fh Revision F and later).
  - Adjust offset if DiodeOffet is set and valid.  Note it is experimental
  but it seems to give us more realistic temperatures.  Newer Linux driver
  blindly adds 21C for Family 0Fh desktop processors, however.
  - Always populate dev.cpu and dev.amdtemp sysctl trees regardless of probe
  order for consistency.  Previously, dev.cpu.N.temperature was not populated
  if amdtemp was loaded later than ACPI CPU driver and temperatures were not
  accessible from dev.amdtemp.N.sensor0 tree for Family 10h/11h processors.
  - Read the CPUID from PCI register instead of CPUID instruction to prevent
  possible revision mismatches on multi-socket system.
  - Change macros and variables to make them closer to AMD documents.
  - Fix style(9) nits and improve comments.

Modified:
  head/sys/dev/amdtemp/amdtemp.c

Modified: head/sys/dev/amdtemp/amdtemp.c
==============================================================================
--- head/sys/dev/amdtemp/amdtemp.c	Fri Sep 11 21:09:59 2009	(r197101)
+++ head/sys/dev/amdtemp/amdtemp.c	Fri Sep 11 21:47:44 2009	(r197102)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 2008, 2009 Rui Paulo 
  * Copyright (c) 2009 Norikatsu Shigemura 
+ * Copyright (c) 2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,8 +27,8 @@
  */
 
 /*
- * Driver for the AMD K8/K10/K11 thermal sensors. Initially based on the
- * k8temp Linux driver.
+ * Driver for the AMD CPU on-die thermal sensors for Family 0Fh/10h/11h procs.
+ * Initially based on the k8temp Linux driver.
  */
 
 #include 
@@ -35,18 +36,15 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
-#include 
-#include 
 #include 
+#include 
 
-#include 
 #include 
 
 typedef enum {
@@ -60,18 +58,19 @@ typedef enum {
 
 struct amdtemp_softc {
 	device_t	sc_dev;
-	int		sc_temps[4];
+	uint32_t	sc_mask;
+	int		sc_ncores;
 	int		sc_ntemps;
-	struct sysctl_oid *sc_oid;
-	struct sysctl_oid *sc_sysctl_cpu[2];
+	int		sc_swap;
+	int32_t		(*sc_gettemp)(device_t, amdsensor_t);
+	struct sysctl_oid *sc_sysctl_cpu[MAXCPU];
 	struct intr_config_hook sc_ich;
-	int32_t (*sc_gettemp)(device_t, amdsensor_t);
 };
 
-#define VENDORID_AMD		0x1022
-#define DEVICEID_AMD_MISC0F	0x1103
-#define DEVICEID_AMD_MISC10	0x1203
-#define DEVICEID_AMD_MISC11	0x1303
+#define	VENDORID_AMD		0x1022
+#define	DEVICEID_AMD_MISC0F	0x1103
+#define	DEVICEID_AMD_MISC10	0x1203
+#define	DEVICEID_AMD_MISC11	0x1303
 
 static struct amdtemp_product {
 	uint16_t	amdtemp_vendorid;
@@ -84,22 +83,21 @@ static struct amdtemp_product {
 };
 
 /*
- * Register control (K8 family)
+ * Reported Temperature Control Register (Family 10h/11h only)
  */
-#define	AMDTEMP_REG0F		0xe4
-#define	AMDTEMP_REG_SELSENSOR	0x40
-#define	AMDTEMP_REG_SELCORE	0x04
+#define	AMDTEMP_REPTMP_CTRL	0xa4
 
 /*
- * Register control (K10 & K11) family
+ * Thermaltrip Status Register
  */
-#define	AMDTEMP_REG		0xa4
-
-#define	TZ_ZEROC		2732
+#define	AMDTEMP_THERMTP_STAT	0xe4
+#define	AMDTEMP_TTSR_SELCORE	0x04	/* Family 0Fh only */
+#define	AMDTEMP_TTSR_SELSENSOR	0x40	/* Family 0Fh only */
 
-					/* -49 C is the mininum temperature */
-#define	AMDTEMP_OFFSET0F	(TZ_ZEROC-490)
-#define	AMDTEMP_OFFSET		(TZ_ZEROC)
+/*
+ * CPU Family/Model Register
+ */
+#define	AMDTEMP_CPUID		0xfc
 
 /*
  * Device methods.
@@ -138,8 +136,8 @@ amdtemp_match(device_t dev)
 {
 	int i;
 	uint16_t vendor, devid;
-	
-        vendor = pci_get_vendor(dev);
+
+	vendor = pci_get_vendor(dev);
 	devid = pci_get_device(dev);
 
 	for (i = 0; amdtemp_products[i].amdtemp_vendorid != 0; i++) {
@@ -159,32 +157,47 @@ amdtemp_identify(driver_t *driver, devic
 	/* Make sure we're not being doubly invoked. */
 	if (device_find_child(parent, "amdtemp", -1) != NULL)
 		return;
-	
+
 	if (amdtemp_match(parent)) {
 		child = device_add_child(parent, "amdtemp", -1);
 		if (child == NULL)
 			device_printf(parent, "add amdtemp child failed\n");
 	}
-    
 }
 
 static int
 amdtemp_probe(device_t dev)
 {
-	uint32_t regs[4];
-	
+	uint32_t cpuid, family, model, temp;
+
 	if (resource_disabled("amdtemp", 0))
 		return (ENXIO);
 
-	do_cpuid(1, regs);
-	switch (regs[0]) {
-	case 0xf40:
-	case 0xf50:
-	case 0xf51:
+	cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
+	family = CPUID_TO_FAMILY(cpuid);
+	model = CPUID_TO_MODEL(cpuid);
+
+	switch (family) {
+	case 0x0f:
+		if ((model == 0x04 && (cpuid & CPUID_STEPPING) == 0) ||
+		    (model == 0x05 && (cpuid & CPUID_STEPPING) <= 1))
+			return (ENXIO);
+		break;
+	case 0x10:
+	case 0x11:
+		/*
+		 * DiodeOffset must be non-zero if thermal diode is supported.
+		 */
+		temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
+		temp = (temp >> 8) & 0x7f;
+		if (temp == 0)
+			return (ENXIO);
+		break;
+	default:
 		return (ENXIO);
 	}
-	device_set_desc(dev, "AMD K8 Thermal Sensors");
-	
+	device_set_desc(dev, "AMD CPU On-Die Thermal Sensors");
+
 	return (BUS_PROBE_GENERIC);
 }
 
@@ -194,63 +207,119 @@ amdtemp_attach(device_t dev)
 	struct amdtemp_softc *sc = device_get_softc(dev);
 	struct sysctl_ctx_list *sysctlctx;
 	struct sysctl_oid *sysctlnode;
+	uint32_t cpuid, family, model;
 
+	cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
+	family = CPUID_TO_FAMILY(cpuid);
+	model = CPUID_TO_MODEL(cpuid);
+
+	switch (family) {
+	case 0x0f:
+		/*
+		 * Thermaltrip Status Register - CurTmp
+		 *
+		 * Revision G:		bits 23-14
+		 * Earlier:		bits 23-16
+		 */
+		if (model >= 0x60 && model != 0xc1)
+			sc->sc_mask = 0x3ff << 14;
+		else
+			sc->sc_mask = 0xff << 16;
+
+		/*
+		 * Thermaltrip Status Register - ThermSenseCoreSel
+		 *
+		 * Revision F:		0 - Core1, 1 - Core0
+		 * Earlier:		0 - Core0, 1 - Core1
+		 */
+		sc->sc_swap = (model >= 0x40);
+
+		/*
+		 * There are two sensors per core.
+		 */
+		sc->sc_ntemps = 2;
 
-	/*
-	 * Setup intrhook function to create dev.cpu sysctl entries. This is
-	 * needed because the cpu driver may be loaded late on boot, after
-	 * us.
-	 */
-	sc->sc_ich.ich_func = amdtemp_intrhook;
-	sc->sc_ich.ich_arg = dev;
-	if (config_intrhook_establish(&sc->sc_ich) != 0) {
-		device_printf(dev, "config_intrhook_establish "
-		    "failed!\n");
-		return (ENXIO);
-	}
-	
-	if (pci_get_device(dev) == DEVICEID_AMD_MISC0F)
 		sc->sc_gettemp = amdtemp_gettemp0f;
-	else {
+		break;
+	case 0x10:
+	case 0x11:
+		/*
+		 * Reported Temperature Control Register - Curtmp
+		 */
+		sc->sc_mask = 0x3ff << 21;
+
+		/*
+		 * There is only one sensor per package.
+		 */
+		sc->sc_ntemps = 1;
+
 		sc->sc_gettemp = amdtemp_gettemp;
-		return (0);
+		break;
 	}
 
+	/* Find number of cores per package. */
+	sc->sc_ncores = (amd_feature2 & AMDID2_CMP) != 0 ?
+	    (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1;
+	if (sc->sc_ncores > MAXCPU)
+		return (ENXIO);
+
+	if (bootverbose)
+		device_printf(dev, "Found %d cores and %d sensors.\n",
+		    sc->sc_ncores,
+		    sc->sc_ntemps > 1 ? sc->sc_ntemps * sc->sc_ncores : 1);
+
 	/*
 	 * dev.amdtemp.N tree.
 	 */
 	sysctlctx = device_get_sysctl_ctx(dev);
 	sysctlnode = SYSCTL_ADD_NODE(sysctlctx,
-	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor0",
-	    CTLFLAG_RD, 0, "Sensor 0");
-	
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    "sensor0", CTLFLAG_RD, 0, "Sensor 0");
+
 	SYSCTL_ADD_PROC(sysctlctx,
 	    SYSCTL_CHILDREN(sysctlnode),
 	    OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD,
 	    dev, SENSOR0_CORE0, amdtemp_sysctl, "IK",
 	    "Sensor 0 / Core 0 temperature");
-	
-	SYSCTL_ADD_PROC(sysctlctx,
-	    SYSCTL_CHILDREN(sysctlnode),
-	    OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD,
-	    dev, SENSOR0_CORE1, amdtemp_sysctl, "IK",
-	    "Sensor 0 / Core 1 temperature");
-	
-	sysctlnode = SYSCTL_ADD_NODE(sysctlctx,
-	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor1",
-	    CTLFLAG_RD, 0, "Sensor 1");
-	
-	SYSCTL_ADD_PROC(sysctlctx,
-	    SYSCTL_CHILDREN(sysctlnode),
-	    OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD,
-	    dev, SENSOR1_CORE0, amdtemp_sysctl, "IK",
-	    "Sensor 1 / Core 0 temperature");
-	
-	SYSCTL_ADD_PROC(sysctlctx,
-	    SYSCTL_CHILDREN(sysctlnode),
-	    OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD,
-	    dev, SENSOR1_CORE1, amdtemp_sysctl, "IK",
-	    "Sensor 1 / Core 1 temperature");
+
+	if (sc->sc_ntemps > 1) {
+		if (sc->sc_ncores > 1)
+			SYSCTL_ADD_PROC(sysctlctx,
+			    SYSCTL_CHILDREN(sysctlnode),
+			    OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD,
+			    dev, SENSOR0_CORE1, amdtemp_sysctl, "IK",
+			    "Sensor 0 / Core 1 temperature");
+
+		sysctlnode = SYSCTL_ADD_NODE(sysctlctx,
+		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+		    "sensor1", CTLFLAG_RD, 0, "Sensor 1");
+
+		SYSCTL_ADD_PROC(sysctlctx,
+		    SYSCTL_CHILDREN(sysctlnode),
+		    OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD,
+		    dev, SENSOR1_CORE0, amdtemp_sysctl, "IK",
+		    "Sensor 1 / Core 0 temperature");
+
+		if (sc->sc_ncores > 1)
+			SYSCTL_ADD_PROC(sysctlctx,
+			    SYSCTL_CHILDREN(sysctlnode),
+			    OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD,
+			    dev, SENSOR1_CORE1, amdtemp_sysctl, "IK",
+			    "Sensor 1 / Core 1 temperature");
+	}
+
+	/*
+	 * Try to create dev.cpu sysctl entries and setup intrhook function.
+	 * This is needed because the cpu driver may be loaded late on boot,
+	 * after us.
+	 */
+	amdtemp_intrhook(dev);
+	sc->sc_ich.ich_func = amdtemp_intrhook;
+	sc->sc_ich.ich_arg = dev;
+	if (config_intrhook_establish(&sc->sc_ich) != 0) {
+		device_printf(dev, "config_intrhook_establish failed!\n");
+		return (ENXIO);
+	}
 
 	return (0);
 }
@@ -258,61 +327,67 @@ amdtemp_attach(device_t dev)
 void
 amdtemp_intrhook(void *arg)
 {
-	int i;
-	device_t nexus, acpi, cpu;
-	device_t dev = (device_t) arg;
 	struct amdtemp_softc *sc;
 	struct sysctl_ctx_list *sysctlctx;
+	device_t dev = (device_t)arg;
+	device_t acpi, cpu, nexus;
+	amdsensor_t sensor;
+	int i;
 
 	sc = device_get_softc(dev);
-	
+
 	/*
 	 * dev.cpu.N.temperature.
 	 */
 	nexus = device_find_child(root_bus, "nexus", 0);
 	acpi = device_find_child(nexus, "acpi", 0);
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < sc->sc_ncores; i++) {
+		if (sc->sc_sysctl_cpu[i] != NULL)
+			continue;
 		cpu = device_find_child(acpi, "cpu",
-		    device_get_unit(dev) * 2 + i);
-		if (cpu) {
+		    device_get_unit(dev) * sc->sc_ncores + i);
+		if (cpu != NULL) {
 			sysctlctx = device_get_sysctl_ctx(cpu);
 
+			sensor = sc->sc_ntemps > 1 ?
+			    (i == 0 ? CORE0 : CORE1) : SENSOR0_CORE0;
 			sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx,
 			    SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)),
 			    OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD,
-			    dev, CORE0, amdtemp_sysctl, "IK",
-			    "Max of sensor 0 / 1");
+			    dev, sensor, amdtemp_sysctl, "IK",
+			    "Current temparature");
 		}
 	}
-	config_intrhook_disestablish(&sc->sc_ich);
+	if (sc->sc_ich.ich_arg != NULL)
+		config_intrhook_disestablish(&sc->sc_ich);
 }
 
 int
 amdtemp_detach(device_t dev)
 {
-	int i;
 	struct amdtemp_softc *sc = device_get_softc(dev);
-	
-	for (i = 0; i < 2; i++) {
-		if (sc->sc_sysctl_cpu[i])
+	int i;
+
+	for (i = 0; i < sc->sc_ncores; i++)
+		if (sc->sc_sysctl_cpu[i] != NULL)
 			sysctl_remove_oid(sc->sc_sysctl_cpu[i], 1, 0);
-	}
 
 	/* NewBus removes the dev.amdtemp.N tree by itself. */
-	
+
 	return (0);
 }
 
 static int
 amdtemp_sysctl(SYSCTL_HANDLER_ARGS)
 {
-	device_t dev = (device_t) arg1;
+	device_t dev = (device_t)arg1;
 	struct amdtemp_softc *sc = device_get_softc(dev);
+	amdsensor_t sensor = (amdsensor_t)arg2;
+	int32_t auxtemp[2], temp;
 	int error;
-	int32_t temp, auxtemp[2];
 
-	switch (arg2) {
+	switch (sensor) {
 	case CORE0:
 		auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE0);
 		auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE0);
@@ -324,54 +399,80 @@ amdtemp_sysctl(SYSCTL_HANDLER_ARGS)
 		temp = imax(auxtemp[0], auxtemp[1]);
 		break;
 	default:
-		temp = sc->sc_gettemp(dev, arg2);
+		temp = sc->sc_gettemp(dev, sensor);
 		break;
 	}
 	error = sysctl_handle_int(oidp, &temp, 0, req);
-	
+
 	return (error);
 }
 
+#define	AMDTEMP_ZERO_C_TO_K	2732
+
 static int32_t
 amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
 {
-	uint8_t cfg;
+	struct amdtemp_softc *sc = device_get_softc(dev);
 	uint32_t temp;
-	
-	cfg = pci_read_config(dev, AMDTEMP_REG0F, 1);
+	int32_t diode_offset, offset;
+	uint8_t cfg, sel;
+
+	/* Set Sensor/Core selector. */
+	sel = 0;
 	switch (sensor) {
-	case SENSOR0_CORE0:
-		cfg &= ~(AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE);
-		break;
-	case SENSOR0_CORE1:
-		cfg &= ~AMDTEMP_REG_SELSENSOR;
-		cfg |= AMDTEMP_REG_SELCORE;
-		break;
 	case SENSOR1_CORE0:
-		cfg &= ~AMDTEMP_REG_SELCORE;
-		cfg |= AMDTEMP_REG_SELSENSOR;
+		sel |= AMDTEMP_TTSR_SELSENSOR;
+		/* FALLTROUGH */
+	case SENSOR0_CORE0:
+	case CORE0:
+		if (sc->sc_swap)
+			sel |= AMDTEMP_TTSR_SELCORE;
 		break;
 	case SENSOR1_CORE1:
-		cfg |= (AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE);
-		break;
-	default:
-		cfg = 0;
+		sel |= AMDTEMP_TTSR_SELSENSOR;
+		/* FALLTROUGH */
+	case SENSOR0_CORE1:
+	case CORE1:
+		if (!sc->sc_swap)
+			sel |= AMDTEMP_TTSR_SELCORE;
 		break;
 	}
-	pci_write_config(dev, AMDTEMP_REG0F, cfg, 1);
-	temp = pci_read_config(dev, AMDTEMP_REG0F, 4);
-	temp = ((temp >> 16) & 0xff) * 10 + AMDTEMP_OFFSET0F;
-	
+	cfg = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 1);
+	cfg &= ~(AMDTEMP_TTSR_SELSENSOR | AMDTEMP_TTSR_SELCORE);
+	pci_write_config(dev, AMDTEMP_THERMTP_STAT, cfg | sel, 1);
+
+	/* CurTmp starts from -49C. */
+	offset = AMDTEMP_ZERO_C_TO_K - 490;
+
+	/* Adjust offset if DiodeOffset is set and valid. */
+	temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
+	diode_offset = (temp >> 8) & 0x3f;
+	if (diode_offset != 0)
+		offset += (diode_offset - 11) * 10;
+
+	temp = ((temp & sc->sc_mask) >> 14) * 5 / 2 + offset;
+
 	return (temp);
 }
 
 static int32_t
 amdtemp_gettemp(device_t dev, amdsensor_t sensor)
 {
+	struct amdtemp_softc *sc = device_get_softc(dev);
 	uint32_t temp;
+	int32_t diode_offset, offset;
+
+	/* CurTmp starts from 0C. */
+	offset = AMDTEMP_ZERO_C_TO_K;
+
+	/* Adjust offset if DiodeOffset is set and valid. */
+	temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
+	diode_offset = (temp >> 8) & 0x7f;
+	if (diode_offset > 0 && diode_offset < 0x40)
+		offset += (diode_offset - 11) * 10;
 
-	temp = pci_read_config(dev, AMDTEMP_REG, 4);
-	temp = ((temp >> 21) & 0x3ff) * 10 / 8 + AMDTEMP_OFFSET;
+	temp = pci_read_config(dev, AMDTEMP_REPTMP_CTRL, 4);
+	temp = ((temp & sc->sc_mask) >> 21) * 5 / 4 + offset;
 
 	return (temp);
 }

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 22:06:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 68ED9106566B;
	Fri, 11 Sep 2009 22:06:01 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 58BA58FC08;
	Fri, 11 Sep 2009 22:06:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BM5xMS064822;
	Fri, 11 Sep 2009 22:05:59 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BM5xD1064820;
	Fri, 11 Sep 2009 22:05:59 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909112205.n8BM5xD1064820@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 11 Sep 2009 22:05:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197103 - head/sys/dev/amdtemp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 22:06:01 -0000

Author: jkim
Date: Fri Sep 11 22:05:59 2009
New Revision: 197103
URL: http://svn.freebsd.org/changeset/base/197103

Log:
  Fix typos in comments from the previous commit.

Modified:
  head/sys/dev/amdtemp/amdtemp.c

Modified: head/sys/dev/amdtemp/amdtemp.c
==============================================================================
--- head/sys/dev/amdtemp/amdtemp.c	Fri Sep 11 21:47:44 2009	(r197102)
+++ head/sys/dev/amdtemp/amdtemp.c	Fri Sep 11 22:05:59 2009	(r197103)
@@ -422,7 +422,7 @@ amdtemp_gettemp0f(device_t dev, amdsenso
 	switch (sensor) {
 	case SENSOR1_CORE0:
 		sel |= AMDTEMP_TTSR_SELSENSOR;
-		/* FALLTROUGH */
+		/* FALLTHROUGH */
 	case SENSOR0_CORE0:
 	case CORE0:
 		if (sc->sc_swap)
@@ -430,7 +430,7 @@ amdtemp_gettemp0f(device_t dev, amdsenso
 		break;
 	case SENSOR1_CORE1:
 		sel |= AMDTEMP_TTSR_SELSENSOR;
-		/* FALLTROUGH */
+		/* FALLTHROUGH */
 	case SENSOR0_CORE1:
 	case CORE1:
 		if (!sc->sc_swap)

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 22:48:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C4D2106566C;
	Fri, 11 Sep 2009 22:48:54 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 283B68FC14;
	Fri, 11 Sep 2009 22:48:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BMmsdo065775;
	Fri, 11 Sep 2009 22:48:54 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BMmsXX065768;
	Fri, 11 Sep 2009 22:48:54 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909112248.n8BMmsXX065768@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 11 Sep 2009 22:48:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197104 - in head/sys/contrib/dev/acpica: . common
	compiler debugger dispatcher events executer hardware include
	namespace parser tables tools/acpiexec utilities
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 22:48:54 -0000

Author: jkim
Date: Fri Sep 11 22:48:53 2009
New Revision: 197104
URL: http://svn.freebsd.org/changeset/base/197104

Log:
  MFV:	r196804
  
  Import ACPICA 20090903

Added:
  head/sys/contrib/dev/acpica/include/actbl2.h   (contents, props changed)
  head/sys/contrib/dev/acpica/namespace/nsrepair.c
     - copied unchanged from r197103, vendor-sys/acpica/dist/namespace/nsrepair.c
  head/sys/contrib/dev/acpica/utilities/utids.c
     - copied unchanged from r197103, vendor-sys/acpica/dist/utilities/utids.c
Modified:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/acpica_prep.sh
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/dmrestag.c
  head/sys/contrib/dev/acpica/common/dmtable.c
  head/sys/contrib/dev/acpica/common/dmtbdump.c
  head/sys/contrib/dev/acpica/common/dmtbinfo.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/aslcompiler.l
  head/sys/contrib/dev/acpica/compiler/aslcompiler.y
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/asllookup.c
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslmap.c
  head/sys/contrib/dev/acpica/compiler/aslstubs.c
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/debugger/dbcmds.c
  head/sys/contrib/dev/acpica/debugger/dbdisply.c
  head/sys/contrib/dev/acpica/debugger/dbexec.c
  head/sys/contrib/dev/acpica/dispatcher/dsfield.c
  head/sys/contrib/dev/acpica/dispatcher/dsmethod.c
  head/sys/contrib/dev/acpica/dispatcher/dsmthdat.c
  head/sys/contrib/dev/acpica/dispatcher/dsobject.c
  head/sys/contrib/dev/acpica/dispatcher/dswload.c
  head/sys/contrib/dev/acpica/events/evgpe.c
  head/sys/contrib/dev/acpica/events/evgpeblk.c
  head/sys/contrib/dev/acpica/events/evrgnini.c
  head/sys/contrib/dev/acpica/executer/exconfig.c
  head/sys/contrib/dev/acpica/executer/exfield.c
  head/sys/contrib/dev/acpica/executer/exfldio.c
  head/sys/contrib/dev/acpica/executer/exstorob.c
  head/sys/contrib/dev/acpica/executer/exutils.c
  head/sys/contrib/dev/acpica/hardware/hwgpe.c
  head/sys/contrib/dev/acpica/hardware/hwregs.c
  head/sys/contrib/dev/acpica/hardware/hwsleep.c
  head/sys/contrib/dev/acpica/hardware/hwtimer.c
  head/sys/contrib/dev/acpica/hardware/hwxface.c
  head/sys/contrib/dev/acpica/include/acconfig.h
  head/sys/contrib/dev/acpica/include/acdebug.h
  head/sys/contrib/dev/acpica/include/acdisasm.h
  head/sys/contrib/dev/acpica/include/acglobal.h
  head/sys/contrib/dev/acpica/include/achware.h
  head/sys/contrib/dev/acpica/include/acinterp.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acmacros.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acobject.h
  head/sys/contrib/dev/acpica/include/acparser.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acpredef.h
  head/sys/contrib/dev/acpica/include/actbl.h
  head/sys/contrib/dev/acpica/include/actbl1.h
  head/sys/contrib/dev/acpica/include/actypes.h
  head/sys/contrib/dev/acpica/include/acutils.h
  head/sys/contrib/dev/acpica/include/amlcode.h
  head/sys/contrib/dev/acpica/namespace/nsalloc.c
  head/sys/contrib/dev/acpica/namespace/nseval.c
  head/sys/contrib/dev/acpica/namespace/nsinit.c
  head/sys/contrib/dev/acpica/namespace/nsload.c
  head/sys/contrib/dev/acpica/namespace/nspredef.c
  head/sys/contrib/dev/acpica/namespace/nsxfeval.c
  head/sys/contrib/dev/acpica/namespace/nsxfname.c
  head/sys/contrib/dev/acpica/parser/psloop.c
  head/sys/contrib/dev/acpica/parser/psxface.c
  head/sys/contrib/dev/acpica/tables/tbutils.c
  head/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h
  head/sys/contrib/dev/acpica/utilities/uteval.c
  head/sys/contrib/dev/acpica/utilities/utglobal.c
  head/sys/contrib/dev/acpica/utilities/utinit.c
  head/sys/contrib/dev/acpica/utilities/utmisc.c
  head/sys/contrib/dev/acpica/utilities/utxface.c

Modified: head/sys/contrib/dev/acpica/acpica_prep.sh
==============================================================================
--- head/sys/contrib/dev/acpica/acpica_prep.sh	Fri Sep 11 22:05:59 2009	(r197103)
+++ head/sys/contrib/dev/acpica/acpica_prep.sh	Fri Sep 11 22:48:53 2009	(r197104)
@@ -21,7 +21,7 @@ fulldirs="common compiler debugger disas
 # files to remove
 stripdirs="acpisrc acpixtract examples generate os_specific"
 stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h	\
-	acos2.h accygwin.h acefi.h actbl2.h acwin.h acwin64.h aeexec.c	\
+	acos2.h accygwin.h acefi.h acwin.h acwin64.h aeexec.c		\
 	aehandlers.c aemain.c aetables.c osunixdir.c readme.txt		\
 	utclib.c"
 
@@ -31,8 +31,8 @@ src_headers="acapps.h accommon.h acconfi
 	aclocal.h acmacros.h acnames.h acnamesp.h acobject.h acopcode.h	\
 	acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h	\
 	acresrc.h acrestyp.h acstruct.h actables.h actbl.h actbl1.h	\
-	actypes.h acutils.h amlcode.h amlresrc.h platform/acenv.h	\
-	platform/acfreebsd.h platform/acgcc.h"
+	actbl2.h actypes.h acutils.h amlcode.h amlresrc.h		\
+	platform/acenv.h platform/acfreebsd.h platform/acgcc.h"
 comp_headers="aslcompiler.h asldefine.h aslglobal.h asltypes.h"
 platform_headers="acfreebsd.h acgcc.h"
 

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Fri Sep 11 22:05:59 2009	(r197103)
+++ head/sys/contrib/dev/acpica/changes.txt	Fri Sep 11 22:48:53 2009	(r197104)
@@ -1,4 +1,227 @@
 ----------------------------------------
+03 September 2009. Summary of changes for version 20090903:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+For Windows Vista compatibility, added the automatic execution of an _INI 
+method located at the namespace root (\_INI). This method is executed at 
+table load time. This support is in addition to the automatic execution of 
+\_SB._INI. Lin Ming.
+
+Fixed a possible memory leak in the interpreter for AML package objects if 
+the package initializer list is longer than the defined size of the package. 
+This apparently can only happen if the BIOS changes the package size on the 
+fly (seen in a _PSS object), as ASL compilers do not allow this. The 
+interpreter will truncate the package to the defined size (and issue an error 
+message), but previously could leave the extra objects undeleted if they were 
+pre-created during the argument processing (such is the case if the package 
+consists of a number of sub-packages as in the _PSS.) ACPICA BZ 805.
+
+Fixed a problem seen when a Buffer or String is stored to itself via ASL. 
+This has been reported in the field. Previously, ACPICA would zero out the 
+buffer/string. Now, the operation is treated as a noop. Provides Windows 
+compatibility. ACPICA BZ 803. Lin Ming.
+
+Removed an extraneous error message for ASL constructs of the form 
+Store(LocalX,LocalX) when LocalX is uninitialized. These curious statements 
+are seen in many BIOSs and are once again treated as NOOPs and no error is 
+emitted when they are encountered. ACPICA BZ 785.
+
+Fixed an extraneous warning message if a _DSM reserved method returns a 
+Package object. _DSM can return any type of object, so validation on the 
+return type cannot be performed. ACPICA BZ 802.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  85.5K Code, 18.0K Data, 103.5K Total
+    Debug Version:     161.6K Code, 50.9K Data, 212.5K Total
+  Current Release:
+    Non-Debug Version:  85.6K Code, 18.0K Data, 103.6K Total
+    Debug Version:     161.7K Code, 50.9K Data, 212.6K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Fixed a problem with the use of the Alias operator and Resource 
+Templates. The correct alias is now constructed and no error is emitted. 
+ACPICA BZ 738.
+
+iASL: Implemented the -I option to specify additional search directories for 
+include files. Allows multiple additional search paths for include files. 
+Directories are searched in the order specified on the command line (after 
+the local directory is searched.) ACPICA BZ 800.
+
+iASL: Fixed a problem where the full pathname for include files was not 
+emitted for warnings/errors. This caused the IDE support to not work 
+properly. ACPICA BZ 765.
+
+iASL: Implemented the -@ option to specify a Windows-style response file 
+containing additional command line options. ACPICA BZ 801.
+
+AcpiExec: Added support to load multiple AML files simultaneously (such as a 
+DSDT and multiple SSDTs). Also added support for wildcards within the AML 
+pathname. These features allow all machine tables to be easily loaded and 
+debugged together. ACPICA BZ 804.
+
+Disassembler: Added missing support for disassembly of HEST table Error Bank 
+subtables. 
+
+----------------------------------------
+30 July 2009. Summary of changes for version 20090730:
+
+This release is available at www.acpica.org/downloads
+
+The ACPI 4.0 implementation for ACPICA is complete with this release.
+
+1) ACPI CA Core Subsystem:
+
+ACPI 4.0: Added header file support for all new and changed ACPI tables. 
+Completely new tables are: IBFT, IVRS, MSCT, and WAET. Tables that are new 
+for ACPI 4.0, but have previously been supported in ACPICA are: CPEP, BERT, 
+EINJ, ERST, and HEST. Other newly supported tables are: UEFI and WDAT. There 
+have been some ACPI 4.0 changes to other existing tables. Split the large 
+actbl1.h header into the existing actbl2.h header. ACPICA BZ 774.
+
+ACPI 4.0: Implemented predefined name validation for all new names. There are 
+31 new names in ACPI 4.0. The predefined validation module was split into two 
+files. The new file is namespace/nsrepair.c. ACPICA BZ 770.
+
+Implemented support for so-called "module-level executable code". This is 
+executable AML code that exists outside of any control method and is intended 
+to be executed at table load time. Although illegal since ACPI 2.0, this type 
+of code still exists and is apparently still being created. Blocks of this 
+code are now detected and executed as intended. Currently, the code blocks 
+must exist under either an If, Else, or While construct; these are the 
+typical cases seen in the field. ACPICA BZ 762. Lin Ming.
+
+Implemented an automatic dynamic repair for predefined names that return 
+nested Package objects. This applies to predefined names that are defined to 
+return a variable-length Package of sub-packages. If the number of sub-
+packages is one, BIOS code is occasionally seen that creates a simple single 
+package with no sub-packages. This code attempts to fix the problem by 
+wrapping a new package object around the existing package. These methods can 
+be repaired: _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, and _TSS. ACPICA BZ 
+790.
+
+Fixed a regression introduced in 20090625 for the AcpiGetDevices interface. 
+The _HID/_CID matching was broken and no longer matched IDs correctly. ACPICA 
+BZ 793.
+
+Fixed a problem with AcpiReset where the reset would silently fail if the 
+register was one of the protected I/O ports. AcpiReset now bypasses the port 
+validation mechanism. This may eventually be driven into the AcpiRead/Write 
+interfaces.
+
+Fixed a regression related to the recent update of the AcpiRead/Write 
+interfaces. A sleep/suspend could fail if the optional PM2 Control register 
+does not exist during an attempt to write the Bus Master Arbitration bit. 
+(However, some hosts already delete the code that writes this bit, and the 
+code may in fact be obsolete at this date.) ACPICA BZ 799.
+
+Fixed a problem where AcpiTerminate could fault if inadvertently called twice 
+in succession. ACPICA BZ 795.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  84.7K Code, 17.8K Data, 102.5K Total
+    Debug Version:     160.5K Code, 50.6K Data, 211.1K Total
+  Current Release:
+    Non-Debug Version:  85.5K Code, 18.0K Data, 103.5K Total
+    Debug Version:     161.6K Code, 50.9K Data, 212.5K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+ACPI 4.0: Implemented disassembler support for all new ACPI tables and 
+changes to existing tables. ACPICA BZ 775.
+
+----------------------------------------
+25 June 2009. Summary of changes for version 20090625:
+
+This release is available at www.acpica.org/downloads
+
+The ACPI 4.0 Specification was released on June 16 and is available at 
+www.acpi.info. ACPICA implementation of ACPI 4.0 is underway and will 
+continue for the next few releases.
+
+1) ACPI CA Core Subsystem:
+
+ACPI 4.0: Implemented interpreter support for the IPMI operation region 
+address space. Includes support for bi-directional data buffers and an IPMI 
+address space handler (to be installed by an IPMI device driver.) ACPICA BZ 
+773. Lin Ming.
+
+ACPI 4.0: Added changes for existing ACPI tables - FACS and SRAT. Includes 
+support in both the header files and the disassembler.
+
+Completed a major update for the AcpiGetObjectInfo external interface. 
+Changes include:
+ - Support for variable, unlimited length HID, UID, and CID strings.
+ - Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.)
+ - Call the _SxW power methods on behalf of a device object.
+ - Determine if a device is a PCI root bridge.
+ - Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO.
+These changes will require an update to all callers of this interface. See 
+the updated ACPICA Programmer Reference for details. One new source file has 
+been added - utilities/utids.c. ACPICA BZ 368, 780.
+
+Updated the AcpiRead and AcpiWrite external interfaces to support 64-bit 
+transfers. The Value parameter has been extended from 32 bits to 64 bits in 
+order to support new ACPI 4.0 tables. These changes will require an update to 
+all callers of these interfaces. See the ACPICA Programmer Reference for 
+details. ACPICA BZ 768.
+
+Fixed several problems with AcpiAttachData. The handler was not invoked when 
+the host node was deleted. The data sub-object was not automatically deleted 
+when the host node was deleted. The interface to the handler had an unused 
+parameter, this was removed. ACPICA BZ 778.
+
+Enhanced the function that dumps ACPI table headers. All non-printable 
+characters in the string fields are now replaced with '?' (Signature, OemId, 
+OemTableId, and CompilerId.) ACPI tables with non-printable characters in 
+these fields are occasionally seen in the field. ACPICA BZ 788.
+
+Fixed a problem with predefined method repair code where the code that 
+attempts to repair/convert an object of incorrect type is only executed on 
+the first time the predefined method is called. The mechanism that disables 
+warnings on subsequent calls was interfering with the repair mechanism. 
+ACPICA BZ 781.
+
+Fixed a possible memory leak in the predefined validation/repair code when a 
+buffer is automatically converted to an expected string object.
+
+Removed obsolete 16-bit files from the distribution and from the current git 
+tree head. ACPICA BZ 776.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  83.4K Code, 17.5K Data, 100.9K Total
+    Debug Version:     158.9K Code, 50.0K Data, 208.9K Total
+  Current Release:
+    Non-Debug Version:  84.7K Code, 17.8K Data, 102.5K Total
+    Debug Version:     160.5K Code, 50.6K Data, 211.1K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+ACPI 4.0: iASL and Disassembler - implemented support for the new IPMI 
+operation region keyword. ACPICA BZ 771, 772. Lin Ming.
+
+ACPI 4.0: iASL - implemented compile-time validation support for all new 
+predefined names and control methods (31 total). ACPICA BZ 769.
+
+----------------------------------------
 21 May 2009. Summary of changes for version 20090521:
 
 This release is available at www.acpica.org/downloads

Modified: head/sys/contrib/dev/acpica/common/dmrestag.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmrestag.c	Fri Sep 11 22:05:59 2009	(r197103)
+++ head/sys/contrib/dev/acpica/common/dmrestag.c	Fri Sep 11 22:48:53 2009	(r197104)
@@ -387,7 +387,7 @@ static ACPI_RESOURCE_TAG        *AcpiGbl
 
 static UINT32                   AcpiGbl_NextResourceId = 0;
 static UINT8                    AcpiGbl_NextPrefix = 0;
-static UINT8                    AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
+static char                     AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
                                     {'Y','Z','J','K','X'};
 
 

Modified: head/sys/contrib/dev/acpica/common/dmtable.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtable.c	Fri Sep 11 22:05:59 2009	(r197103)
+++ head/sys/contrib/dev/acpica/common/dmtable.c	Fri Sep 11 22:48:53 2009	(r197104)
@@ -132,6 +132,7 @@ AcpiDmGetTableData (
 static void
 AcpiDmCheckAscii (
     UINT8                   *Target,
+    char                    *RepairedName,
     UINT32                  Count);
 
 UINT8
@@ -156,17 +157,18 @@ static const char           *AcpiDmDmarS
     "Hardware Unit Definition",
     "Reserved Memory Region",
     "Root Port ATS Capability",
+    "Remapping Hardware Static Affinity",
     "Unknown SubTable Type"         /* Reserved */
 };
 
 static const char           *AcpiDmHestSubnames[] =
 {
-    "XPF Machine Check Exception",
-    "XPF Corrected Machine Check",
-    "NOT USED???",
-    "XPF Non-Maskable Interrupt",
-    "IPF Corrected Machine Check",
-    "IPF Corrected Platform Error",
+    "IA-32 Machine Check Exception",
+    "IA-32 Corrected Machine Check",
+    "IA-32 Non-Maskable Interrupt",
+    "Unknown SubTable Type",        /* 3 - Reserved */
+    "Unknown SubTable Type",        /* 4 - Reserved */
+    "Unknown SubTable Type",        /* 5 - Reserved */
     "PCI Express Root Port AER",
     "PCI Express AER (AER Endpoint)",
     "PCI Express/PCI-X Bridge AER",
@@ -208,6 +210,14 @@ static const char           *AcpiDmSratS
     "Unknown SubTable Type"         /* Reserved */
 };
 
+static const char           *AcpiDmIvrsSubnames[] =
+{
+    "Hardware Definition Block",
+    "Memory Definition Block",
+    "Unknown SubTable Type"         /* Reserved */
+};
+
+
 
 #define ACPI_FADT_PM_RESERVED       8
 
@@ -224,11 +234,12 @@ static const char           *AcpiDmFadtP
     "Unknown Profile Type"
 };
 
-
 /*******************************************************************************
  *
  * ACPI Table Data, indexed by signature.
  *
+ * Each entry contains: Signature, Table Info, Handler, Description
+ *
  * Simple tables have only a TableInfo structure, complex tables have a handler.
  * This table must be NULL terminated. RSDP and FACS are special-cased
  * elsewhere.
@@ -249,8 +260,10 @@ static ACPI_DMTABLE_DATA    AcpiDmTableD
     {ACPI_SIG_FADT, NULL,                   AcpiDmDumpFadt, "Fixed ACPI Description Table"},
     {ACPI_SIG_HEST, NULL,                   AcpiDmDumpHest, "Hardware Error Source Table"},
     {ACPI_SIG_HPET, AcpiDmTableInfoHpet,    NULL,           "High Precision Event Timer table"},
+    {ACPI_SIG_IVRS, NULL,                   AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"},
     {ACPI_SIG_MADT, NULL,                   AcpiDmDumpMadt, "Multiple APIC Description Table"},
     {ACPI_SIG_MCFG, NULL,                   AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
+    {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, "Maximum System Characteristics Table"},
     {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, "Root System Description Table"},
     {ACPI_SIG_SBST, AcpiDmTableInfoSbst,    NULL,           "Smart Battery Specification Table"},
     {ACPI_SIG_SLIC, AcpiDmTableInfoSlic,    NULL,           "Software Licensing Description Table"},
@@ -259,6 +272,9 @@ static ACPI_DMTABLE_DATA    AcpiDmTableD
     {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi,    NULL,           "Server Platform Management Interface table"},
     {ACPI_SIG_SRAT, NULL,                   AcpiDmDumpSrat, "System Resource Affinity Table"},
     {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           "Trusted Computing Platform Alliance table"},
+    {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           "UEFI Boot Optimization Table"},
+    {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           "Windows ACPI Emulated Devices Table"},
+    {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, "Watchdog Action Table"},
     {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt,    NULL,           "Watchdog Resource Table"},
     {ACPI_SIG_XSDT, NULL,                   AcpiDmDumpXsdt, "Extended System Description Table"},
     {NULL,          NULL,                   NULL,           NULL}
@@ -511,7 +527,9 @@ AcpiDmDumpTable (
     UINT8                   Temp8;
     UINT16                  Temp16;
     ACPI_DMTABLE_DATA       *TableData;
+    const char              *Name;
     BOOLEAN                 LastOutputBlankLine = FALSE;
+    char                    RepairedName[8];
 
 
     if (!Info)
@@ -547,6 +565,7 @@ AcpiDmDumpTable (
         case ACPI_DMT_UINT8:
         case ACPI_DMT_CHKSUM:
         case ACPI_DMT_SPACEID:
+        case ACPI_DMT_IVRS:
         case ACPI_DMT_MADT:
         case ACPI_DMT_SRAT:
         case ACPI_DMT_ASF:
@@ -577,6 +596,9 @@ AcpiDmDumpTable (
         case ACPI_DMT_NAME8:
             ByteLength = 8;
             break;
+        case ACPI_DMT_BUF16:
+            ByteLength = 16;
+            break;
         case ACPI_DMT_STRING:
             ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
             break;
@@ -677,17 +699,28 @@ AcpiDmDumpTable (
                 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
             break;
 
+        case ACPI_DMT_BUF16:
+
+            /* Buffer of length 16 */
+
+            for (Temp8 = 0; Temp8 < 16; Temp8++)
+            {
+                AcpiOsPrintf ("%2.2X,", Target[Temp8]);
+            }
+            AcpiOsPrintf ("\n");
+            break;
+
         case ACPI_DMT_STRING:
 
-            AcpiOsPrintf ("%s\n", ACPI_CAST_PTR (char, Target));
+            AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target));
             break;
 
         /* Fixed length ASCII name fields */
 
         case ACPI_DMT_SIG:
 
-            AcpiDmCheckAscii (Target, 4);
-            AcpiOsPrintf ("\"%4.4s\"    ", Target);
+            AcpiDmCheckAscii (Target, RepairedName, 4);
+            AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
             TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
             if (TableData)
             {
@@ -698,20 +731,20 @@ AcpiDmDumpTable (
 
         case ACPI_DMT_NAME4:
 
-            AcpiDmCheckAscii (Target, 4);
-            AcpiOsPrintf ("\"%4.4s\"\n", Target);
+            AcpiDmCheckAscii (Target, RepairedName, 4);
+            AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
             break;
 
         case ACPI_DMT_NAME6:
 
-            AcpiDmCheckAscii (Target, 6);
-            AcpiOsPrintf ("\"%6.6s\"\n", Target);
+            AcpiDmCheckAscii (Target, RepairedName, 6);
+            AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
             break;
 
         case ACPI_DMT_NAME8:
 
-            AcpiDmCheckAscii (Target, 8);
-            AcpiOsPrintf ("\"%8.8s\"\n", Target);
+            AcpiDmCheckAscii (Target, RepairedName, 8);
+            AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
             break;
 
         /* Special Data Types */
@@ -742,8 +775,8 @@ AcpiDmDumpTable (
             /* Generic Address Structure */
 
             AcpiOsPrintf ("\n");
-            AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
-                CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
+            AcpiDmDumpTable (TableLength, CurrentOffset, Target,
+                sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
             AcpiOsPrintf ("\n");
             LastOutputBlankLine = TRUE;
             break;
@@ -790,8 +823,8 @@ AcpiDmDumpTable (
         case ACPI_DMT_HESTNTFY:
 
             AcpiOsPrintf ("\n");
-            AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
-                CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
+            AcpiDmDumpTable (TableLength, CurrentOffset, Target,
+                sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
             AcpiOsPrintf ("\n");
             LastOutputBlankLine = TRUE;
             break;
@@ -849,6 +882,31 @@ AcpiDmDumpTable (
             AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]);
             break;
 
+        case ACPI_DMT_IVRS:
+
+            /* IVRS subtable types */
+
+            Temp8 = *Target;
+            switch (Temp8)
+            {
+            case ACPI_IVRS_TYPE_HARDWARE:
+                Name = AcpiDmIvrsSubnames[0];
+                break;
+
+            case ACPI_IVRS_TYPE_MEMORY1:
+            case ACPI_IVRS_TYPE_MEMORY2:
+            case ACPI_IVRS_TYPE_MEMORY3:
+                Name = AcpiDmIvrsSubnames[1];
+                break;
+
+            default:
+                Name = AcpiDmIvrsSubnames[2];
+                break;
+            }
+
+            AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name);
+            break;
+
         case ACPI_DMT_EXIT:
             return (AE_OK);
 
@@ -888,6 +946,7 @@ AcpiDmDumpTable (
 static void
 AcpiDmCheckAscii (
     UINT8                   *Name,
+    char                    *RepairedName,
     UINT32                  Count)
 {
     UINT32                  i;
@@ -895,9 +954,15 @@ AcpiDmCheckAscii (
 
     for (i = 0; i < Count; i++)
     {
-        if (!Name[i] || !isprint (Name[i]))
+        RepairedName[i] = Name[i];
+
+        if (!Name[i])
+        {
+            return;
+        }
+        if (!isprint (Name[i]))
         {
-            Name[i] = ' ';
+            RepairedName[i] = ' ';
         }
     }
 }

Modified: head/sys/contrib/dev/acpica/common/dmtbdump.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/dmtbdump.c	Fri Sep 11 22:05:59 2009	(r197103)
+++ head/sys/contrib/dev/acpica/common/dmtbdump.c	Fri Sep 11 22:48:53 2009	(r197104)
@@ -306,6 +306,7 @@ AcpiDmDumpAsf (
     UINT32                  DataLength = 0;
     UINT32                  DataOffset = 0;
     UINT32                  i;
+    UINT8                   Type;
 
 
     /* No main table, only sub-tables */
@@ -322,7 +323,11 @@ AcpiDmDumpAsf (
             return;
         }
 
-        switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+        /* The actual type is the lower 7 bits of Type */
+
+        Type = (UINT8) (SubTable->Header.Type & 0x7F);
+
+        switch (Type)
         {
         case ACPI_ASF_TYPE_INFO:
             InfoTable = AcpiDmTableInfoAsf0;
@@ -332,8 +337,8 @@ AcpiDmDumpAsf (
             InfoTable = AcpiDmTableInfoAsf1;
             DataInfoTable = AcpiDmTableInfoAsf1a;
             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
-            DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts;
-            DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength;
+            DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts;
+            DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength;
             DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
             break;
 
@@ -341,8 +346,8 @@ AcpiDmDumpAsf (
             InfoTable = AcpiDmTableInfoAsf2;
             DataInfoTable = AcpiDmTableInfoAsf2a;
             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
-            DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls;
-            DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength;
+            DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls;
+            DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength;
             DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
             break;
 
@@ -353,7 +358,7 @@ AcpiDmDumpAsf (
         case ACPI_ASF_TYPE_ADDRESS:
             InfoTable = AcpiDmTableInfoAsf4;
             DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
-            DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices;
+            DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
             DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
             break;
 
@@ -371,7 +376,7 @@ AcpiDmDumpAsf (
 
         /* Dump variable-length extra data */
 
-        switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+        switch (Type)
         {
         case ACPI_ASF_TYPE_ALERT:
         case ACPI_ASF_TYPE_CONTROL:
@@ -471,7 +476,7 @@ AcpiDmDumpCpep (
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoCpep0);
+                    SubTable->Header.Length, AcpiDmTableInfoCpep0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -479,8 +484,9 @@ AcpiDmDumpCpep (
 
         /* Point to next sub-table */
 
-        Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);
+        Offset += SubTable->Header.Length;
+        SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
+                    SubTable->Header.Length);
     }
 }
 
@@ -550,6 +556,10 @@ AcpiDmDumpDmar (
             InfoTable = AcpiDmTableInfoDmar2;
             ScopeOffset = sizeof (ACPI_DMAR_ATSR);
             break;
+        case ACPI_DMAR_HARDWARE_AFFINITY:
+            InfoTable = AcpiDmTableInfoDmar3;
+            ScopeOffset = sizeof (ACPI_DMAR_RHSA);
+            break;
         default:
             AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
             return;
@@ -737,6 +747,8 @@ AcpiDmDumpHest (
     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
     ACPI_DMTABLE_INFO       *InfoTable;
     UINT32                  SubTableLength;
+    UINT32                  BankCount;
+    ACPI_HEST_IA_ERROR_BANK *BankTable;
 
 
     /* Main table */
@@ -752,31 +764,26 @@ AcpiDmDumpHest (
     SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
     while (Offset < Table->Length)
     {
+        BankCount = 0;
         switch (SubTable->Type)
         {
-        case ACPI_HEST_TYPE_XPF_MACHINE_CHECK:
+        case ACPI_HEST_TYPE_IA32_CHECK:
             InfoTable = AcpiDmTableInfoHest0;
-            SubTableLength = sizeof (ACPI_HEST_XPF_MACHINE_CHECK);
+            SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
+            BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
+                            SubTable))->NumHardwareBanks;
             break;
 
-        case ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK:
+        case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
             InfoTable = AcpiDmTableInfoHest1;
-            SubTableLength = sizeof (ACPI_HEST_XPF_CORRECTED);
-            break;
-
-        case ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT:
-            InfoTable = AcpiDmTableInfoHest3;
-            SubTableLength = sizeof (ACPI_HEST_XPF_NMI);
+            SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
+            BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
+                            SubTable))->NumHardwareBanks;
             break;
 
-        case ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK:
-            InfoTable = AcpiDmTableInfoHest4;
-            SubTableLength = sizeof (ACPI_HEST_IPF_CORRECTED);
-            break;
-
-        case ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR:
-            InfoTable = AcpiDmTableInfoHest5;
-            SubTableLength = sizeof (ACPI_HEST_IPF_CORRECTED_PLATFORM);
+        case ACPI_HEST_TYPE_IA32_NMI:
+            InfoTable = AcpiDmTableInfoHest2;
+            SubTableLength = sizeof (ACPI_HEST_IA_NMI);
             break;
 
         case ACPI_HEST_TYPE_AER_ROOT_PORT:
@@ -794,7 +801,7 @@ AcpiDmDumpHest (
             SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
             break;
 
-        case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE:
+        case ACPI_HEST_TYPE_GENERIC_ERROR:
             InfoTable = AcpiDmTableInfoHest9;
             SubTableLength = sizeof (ACPI_HEST_GENERIC);
             break;
@@ -814,9 +821,34 @@ AcpiDmDumpHest (
             return;
         }
 
-        /* Point to next sub-table (each subtable is of fixed length) */
+        /* Point to end of current subtable (each subtable above is of fixed length) */
 
         Offset += SubTableLength;
+
+        /* If there are any (fixed-length) Error Banks from above, dump them now */
+
+        if (BankCount)
+        {
+            BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
+            SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
+
+            while (BankCount)
+            {
+                AcpiOsPrintf ("\n");
+                Status = AcpiDmDumpTable (Length, Offset, BankTable,
+                            sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+                Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
+                BankTable++;
+                BankCount--;
+            }
+        }
+
+        /* Point to next sub-table */
+
         SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
     }
 }
@@ -824,6 +856,179 @@ AcpiDmDumpHest (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiDmDumpIvrs
+ *
+ * PARAMETERS:  Table               - A IVRS table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Format the contents of a IVRS
+ *
+ ******************************************************************************/
+
+static UINT8 EntrySizes[] = {4,8,16,32};
+
+void
+AcpiDmDumpIvrs (
+    ACPI_TABLE_HEADER       *Table)
+{
+    ACPI_STATUS             Status;
+    UINT32                  Offset = sizeof (ACPI_TABLE_IVRS);
+    UINT32                  EntryOffset;
+    UINT32                  EntryLength;
+    UINT32                  EntryType;
+    ACPI_IVRS_DE_HEADER     *DeviceEntry;
+    ACPI_IVRS_HEADER        *SubTable;
+    ACPI_DMTABLE_INFO       *InfoTable;
+
+
+    /* Main table */
+
+    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
+    if (ACPI_FAILURE (Status))
+    {
+        return;
+    }
+
+    /* Sub-tables */
+
+    SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
+    while (Offset < Table->Length)
+    {
+        /* Common sub-table header */
+
+        AcpiOsPrintf ("\n");
+        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+                    SubTable->Length, AcpiDmTableInfoIvrsHdr);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
+
+        switch (SubTable->Type)
+        {
+        case ACPI_IVRS_TYPE_HARDWARE:
+            InfoTable = AcpiDmTableInfoIvrs0;
+            break;
+        case ACPI_IVRS_TYPE_MEMORY1:
+        case ACPI_IVRS_TYPE_MEMORY2:
+        case ACPI_IVRS_TYPE_MEMORY3:
+            InfoTable = AcpiDmTableInfoIvrs1;
+            break;
+        default:
+            AcpiOsPrintf ("\n**** Unknown IVRS sub-table type %X\n",
+                SubTable->Type);
+
+            /* Attempt to continue */
+
+            if (!SubTable->Length)
+            {
+                AcpiOsPrintf ("Invalid zero length subtable\n");
+                return;
+            }
+            goto NextSubTable;
+        }
+
+        /* Dump the subtable */
+
+        AcpiOsPrintf ("\n");
+        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+                    SubTable->Length, InfoTable);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
+
+        /* The hardware subtable can contain multiple device entries */
+
+        if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE)
+        {
+            EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
+            DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
+                            sizeof (ACPI_IVRS_HARDWARE));
+
+            while (EntryOffset < (Offset + SubTable->Length))
+            {
+                AcpiOsPrintf ("\n");
+                /*
+                 * Upper 2 bits of Type encode the length of the device entry
+                 *
+                 * 00 = 4 byte
+                 * 01 = 8 byte
+                 * 10 = 16 byte - currently no entries defined
+                 * 11 = 32 byte - currently no entries defined
+                 */
+                EntryType = DeviceEntry->Type;
+                EntryLength = EntrySizes [EntryType >> 6];
+
+                switch (EntryType)
+                {
+                /* 4-byte device entries */
+
+                case ACPI_IVRS_TYPE_PAD4:
+                case ACPI_IVRS_TYPE_ALL:
+                case ACPI_IVRS_TYPE_SELECT:
+                case ACPI_IVRS_TYPE_START:
+                case ACPI_IVRS_TYPE_END:
+
+                    InfoTable = AcpiDmTableInfoIvrs4;
+                    break;
+
+                /* 8-byte entries, type A */
+
+                case ACPI_IVRS_TYPE_ALIAS_SELECT:
+                case ACPI_IVRS_TYPE_ALIAS_START:
+
+                    InfoTable = AcpiDmTableInfoIvrs8a;
+                    break;
+
+                /* 8-byte entries, type B */
+
+                case ACPI_IVRS_TYPE_PAD8:
+                case ACPI_IVRS_TYPE_EXT_SELECT:
+                case ACPI_IVRS_TYPE_EXT_START:
+
+                    InfoTable = AcpiDmTableInfoIvrs8b;
+                    break;
+
+                /* 8-byte entries, type C */
+
+                case ACPI_IVRS_TYPE_SPECIAL:
+
+                    InfoTable = AcpiDmTableInfoIvrs8c;
+                    break;
+
+                default:
+                    InfoTable = AcpiDmTableInfoIvrs4;
+                    AcpiOsPrintf (
+                        "\n**** Unknown IVRS device entry type/length: "
+                        "%.2X/%X at offset %.4X: (header below)\n",
+                        EntryType, EntryLength, EntryOffset);
+                    break;
+                }
+
+                /* Dump the Device Entry */
+
+                Status = AcpiDmDumpTable (Table->Length, EntryOffset,
+                            DeviceEntry, EntryLength, InfoTable);
+
+                EntryOffset += EntryLength;
+                DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
+                                EntryLength);
+            }
+        }
+
+NextSubTable:
+        /* Point to next sub-table */
+
+        Offset += SubTable->Length;
+        SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length);
+    }
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiDmDumpMadt
  *
  * PARAMETERS:  Table               - A MADT table
@@ -993,6 +1198,58 @@ AcpiDmDumpMcfg (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiDmDumpMsct
+ *
+ * PARAMETERS:  Table               - A MSCT table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Format the contents of a MSCT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMsct (
+    ACPI_TABLE_HEADER       *Table)
+{
+    ACPI_STATUS             Status;
+    UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
+    ACPI_MSCT_PROXIMITY     *SubTable;
+
+
+    /* Main table */
+
+    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
+    if (ACPI_FAILURE (Status))
+    {
+        return;
+    }
+
+    /* Sub-tables */
+
+    SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
+    while (Offset < Table->Length)
+    {
+        /* Common sub-table header */
+
+        AcpiOsPrintf ("\n");
+        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+                    sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
+
+        /* Point to next sub-table */
+
+        Offset += sizeof (ACPI_MSCT_PROXIMITY);
+        SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
+    }
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiDmDumpSlit
  *
  * PARAMETERS:  Table               - An SLIT
@@ -1149,3 +1406,54 @@ NextSubTable:
     }
 }
 
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmDumpWdat
+ *
+ * PARAMETERS:  Table               - A WDAT table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Format the contents of a WDAT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpWdat (
+    ACPI_TABLE_HEADER       *Table)
+{
+    ACPI_STATUS             Status;
+    UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
+    ACPI_WDAT_ENTRY         *SubTable;
+
+
+    /* Main table */
+
+    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
+    if (ACPI_FAILURE (Status))
+    {
+        return;
+    }
+
+    /* Sub-tables */
+
+    SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
+    while (Offset < Table->Length)
+    {
+        /* Common sub-table header */
+
+        AcpiOsPrintf ("\n");
+        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
+                    sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
+
+        /* Point to next sub-table */
+
+        Offset += sizeof (ACPI_WDAT_ENTRY);
+        SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 22:49:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9515E106568F;
	Fri, 11 Sep 2009 22:49:34 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 832F98FC0A;
	Fri, 11 Sep 2009 22:49:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BMnYDD065832;
	Fri, 11 Sep 2009 22:49:34 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BMnY0U065825;
	Fri, 11 Sep 2009 22:49:34 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909112249.n8BMnY0U065825@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 11 Sep 2009 22:49:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197105 - in head/sys: conf dev/acpica modules/acpi/acpi
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 22:49:34 -0000

Author: jkim
Date: Fri Sep 11 22:49:34 2009
New Revision: 197105
URL: http://svn.freebsd.org/changeset/base/197105

Log:
  Catch up with ACPICA 20090903.

Modified:
  head/sys/conf/files
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_cpu.c
  head/sys/dev/acpica/acpi_pcib_acpi.c
  head/sys/dev/acpica/acpivar.h
  head/sys/modules/acpi/acpi/Makefile

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Fri Sep 11 22:48:53 2009	(r197104)
+++ head/sys/conf/files	Fri Sep 11 22:49:34 2009	(r197105)
@@ -220,6 +220,7 @@ contrib/dev/acpica/namespace/nsnames.c	o
 contrib/dev/acpica/namespace/nsobject.c	optional acpi
 contrib/dev/acpica/namespace/nsparse.c	optional acpi
 contrib/dev/acpica/namespace/nspredef.c	optional acpi
+contrib/dev/acpica/namespace/nsrepair.c	optional acpi
 contrib/dev/acpica/namespace/nssearch.c	optional acpi
 contrib/dev/acpica/namespace/nsutils.c	optional acpi
 contrib/dev/acpica/namespace/nswalk.c	optional acpi
@@ -260,6 +261,7 @@ contrib/dev/acpica/utilities/utdebug.c	o
 contrib/dev/acpica/utilities/utdelete.c	optional acpi
 contrib/dev/acpica/utilities/uteval.c	optional acpi
 contrib/dev/acpica/utilities/utglobal.c	optional acpi
+contrib/dev/acpica/utilities/utids.c	optional acpi
 contrib/dev/acpica/utilities/utinit.c	optional acpi
 contrib/dev/acpica/utilities/utlock.c	optional acpi
 contrib/dev/acpica/utilities/utmath.c	optional acpi

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Fri Sep 11 22:48:53 2009	(r197104)
+++ head/sys/dev/acpica/acpi.c	Fri Sep 11 22:49:34 2009	(r197105)
@@ -864,24 +864,20 @@ static int
 acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf,
     size_t buflen)
 {
-    ACPI_BUFFER adbuf = {ACPI_ALLOCATE_BUFFER, NULL}; 
-    ACPI_DEVICE_INFO *adinfo;
     struct acpi_device *dinfo = device_get_ivars(child);
-    char *end;
-    int error;
+    ACPI_DEVICE_INFO *adinfo;
 
-    error = AcpiGetObjectInfo(dinfo->ad_handle, &adbuf);
-    adinfo = (ACPI_DEVICE_INFO *) adbuf.Pointer;
-    if (error)
+    if (ACPI_FAILURE(AcpiGetObjectInfo(dinfo->ad_handle, &adinfo))) {
 	snprintf(buf, buflen, "unknown");
-    else
-	snprintf(buf, buflen, "_HID=%s _UID=%lu",
-		 (adinfo->Valid & ACPI_VALID_HID) ?
-		 adinfo->HardwareId.Value : "none",
-		 (adinfo->Valid & ACPI_VALID_UID) ?
-		 strtoul(adinfo->UniqueId.Value, &end, 10) : 0);
-    if (adinfo)
-	AcpiOsFree(adinfo);
+	return (0);
+    }
+
+    snprintf(buf, buflen, "_HID=%s _UID=%lu",
+	(adinfo->Valid & ACPI_VALID_HID) ?
+	adinfo->HardwareId.String : "none",
+	(adinfo->Valid & ACPI_VALID_UID) ?
+	strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL);
+    AcpiOsFree(adinfo);
 
     return (0);
 }
@@ -1315,31 +1311,21 @@ static uint32_t
 acpi_isa_get_logicalid(device_t dev)
 {
     ACPI_DEVICE_INFO	*devinfo;
-    ACPI_BUFFER		buf;
     ACPI_HANDLE		h;
-    ACPI_STATUS		error;
-    u_int32_t		pnpid;
+    uint32_t		pnpid;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
-    pnpid = 0;
-    buf.Pointer = NULL;
-    buf.Length = ACPI_ALLOCATE_BUFFER;
-
     /* Fetch and validate the HID. */
-    if ((h = acpi_get_handle(dev)) == NULL)
-	goto out;
-    error = AcpiGetObjectInfo(h, &buf);
-    if (ACPI_FAILURE(error))
-	goto out;
-    devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
-
-    if ((devinfo->Valid & ACPI_VALID_HID) != 0)
-	pnpid = PNP_EISAID(devinfo->HardwareId.Value);
+    if ((h = acpi_get_handle(dev)) == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
+	return_VALUE (0);
+
+    pnpid = (devinfo->Valid & ACPI_VALID_HID) != 0 &&
+	devinfo->HardwareId.Length >= ACPI_EISAID_STRING_SIZE ?
+	PNP_EISAID(devinfo->HardwareId.String) : 0;
+    AcpiOsFree(devinfo);
 
-out:
-    if (buf.Pointer != NULL)
-	AcpiOsFree(buf.Pointer);
     return_VALUE (pnpid);
 }
 
@@ -1347,41 +1333,36 @@ static int
 acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count)
 {
     ACPI_DEVICE_INFO	*devinfo;
-    ACPI_BUFFER		buf;
+    ACPI_DEVICE_ID	*ids;
     ACPI_HANDLE		h;
-    ACPI_STATUS		error;
     uint32_t		*pnpid;
-    int			valid, i;
+    int			i, valid;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
     pnpid = cids;
-    valid = 0;
-    buf.Pointer = NULL;
-    buf.Length = ACPI_ALLOCATE_BUFFER;
 
     /* Fetch and validate the CID */
-    if ((h = acpi_get_handle(dev)) == NULL)
-	goto out;
-    error = AcpiGetObjectInfo(h, &buf);
-    if (ACPI_FAILURE(error))
-	goto out;
-    devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
-    if ((devinfo->Valid & ACPI_VALID_CID) == 0)
-	goto out;
-
-    if (devinfo->CompatibilityId.Count < count)
-	count = devinfo->CompatibilityId.Count;
-    for (i = 0; i < count; i++) {
-	if (strncmp(devinfo->CompatibilityId.Id[i].Value, "PNP", 3) != 0)
-	    continue;
-	*pnpid++ = PNP_EISAID(devinfo->CompatibilityId.Id[i].Value);
-	valid++;
-    }
+    if ((h = acpi_get_handle(dev)) == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
+	return_VALUE (0);
+
+    if ((devinfo->Valid & ACPI_VALID_CID) == 0) {
+	AcpiOsFree(devinfo);
+	return_VALUE (0);
+    }
+
+    if (devinfo->CompatibleIdList.Count < count)
+	count = devinfo->CompatibleIdList.Count;
+    ids = devinfo->CompatibleIdList.Ids;
+    for (i = 0, valid = 0; i < count; i++)
+	if (ids[i].Length >= ACPI_EISAID_STRING_SIZE &&
+	    strncmp(ids[i].String, "PNP", 3) == 0) {
+	    *pnpid++ = PNP_EISAID(ids[i].String);
+	    valid++;
+	}
+    AcpiOsFree(devinfo);
 
-out:
-    if (buf.Pointer != NULL)
-	AcpiOsFree(buf.Pointer);
     return_VALUE (valid);
 }
 
@@ -1389,10 +1370,14 @@ static char *
 acpi_device_id_probe(device_t bus, device_t dev, char **ids) 
 {
     ACPI_HANDLE h;
+    ACPI_OBJECT_TYPE t;
     int i;
 
     h = acpi_get_handle(dev);
-    if (ids == NULL || h == NULL || acpi_get_type(dev) != ACPI_TYPE_DEVICE)
+    if (ids == NULL || h == NULL)
+	return (NULL);
+    t = acpi_get_type(dev);
+    if (t != ACPI_TYPE_DEVICE && t != ACPI_TYPE_PROCESSOR)
 	return (NULL);
 
     /* Try to match one of the array of IDs with a HID or CID. */
@@ -1821,7 +1806,7 @@ acpi_probe_child(ACPI_HANDLE handle, UIN
  * placeholder object handler so we can store a device_t in an ACPI_HANDLE.
  */
 void
-acpi_fake_objhandler(ACPI_HANDLE h, UINT32 fn, void *data)
+acpi_fake_objhandler(ACPI_HANDLE h, void *data)
 {
 }
 
@@ -1910,30 +1895,18 @@ acpi_DeviceIsPresent(device_t dev)
 {
     ACPI_DEVICE_INFO	*devinfo;
     ACPI_HANDLE		h;
-    ACPI_BUFFER		buf;
-    ACPI_STATUS		error;
-    int			ret;
+    BOOLEAN		present;
 
-    ret = FALSE;
-    if ((h = acpi_get_handle(dev)) == NULL)
+    if ((h = acpi_get_handle(dev)) == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
 	return (FALSE);
-    buf.Pointer = NULL;
-    buf.Length = ACPI_ALLOCATE_BUFFER;
-    error = AcpiGetObjectInfo(h, &buf);
-    if (ACPI_FAILURE(error))
-	return (FALSE);
-    devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
 
     /* If no _STA method, must be present */
-    if ((devinfo->Valid & ACPI_VALID_STA) == 0)
-	ret = TRUE;
-
-    /* Return true for 'present' and 'functioning' */
-    if (ACPI_DEVICE_PRESENT(devinfo->CurrentStatus))
-	ret = TRUE;
+    present = (devinfo->Valid & ACPI_VALID_STA) == 0 ||
+	ACPI_DEVICE_PRESENT(devinfo->CurrentStatus) ? TRUE : FALSE;
 
-    AcpiOsFree(buf.Pointer);
-    return (ret);
+    AcpiOsFree(devinfo);
+    return (present);
 }
 
 /*
@@ -1944,30 +1917,18 @@ acpi_BatteryIsPresent(device_t dev)
 {
     ACPI_DEVICE_INFO	*devinfo;
     ACPI_HANDLE		h;
-    ACPI_BUFFER		buf;
-    ACPI_STATUS		error;
-    int			ret;
+    BOOLEAN		present;
 
-    ret = FALSE;
-    if ((h = acpi_get_handle(dev)) == NULL)
+    if ((h = acpi_get_handle(dev)) == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
 	return (FALSE);
-    buf.Pointer = NULL;
-    buf.Length = ACPI_ALLOCATE_BUFFER;
-    error = AcpiGetObjectInfo(h, &buf);
-    if (ACPI_FAILURE(error))
-	return (FALSE);
-    devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
 
     /* If no _STA method, must be present */
-    if ((devinfo->Valid & ACPI_VALID_STA) == 0)
-	ret = TRUE;
-
-    /* Return true for 'present', 'battery present', and 'functioning' */
-    if (ACPI_BATTERY_PRESENT(devinfo->CurrentStatus))
-	ret = TRUE;
+    present = (devinfo->Valid & ACPI_VALID_STA) == 0 ||
+	ACPI_BATTERY_PRESENT(devinfo->CurrentStatus) ? TRUE : FALSE;
 
-    AcpiOsFree(buf.Pointer);
-    return (ret);
+    AcpiOsFree(devinfo);
+    return (present);
 }
 
 /*
@@ -1977,33 +1938,26 @@ static BOOLEAN
 acpi_MatchHid(ACPI_HANDLE h, const char *hid) 
 {
     ACPI_DEVICE_INFO	*devinfo;
-    ACPI_BUFFER		buf;
-    ACPI_STATUS		error;
-    int			ret, i;
+    BOOLEAN		ret;
+    int			i;
 
-    ret = FALSE;
-    if (hid == NULL || h == NULL)
-	return (ret);
-    buf.Pointer = NULL;
-    buf.Length = ACPI_ALLOCATE_BUFFER;
-    error = AcpiGetObjectInfo(h, &buf);
-    if (ACPI_FAILURE(error))
-	return (ret);
-    devinfo = (ACPI_DEVICE_INFO *)buf.Pointer;
+    if (hid == NULL || h == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
+	return (FALSE);
 
+    ret = FALSE;
     if ((devinfo->Valid & ACPI_VALID_HID) != 0 &&
-	strcmp(hid, devinfo->HardwareId.Value) == 0)
+	strcmp(hid, devinfo->HardwareId.String) == 0)
 	    ret = TRUE;
-    else if ((devinfo->Valid & ACPI_VALID_CID) != 0) {
-	for (i = 0; i < devinfo->CompatibilityId.Count; i++) {
-	    if (strcmp(hid, devinfo->CompatibilityId.Id[i].Value) == 0) {
+    else if ((devinfo->Valid & ACPI_VALID_CID) != 0)
+	for (i = 0; i < devinfo->CompatibleIdList.Count; i++) {
+	    if (strcmp(hid, devinfo->CompatibleIdList.Ids[i].String) == 0) {
 		ret = TRUE;
 		break;
 	    }
 	}
-    }
 
-    AcpiOsFree(buf.Pointer);
+    AcpiOsFree(devinfo);
     return (ret);
 }
 

Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c	Fri Sep 11 22:48:53 2009	(r197104)
+++ head/sys/dev/acpica/acpi_cpu.c	Fri Sep 11 22:49:34 2009	(r197105)
@@ -940,7 +940,7 @@ acpi_cpu_idle()
      * get the time very close to the CPU start/stop clock logic, this
      * is the only reliable time source.
      */
-    AcpiRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock);
+    AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock);
     CPU_GET_REG(cx_next->p_lvlx, 1);
 
     /*
@@ -949,8 +949,8 @@ acpi_cpu_idle()
      * the processor has stopped.  Doing it again provides enough
      * margin that we are certain to have a correct value.
      */
-    AcpiRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock);
-    AcpiRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock);
+    AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock);
+    AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock);
 
     /* Enable bus master arbitration and disable bus master wakeup. */
     if (cx_next->type == ACPI_STATE_C3 &&

Modified: head/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi_pcib_acpi.c	Fri Sep 11 22:48:53 2009	(r197104)
+++ head/sys/dev/acpica/acpi_pcib_acpi.c	Fri Sep 11 22:49:34 2009	(r197105)
@@ -131,14 +131,18 @@ MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1);
 static int
 acpi_pcib_acpi_probe(device_t dev)
 {
-    static char *pcib_ids[] = { "PNP0A03", "PNP0A08", NULL };
+    ACPI_DEVICE_INFO	*devinfo;
+    ACPI_HANDLE		h;
+    int			root;
 
-    if (acpi_disabled("pcib") ||
-	ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL)
+    if (acpi_disabled("pcib") || (h = acpi_get_handle(dev)) == NULL ||
+	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
 	return (ENXIO);
-
-    if (pci_cfgregopen() == 0)
+    root = (devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0;
+    AcpiOsFree(devinfo);
+    if (!root || pci_cfgregopen() == 0)
 	return (ENXIO);
+
     device_set_desc(dev, "ACPI Host-PCI bridge");
     return (0);
 }

Modified: head/sys/dev/acpica/acpivar.h
==============================================================================
--- head/sys/dev/acpica/acpivar.h	Fri Sep 11 22:48:53 2009	(r197104)
+++ head/sys/dev/acpica/acpivar.h	Fri Sep 11 22:49:34 2009	(r197105)
@@ -254,7 +254,7 @@ __ACPI_BUS_ACCESSOR(acpi, magic, ACPI, M
 __ACPI_BUS_ACCESSOR(acpi, private, ACPI, PRIVATE, void *)
 __ACPI_BUS_ACCESSOR(acpi, flags, ACPI, FLAGS, int)
 
-void acpi_fake_objhandler(ACPI_HANDLE h, UINT32 fn, void *data);
+void acpi_fake_objhandler(ACPI_HANDLE h, void *data);
 static __inline device_t
 acpi_get_device(ACPI_HANDLE handle)
 {

Modified: head/sys/modules/acpi/acpi/Makefile
==============================================================================
--- head/sys/modules/acpi/acpi/Makefile	Fri Sep 11 22:48:53 2009	(r197104)
+++ head/sys/modules/acpi/acpi/Makefile	Fri Sep 11 22:49:34 2009	(r197105)
@@ -37,16 +37,16 @@ SRCS+=	exprep.c exregion.c exresnte.c ex
 SRCS+=	exstoren.c exstorob.c exsystem.c exutils.c
 SRCS+=	hwacpi.c hwgpe.c hwregs.c hwsleep.c hwtimer.c hwvalid.c hwxface.c
 SRCS+=	nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c nsload.c nsnames.c
-SRCS+=	nsobject.c nsparse.c nspredef.c nssearch.c nsutils.c nswalk.c
-SRCS+=	nsxfeval.c nsxfname.c nsxfobj.c
+SRCS+=	nsobject.c nsparse.c nspredef.c nsrepair.c nssearch.c nsutils.c
+SRCS+=	nswalk.c nsxfeval.c nsxfname.c nsxfobj.c
 SRCS+=	psargs.c psloop.c psopcode.c psparse.c psscope.c pstree.c psutils.c
 SRCS+=	pswalk.c psxface.c
 SRCS+=	rsaddr.c rscalc.c rscreate.c rsdump.c rsinfo.c rsio.c rsirq.c rslist.c
 SRCS+=	rsmemory.c rsmisc.c rsutils.c rsxface.c
 SRCS+=	tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c tbxfroot.c
 SRCS+=	utalloc.c utcache.c utcopy.c utdebug.c utdelete.c uteval.c utglobal.c
-SRCS+=	utinit.c utlock.c utmath.c utmisc.c utmutex.c utobject.c utresrc.c
-SRCS+=	utstate.c utxface.c
+SRCS+=	utids.c utinit.c utlock.c utmath.c utmisc.c utmutex.c utobject.c
+SRCS+=	utresrc.c utstate.c utxface.c
 
 # OSPM layer and core hardware drivers
 SRCS+=	acpi.c acpi_button.c acpi_isab.c acpi_package.c acpi_pci.c acpi_pcib.c

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 22:50:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2A3FA1065676;
	Fri, 11 Sep 2009 22:50:16 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A33F8FC1B;
	Fri, 11 Sep 2009 22:50:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BMoF7f065890;
	Fri, 11 Sep 2009 22:50:15 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BMoF2G065888;
	Fri, 11 Sep 2009 22:50:15 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909112250.n8BMoF2G065888@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 11 Sep 2009 22:50:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197106 - head/usr.sbin/acpi/acpidb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 22:50:16 -0000

Author: jkim
Date: Fri Sep 11 22:50:15 2009
New Revision: 197106
URL: http://svn.freebsd.org/changeset/base/197106

Log:
  Catch up with ACPICA 20090903.

Modified:
  head/usr.sbin/acpi/acpidb/Makefile

Modified: head/usr.sbin/acpi/acpidb/Makefile
==============================================================================
--- head/usr.sbin/acpi/acpidb/Makefile	Fri Sep 11 22:49:34 2009	(r197105)
+++ head/usr.sbin/acpi/acpidb/Makefile	Fri Sep 11 22:50:15 2009	(r197106)
@@ -38,8 +38,8 @@ SRCS+=	psargs.c psloop.c psopcode.c pspa
 # namespace
 SRCS+=	nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c		\
 	nsload.c nsnames.c nsobject.c nsparse.c nspredef.c	\
-	nssearch.c nsutils.c nswalk.c nsxfeval.c nsxfname.c	\
-	nsxfobj.c
+	nsrepair.c nssearch.c nsutils.c nswalk.c nsxfeval.c	\
+	nsxfname.c nsxfobj.c
 
 # resources
 SRCS+=	rsaddr.c rscalc.c rscreate.c rsdump.c rsinfo.c		\
@@ -52,9 +52,9 @@ SRCS+=	tbfadt.c tbfind.c tbinstal.c tbut
 
 # utilities
 SRCS+=	utalloc.c utcache.c utcopy.c utdebug.c utdelete.c	\
-	uteval.c utglobal.c utinit.c utlock.c utmath.c utmisc.c	\
-	utmutex.c utobject.c utresrc.c utstate.c uttrack.c	\
-	utxface.c
+	uteval.c utglobal.c utids.c utinit.c utlock.c utmath.c	\
+	utmisc.c utmutex.c utobject.c utresrc.c utstate.c	\
+	uttrack.c utxface.c
 
 MAN=	acpidb.8
 WARNS?=	2

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 22:56:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9958C106566B;
	Fri, 11 Sep 2009 22:56:08 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6EC278FC0C;
	Fri, 11 Sep 2009 22:56:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BMu81g066041;
	Fri, 11 Sep 2009 22:56:08 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BMu8CV066036;
	Fri, 11 Sep 2009 22:56:08 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200909112256.n8BMu8CV066036@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 11 Sep 2009 22:56:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197107 - in head/sys/contrib/dev/acpica: compiler
	include namespace utilities
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 22:56:08 -0000

Author: jkim
Date: Fri Sep 11 22:56:08 2009
New Revision: 197107
URL: http://svn.freebsd.org/changeset/base/197107

Log:
  Canonify include paths for newly added files.

Modified:
  head/sys/contrib/dev/acpica/compiler/aslstubs.c
  head/sys/contrib/dev/acpica/include/actbl.h
  head/sys/contrib/dev/acpica/namespace/nsrepair.c
  head/sys/contrib/dev/acpica/utilities/utids.c

Modified: head/sys/contrib/dev/acpica/compiler/aslstubs.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslstubs.c	Fri Sep 11 22:50:15 2009	(r197106)
+++ head/sys/contrib/dev/acpica/compiler/aslstubs.c	Fri Sep 11 22:56:08 2009	(r197107)
@@ -119,7 +119,7 @@
 #include 
 #include 
 #include 
-#include "acnamesp.h"
+#include 
 
 #define _COMPONENT          ACPI_COMPILER
         ACPI_MODULE_NAME    ("aslstubs")

Modified: head/sys/contrib/dev/acpica/include/actbl.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/actbl.h	Fri Sep 11 22:50:15 2009	(r197106)
+++ head/sys/contrib/dev/acpica/include/actbl.h	Fri Sep 11 22:56:08 2009	(r197107)
@@ -442,7 +442,7 @@ typedef struct acpi_table_desc
  * Get the remaining ACPI tables
  */
 #include 
-#include "actbl2.h"
+#include 
 
 /* Macros used to generate offsets to specific table fields */
 

Modified: head/sys/contrib/dev/acpica/namespace/nsrepair.c
==============================================================================
--- head/sys/contrib/dev/acpica/namespace/nsrepair.c	Fri Sep 11 22:50:15 2009	(r197106)
+++ head/sys/contrib/dev/acpica/namespace/nsrepair.c	Fri Sep 11 22:56:08 2009	(r197107)
@@ -115,10 +115,10 @@
 
 #define __NSREPAIR_C__
 
-#include "acpi.h"
-#include "accommon.h"
-#include "acnamesp.h"
-#include "acpredef.h"
+#include 
+#include 
+#include 
+#include 
 
 #define _COMPONENT          ACPI_NAMESPACE
         ACPI_MODULE_NAME    ("nsrepair")

Modified: head/sys/contrib/dev/acpica/utilities/utids.c
==============================================================================
--- head/sys/contrib/dev/acpica/utilities/utids.c	Fri Sep 11 22:50:15 2009	(r197106)
+++ head/sys/contrib/dev/acpica/utilities/utids.c	Fri Sep 11 22:56:08 2009	(r197107)
@@ -115,9 +115,9 @@
 
 #define __UTIDS_C__
 
-#include "acpi.h"
-#include "accommon.h"
-#include "acinterp.h"
+#include 
+#include 
+#include 
 
 
 #define _COMPONENT          ACPI_UTILITIES

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 23:41:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08948106566B;
	Fri, 11 Sep 2009 23:41:12 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EC4288FC08;
	Fri, 11 Sep 2009 23:41:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BNfBxX066939;
	Fri, 11 Sep 2009 23:41:11 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8BNfBle066936;
	Fri, 11 Sep 2009 23:41:11 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200909112341.n8BNfBle066936@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 11 Sep 2009 23:41:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197108 - in head/sys/i386: include/xen xen
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 23:41:12 -0000

Author: kmacy
Date: Fri Sep 11 23:41:11 2009
New Revision: 197108
URL: http://svn.freebsd.org/changeset/base/197108

Log:
  fix UP compilation

Modified:
  head/sys/i386/include/xen/xen-os.h
  head/sys/i386/xen/locore.s

Modified: head/sys/i386/include/xen/xen-os.h
==============================================================================
--- head/sys/i386/include/xen/xen-os.h	Fri Sep 11 22:56:08 2009	(r197107)
+++ head/sys/i386/include/xen/xen-os.h	Fri Sep 11 23:41:11 2009	(r197108)
@@ -34,10 +34,10 @@ void force_evtchn_callback(void);
 #include 
 #endif
 
+extern int gdtset;
 #ifdef SMP
 #include  /* XXX for pcpu.h */
 #include  /* XXX for PCPU_GET */
-extern int gdtset;
 static inline int 
 smp_processor_id(void)  
 {

Modified: head/sys/i386/xen/locore.s
==============================================================================
--- head/sys/i386/xen/locore.s	Fri Sep 11 22:56:08 2009	(r197107)
+++ head/sys/i386/xen/locore.s	Fri Sep 11 23:41:11 2009	(r197108)
@@ -148,9 +148,7 @@ IdlePDPT:	.long	0		/* phys addr of kerne
 	.globl	KPTphys
 #endif
 KPTphys:	.long	0		/* phys addr of kernel page tables */
-#ifdef SMP
 	.globl	gdtset
-#endif
 gdtset:		.long	0		/* GDT is valid */	
 
 	.globl	proc0kstack

From owner-svn-src-all@FreeBSD.ORG  Fri Sep 11 15:02:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3BD8B106566C;
	Fri, 11 Sep 2009 15:02:28 +0000 (UTC)
	(envelope-from jasonh@DataIX.net)
Received: from www6.pairlite.com (www6.pairlite.com [64.130.10.16])
	by mx1.freebsd.org (Postfix) with ESMTP id 079658FC08;
	Fri, 11 Sep 2009 15:02:27 +0000 (UTC)
Received: from firewall.5p.local (unknown [99.19.41.238])
	by www6.pairlite.com (Postfix) with ESMTP id DA9C8B828;
	Fri, 11 Sep 2009 11:02:25 -0400 (EDT)
Date: Fri, 11 Sep 2009 11:02:18 -0400
From: "Jason J. Hellenthal" 
To: =?ISO-8859-15?Q?Dag-Erling_Sm=F8rgrav?= 
In-Reply-To: <86tyza6j47.fsf@ds4.des.no>
Message-ID: 
References: <200909101404.n8AE41C6021588@svn.freebsd.org>
	<200909101023.44913.jhb@freebsd.org>
	<1252593149.75144.18.camel@bauer.cse.buffalo.edu>
	<200909101118.22525.jhb@freebsd.org>
	
	
	
	
	<86tyza6j47.fsf@ds4.des.no>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
X-OpenPGP-Key-ID: 0x691411AC
X-OpenPGP-Key-Fingerprint: 6F56 3B10 D8AD 1D33 96E7  5946 E3B6 2768 6914 11AC
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-Mailman-Approved-At: Fri, 11 Sep 2009 23:46:41 +0000
Cc: Remko Lodder , John Baldwin ,
	svn-src-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson ,
	svn-src-stable-8@freebsd.org, Ken Smith ,
	"Jason J. Hellenthal" , Ken Smith 
Subject: Re: svn commit: r197065 - in stable/8: etc/defaults lib/libc/stdlib
 sys/amd64/conf sys/i386/conf sys/ia64/conf sys/pc98/conf
 sys/powerpc/conf sys/sparc64/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: "Jason J. Hellenthal" 
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 11 Sep 2009 15:02:28 -0000

On Fri, 11 Sep 2009 03:22 -0000, des wrote:

> "Jason J. Hellenthal"  writes:
>> If I may, I would like to introduce a distributed targeting system to
>> this conversation in addition to crashinfo. Given with the above
>> conversations I cant help but think that in a case like this it would
>> be helpful to setup a central database for collection of information
>> and write a little bit more code into crashinfo for uuencoding a blob
>> to send through email or maybe another way so data can be collected,
>> sorted & analyzed with statistics spilled out into a web page for
>> review.
>
> It's a good idea in principle, but I'm worried that such a system might
> get flooded with crash reports from people running old -STABLE versions
> and / or local patches.  There is no way we can control that, neither in
> the client script nor at the receiving end.
>
> DES
>

I am thinking more of something like the distributed.net project where as they 
have two very well defined projects or areas that they can allow their users to 
work on and that they can close at any point in time. This would certainly get 
rid of the unwanted branch reports.

As for the others I can only help but think of Subversion, uuids, md5 sums, and 
specific version strings that are made up on compile time so as if r??????M is a 
version that is being submitted it would be turned down by the waiting server 
or stopped directly on client side. And for the rest of the world running CVS ;) 
I don't have something coming to mind at the moment.

I am pretty sure though by any means that a solution to all the above can be met 
with prejudice.


-- 

  Jason J. Hellenthal
  http://www.DataIX.net/
  jasonh@DataIX.net
  0x691411AC

  - (2^(N-1))

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 00:12:47 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ACAA4106566B;
	Sat, 12 Sep 2009 00:12:47 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 81E5D8FC13;
	Sat, 12 Sep 2009 00:12:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8C0Clgq067631;
	Sat, 12 Sep 2009 00:12:47 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8C0ClCB067628;
	Sat, 12 Sep 2009 00:12:47 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909120012.n8C0ClCB067628@svn.freebsd.org>
From: Xin LI 
Date: Sat, 12 Sep 2009 00:12:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197109 - in head: share/man/man4 sys/dev/syscons
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 00:12:47 -0000

Author: delphij
Date: Sat Sep 12 00:12:47 2009
New Revision: 197109
URL: http://svn.freebsd.org/changeset/base/197109

Log:
  Make use of the more flexable device hints by adding a new field,
  vesa_mode to specify VESA mode, as suggested by jhb@.

Modified:
  head/share/man/man4/syscons.4
  head/sys/dev/syscons/syscons.c

Modified: head/share/man/man4/syscons.4
==============================================================================
--- head/share/man/man4/syscons.4	Fri Sep 11 23:41:11 2009	(r197108)
+++ head/share/man/man4/syscons.4	Sat Sep 12 00:12:47 2009	(r197109)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2009
+.Dd September 11, 2009
 .Dt SYSCONS 4
 .Os
 .Sh NAME
@@ -61,6 +61,7 @@
 In
 .Pa /boot/device.hints :
 .Cd hint.sc.0.at="isa"
+.Cd hint.sc.0.vesa_mode=0x103
 .Sh DESCRIPTION
 The
 .Nm
@@ -427,8 +428,11 @@ or else at the loader prompt (see
 .\"This option suppresses the bell, whether audible or visual,
 .\"if it is rung in a background virtual terminal.
 .It 0x0080 (VESAMODE)
-This option puts the video card in the VESA mode specified by higher
-16 bits of the flags during kernel initialization.
+This option puts the video card in the VESA mode specified by
+.Pa /boot/device.hints
+variable
+.Va vesa_mode
+during kernel initialization.
 Note that in order for this flag to work, the kernel must be
 compiled with the
 .Dv SC_PIXEL_MODE

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Fri Sep 11 23:41:11 2009	(r197108)
+++ head/sys/dev/syscons/syscons.c	Sat Sep 12 00:12:47 2009	(r197109)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -352,7 +353,7 @@ sc_attach_unit(int unit, int flags)
 #endif
     int vc;
     struct cdev *dev;
-    u_int16_t vmode;
+    unsigned int vmode = 0;
 
     flags &= ~SC_KERNEL_CONSOLE;
 
@@ -373,7 +374,7 @@ sc_attach_unit(int unit, int flags)
     if (sc_console == NULL)	/* sc_console_unit < 0 */
 	sc_console = scp;
 
-    vmode = (flags >> 16) & 0x1fff;
+    (void)resource_int_value("sc", unit, "vesa_mode", &vmode);
     if (vmode < M_VESA_BASE || vmode > M_VESA_MODE_MAX)
 	vmode = M_VESA_FULL_800;
 

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 00:18:52 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 759B8106566C;
	Sat, 12 Sep 2009 00:18:52 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net
	[IPv6:2001:470:1f03:2c9::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D23D8FC19;
	Sat, 12 Sep 2009 00:18:52 +0000 (UTC)
Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.delphij.net (Postfix) with ESMTPS id 62D2C5C06F;
	Sat, 12 Sep 2009 08:18:51 +0800 (CST)
Received: from localhost (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id 1AAD555CDF7D;
	Sat, 12 Sep 2009 08:18:51 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with ESMTP id FTLjqKvQwP5v; Sat, 12 Sep 2009 08:18:45 +0800 (CST)
Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net
	[76.237.33.62])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id D630655CDF7B;
	Sat, 12 Sep 2009 08:18:43 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:
	x-enigmail-version:openpgp:content-type:content-transfer-encoding;
	b=vX4hJY1Z4uL2URTVnW8wEiaqgemZrnj7QCVtyTPZnSbolF6W9aue56yP29qclZFTw
	kfLyRuu1xEd4mtFn1jBYQ==
Message-ID: <4AAAE8E1.10705@delphij.net>
Date: Fri, 11 Sep 2009 17:18:41 -0700
From: Xin LI 
Organization: The FreeBSD Project
User-Agent: Thunderbird 2.0.0.22 (X11/20090803)
MIME-Version: 1.0
To: John Baldwin 
References: <200909110207.n8B27PjH037758@svn.freebsd.org>
	<200909111055.14845.jhb@freebsd.org>
In-Reply-To: <200909111055.14845.jhb@freebsd.org>
X-Enigmail-Version: 0.96.0
OpenPGP: id=18EDEBA0;
	url=http://www.delphij.net/delphij.asc
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG,
	src-committers@FreeBSD.ORG, Xin LI 
Subject: Re: svn commit: r197085 - in head: share/man/man4 sys/dev/syscons
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 00:18:52 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Baldwin wrote:
> On Thursday 10 September 2009 10:07:25 pm Xin LI wrote:
>> Author: delphij
>> Date: Fri Sep 11 02:07:24 2009
>> New Revision: 197085
>> URL: http://svn.freebsd.org/changeset/base/197085
>>
>> Log:
>>   Extend the usage of sc(4)'s hint variable 'flag'.  Bit 0x80 now means
>>   "set vesa mode" and higher 16bits of the flag would be the desired mode.
>>   
>>   One can now set, for instance, hint.sc.0.flags=0x01680180, which means
>>   that the system should set VESA mode 0x168 upon boot.
>>   
>>   Submitted by:	paradox , swell k at gmail.com with
>>   		some minor changes.
> 
> Ugh, I don't like overloading flags this much.  The historical usage of flags 
> was due to userconfig only letting one set a single flags property for a 
> given device.  Since moving to hints we now support free-form text 
> properties.  I would much prefer this be implemented by 
> setting 'hint.sc.0.vesa_mode=XXX' instead.

Oh I thought that hints does not work that way in the past.  I have make
change to make syscons work in this way, thanks for your suggestion!

Cheers,
- --
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkqq6OEACgkQi+vbBBjt66DB6gCeMpzzOMoN3DHmTD5qdxtVtLRf
vTYAoIH7HzAWYTb7HN9NwZlk5AQ5kg1L
=JxLv
-----END PGP SIGNATURE-----

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 00:28:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 80432106566B;
	Sat, 12 Sep 2009 00:28:05 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F9658FC19;
	Sat, 12 Sep 2009 00:28:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8C0S5j3067964;
	Sat, 12 Sep 2009 00:28:05 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8C0S5Xh067962;
	Sat, 12 Sep 2009 00:28:05 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200909120028.n8C0S5Xh067962@svn.freebsd.org>
From: Xin LI 
Date: Sat, 12 Sep 2009 00:28:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197110 - head/share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 00:28:05 -0000

Author: delphij
Date: Sat Sep 12 00:28:05 2009
New Revision: 197110
URL: http://svn.freebsd.org/changeset/base/197110

Log:
  Mention that individual device driver can accept other flags through
  resource_int_value(9).
  
  MFC after:	1 month

Modified:
  head/share/man/man5/device.hints.5

Modified: head/share/man/man5/device.hints.5
==============================================================================
--- head/share/man/man5/device.hints.5	Sat Sep 12 00:12:47 2009	(r197109)
+++ head/share/man/man5/device.hints.5	Sat Sep 12 00:28:05 2009	(r197110)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 7, 2001
+.Dd September 11, 2009
 .Dt DEVICE.HINTS 5
 .Os
 .Sh NAME
@@ -112,7 +112,8 @@ to disable the device.
 .El
 .Pp
 A device driver may require one or more hint lines with these keywords,
-and may accept other keywords not listed here.
+and may accept other keywords not listed here, through
+.Xr resource_int_value 9 .
 Consult individual device drivers' manual pages for available
 keywords and their possible values.
 .\" .Sh CONTROL VARIABLES
@@ -160,7 +161,8 @@ hint.acpi.0.disabled="1"
 .Sh SEE ALSO
 .Xr kenv 1 ,
 .Xr loader.conf 5 ,
-.Xr loader 8
+.Xr loader 8,
+.Xr resource_int_value 9 .
 .Sh HISTORY
 The
 .Nm

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 01:37:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1CA0F106566B;
	Sat, 12 Sep 2009 01:37:23 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0BD5E8FC12;
	Sat, 12 Sep 2009 01:37:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8C1bMNq069493;
	Sat, 12 Sep 2009 01:37:22 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8C1bMVK069491;
	Sat, 12 Sep 2009 01:37:22 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200909120137.n8C1bMVK069491@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Sat, 12 Sep 2009 01:37:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197111 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 01:37:23 -0000

Author: des
Date: Sat Sep 12 01:37:22 2009
New Revision: 197111
URL: http://svn.freebsd.org/changeset/base/197111

Log:
  Fix typo in example.
  
  Noticed by:	rookie@
  MFC after:	1 week

Modified:
  head/share/man/man4/textdump.4

Modified: head/share/man/man4/textdump.4
==============================================================================
--- head/share/man/man4/textdump.4	Sat Sep 12 00:28:05 2009	(r197110)
+++ head/share/man/man4/textdump.4	Sat Sep 12 01:37:22 2009	(r197111)
@@ -138,7 +138,7 @@ invoke panic in order to force a kernel 
 reboot:
 .Bd -literal -offset indent
 script kdb.enter.panic=textdump set; capture on; show allpcpu; bt;
-  ps; alltrace; show alllock; call doadump; reset
+  ps; alltrace; show alllocks; call doadump; reset
 .Ed
 .Pp
 In the following example, the script

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 01:39:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BF561106566B;
	Sat, 12 Sep 2009 01:39:56 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 8094C8FC0C;
	Sat, 12 Sep 2009 01:39:56 +0000 (UTC)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 7F1906D44C;
	Sat, 12 Sep 2009 01:39:55 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 61B0C844B5; Sat, 12 Sep 2009 03:39:55 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: src-committers@freebsd.org
References: <200909120137.n8C1bMVK069491@svn.freebsd.org>
Date: Sat, 12 Sep 2009 03:39:55 +0200
In-Reply-To: <200909120137.n8C1bMVK069491@svn.freebsd.org> (Dag-Erling
	Smorgrav's message of "Sat, 12 Sep 2009 01:37:22 +0000 (UTC)")
Message-ID: <86fxatj5zo.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r197111 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 01:39:56 -0000

Dag-Erling Smorgrav  writes:
>   Noticed by:	rookie@

by which I mean attilio@ - rookie is his Indian name.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 08:19:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 755651065672;
	Sat, 12 Sep 2009 08:19:24 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 656568FC14;
	Sat, 12 Sep 2009 08:19:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8C8JOT1079106;
	Sat, 12 Sep 2009 08:19:24 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8C8JOqT079103;
	Sat, 12 Sep 2009 08:19:24 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200909120819.n8C8JOqT079103@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 12 Sep 2009 08:19:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197114 - head/sys/teken
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 08:19:24 -0000

Author: ed
Date: Sat Sep 12 08:19:24 2009
New Revision: 197114
URL: http://svn.freebsd.org/changeset/base/197114

Log:
  Make resizing of teken terminals a bit more safe.
  
  Just perform a full reset when resizing the terminal. This means the
  cursor, scrolling region, etc. are never positioned outside the
  terminal.

Modified:
  head/sys/teken/teken.c
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Sat Sep 12 05:39:51 2009	(r197113)
+++ head/sys/teken/teken.c	Sat Sep 12 08:19:24 2009	(r197114)
@@ -341,10 +341,7 @@ teken_set_winsize(teken_t *t, const teke
 {
 
 	t->t_winsize = *p;
-	/* XXX: bounds checking with cursor/etc! */
-	t->t_scrollreg.ts_begin = 0;
-	t->t_scrollreg.ts_end = t->t_winsize.tp_row;
-	t->t_originreg = t->t_scrollreg;
+	teken_subr_do_reset(t);
 }
 
 /*

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Sat Sep 12 05:39:51 2009	(r197113)
+++ head/sys/teken/teken_subr.h	Sat Sep 12 08:19:24 2009	(r197114)
@@ -927,6 +927,9 @@ teken_subr_do_reset(teken_t *t)
 
 	t->t_curattr = t->t_defattr;
 	t->t_cursor.tp_row = t->t_cursor.tp_col = 0;
+	t->t_scrollreg.ts_begin = 0;
+	t->t_scrollreg.ts_end = t->t_winsize.tp_row;
+	t->t_originreg = t->t_scrollreg;
 	t->t_stateflags = TS_AUTOWRAP;
 
 	teken_scs_set(t, 0, teken_scs_us_ascii);

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 10:34:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8D041065670;
	Sat, 12 Sep 2009 10:34:34 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B73308FC08;
	Sat, 12 Sep 2009 10:34:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CAYYQb081928;
	Sat, 12 Sep 2009 10:34:34 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CAYYBD081922;
	Sat, 12 Sep 2009 10:34:34 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200909121034.n8CAYYBD081922@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 12 Sep 2009 10:34:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197115 - in head/sys: dev/syscons teken
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 10:34:34 -0000

Author: ed
Date: Sat Sep 12 10:34:34 2009
New Revision: 197115
URL: http://svn.freebsd.org/changeset/base/197115

Log:
  Make 8-bit support run-time configurable.
  
  Now to do the same for xterm support. This means people can eventually
  toy around with xterm+UTF-8 without recompiling their kernel.

Modified:
  head/sys/dev/syscons/scterm-teken.c
  head/sys/teken/teken.c
  head/sys/teken/teken.h
  head/sys/teken/teken_demo.c
  head/sys/teken/teken_subr.h

Modified: head/sys/dev/syscons/scterm-teken.c
==============================================================================
--- head/sys/dev/syscons/scterm-teken.c	Sat Sep 12 08:19:24 2009	(r197114)
+++ head/sys/dev/syscons/scterm-teken.c	Sat Sep 12 10:34:34 2009	(r197115)
@@ -125,6 +125,9 @@ scteken_init(scr_stat *scp, void **softc
 		/* FALLTHROUGH */
 	case SC_TE_WARM_INIT:
 		teken_init(&ts->ts_teken, &scteken_funcs, scp);
+#ifndef TEKEN_UTF8
+		teken_set_8bit(&ts->ts_teken);
+#endif /* !TEKEN_UTF8 */
 
 		tp.tp_row = scp->ysize;
 		tp.tp_col = scp->xsize;

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Sat Sep 12 08:19:24 2009	(r197114)
+++ head/sys/teken/teken.c	Sat Sep 12 10:34:34 2009	(r197115)
@@ -49,26 +49,17 @@ static FILE *df;
 #endif /* __FreeBSD__ && _KERNEL */
 
 #include "teken.h"
-
-#ifdef TEKEN_UTF8
 #include "teken_wcwidth.h"
-#else /* !TEKEN_UTF8 */
-#ifdef TEKEN_XTERM
-#define	teken_wcwidth(c)	((c <= 0x1B) ? -1 : 1)
-#else /* !TEKEN_XTERM */
-#define	teken_wcwidth(c)	(1)
-#endif /* TEKEN_XTERM */
-#endif /* TEKEN_UTF8 */
 
-#if defined(TEKEN_XTERM) && defined(TEKEN_UTF8)
+#ifdef TEKEN_XTERM
 #include "teken_scs.h"
-#else /* !(TEKEN_XTERM && TEKEN_UTF8) */
+#else /* !TEKEN_XTERM */
 #define	teken_scs_process(t, c)	(c)
 #define	teken_scs_restore(t)
 #define	teken_scs_save(t)
 #define	teken_scs_set(t, g, ts)
 #define	teken_scs_switch(t, g)
-#endif /* TEKEN_XTERM && TEKEN_UTF8 */
+#endif /* TEKEN_XTERM */
 
 /* Private flags for t_stateflags. */
 #define	TS_FIRSTDIGIT	0x01	/* First numeric digit in escape sequence. */
@@ -187,9 +178,7 @@ teken_init(teken_t *t, const teken_funcs
 	t->t_defattr.ta_bgcolor = TC_BLACK;
 	teken_subr_do_reset(t);
 
-#ifdef TEKEN_UTF8
 	t->t_utf8_left = 0;
-#endif /* TEKEN_UTF8 */
 
 	teken_set_winsize(t, &tp);
 }
@@ -214,14 +203,14 @@ teken_input_char(teken_t *t, teken_char_
 	case '\x0C':
 		teken_subr_newpage(t);
 		break;
-#if defined(TEKEN_XTERM) && defined(TEKEN_UTF8)
+#ifdef TEKEN_XTERM
 	case '\x0E':
 		teken_scs_switch(t, 1);
 		break;
 	case '\x0F':
 		teken_scs_switch(t, 0);
 		break;
-#endif /* TEKEN_XTERM && TEKEN_UTF8 */
+#endif /* TEKEN_XTERM */
 	case '\r':
 		teken_subr_carriage_return(t);
 		break;
@@ -253,11 +242,13 @@ static void
 teken_input_byte(teken_t *t, unsigned char c)
 {
 
-#ifdef TEKEN_UTF8
 	/*
 	 * UTF-8 handling.
 	 */
-	if ((c & 0x80) == 0x00) {
+	 if (t->t_utf8_left == -1) {
+	 	/* UTF-8 disabled. */
+		teken_input_char(t, c);
+	} else if ((c & 0x80) == 0x00) {
 		/* One-byte sequence. */
 		t->t_utf8_left = 0;
 		teken_input_char(t, c);
@@ -283,9 +274,6 @@ teken_input_byte(teken_t *t, unsigned ch
 			teken_input_char(t, t->t_utf8_partial);
 		}
 	}
-#else /* !TEKEN_UTF8 */
-	teken_input_char(t, c);
-#endif /* TEKEN_UTF8 */
 }
 
 void
@@ -344,6 +332,13 @@ teken_set_winsize(teken_t *t, const teke
 	teken_subr_do_reset(t);
 }
 
+void
+teken_set_8bit(teken_t *t)
+{
+
+	t->t_utf8_left = -1;
+}
+
 /*
  * State machine.
  */

Modified: head/sys/teken/teken.h
==============================================================================
--- head/sys/teken/teken.h	Sat Sep 12 08:19:24 2009	(r197114)
+++ head/sys/teken/teken.h	Sat Sep 12 10:34:34 2009	(r197115)
@@ -36,7 +36,6 @@
  * commands.
  *
  * Configuration switches:
- * - TEKEN_UTF8: Enable/disable UTF-8 handling.
  * - TEKEN_XTERM: Enable xterm-style emulation, instead of cons25.
  */
 
@@ -44,11 +43,7 @@
 #include "opt_teken.h"
 #endif /* __FreeBSD__ && _KERNEL */
 
-#ifdef TEKEN_UTF8
 typedef uint32_t teken_char_t;
-#else /* !TEKEN_UTF8 */
-typedef unsigned char teken_char_t;
-#endif /* TEKEN_UTF8 */
 typedef unsigned short teken_unit_t;
 typedef unsigned char teken_format_t;
 #define	TF_BOLD		0x01
@@ -121,9 +116,9 @@ typedef struct {
 	tf_respond_t	*tf_respond;
 } teken_funcs_t;
 
-#if defined(TEKEN_XTERM) && defined(TEKEN_UTF8)
+#ifdef TEKEN_XTERM
 typedef teken_char_t teken_scs_t(teken_char_t);
-#endif /* TEKEN_XTERM && TEKEN_UTF8 */
+#endif /* TEKEN_XTERM */
 
 /*
  * Terminal state.
@@ -156,16 +151,14 @@ struct __teken {
 #define	T_NUMCOL	160
 	unsigned int	 t_tabstops[T_NUMCOL / (sizeof(unsigned int) * 8)];
 
-#ifdef TEKEN_UTF8
-	unsigned int	 t_utf8_left;
+	int		 t_utf8_left;
 	teken_char_t	 t_utf8_partial;
-#endif /* TEKEN_UTF8 */
 
-#if defined(TEKEN_XTERM) && defined(TEKEN_UTF8)
+#ifdef TEKEN_XTERM
 	unsigned int	 t_curscs;
 	teken_scs_t	*t_saved_curscs;
 	teken_scs_t	*t_scs[2];
-#endif /* TEKEN_XTERM && TEKEN_UTF8 */
+#endif /* TEKEN_XTERM */
 };
 
 /* Initialize teken structure. */
@@ -182,4 +175,7 @@ void	teken_set_curattr(teken_t *, const 
 void	teken_set_defattr(teken_t *, const teken_attr_t *);
 void	teken_set_winsize(teken_t *, const teken_pos_t *);
 
+/* Legacy features. */
+void	teken_set_8bit(teken_t *);
+
 #endif /* !_TEKEN_H_ */

Modified: head/sys/teken/teken_demo.c
==============================================================================
--- head/sys/teken/teken_demo.c	Sat Sep 12 08:19:24 2009	(r197114)
+++ head/sys/teken/teken_demo.c	Sat Sep 12 10:34:34 2009	(r197115)
@@ -95,7 +95,6 @@ printchar(const teken_pos_t *p)
  	px = &buffer[p->tp_col][p->tp_row];
 
 	/* Convert Unicode to UTF-8. */
-#ifdef TEKEN_UTF8
 	if (px->c < 0x80) {
 		str[0] = px->c;
 	} else if (px->c < 0x800) {
@@ -111,9 +110,6 @@ printchar(const teken_pos_t *p)
 		str[2] = 0x80 | ((px->c >> 6) & 0x3f);
 		str[3] = 0x80 | (px->c & 0x3f);
 	}
-#else /* !TEKEN_UTF8 */
-	str[0] = px->c;
-#endif /* TEKEN_UTF8 */
 
 	if (px->a.ta_format & TF_BOLD)
 		attr |= A_BOLD;
@@ -294,9 +290,7 @@ main(int argc __unused, char *argv[] __u
 	};
 	int i, j;
 
-#ifdef TEKEN_UTF8
 	setlocale(LC_CTYPE, "UTF-8");
-#endif /* TEKEN_UTF8 */
 
 	tp.tp_row = ws.ws_row = NROWS;
 	tp.tp_col = ws.ws_col = NCOLS;
@@ -311,9 +305,7 @@ main(int argc __unused, char *argv[] __u
 #else /* !TEKEN_XTERM */
 		setenv("TERM", "cons25", 1);
 #endif /* TEKEN_XTERM */
-#ifdef TEKEN_UTF8
 		setenv("LC_CTYPE", "UTF-8", 0);
-#endif /* TEKEN_UTF8 */
 		execlp("zsh", "-zsh", NULL);
 		execlp("bash", "-bash", NULL);
 		execlp("sh", "-sh", NULL);

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Sat Sep 12 08:19:24 2009	(r197114)
+++ head/sys/teken/teken_subr.h	Sat Sep 12 10:34:34 2009	(r197115)
@@ -786,13 +786,20 @@ static void
 teken_subr_regular_character(teken_t *t, teken_char_t c)
 {
 	int width;
-	
-	c = teken_scs_process(t, c);
 
-	/* XXX: Don't process zero-width characters yet. */
-	width = teken_wcwidth(c);
-	if (width <= 0)
-		return;
+	if (t->t_utf8_left == -1) {
+#ifdef TEKEN_XTERM
+		if (c <= 0x1B)
+			return;
+#endif /* TEKEN_XTERM */
+		width = 1;
+	} else {
+		c = teken_scs_process(t, c);
+		width = teken_wcwidth(c);
+		/* XXX: Don't process zero-width characters yet. */
+		if (width <= 0)
+			return;
+	}
 
 #ifdef TEKEN_XTERM
 	if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 &&

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 10:41:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2184C106566B;
	Sat, 12 Sep 2009 10:41:33 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 110C78FC0C;
	Sat, 12 Sep 2009 10:41:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CAfW8r082141;
	Sat, 12 Sep 2009 10:41:32 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CAfWFm082139;
	Sat, 12 Sep 2009 10:41:32 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200909121041.n8CAfWFm082139@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 12 Sep 2009 10:41:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197116 - head/sys/teken
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 10:41:33 -0000

Author: ed
Date: Sat Sep 12 10:41:32 2009
New Revision: 197116
URL: http://svn.freebsd.org/changeset/base/197116

Log:
  Small style(9) bug introduced in the previous commit.

Modified:
  head/sys/teken/teken.c

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Sat Sep 12 10:34:34 2009	(r197115)
+++ head/sys/teken/teken.c	Sat Sep 12 10:41:32 2009	(r197116)
@@ -245,8 +245,8 @@ teken_input_byte(teken_t *t, unsigned ch
 	/*
 	 * UTF-8 handling.
 	 */
-	 if (t->t_utf8_left == -1) {
-	 	/* UTF-8 disabled. */
+	if (t->t_utf8_left == -1) {
+		/* UTF-8 disabled. */
 		teken_input_char(t, c);
 	} else if ((c & 0x80) == 0x00) {
 		/* One-byte sequence. */

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 12:44:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F3950106566B;
	Sat, 12 Sep 2009 12:44:21 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E0DAD8FC0A;
	Sat, 12 Sep 2009 12:44:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CCiLZZ086951;
	Sat, 12 Sep 2009 12:44:21 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CCiL47086945;
	Sat, 12 Sep 2009 12:44:21 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200909121244.n8CCiL47086945@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 12 Sep 2009 12:44:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197117 - head/sys/teken
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 12:44:22 -0000

Author: ed
Date: Sat Sep 12 12:44:21 2009
New Revision: 197117
URL: http://svn.freebsd.org/changeset/base/197117

Log:
  Commit all local modifications I have to libteken:
  
  - Make xterm/cons25 support runtime configurable. This allows me to
    share libteken between syscons and my new vt driver.
  - Add a fix to print blanks after printing a double width character to
    prevent rendering artifacts.
  - Add some more utility functions that I use in the vt driver.

Modified:
  head/sys/teken/teken.c
  head/sys/teken/teken.h
  head/sys/teken/teken_demo.c
  head/sys/teken/teken_subr.h
  head/sys/teken/teken_subr_compat.h

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Sat Sep 12 10:41:32 2009	(r197116)
+++ head/sys/teken/teken.c	Sat Sep 12 12:44:21 2009	(r197117)
@@ -50,27 +50,16 @@ static FILE *df;
 
 #include "teken.h"
 #include "teken_wcwidth.h"
-
-#ifdef TEKEN_XTERM
 #include "teken_scs.h"
-#else /* !TEKEN_XTERM */
-#define	teken_scs_process(t, c)	(c)
-#define	teken_scs_restore(t)
-#define	teken_scs_save(t)
-#define	teken_scs_set(t, g, ts)
-#define	teken_scs_switch(t, g)
-#endif /* TEKEN_XTERM */
 
 /* Private flags for t_stateflags. */
 #define	TS_FIRSTDIGIT	0x01	/* First numeric digit in escape sequence. */
 #define	TS_INSERT	0x02	/* Insert mode. */
 #define	TS_AUTOWRAP	0x04	/* Autowrap. */
 #define	TS_ORIGIN	0x08	/* Origin mode. */
-#ifdef TEKEN_XTERM
 #define	TS_WRAPPED	0x10	/* Next character should be printed on col 0. */
-#else /* !TEKEN_XTERM */
-#define	TS_WRAPPED	0x00	/* Simple line wrapping. */
-#endif /* TEKEN_XTERM */
+#define	TS_8BIT		0x20	/* UTF-8 disabled. */
+#define	TS_CONS25	0x40	/* cons25 emulation. */
 
 /* Character that blanks a cell. */
 #define	BLANK	' '
@@ -172,14 +161,14 @@ teken_init(teken_t *t, const teken_funcs
 	t->t_softc = softc;
 
 	t->t_nextstate = teken_state_init;
+	t->t_stateflags = 0;
+	t->t_utf8_left = 0;
 
 	t->t_defattr.ta_format = 0;
 	t->t_defattr.ta_fgcolor = TC_WHITE;
 	t->t_defattr.ta_bgcolor = TC_BLACK;
 	teken_subr_do_reset(t);
 
-	t->t_utf8_left = 0;
-
 	teken_set_winsize(t, &tp);
 }
 
@@ -203,14 +192,18 @@ teken_input_char(teken_t *t, teken_char_
 	case '\x0C':
 		teken_subr_newpage(t);
 		break;
-#ifdef TEKEN_XTERM
 	case '\x0E':
-		teken_scs_switch(t, 1);
+		if (t->t_stateflags & TS_CONS25)
+			t->t_nextstate(t, c);
+		else
+			teken_scs_switch(t, 1);
 		break;
 	case '\x0F':
-		teken_scs_switch(t, 0);
+		if (t->t_stateflags & TS_CONS25)
+			t->t_nextstate(t, c);
+		else
+			teken_scs_switch(t, 0);
 		break;
-#endif /* TEKEN_XTERM */
 	case '\r':
 		teken_subr_carriage_return(t);
 		break;
@@ -245,10 +238,7 @@ teken_input_byte(teken_t *t, unsigned ch
 	/*
 	 * UTF-8 handling.
 	 */
-	if (t->t_utf8_left == -1) {
-		/* UTF-8 disabled. */
-		teken_input_char(t, c);
-	} else if ((c & 0x80) == 0x00) {
+	if ((c & 0x80) == 0x00 || t->t_stateflags & TS_8BIT) {
 		/* One-byte sequence. */
 		t->t_utf8_left = 0;
 		teken_input_char(t, c);
@@ -285,6 +275,13 @@ teken_input(teken_t *t, const void *buf,
 		teken_input_byte(t, *c++);
 }
 
+const teken_pos_t *
+teken_get_cursor(teken_t *t)
+{
+
+	return (&t->t_cursor);
+}
+
 void
 teken_set_cursor(teken_t *t, const teken_pos_t *p)
 {
@@ -324,6 +321,13 @@ teken_set_defattr(teken_t *t, const teke
 	t->t_curattr = t->t_saved_curattr = t->t_defattr = *a;
 }
 
+const teken_pos_t *
+teken_get_winsize(teken_t *t)
+{
+
+	return (&t->t_winsize);
+}
+
 void
 teken_set_winsize(teken_t *t, const teken_pos_t *p)
 {
@@ -336,7 +340,14 @@ void
 teken_set_8bit(teken_t *t)
 {
 
-	t->t_utf8_left = -1;
+	t->t_stateflags |= TS_8BIT;
+}
+
+void
+teken_set_cons25(teken_t *t)
+{
+
+	t->t_stateflags |= TS_CONS25;
 }
 
 /*

Modified: head/sys/teken/teken.h
==============================================================================
--- head/sys/teken/teken.h	Sat Sep 12 10:41:32 2009	(r197116)
+++ head/sys/teken/teken.h	Sat Sep 12 12:44:21 2009	(r197117)
@@ -34,15 +34,8 @@
  *
  * This library converts an UTF-8 stream of bytes to terminal drawing
  * commands.
- *
- * Configuration switches:
- * - TEKEN_XTERM: Enable xterm-style emulation, instead of cons25.
  */
 
-#if defined(__FreeBSD__) && defined(_KERNEL)
-#include "opt_teken.h"
-#endif /* __FreeBSD__ && _KERNEL */
-
 typedef uint32_t teken_char_t;
 typedef unsigned short teken_unit_t;
 typedef unsigned char teken_format_t;
@@ -116,9 +109,7 @@ typedef struct {
 	tf_respond_t	*tf_respond;
 } teken_funcs_t;
 
-#ifdef TEKEN_XTERM
 typedef teken_char_t teken_scs_t(teken_char_t);
-#endif /* TEKEN_XTERM */
 
 /*
  * Terminal state.
@@ -151,14 +142,12 @@ struct __teken {
 #define	T_NUMCOL	160
 	unsigned int	 t_tabstops[T_NUMCOL / (sizeof(unsigned int) * 8)];
 
-	int		 t_utf8_left;
+	unsigned int	 t_utf8_left;
 	teken_char_t	 t_utf8_partial;
 
-#ifdef TEKEN_XTERM
 	unsigned int	 t_curscs;
 	teken_scs_t	*t_saved_curscs;
 	teken_scs_t	*t_scs[2];
-#endif /* TEKEN_XTERM */
 };
 
 /* Initialize teken structure. */
@@ -168,8 +157,11 @@ void	teken_init(teken_t *, const teken_f
 void	teken_input(teken_t *, const void *, size_t);
 
 /* Get/set teken attributes. */
+const teken_pos_t *teken_get_cursor(teken_t *);
 const teken_attr_t *teken_get_curattr(teken_t *);
 const teken_attr_t *teken_get_defattr(teken_t *);
+void	teken_get_defattr_cons25(teken_t *, int *, int *);
+const teken_pos_t *teken_get_winsize(teken_t *);
 void	teken_set_cursor(teken_t *, const teken_pos_t *);
 void	teken_set_curattr(teken_t *, const teken_attr_t *);
 void	teken_set_defattr(teken_t *, const teken_attr_t *);
@@ -177,5 +169,6 @@ void	teken_set_winsize(teken_t *, const 
 
 /* Legacy features. */
 void	teken_set_8bit(teken_t *);
+void	teken_set_cons25(teken_t *);
 
 #endif /* !_TEKEN_H_ */

Modified: head/sys/teken/teken_demo.c
==============================================================================
--- head/sys/teken/teken_demo.c	Sat Sep 12 10:41:32 2009	(r197116)
+++ head/sys/teken/teken_demo.c	Sat Sep 12 12:44:21 2009	(r197117)
@@ -71,11 +71,7 @@ struct pixel {
 };
 
 #define NCOLS	80
-#ifdef TEKEN_XTERM
 #define NROWS	24
-#else /* !TEKEN_XTERM */
-#define NROWS	25
-#endif /* TEKEN_XTERM */
 struct pixel buffer[NCOLS][NROWS];
 
 static int ptfd;
@@ -300,11 +296,7 @@ main(int argc __unused, char *argv[] __u
 		perror("forkpty");
 		exit(1);
 	case 0:
-#ifdef TEKEN_XTERM
 		setenv("TERM", "xterm", 1);
-#else /* !TEKEN_XTERM */
-		setenv("TERM", "cons25", 1);
-#endif /* TEKEN_XTERM */
 		setenv("LC_CTYPE", "UTF-8", 0);
 		execlp("zsh", "-zsh", NULL);
 		execlp("bash", "-bash", NULL);

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Sat Sep 12 10:41:32 2009	(r197116)
+++ head/sys/teken/teken_subr.h	Sat Sep 12 12:44:21 2009	(r197117)
@@ -202,22 +202,22 @@ static void
 teken_subr_backspace(teken_t *t)
 {
 
-#ifdef TEKEN_XTERM
-	if (t->t_cursor.tp_col == 0)
-		return;
-
-	t->t_cursor.tp_col--;
-	t->t_stateflags &= ~TS_WRAPPED;
-#else /* !TEKEN_XTERM */
-	if (t->t_cursor.tp_col == 0) {
-		if (t->t_cursor.tp_row == t->t_originreg.ts_begin)
-			return;
-		t->t_cursor.tp_row--;
-		t->t_cursor.tp_col = t->t_winsize.tp_col - 1;
+	if (t->t_stateflags & TS_CONS25) {
+		if (t->t_cursor.tp_col == 0) {
+			if (t->t_cursor.tp_row == t->t_originreg.ts_begin)
+				return;
+			t->t_cursor.tp_row--;
+			t->t_cursor.tp_col = t->t_winsize.tp_col - 1;
+		} else {
+			t->t_cursor.tp_col--;
+		}
 	} else {
+		if (t->t_cursor.tp_col == 0)
+			return;
+
 		t->t_cursor.tp_col--;
+		t->t_stateflags &= ~TS_WRAPPED;
 	}
-#endif /* TEKEN_XTERM */
 
 	teken_funcs_cursor(t);
 }
@@ -588,21 +588,21 @@ teken_subr_horizontal_position_absolute(
 static void
 teken_subr_horizontal_tab(teken_t *t)
 {
-#ifdef TEKEN_XTERM
-	teken_rect_t tr;
 
-	tr.tr_begin = t->t_cursor;
-	teken_subr_cursor_forward_tabulation(t, 1);
-	tr.tr_end.tp_row = tr.tr_begin.tp_row + 1;
-	tr.tr_end.tp_col = t->t_cursor.tp_col;
-
-	/* Blank region that we skipped. */
-	if (tr.tr_end.tp_col > tr.tr_begin.tp_col)
-		teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
-#else /* !TEKEN_XTERM */
+	if (t->t_stateflags & TS_CONS25) {
+		teken_subr_cursor_forward_tabulation(t, 1);
+	} else {
+		teken_rect_t tr;
 
-	teken_subr_cursor_forward_tabulation(t, 1);
-#endif /* TEKEN_XTERM */
+		tr.tr_begin = t->t_cursor;
+		teken_subr_cursor_forward_tabulation(t, 1);
+		tr.tr_end.tp_row = tr.tr_begin.tp_row + 1;
+		tr.tr_end.tp_col = t->t_cursor.tp_col;
+
+		/* Blank region that we skipped. */
+		if (tr.tr_end.tp_col > tr.tr_begin.tp_col)
+			teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
+	}
 }
 
 static void
@@ -710,19 +710,19 @@ teken_subr_newline(teken_t *t)
 static void
 teken_subr_newpage(teken_t *t)
 {
-#ifdef TEKEN_XTERM
 
-	teken_subr_newline(t);
-#else /* !TEKEN_XTERM */
-	teken_rect_t tr;
+	if (t->t_stateflags & TS_CONS25) {
+		teken_rect_t tr;
 
-	tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0;
-	tr.tr_end = t->t_winsize;
-	teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
+		tr.tr_begin.tp_row = tr.tr_begin.tp_col = 0;
+		tr.tr_end = t->t_winsize;
+		teken_funcs_fill(t, &tr, BLANK, &t->t_curattr);
 
-	t->t_cursor.tp_row = t->t_cursor.tp_col = 0;
-	teken_funcs_cursor(t);
-#endif /* TEKEN_XTERM */
+		t->t_cursor.tp_row = t->t_cursor.tp_col = 0;
+		teken_funcs_cursor(t);
+	} else {
+		teken_subr_newline(t);
+	}
 }
 
 static void
@@ -779,6 +779,20 @@ teken_subr_do_putchar(teken_t *t, const 
 		teken_funcs_copy(t, &ctr, &ctp);
 	}
 
+	if (width == 2 && tp->tp_col + 1 < t->t_winsize.tp_col) {
+		teken_pos_t tp2;
+
+		/*
+		 * Store a space behind double width characters before
+		 * actually printing them. This prevents artifacts when
+		 * the consumer doesn't render it using double width
+		 * glyphs.
+		 */
+		tp2.tp_row = tp->tp_row;
+		tp2.tp_col = tp->tp_col + 1;
+		teken_funcs_putchar(t, &tp2, BLANK, &t->t_curattr);
+	}
+
 	teken_funcs_putchar(t, tp, c, &t->t_curattr);
 }
 
@@ -787,11 +801,9 @@ teken_subr_regular_character(teken_t *t,
 {
 	int width;
 
-	if (t->t_utf8_left == -1) {
-#ifdef TEKEN_XTERM
-		if (c <= 0x1B)
+	if (t->t_stateflags & TS_8BIT) {
+		if (!(t->t_stateflags & TS_CONS25) && c <= 0x1B)
 			return;
-#endif /* TEKEN_XTERM */
 		width = 1;
 	} else {
 		c = teken_scs_process(t, c);
@@ -801,8 +813,23 @@ teken_subr_regular_character(teken_t *t,
 			return;
 	}
 
-#ifdef TEKEN_XTERM
-	if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 &&
+	if (t->t_stateflags & TS_CONS25) {
+		teken_subr_do_putchar(t, &t->t_cursor, c, width);
+		t->t_cursor.tp_col += width;
+
+		if (t->t_cursor.tp_col >= t->t_winsize.tp_col) {
+			if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) {
+				/* Perform scrolling. */
+				teken_subr_do_scroll(t, 1);
+			} else {
+				/* No scrolling needed. */
+				if (t->t_cursor.tp_row <
+				    t->t_winsize.tp_row - 1)
+					t->t_cursor.tp_row++;
+			}
+			t->t_cursor.tp_col = 0;
+		}
+	} else if (t->t_cursor.tp_col == t->t_winsize.tp_col - 1 &&
 	    (t->t_stateflags & (TS_WRAPPED|TS_AUTOWRAP)) ==
 	    (TS_WRAPPED|TS_AUTOWRAP)) {
 		teken_pos_t tp;
@@ -846,22 +873,6 @@ teken_subr_regular_character(teken_t *t,
 			t->t_stateflags &= ~TS_WRAPPED;
 		}
 	}
-#else /* !TEKEN_XTERM */
-	teken_subr_do_putchar(t, &t->t_cursor, c, width);
-	t->t_cursor.tp_col += width;
-
-	if (t->t_cursor.tp_col >= t->t_winsize.tp_col) {
-		if (t->t_cursor.tp_row == t->t_scrollreg.ts_end - 1) {
-			/* Perform scrolling. */
-			teken_subr_do_scroll(t, 1);
-		} else {
-			/* No scrolling needed. */
-			if (t->t_cursor.tp_row < t->t_winsize.tp_row - 1)
-				t->t_cursor.tp_row++;
-		}
-		t->t_cursor.tp_col = 0;
-	}
-#endif /* TEKEN_XTERM */
 
 	teken_funcs_cursor(t);
 }
@@ -937,7 +948,8 @@ teken_subr_do_reset(teken_t *t)
 	t->t_scrollreg.ts_begin = 0;
 	t->t_scrollreg.ts_end = t->t_winsize.tp_row;
 	t->t_originreg = t->t_scrollreg;
-	t->t_stateflags = TS_AUTOWRAP;
+	t->t_stateflags &= TS_8BIT|TS_CONS25;
+	t->t_stateflags |= TS_AUTOWRAP;
 
 	teken_scs_set(t, 0, teken_scs_us_ascii);
 	teken_scs_set(t, 1, teken_scs_us_ascii);

Modified: head/sys/teken/teken_subr_compat.h
==============================================================================
--- head/sys/teken/teken_subr_compat.h	Sat Sep 12 10:41:32 2009	(r197116)
+++ head/sys/teken/teken_subr_compat.h	Sat Sep 12 12:44:21 2009	(r197117)
@@ -59,6 +59,18 @@ teken_subr_cons25_set_adapter_foreground
 	}
 }
 
+static const teken_color_t cons25_revcolors[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
+
+void
+teken_get_defattr_cons25(teken_t *t, int *fg, int *bg)
+{
+
+	*fg = cons25_revcolors[t->t_defattr.ta_fgcolor];
+	if (t->t_defattr.ta_format & TF_BOLD)
+		*fg += 8;
+	*bg = cons25_revcolors[t->t_defattr.ta_bgcolor];
+}
+
 static void
 teken_subr_cons25_switch_virtual_terminal(teken_t *t, unsigned int vt)
 {

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 14:46:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A47E1065693;
	Sat, 12 Sep 2009 14:46:22 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 894718FC14;
	Sat, 12 Sep 2009 14:46:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CEkM1q089352;
	Sat, 12 Sep 2009 14:46:22 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CEkMnH089350;
	Sat, 12 Sep 2009 14:46:22 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200909121446.n8CEkMnH089350@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 12 Sep 2009 14:46:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197118 - head/sys/dev/syscons
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 14:46:22 -0000

Author: ed
Date: Sat Sep 12 14:46:22 2009
New Revision: 197118
URL: http://svn.freebsd.org/changeset/base/197118

Log:
  Commit a change that I missed in the previous commit.
  
  I ran `svn commit' in sys/teken/, instead of sys/.

Modified:
  head/sys/dev/syscons/scterm-teken.c

Modified: head/sys/dev/syscons/scterm-teken.c
==============================================================================
--- head/sys/dev/syscons/scterm-teken.c	Sat Sep 12 12:44:21 2009	(r197117)
+++ head/sys/dev/syscons/scterm-teken.c	Sat Sep 12 14:46:22 2009	(r197118)
@@ -31,6 +31,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_syscons.h"
+#include "opt_teken.h"
 
 #include 
 #include 
@@ -128,6 +129,9 @@ scteken_init(scr_stat *scp, void **softc
 #ifndef TEKEN_UTF8
 		teken_set_8bit(&ts->ts_teken);
 #endif /* !TEKEN_UTF8 */
+#ifndef TEKEN_XTERM
+		teken_set_cons25(&ts->ts_teken);
+#endif /* !TEKEN_XTERM */
 
 		tp.tp_row = scp->ysize;
 		tp.tp_col = scp->xsize;

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 15:50:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EBF93106566B;
	Sat, 12 Sep 2009 15:50:08 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DAD368FC16;
	Sat, 12 Sep 2009 15:50:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CFo8q1090499;
	Sat, 12 Sep 2009 15:50:08 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CFo8b6090497;
	Sat, 12 Sep 2009 15:50:08 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200909121550.n8CFo8b6090497@svn.freebsd.org>
From: Luigi Rizzo 
Date: Sat, 12 Sep 2009 15:50:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197119 - head/release/picobsd/bridge
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 15:50:09 -0000

Author: luigi
Date: Sat Sep 12 15:50:08 2009
New Revision: 197119
URL: http://svn.freebsd.org/changeset/base/197119

Log:
  ifconfig now needs -ljail
  (this needs to go to RELENG_8 as well after the release is out)
  
  MFC after:	1 month

Modified:
  head/release/picobsd/bridge/crunch.conf

Modified: head/release/picobsd/bridge/crunch.conf
==============================================================================
--- head/release/picobsd/bridge/crunch.conf	Sat Sep 12 14:46:22 2009	(r197118)
+++ head/release/picobsd/bridge/crunch.conf	Sat Sep 12 15:50:08 2009	(r197119)
@@ -178,3 +178,4 @@ libs_so -lkvm
 libs_so -lz
 libs_so -lbsdxml
 libs_so -lsbuf
+libs_so -ljail	# used by ifconfig

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 17:58:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 080C6106568B;
	Sat, 12 Sep 2009 17:58:16 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E90498FC1E;
	Sat, 12 Sep 2009 17:58:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CHwFko092984;
	Sat, 12 Sep 2009 17:58:15 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CHwFD7092982;
	Sat, 12 Sep 2009 17:58:15 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200909121758.n8CHwFD7092982@svn.freebsd.org>
From: Michael Tuexen 
Date: Sat, 12 Sep 2009 17:58:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197122 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 17:58:16 -0000

Author: tuexen
Date: Sat Sep 12 17:58:15 2009
New Revision: 197122
URL: http://svn.freebsd.org/changeset/base/197122

Log:
  This fixes a bug where the value set by SCTP_PARTIAL_DELIVERY_POINT
  was not honored, if the socket buffer size was not 4 times that large.
  MFC of 196509.
  
  Approved by: re, rrs (mentor)`

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/sctp_indata.c

Modified: stable/8/sys/netinet/sctp_indata.c
==============================================================================
--- stable/8/sys/netinet/sctp_indata.c	Sat Sep 12 17:36:00 2009	(r197121)
+++ stable/8/sys/netinet/sctp_indata.c	Sat Sep 12 17:58:15 2009	(r197122)
@@ -921,7 +921,7 @@ doit_again:
 			 * but should we?
 			 */
 			if (stcb->sctp_socket) {
-				pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket) >> SCTP_PARTIAL_DELIVERY_SHIFT,
+				pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket),
 				    stcb->sctp_ep->partial_delivery_point);
 			} else {
 				pd_point = stcb->sctp_ep->partial_delivery_point;
@@ -2862,11 +2862,11 @@ doit_again:
 
 		/*
 		 * Before we start though either all of the message should
-		 * be here or 1/4 the socket buffer max or nothing on the
+		 * be here or the socket buffer max or nothing on the
 		 * delivery queue and something can be delivered.
 		 */
 		if (stcb->sctp_socket) {
-			pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket) >> SCTP_PARTIAL_DELIVERY_SHIFT,
+			pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket),
 			    stcb->sctp_ep->partial_delivery_point);
 		} else {
 			pd_point = stcb->sctp_ep->partial_delivery_point;

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:02:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 16310106566B;
	Sat, 12 Sep 2009 18:02:58 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0316B8FC0A;
	Sat, 12 Sep 2009 18:02:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CI2vLK093178;
	Sat, 12 Sep 2009 18:02:57 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CI2vJp093176;
	Sat, 12 Sep 2009 18:02:57 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909121802.n8CI2vJp093176@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 12 Sep 2009 18:02:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197123 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:02:58 -0000

Author: kib
Date: Sat Sep 12 18:02:57 2009
New Revision: 197123
URL: http://svn.freebsd.org/changeset/base/197123

Log:
  MFC r197030:
  In vfs_mark_atime(9), be resistent against reclaimed vnodes.
  Assert that neccessary locks are taken, since vop might not be called.
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/vfs_subr.c

Modified: stable/8/sys/kern/vfs_subr.c
==============================================================================
--- stable/8/sys/kern/vfs_subr.c	Sat Sep 12 17:58:15 2009	(r197122)
+++ stable/8/sys/kern/vfs_subr.c	Sat Sep 12 18:02:57 2009	(r197123)
@@ -4269,8 +4269,12 @@ vfs_read_dirent(struct vop_readdir_args 
 void
 vfs_mark_atime(struct vnode *vp, struct ucred *cred)
 {
+	struct mount *mp;
 
-	if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
+	mp = vp->v_mount;
+	VFS_ASSERT_GIANT(mp);
+	ASSERT_VOP_LOCKED(vp, "vfs_mark_atime");
+	if (mp != NULL && (mp->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
 		(void)VOP_MARKATIME(vp);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:05:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 662ED1065670;
	Sat, 12 Sep 2009 18:05:57 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 537D88FC08;
	Sat, 12 Sep 2009 18:05:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CI5vmT093276;
	Sat, 12 Sep 2009 18:05:57 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CI5vLd093274;
	Sat, 12 Sep 2009 18:05:57 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909121805.n8CI5vLd093274@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 12 Sep 2009 18:05:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197124 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:05:57 -0000

Author: kib
Date: Sat Sep 12 18:05:57 2009
New Revision: 197124
URL: http://svn.freebsd.org/changeset/base/197124

Log:
  MFC r197031:
  Unlock the image vnode around the call of pmc PMC_FN_PROCESS_EXEC hook.
  The hook calls vn_fullpath(9), that should not be executed with a vnode
  lock held.
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_exec.c

Modified: stable/8/sys/kern/kern_exec.c
==============================================================================
--- stable/8/sys/kern/kern_exec.c	Sat Sep 12 18:02:57 2009	(r197123)
+++ stable/8/sys/kern/kern_exec.c	Sat Sep 12 18:05:57 2009	(r197124)
@@ -786,10 +786,12 @@ interpret:
 	 */
 	if (PMC_SYSTEM_SAMPLING_ACTIVE() || PMC_PROC_IS_USING_PMCS(p)) {
 		PROC_UNLOCK(p);
+		VOP_UNLOCK(imgp->vp, 0);
 		pe.pm_credentialschanged = credential_changing;
 		pe.pm_entryaddr = imgp->entry_addr;
 
 		PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC, (void *) &pe);
+		vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
 	} else
 		PROC_UNLOCK(p);
 #else  /* !HWPMC_HOOKS */

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:08:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9312A1065679;
	Sat, 12 Sep 2009 18:08:44 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 802B68FC1F;
	Sat, 12 Sep 2009 18:08:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CI8i0x093428;
	Sat, 12 Sep 2009 18:08:44 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CI8it3093426;
	Sat, 12 Sep 2009 18:08:44 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200909121808.n8CI8it3093426@svn.freebsd.org>
From: Michael Tuexen 
Date: Sat, 12 Sep 2009 18:08:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197125 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:08:44 -0000

Author: tuexen
Date: Sat Sep 12 18:08:44 2009
New Revision: 197125
URL: http://svn.freebsd.org/changeset/base/197125

Log:
  MFC 196610:
  Fix a bug where vlan interfaces are not supported by SCTP.
  
  Approved by: re, rrs (mentor)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/sctp_bsd_addr.c

Modified: stable/8/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- stable/8/sys/netinet/sctp_bsd_addr.c	Sat Sep 12 18:05:57 2009	(r197124)
+++ stable/8/sys/netinet/sctp_bsd_addr.c	Sat Sep 12 18:08:44 2009	(r197125)
@@ -175,6 +175,7 @@ sctp_is_desired_interface_type(struct if
 	case IFT_LOOP:
 	case IFT_SLIP:
 	case IFT_GIF:
+	case IFT_L2VLAN:
 	case IFT_IP:
 	case IFT_IPOVERCDLC:
 	case IFT_IPOVERCLAW:

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:11:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7C2F106566B;
	Sat, 12 Sep 2009 18:11:48 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 94AFB8FC17;
	Sat, 12 Sep 2009 18:11:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CIBmG2093545;
	Sat, 12 Sep 2009 18:11:48 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CIBmsK093543;
	Sat, 12 Sep 2009 18:11:48 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909121811.n8CIBmsK093543@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 12 Sep 2009 18:11:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197126 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci i386/xen
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:11:48 -0000

Author: kib
Date: Sat Sep 12 18:11:48 2009
New Revision: 197126
URL: http://svn.freebsd.org/changeset/base/197126

Log:
  MFC r197046:
  As was done in r196643 for i386 and amd64, swap the start/end virtual
  addresses in pmap_invalidate_cache_range().
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/xen/pmap.c

Modified: stable/8/sys/i386/xen/pmap.c
==============================================================================
--- stable/8/sys/i386/xen/pmap.c	Sat Sep 12 18:08:44 2009	(r197125)
+++ stable/8/sys/i386/xen/pmap.c	Sat Sep 12 18:11:48 2009	(r197126)
@@ -1010,8 +1010,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 		 * coherence domain.
 		 */
 		mfence();
-		for (; eva < sva; eva += cpu_clflush_line_size)
-			clflush(eva);
+		for (; sva < eva; sva += cpu_clflush_line_size)
+			clflush(sva);
 		mfence();
 	} else {
 

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:16:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2504106568D;
	Sat, 12 Sep 2009 18:16:46 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 55A748FC17;
	Sat, 12 Sep 2009 18:16:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CIGkBn093700;
	Sat, 12 Sep 2009 18:16:46 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CIGk3k093698;
	Sat, 12 Sep 2009 18:16:46 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200909121816.n8CIGk3k093698@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 12 Sep 2009 18:16:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197127 - in stable/8/lib/libc: . stdio stdlib stdtime
	string
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:16:46 -0000

Author: kib
Date: Sat Sep 12 18:16:46 2009
New Revision: 197127
URL: http://svn.freebsd.org/changeset/base/197127

Log:
  MFC r196861:
  Handle zero size for posix_memalign. Return NULL or unique address
  according to the 'V' option.
  
  Approved by:	re (kensmith)

Modified:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdio/asprintf.c   (props changed)
  stable/8/lib/libc/stdlib/malloc.c
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/string/ffsll.c   (props changed)
  stable/8/lib/libc/string/flsll.c   (props changed)
  stable/8/lib/libc/string/wcpcpy.c   (props changed)
  stable/8/lib/libc/string/wcpncpy.c   (props changed)

Modified: stable/8/lib/libc/stdlib/malloc.c
==============================================================================
--- stable/8/lib/libc/stdlib/malloc.c	Sat Sep 12 18:11:48 2009	(r197126)
+++ stable/8/lib/libc/stdlib/malloc.c	Sat Sep 12 18:16:46 2009	(r197127)
@@ -5320,6 +5320,15 @@ posix_memalign(void **memptr, size_t ali
 			goto RETURN;
 		}
 
+		if (size == 0) {
+			if (opt_sysv == false)
+				size = 1;
+			else {
+				result = NULL;
+				ret = 0;
+				goto RETURN;
+			}
+		}
 		result = ipalloc(alignment, size);
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:24:31 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E11A11065679;
	Sat, 12 Sep 2009 18:24:31 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D023F8FC0C;
	Sat, 12 Sep 2009 18:24:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CIOVoD093933;
	Sat, 12 Sep 2009 18:24:31 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CIOVDq093930;
	Sat, 12 Sep 2009 18:24:31 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200909121824.n8CIOVDq093930@svn.freebsd.org>
From: Andriy Gapon 
Date: Sat, 12 Sep 2009 18:24:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197128 - head/sys/pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:24:32 -0000

Author: avg
Date: Sat Sep 12 18:24:31 2009
New Revision: 197128
URL: http://svn.freebsd.org/changeset/base/197128

Log:
  intpm: add support for smbus controller found in AMD SB700
  
  According to the specifications AMD/ATI SMBus controller is very
  similar to SMBus controller found in PIIX4.
  Some notable differences:
   o different bit for enabling/signalling regular interrupt mode
   o in practice seems to support only polling mode
  Thus, intpm driver is modified to support polling-only mode
  and to recognize SB700 PCI ID and differences.
  
  Tested on:	SB700 and PIIX4E platforms
  Reviewed by:	jhb
  MFC after:	2 weeks
  X-Perhaps-ToDo:	rename the driver to reflect its function
  		and supported hardware

Modified:
  head/sys/pci/intpm.c
  head/sys/pci/intpmreg.h

Modified: head/sys/pci/intpm.c
==============================================================================
--- head/sys/pci/intpm.c	Sat Sep 12 18:16:46 2009	(r197127)
+++ head/sys/pci/intpm.c	Sat Sep 12 18:24:31 2009	(r197128)
@@ -53,6 +53,8 @@ struct intsmb_softc {
 	void			*irq_hand;
 	device_t		smbus;
 	int			isbusy;
+	int			cfg_irq9;
+	int			poll;
 	struct mtx		lock;
 };
 
@@ -96,6 +98,10 @@ intsmb_probe(device_t dev)
 #endif
 		device_set_desc(dev, "Intel PIIX4 SMBUS Interface");
 		break;
+	case 0x43851002:
+		device_set_desc(dev, "AMD SB600/700/710/750 SMBus Controller");
+		/* XXX Maybe force polling right here? */
+		break;
 	default:
 		return (ENXIO);
 	}
@@ -108,12 +114,24 @@ intsmb_attach(device_t dev)
 {
 	struct intsmb_softc *sc = device_get_softc(dev);
 	int error, rid, value;
+	int intr;
 	char *str;
 
 	sc->dev = dev;
 
 	mtx_init(&sc->lock, device_get_nameunit(dev), "intsmb", MTX_DEF);
 
+	sc->cfg_irq9 = 0;
+#ifndef NO_CHANGE_PCICONF
+	switch (pci_get_devid(dev)) {
+	case 0x71138086:	/* Intel 82371AB */
+	case 0x719b8086:	/* Intel 82443MX */
+		/* Changing configuration is allowed. */
+		sc->cfg_irq9 = 1;
+		break;
+	}
+#endif
+
 	rid = PCI_BASE_ADDR_SMB;
 	sc->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
 	    RF_ACTIVE);
@@ -123,27 +141,36 @@ intsmb_attach(device_t dev)
 		goto fail;
 	}
 
-#ifndef NO_CHANGE_PCICONF
-	pci_write_config(dev, PCIR_INTLINE, 0x9, 1);
-	pci_write_config(dev, PCI_HST_CFG_SMB,
-	    PCI_INTR_SMB_IRQ9 | PCI_INTR_SMB_ENABLE, 1);
-#endif
+	if (sc->cfg_irq9) {
+		pci_write_config(dev, PCIR_INTLINE, 0x9, 1);
+		pci_write_config(dev, PCI_HST_CFG_SMB,
+		    PCI_INTR_SMB_IRQ9 | PCI_INTR_SMB_ENABLE, 1);
+	}
 	value = pci_read_config(dev, PCI_HST_CFG_SMB, 1);
-	switch (value & 0xe) {
+	sc->poll = (value & PCI_INTR_SMB_ENABLE) == 0;
+	intr = value & PCI_INTR_SMB_MASK;
+	switch (intr) {
 	case PCI_INTR_SMB_SMI:
 		str = "SMI";
 		break;
 	case PCI_INTR_SMB_IRQ9:
 		str = "IRQ 9";
 		break;
+	case PCI_INTR_SMB_IRQ_PCI:
+		str = "PCI IRQ";
+		break;
 	default:
 		str = "BOGUS";
 	}
+
 	device_printf(dev, "intr %s %s ", str,
-	    (value & 1) ? "enabled" : "disabled");
+	    sc->poll == 0 ? "enabled" : "disabled");
 	printf("revision %d\n", pci_read_config(dev, PCI_REVID_SMB, 1));
 
-	if ((value & 0xe) != PCI_INTR_SMB_IRQ9) {
+	if (sc->poll)
+	    goto no_intr;
+
+	if (intr != PCI_INTR_SMB_IRQ9 && intr != PCI_INTR_SMB_IRQ_PCI) {
 		device_printf(dev, "Unsupported interrupt mode\n");
 		error = ENXIO;
 		goto fail;
@@ -151,7 +178,9 @@ intsmb_attach(device_t dev)
 
 	/* Force IRQ 9. */
 	rid = 0;
-	bus_set_resource(dev, SYS_RES_IRQ, rid, 9, 1);
+	if (sc->cfg_irq9)
+		bus_set_resource(dev, SYS_RES_IRQ, rid, 9, 1);
+
 	sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
 	    RF_SHAREABLE | RF_ACTIVE);
 	if (sc->irq_res == NULL) {
@@ -167,6 +196,7 @@ intsmb_attach(device_t dev)
 		goto fail;
 	}
 
+no_intr:
 	sc->isbusy = 0;
 	sc->smbus = device_add_child(dev, "smbus", -1);
 	if (sc->smbus == NULL) {
@@ -361,7 +391,7 @@ intsmb_start(struct intsmb_softc *sc, un
 	tmp |= PIIX4_SMBHSTCNT_START;
 
 	/* While not in autoconfiguration enable interrupts. */
-	if (!cold && !nointr)
+	if (!sc->poll && !cold && !nointr)
 		tmp |= PIIX4_SMBHSTCNT_INTREN;
 	bus_write_1(sc->io_res, PIIX4_SMBHSTCNT, tmp);
 }
@@ -411,8 +441,6 @@ intsmb_stop_poll(struct intsmb_softc *sc
 		if (!(status & PIIX4_SMBHSTSTAT_BUSY)) {
 			sc->isbusy = 0;
 			error = intsmb_error(sc->dev, status);
-			if (error == 0 && !(status & PIIX4_SMBHSTSTAT_INTR))
-				device_printf(sc->dev, "unknown cause why?\n");
 			return (error);
 		}
 	}
@@ -434,7 +462,7 @@ intsmb_stop(struct intsmb_softc *sc)
 
 	INTSMB_LOCK_ASSERT(sc);
 
-	if (cold)
+	if (sc->poll || cold)
 		/* So that it can use device during device probe on SMBus. */
 		return (intsmb_stop_poll(sc));
 

Modified: head/sys/pci/intpmreg.h
==============================================================================
--- head/sys/pci/intpmreg.h	Sat Sep 12 18:16:46 2009	(r197127)
+++ head/sys/pci/intpmreg.h	Sat Sep 12 18:24:31 2009	(r197128)
@@ -35,7 +35,9 @@
 #define	PCI_BASE_ADDR_SMB	0x90	/* IO BAR. */
 #define	PCI_BASE_ADDR_PM	0x40
 #define	PCI_HST_CFG_SMB		0xd2	/* Host Configuration */
+#define	PCI_INTR_SMB_MASK	0xe
 #define	PCI_INTR_SMB_SMI	0
+#define	PCI_INTR_SMB_IRQ_PCI	2
 #define	PCI_INTR_SMB_IRQ9	8
 #define	PCI_INTR_SMB_ENABLE	1
 #define	PCI_SLV_CMD_SMB		0xd3 /*SLAVE COMMAND*/

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 18:55:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C74EF106568D;
	Sat, 12 Sep 2009 18:55:15 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B701C8FC19;
	Sat, 12 Sep 2009 18:55:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CItFJM094639;
	Sat, 12 Sep 2009 18:55:15 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CItFdP094637;
	Sat, 12 Sep 2009 18:55:15 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200909121855.n8CItFdP094637@svn.freebsd.org>
From: Bruce M Simpson 
Date: Sat, 12 Sep 2009 18:55:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197129 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 18:55:15 -0000

Author: bms
Date: Sat Sep 12 18:55:15 2009
New Revision: 197129
URL: http://svn.freebsd.org/changeset/base/197129

Log:
  Fix an API issue in leave processing for IPv4 multicast groups.
   * Do not assume that the group lookup performed by imo_match_group()
     is valid when ifp is NULL in this case.
   * Instead, return EADDRNOTAVAIL if the ifp cannot be resolved for the
     membership we are being asked to leave.
  
  Caveat user:
   * The way IPv4 multicast memberships are implemented in the inpcb layer
     at the moment, has the side-effect that struct ip_moptions will
     still hold the membership, under the old ifp, until ip_freemoptions()
     is called for the parent inpcb.
   * The underlying issue is: the inpcb layer does not get notification
     of ifp being detached going away in a thread-safe manner.
     This is non-trivial to fix.
  
  But hey, at least the kernel should't panic when you unplug a card.
  
  PR:		138689
  Submitted by:	Stef Walter
  MFC after:	5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Sat Sep 12 18:24:31 2009	(r197128)
+++ head/sys/netinet/in_mcast.c	Sat Sep 12 18:55:15 2009	(r197129)
@@ -2189,6 +2189,9 @@ inp_leave_group(struct inpcb *inp, struc
 	if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr)))
 		return (EINVAL);
 
+	if (ifp == NULL)
+		return (EADDRNOTAVAIL);
+
 	/*
 	 * Find the membership in the membership array.
 	 */

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 19:07:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9FD3F106566B;
	Sat, 12 Sep 2009 19:07:03 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F90C8FC17;
	Sat, 12 Sep 2009 19:07:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CJ73K9094916;
	Sat, 12 Sep 2009 19:07:03 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CJ73xC094914;
	Sat, 12 Sep 2009 19:07:03 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200909121907.n8CJ73xC094914@svn.freebsd.org>
From: Bruce M Simpson 
Date: Sat, 12 Sep 2009 19:07:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197130 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 19:07:03 -0000

Author: bms
Date: Sat Sep 12 19:07:03 2009
New Revision: 197130
URL: http://svn.freebsd.org/changeset/base/197130

Log:
  Fix an obvious logic error in the IPv4 multicast leave processing,
  where the filter mode vector was not updated correctly after the leave.
  
  PR:		138691
  Submitted by:	Stef Walter
  MFC after:	5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Sat Sep 12 18:55:15 2009	(r197129)
+++ head/sys/netinet/in_mcast.c	Sat Sep 12 19:07:03 2009	(r197130)
@@ -2278,9 +2278,11 @@ out_imf_rollback:
 	imf_reap(imf);
 
 	if (is_final) {
-		/* Remove the gap in the membership array. */
-		for (++idx; idx < imo->imo_num_memberships; ++idx)
+		/* Remove the gap in the membership and filter array. */
+		for (++idx; idx < imo->imo_num_memberships; ++idx) {
 			imo->imo_membership[idx-1] = imo->imo_membership[idx];
+			imo->imo_mfilters[idx-1] = imo->imo_mfilters[idx];
+		}
 		imo->imo_num_memberships--;
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 19:27:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E8C5E106568F;
	Sat, 12 Sep 2009 19:27:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D7FF38FC1E;
	Sat, 12 Sep 2009 19:27:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CJRsFu095332;
	Sat, 12 Sep 2009 19:27:54 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CJRsHf095330;
	Sat, 12 Sep 2009 19:27:54 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200909121927.n8CJRsHf095330@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 12 Sep 2009 19:27:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197131 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 19:27:55 -0000

Author: pjd
Date: Sat Sep 12 19:27:54 2009
New Revision: 197131
URL: http://svn.freebsd.org/changeset/base/197131

Log:
  Tighten up the check for race in zfs_zget() - ZTOV(zp) can not only contain
  NULL, but also can point to dead vnode, take that into account.
  
  PR:		kern/132068
  Reported by:	Edward Fisk" <7ogcg7g02@sneakemail.com>, kris
  Fix based on patch from:	Jaakko Heinonen 
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Sat Sep 12 19:07:03 2009	(r197130)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c	Sat Sep 12 19:27:54 2009	(r197131)
@@ -890,8 +890,16 @@ again:
 		if (zp->z_unlinked) {
 			err = ENOENT;
 		} else {
-			if (ZTOV(zp) != NULL)
-				VN_HOLD(ZTOV(zp));
+			if ((vp = ZTOV(zp)) != NULL) {
+				VI_LOCK(vp);
+				if ((vp->v_iflag & VI_DOOMED) != 0) {
+					VI_UNLOCK(vp);
+					vp = NULL;
+				} else
+					VI_UNLOCK(vp);
+			}
+			if (vp != NULL)
+				VN_HOLD(vp);
 			else {
 				if (first) {
 					ZFS_LOG(1, "dying znode detected (zp=%p)", zp);

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 19:45:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 65BF1106566B;
	Sat, 12 Sep 2009 19:45:56 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1F11C8FC0C;
	Sat, 12 Sep 2009 19:45:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CJjtIR095734;
	Sat, 12 Sep 2009 19:45:55 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CJjt5P095732;
	Sat, 12 Sep 2009 19:45:55 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200909121945.n8CJjt5P095732@svn.freebsd.org>
From: Bruce M Simpson 
Date: Sat, 12 Sep 2009 19:45:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197132 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 19:45:56 -0000

Author: bms
Date: Sat Sep 12 19:45:55 2009
New Revision: 197132
URL: http://svn.freebsd.org/changeset/base/197132

Log:
  Tighten input checking in inp_join_group():
   * Don't try to use the source address, when its family is unspecified.
   * If we get a join without a source, on an existing inclusive
     mode group, this is an error, as it would change the filter mode.
  
  Fix a problem with the handling of in_mfilter for new memberships:
   * Do not rely on imf being NULL; it is explicitly initialized to a
     non-NULL pointer when constructing a membership.
   * Explicitly initialize *imf to EX mode when the source address
     is unspecified.
  
  This fixes a problem with in_mfilter slot recycling in the join path.
  
  PR:		138690
  Submitted by:	Stef Walter
  MFC after:	5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Sat Sep 12 19:27:54 2009	(r197131)
+++ head/sys/netinet/in_mcast.c	Sat Sep 12 19:45:55 2009	(r197132)
@@ -1957,11 +1957,6 @@ inp_join_group(struct inpcb *inp, struct
 	if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0)
 		return (EADDRNOTAVAIL);
 
-	/*
-	 * MCAST_JOIN_SOURCE on an exclusive membership is an error.
-	 * On an existing inclusive membership, it just adds the
-	 * source to the filter list.
-	 */
 	imo = inp_findmoptions(inp);
 	idx = imo_match_group(imo, ifp, &gsa->sa);
 	if (idx == -1) {
@@ -1969,15 +1964,33 @@ inp_join_group(struct inpcb *inp, struct
 	} else {
 		inm = imo->imo_membership[idx];
 		imf = &imo->imo_mfilters[idx];
-		if (ssa->ss.ss_family != AF_UNSPEC &&
-		    imf->imf_st[1] != MCAST_INCLUDE) {
-			error = EINVAL;
-			goto out_inp_locked;
-		}
-		lims = imo_match_source(imo, idx, &ssa->sa);
-		if (lims != NULL) {
-			error = EADDRNOTAVAIL;
-			goto out_inp_locked;
+		if (ssa->ss.ss_family != AF_UNSPEC) {
+			/*
+			 * MCAST_JOIN_SOURCE on an exclusive membership
+			 * is an error. On an existing inclusive membership,
+			 * it just adds the source to the filter list.
+			 */
+			if (imf->imf_st[1] != MCAST_INCLUDE) {
+				error = EINVAL;
+				goto out_inp_locked;
+			}
+			/* Throw out duplicates. */
+			lims = imo_match_source(imo, idx, &ssa->sa);
+			if (lims != NULL) {
+				error = EADDRNOTAVAIL;
+				goto out_inp_locked;
+			}
+		} else {
+			/*
+			 * MCAST_JOIN_GROUP on an existing inclusive
+			 * membership is an error; if you want to change
+			 * filter mode, you must use the userland API
+			 * setsourcefilter().
+			 */
+			if (imf->imf_st[1] == MCAST_INCLUDE) {
+				error = EINVAL;
+				goto out_inp_locked;
+			}
 		}
 	}
 
@@ -2010,7 +2023,8 @@ inp_join_group(struct inpcb *inp, struct
 	/*
 	 * Graft new source into filter list for this inpcb's
 	 * membership of the group. The in_multi may not have
-	 * been allocated yet if this is a new membership.
+	 * been allocated yet if this is a new membership, however,
+	 * the in_mfilter slot will be allocated and must be initialized.
 	 */
 	if (ssa->ss.ss_family != AF_UNSPEC) {
 		/* Membership starts in IN mode */
@@ -2027,6 +2041,12 @@ inp_join_group(struct inpcb *inp, struct
 			error = ENOMEM;
 			goto out_imo_free;
 		}
+	} else {
+		/* No address specified; Membership starts in EX mode */
+		if (is_new) {
+			CTR1(KTR_IGMPV3, "%s: new join w/o source", __func__);
+			imf_init(imf, MCAST_UNDEFINED, MCAST_EXCLUDE);
+		}
 	}
 
 	/*

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 19:53:31 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B86AE106566B;
	Sat, 12 Sep 2009 19:53:31 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D09C8FC14;
	Sat, 12 Sep 2009 19:53:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CJrVRp095916;
	Sat, 12 Sep 2009 19:53:31 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CJrVpx095913;
	Sat, 12 Sep 2009 19:53:31 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200909121953.n8CJrVpx095913@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 12 Sep 2009 19:53:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197133 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 19:53:31 -0000

Author: pjd
Date: Sat Sep 12 19:53:31 2009
New Revision: 197133
URL: http://svn.freebsd.org/changeset/base/197133

Log:
  - Protect reclaim with z_teardown_inactive_lock.
  - Be prepared for dbuf to disappear in zfs_reclaim_complete() and check if
    z_dbuf field is NULL - this might happen in case of rollback or forced
    unmount between zfs_freebsd_reclaim() and zfs_reclaim_complete().
  - On forced unmount wait for all znodes to be destroyed - destruction can be
    done asynchronously via zfs_reclaim_complete().
  
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Sat Sep 12 19:45:55 2009	(r197132)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Sat Sep 12 19:53:31 2009	(r197133)
@@ -947,6 +947,18 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea
 		zfsvfs->z_unmounted = B_TRUE;
 		rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
 		rw_exit(&zfsvfs->z_teardown_inactive_lock);
+
+#ifdef __FreeBSD__
+		/*
+		 * Some znodes might not be fully reclaimed, wait for them.
+		 */
+		mutex_enter(&zfsvfs->z_znodes_lock);
+		while (list_head(&zfsvfs->z_all_znodes) != NULL) {
+			msleep(zfsvfs, &zfsvfs->z_znodes_lock, 0,
+			    "zteardown", 0);
+		}
+		mutex_exit(&zfsvfs->z_znodes_lock);
+#endif
 	}
 
 	/*

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Sat Sep 12 19:45:55 2009	(r197132)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Sat Sep 12 19:53:31 2009	(r197133)
@@ -4343,11 +4343,20 @@ zfs_reclaim_complete(void *arg, int pend
 	znode_t	*zp = arg;
 	zfsvfs_t *zfsvfs = zp->z_zfsvfs;
 
-	ZFS_LOG(1, "zp=%p", zp);
-	ZFS_OBJ_HOLD_ENTER(zfsvfs, zp->z_id);
-	zfs_znode_dmu_fini(zp);
-	ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id);
+	rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER);
+	if (zp->z_dbuf != NULL) {
+		ZFS_OBJ_HOLD_ENTER(zfsvfs, zp->z_id);
+		zfs_znode_dmu_fini(zp);
+		ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id);
+	}
 	zfs_znode_free(zp);
+	rw_exit(&zfsvfs->z_teardown_inactive_lock);
+	/*
+	 * If the file system is being unmounted, there is a process waiting
+	 * for us, wake it up.
+	 */
+	if (zfsvfs->z_unmounted)
+		wakeup_one(zfsvfs);
 }
 
 static int
@@ -4359,6 +4368,9 @@ zfs_freebsd_reclaim(ap)
 {
 	vnode_t	*vp = ap->a_vp;
 	znode_t	*zp = VTOZ(vp);
+	zfsvfs_t *zfsvfs = zp->z_zfsvfs;
+
+	rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER);
 
 	ASSERT(zp != NULL);
 
@@ -4377,7 +4389,6 @@ zfs_freebsd_reclaim(ap)
 	else if (zp->z_dbuf == NULL)
 		zfs_znode_free(zp);
 	else /* if (!zp->z_unlinked && zp->z_dbuf != NULL) */ {
-		zfsvfs_t *zfsvfs = zp->z_zfsvfs;
 		int locked;
 
 		locked = MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)) ? 2 :
@@ -4400,6 +4411,7 @@ zfs_freebsd_reclaim(ap)
 	vp->v_data = NULL;
 	ASSERT(vp->v_holdcnt >= 1);
 	VI_UNLOCK(vp);
+	rw_exit(&zfsvfs->z_teardown_inactive_lock);
 	return (0);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 20:03:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3574106566B;
	Sat, 12 Sep 2009 20:03:45 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B0EA08FC13;
	Sat, 12 Sep 2009 20:03:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CK3jHc096186;
	Sat, 12 Sep 2009 20:03:45 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CK3jVT096172;
	Sat, 12 Sep 2009 20:03:45 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200909122003.n8CK3jVT096172@svn.freebsd.org>
From: Robert Watson 
Date: Sat, 12 Sep 2009 20:03:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197134 - in head/sys: cam/scsi fs/fifofs i386/acpica
	kern net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 20:03:45 -0000

Author: rwatson
Date: Sat Sep 12 20:03:45 2009
New Revision: 197134
URL: http://svn.freebsd.org/changeset/base/197134

Log:
  Use C99 initialization for struct filterops.
  
  Obtained from:	Mac OS X
  Sponsored by:	Apple Inc.
  MFC after:	3 weeks

Modified:
  head/sys/cam/scsi/scsi_target.c
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/i386/acpica/acpi_machdep.c
  head/sys/kern/kern_event.c
  head/sys/kern/kern_sig.c
  head/sys/kern/sys_pipe.c
  head/sys/kern/tty.c
  head/sys/kern/tty_pts.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/vfs_aio.c
  head/sys/kern/vfs_subr.c
  head/sys/net/bpf.c

Modified: head/sys/cam/scsi/scsi_target.c
==============================================================================
--- head/sys/cam/scsi/scsi_target.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/cam/scsi/scsi_target.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -103,8 +103,11 @@ static d_poll_t		targpoll;
 static d_kqfilter_t	targkqfilter;
 static void		targreadfiltdetach(struct knote *kn);
 static int		targreadfilt(struct knote *kn, long hint);
-static struct filterops targread_filtops =
-	{ 1, NULL, targreadfiltdetach, targreadfilt };
+static struct filterops targread_filtops = {
+	.f_isfd = 1,
+	.f_detach = targreadfiltdetach,
+	.f_event = targreadfilt,
+};
 
 static struct cdevsw targ_cdevsw = {
 	.d_version =	D_VERSION,

Modified: head/sys/fs/fifofs/fifo_vnops.c
==============================================================================
--- head/sys/fs/fifofs/fifo_vnops.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/fs/fifofs/fifo_vnops.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -100,12 +100,21 @@ static int	filt_fifowrite(struct knote *
 static void	filt_fifodetach_notsup(struct knote *kn);
 static int	filt_fifo_notsup(struct knote *kn, long hint);
 
-static struct filterops fiforead_filtops =
-	{ 1, NULL, filt_fifordetach, filt_fiforead };
-static struct filterops fifowrite_filtops =
-	{ 1, NULL, filt_fifowdetach, filt_fifowrite };
-static struct filterops fifo_notsup_filtops =
-	{ 1, NULL, filt_fifodetach_notsup, filt_fifo_notsup };
+static struct filterops fiforead_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_fifordetach,
+	.f_event = filt_fiforead,
+};
+static struct filterops fifowrite_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_fifowdetach,
+	.f_event = filt_fifowrite,
+};
+static struct filterops fifo_notsup_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_fifodetach_notsup,
+	.f_event = filt_fifo_notsup,
+};
 
 struct vop_vector fifo_specops = {
 	.vop_default =		&default_vnodeops,

Modified: head/sys/i386/acpica/acpi_machdep.c
==============================================================================
--- head/sys/i386/acpica/acpi_machdep.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/i386/acpica/acpi_machdep.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -80,8 +80,11 @@ static d_poll_t		apmpoll;
 static d_kqfilter_t	apmkqfilter;
 static void		apmreadfiltdetach(struct knote *kn);
 static int		apmreadfilt(struct knote *kn, long hint);
-static struct filterops	apm_readfiltops =
-	{ 1, NULL, apmreadfiltdetach, apmreadfilt };
+static struct filterops	apm_readfiltops = {
+	.f_isfd = 1,
+	.f_detach = apmreadfiltdetach,
+	.f_event = apmreadfilt,
+};
 
 static struct cdevsw apm_cdevsw = {
 	.d_version =	D_VERSION,

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/kern_event.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -142,15 +142,28 @@ static int	filt_timerattach(struct knote
 static void	filt_timerdetach(struct knote *kn);
 static int	filt_timer(struct knote *kn, long hint);
 
-static struct filterops file_filtops =
-	{ 1, filt_fileattach, NULL, NULL };
-static struct filterops kqread_filtops =
-	{ 1, NULL, filt_kqdetach, filt_kqueue };
+static struct filterops file_filtops = {
+	.f_isfd = 1,
+	.f_attach = filt_fileattach,
+};
+static struct filterops kqread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_kqdetach,
+	.f_event = filt_kqueue,
+};
 /* XXX - move to kern_proc.c?  */
-static struct filterops proc_filtops =
-	{ 0, filt_procattach, filt_procdetach, filt_proc };
-static struct filterops timer_filtops =
-	{ 0, filt_timerattach, filt_timerdetach, filt_timer };
+static struct filterops proc_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_procattach,
+	.f_detach = filt_procdetach,
+	.f_event = filt_proc,
+};
+static struct filterops timer_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_timerattach,
+	.f_detach = filt_timerdetach,
+	.f_event = filt_timer,
+};
 
 static uma_zone_t	knote_zone;
 static int 		kq_ncallouts = 0;
@@ -228,8 +241,10 @@ filt_nullattach(struct knote *kn)
 	return (ENXIO);
 };
 
-struct filterops null_filtops =
-	{ 0, filt_nullattach, NULL, NULL };
+struct filterops null_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_nullattach,
+};
 
 /* XXX - make SYSINIT to add these, and move into respective modules. */
 extern struct filterops sig_filtops;

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/kern_sig.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -111,8 +111,12 @@ static struct thread *sigtd(struct proc 
 static void	sigqueue_start(void);
 
 static uma_zone_t	ksiginfo_zone = NULL;
-struct filterops sig_filtops =
-	{ 0, filt_sigattach, filt_sigdetach, filt_signal };
+struct filterops sig_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_sigattach,
+	.f_detach = filt_sigdetach,
+	.f_event = filt_signal,
+};
 
 int	kern_logsigexit = 1;
 SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, 

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/sys_pipe.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -162,10 +162,16 @@ static void	filt_pipedetach(struct knote
 static int	filt_piperead(struct knote *kn, long hint);
 static int	filt_pipewrite(struct knote *kn, long hint);
 
-static struct filterops pipe_rfiltops =
-	{ 1, NULL, filt_pipedetach, filt_piperead };
-static struct filterops pipe_wfiltops =
-	{ 1, NULL, filt_pipedetach, filt_pipewrite };
+static struct filterops pipe_rfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_pipedetach,
+	.f_event = filt_piperead
+};
+static struct filterops pipe_wfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_pipedetach,
+	.f_event = filt_pipewrite
+};
 
 /*
  * Default pipe buffer size(s), this can be kind-of large now because pipe

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/tty.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -635,10 +635,16 @@ tty_kqops_write_event(struct knote *kn, 
 	}
 }
 
-static struct filterops tty_kqops_read =
-    { 1, NULL, tty_kqops_read_detach, tty_kqops_read_event };
-static struct filterops tty_kqops_write =
-    { 1, NULL, tty_kqops_write_detach, tty_kqops_write_event };
+static struct filterops tty_kqops_read = {
+	.f_isfd = 1,
+	.f_detach = tty_kqops_read_detach,
+	.f_event = tty_kqops_read_event,
+};
+static struct filterops tty_kqops_write = {
+	.f_isfd = 1,
+	.f_detach = tty_kqops_write_detach,
+	.f_event = tty_kqops_write_event,
+};
 
 static int
 ttydev_kqfilter(struct cdev *dev, struct knote *kn)

Modified: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/tty_pts.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -494,10 +494,16 @@ pts_kqops_write_event(struct knote *kn, 
 	}
 }
 
-static struct filterops pts_kqops_read =
-    { 1, NULL, pts_kqops_read_detach, pts_kqops_read_event };
-static struct filterops pts_kqops_write =
-    { 1, NULL, pts_kqops_write_detach, pts_kqops_write_event };
+static struct filterops pts_kqops_read = {
+	.f_isfd = 1,
+	.f_detach = pts_kqops_read_detach,
+	.f_event = pts_kqops_read_event,
+};
+static struct filterops pts_kqops_write = {
+	.f_isfd = 1,
+	.f_detach = pts_kqops_write_detach,
+	.f_event = pts_kqops_write_event,
+};
 
 static int
 ptsdev_kqfilter(struct file *fp, struct knote *kn)

Modified: head/sys/kern/uipc_mqueue.c
==============================================================================
--- head/sys/kern/uipc_mqueue.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/uipc_mqueue.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -256,10 +256,16 @@ static void	filt_mqdetach(struct knote *
 static int	filt_mqread(struct knote *kn, long hint);
 static int	filt_mqwrite(struct knote *kn, long hint);
 
-struct filterops mq_rfiltops =
-	{ 1, NULL, filt_mqdetach, filt_mqread };
-struct filterops mq_wfiltops =
-	{ 1, NULL, filt_mqdetach, filt_mqwrite };
+struct filterops mq_rfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_mqdetach,
+	.f_event = filt_mqread,
+};
+struct filterops mq_wfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_mqdetach,
+	.f_event = filt_mqwrite,
+};
 
 /*
  * Initialize fileno bitmap

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/uipc_socket.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -151,12 +151,21 @@ static void	filt_sowdetach(struct knote 
 static int	filt_sowrite(struct knote *kn, long hint);
 static int	filt_solisten(struct knote *kn, long hint);
 
-static struct filterops solisten_filtops =
-	{ 1, NULL, filt_sordetach, filt_solisten };
-static struct filterops soread_filtops =
-	{ 1, NULL, filt_sordetach, filt_soread };
-static struct filterops sowrite_filtops =
-	{ 1, NULL, filt_sowdetach, filt_sowrite };
+static struct filterops solisten_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_sordetach,
+	.f_event = filt_solisten,
+};
+static struct filterops soread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_sordetach,
+	.f_event = filt_soread,
+};
+static struct filterops sowrite_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_sowdetach,
+	.f_event = filt_sowrite,
+};
 
 uma_zone_t socket_zone;
 so_gen_t	so_gencnt;	/* generation count for sockets */

Modified: head/sys/kern/vfs_aio.c
==============================================================================
--- head/sys/kern/vfs_aio.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/vfs_aio.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -372,10 +372,18 @@ static int	filt_lio(struct knote *kn, lo
 static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiol_zone, aiolio_zone;
 
 /* kqueue filters for aio */
-static struct filterops aio_filtops =
-	{ 0, filt_aioattach, filt_aiodetach, filt_aio };
-static struct filterops lio_filtops =
-	{ 0, filt_lioattach, filt_liodetach, filt_lio };
+static struct filterops aio_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_aioattach,
+	.f_detach = filt_aiodetach,
+	.f_event = filt_aio,
+};
+static struct filterops lio_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_lioattach,
+	.f_detach = filt_liodetach,
+	.f_event = filt_lio
+};
 
 static eventhandler_tag exit_tag, exec_tag;
 

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/vfs_subr.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -4002,8 +4002,12 @@ static int	filt_fsattach(struct knote *k
 static void	filt_fsdetach(struct knote *kn);
 static int	filt_fsevent(struct knote *kn, long hint);
 
-struct filterops fs_filtops =
-	{ 0, filt_fsattach, filt_fsdetach, filt_fsevent };
+struct filterops fs_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_fsattach,
+	.f_detach = filt_fsdetach,
+	.f_event = filt_fsevent
+};
 
 static int
 filt_fsattach(struct knote *kn)
@@ -4076,12 +4080,21 @@ static int	filt_vfsread(struct knote *kn
 static int	filt_vfswrite(struct knote *kn, long hint);
 static int	filt_vfsvnode(struct knote *kn, long hint);
 static void	filt_vfsdetach(struct knote *kn);
-static struct filterops vfsread_filtops =
-	{ 1, NULL, filt_vfsdetach, filt_vfsread };
-static struct filterops vfswrite_filtops =
-	{ 1, NULL, filt_vfsdetach, filt_vfswrite };
-static struct filterops vfsvnode_filtops =
-	{ 1, NULL, filt_vfsdetach, filt_vfsvnode };
+static struct filterops vfsread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_vfsdetach,
+	.f_event = filt_vfsread
+};
+static struct filterops vfswrite_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_vfsdetach,
+	.f_event = filt_vfswrite
+};
+static struct filterops vfsvnode_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_vfsdetach,
+	.f_event = filt_vfsvnode
+};
 
 static void
 vfs_knllock(void *arg)

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/net/bpf.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -148,8 +148,11 @@ static struct cdevsw bpf_cdevsw = {
 	.d_kqfilter =	bpfkqfilter,
 };
 
-static struct filterops bpfread_filtops =
-	{ 1, NULL, filt_bpfdetach, filt_bpfread };
+static struct filterops bpfread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_bpfdetach,
+	.f_event = filt_bpfread,
+};
 
 /*
  * Wrapper functions for various buffering methods.  If the set of buffer

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 20:18:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 392F5106566B;
	Sat, 12 Sep 2009 20:18:24 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F5AA8FC0A;
	Sat, 12 Sep 2009 20:18:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CKINI0096482;
	Sat, 12 Sep 2009 20:18:23 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CKINU6096480;
	Sat, 12 Sep 2009 20:18:23 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200909122018.n8CKINU6096480@svn.freebsd.org>
From: Bruce M Simpson 
Date: Sat, 12 Sep 2009 20:18:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197135 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 20:18:24 -0000

Author: bms
Date: Sat Sep 12 20:18:23 2009
New Revision: 197135
URL: http://svn.freebsd.org/changeset/base/197135

Log:
  Don't allow joins w/o source on an existing group.
  This is almost always pilot error.
  
  We don't need to check for group filter UNDEFINED state at t1,
  because we only ever allocate filters with their groups, so we
  unconditionally reject such calls with EINVAL.
  Trying to change the active filter mode w/o going through IP_MSFILTER
  is also disallowed.
  
  Deals with the case described in PR 137164 upfront, cumulative
  with the fix in svn rev 197132 which only calls imo_match_source()
  if the source address family was not unspecified.
  
  PR:		137164
  MFC after:	5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Sat Sep 12 20:03:45 2009	(r197134)
+++ head/sys/netinet/in_mcast.c	Sat Sep 12 20:18:23 2009	(r197135)
@@ -1982,15 +1982,18 @@ inp_join_group(struct inpcb *inp, struct
 			}
 		} else {
 			/*
-			 * MCAST_JOIN_GROUP on an existing inclusive
-			 * membership is an error; if you want to change
-			 * filter mode, you must use the userland API
-			 * setsourcefilter().
+			 * MCAST_JOIN_GROUP alone, on any existing membership,
+			 * is rejected, to stop the same inpcb tying up
+			 * multiple refs to the in_multi.
+			 * On an existing inclusive membership, this is also
+			 * an error; if you want to change filter mode,
+			 * you must use the userland API setsourcefilter().
+			 * XXX We don't reject this for imf in UNDEFINED
+			 * state at t1, because allocation of a filter
+			 * is atomic with allocation of a membership.
 			 */
-			if (imf->imf_st[1] == MCAST_INCLUDE) {
-				error = EINVAL;
-				goto out_inp_locked;
-			}
+			error = EINVAL;
+			goto out_inp_locked;
 		}
 	}
 
@@ -2025,6 +2028,9 @@ inp_join_group(struct inpcb *inp, struct
 	 * membership of the group. The in_multi may not have
 	 * been allocated yet if this is a new membership, however,
 	 * the in_mfilter slot will be allocated and must be initialized.
+	 *
+	 * Note: Grafting of exclusive mode filters doesn't happen
+	 * in this path.
 	 */
 	if (ssa->ss.ss_family != AF_UNSPEC) {
 		/* Membership starts in IN mode */

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 20:37:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21900106566B;
	Sat, 12 Sep 2009 20:37:45 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 116028FC1A;
	Sat, 12 Sep 2009 20:37:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CKbiuZ096866;
	Sat, 12 Sep 2009 20:37:44 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CKbiM9096864;
	Sat, 12 Sep 2009 20:37:44 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200909122037.n8CKbiM9096864@svn.freebsd.org>
From: Bruce M Simpson 
Date: Sat, 12 Sep 2009 20:37:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197136 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 20:37:45 -0000

Author: bms
Date: Sat Sep 12 20:37:44 2009
New Revision: 197136
URL: http://svn.freebsd.org/changeset/base/197136

Log:
  Comment some flawed assumptions in inp_join_group() about
  mixing SSM full-state and delta-based APIs.
  
  ENOTIME to fix right now.  No functional changes.
  
  MFC after:	5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Sat Sep 12 20:18:23 2009	(r197135)
+++ head/sys/netinet/in_mcast.c	Sat Sep 12 20:37:44 2009	(r197136)
@@ -1857,6 +1857,7 @@ inp_join_group(struct inpcb *inp, struct
 
 	ifp = NULL;
 	imf = NULL;
+	lims = NULL;
 	error = 0;
 	is_new = 0;
 
@@ -1974,9 +1975,25 @@ inp_join_group(struct inpcb *inp, struct
 				error = EINVAL;
 				goto out_inp_locked;
 			}
-			/* Throw out duplicates. */
+			/*
+			 * Throw out duplicates.
+			 *
+			 * XXX FIXME: This makes a naive assumption that
+			 * even if entries exist for *ssa in this imf,
+			 * they will be rejected as dupes, even if they
+			 * are not valid in the current mode (in-mode).
+			 *
+			 * in_msource is transactioned just as for anything
+			 * else in SSM -- but note naive use of inm_graft()
+			 * below for allocating new filter entries.
+			 *
+			 * This is only an issue if someone mixes the
+			 * full-state SSM API with the delta-based API,
+			 * which is discouraged in the relevant RFCs.
+			 */
 			lims = imo_match_source(imo, idx, &ssa->sa);
-			if (lims != NULL) {
+			if (lims != NULL /*&&
+			    lims->imsl_st[1] == MCAST_INCLUDE*/) {
 				error = EADDRNOTAVAIL;
 				goto out_inp_locked;
 			}
@@ -2031,6 +2048,8 @@ inp_join_group(struct inpcb *inp, struct
 	 *
 	 * Note: Grafting of exclusive mode filters doesn't happen
 	 * in this path.
+	 * XXX: Should check for non-NULL lims (node exists but may
+	 * not be in-mode) for interop with full-state API.
 	 */
 	if (ssa->ss.ss_family != AF_UNSPEC) {
 		/* Membership starts in IN mode */

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 21:44:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B217D1065679;
	Sat, 12 Sep 2009 21:44:34 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6D4138FC0A;
	Sat, 12 Sep 2009 21:44:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CLiY2f098197;
	Sat, 12 Sep 2009 21:44:34 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CLiYTj098195;
	Sat, 12 Sep 2009 21:44:34 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200909122144.n8CLiYTj098195@svn.freebsd.org>
From: Luigi Rizzo 
Date: Sat, 12 Sep 2009 21:44:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197137 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 21:44:34 -0000

Author: luigi
Date: Sat Sep 12 21:44:34 2009
New Revision: 197137
URL: http://svn.freebsd.org/changeset/base/197137

Log:
  Make sure callouts are not processed one tick late.
  The problem was introduced in SVN 180608/ rev 1.114 and affects
  all users of callout_reset() (including select, usleep, setitimer).
  A better fix probably involves replicating 'ticks' in the
  struct callout_cpu; this commit is just a temporary thing so that
  we can MFC it after a suitable test time and RE approval.
  
  MFC after:	3 days

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c	Sat Sep 12 20:37:44 2009	(r197136)
+++ head/sys/kern/kern_timeout.c	Sat Sep 12 21:44:34 2009	(r197137)
@@ -244,7 +244,7 @@ callout_tick(void)
 	need_softclock = 0;
 	cc = CC_SELF();
 	mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET);
-	for (; (cc->cc_softticks - ticks) < 0; cc->cc_softticks++) {
+	for (; (cc->cc_softticks - ticks) <= 0; cc->cc_softticks++) {
 		bucket = cc->cc_softticks & callwheelmask;
 		if (!TAILQ_EMPTY(&cc->cc_callwheel[bucket])) {
 			need_softclock = 1;
@@ -323,7 +323,7 @@ softclock(void *arg)
 	steps = 0;
 	cc = (struct callout_cpu *)arg;
 	CC_LOCK(cc);
-	while (cc->cc_softticks != ticks) {
+	while (cc->cc_softticks - 1 != ticks) {
 		/*
 		 * cc_softticks may be modified by hard clock, so cache
 		 * it while we work on a given bucket.

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:08:20 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D0A7A106566C;
	Sat, 12 Sep 2009 22:08:20 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BDE038FC14;
	Sat, 12 Sep 2009 22:08:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CM8KRi098669;
	Sat, 12 Sep 2009 22:08:20 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CM8KQ8098653;
	Sat, 12 Sep 2009 22:08:20 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122208.n8CM8KQ8098653@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:08:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197138 - in head: sbin/ifconfig share/man/man4
	sys/netinet6 usr.sbin/ndp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:08:20 -0000

Author: hrs
Date: Sat Sep 12 22:08:20 2009
New Revision: 197138
URL: http://svn.freebsd.org/changeset/base/197138

Log:
  Improve flexibility of receiving Router Advertisement and
  automatic link-local address configuration:
  
  - Convert a sysctl net.inet6.ip6.accept_rtadv to one for the
    default value of a per-IF flag ND6_IFF_ACCEPT_RTADV, not a
    global knob.  The default value of the sysctl is 0.
  
  - Add a new per-IF flag ND6_IFF_AUTO_LINKLOCAL and convert a
    sysctl net.inet6.ip6.auto_linklocal to one for its default
    value.  The default value of the sysctl is 1.
  
  - Make ND6_IFF_IFDISABLED more robust.  It can be used to disable
    IPv6 functionality of an interface now.
  
  - Receiving RA is allowed if ip6_forwarding==0 *and*
    ND6_IFF_ACCEPT_RTADV is set on that interface.  The former
    condition will be revisited later to support a "host + router" box
    like IPv6 CPE router.  The current behavior is compatible with
    the older releases of FreeBSD.
  
  - The ifconfig(8) now supports these ND6 flags as well as "nud",
    "prefer_source", and "disabled" in ndp(8).  The ndp(8) now
    supports "auto_linklocal".
  
  Discussed with:	bz and jinmei
  Reviewed by:	bz
  MFC after:	3 days

Added:
  head/sbin/ifconfig/af_nd6.c   (contents, props changed)
Modified:
  head/sbin/ifconfig/Makefile
  head/sbin/ifconfig/af_inet6.c
  head/sbin/ifconfig/ifconfig.8
  head/share/man/man4/inet6.4
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/in6_proto.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_nbr.c
  head/sys/netinet6/nd6_rtr.c
  head/usr.sbin/ndp/ndp.8
  head/usr.sbin/ndp/ndp.c

Modified: head/sbin/ifconfig/Makefile
==============================================================================
--- head/sbin/ifconfig/Makefile	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sbin/ifconfig/Makefile	Sat Sep 12 22:08:20 2009	(r197138)
@@ -18,6 +18,7 @@ SRCS+=	af_link.c		# LLC support
 SRCS+=	af_inet.c		# IPv4 support
 SRCS+=	af_inet6.c		# IPv6 support
 SRCS+=	af_atalk.c		# AppleTalk support
+SRCS+=	af_nd6.c		# ND6 support
 
 SRCS+=	ifclone.c		# clone device support
 SRCS+=	ifmac.c			# MAC support

Modified: head/sbin/ifconfig/af_inet6.c
==============================================================================
--- head/sbin/ifconfig/af_inet6.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sbin/ifconfig/af_inet6.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -67,6 +67,9 @@ static	int prefix(void *, int);
 static	char *sec2str(time_t);
 static	int explicit_prefix = 0;
 
+extern void setnd6flags(const char *, int, int, const struct afswtch *);
+extern void setnd6defif(const char *, int, int, const struct afswtch *);
+
 static	char addr_buf[MAXHOSTNAMELEN *2 + 1];	/*for getnameinfo()*/
 
 static void
@@ -493,6 +496,18 @@ static struct cmd inet6_cmds[] = {
 	DEF_CMD("-deprecated", -IN6_IFF_DEPRECATED,	setip6flags),
 	DEF_CMD("autoconf",	IN6_IFF_AUTOCONF,	setip6flags),
 	DEF_CMD("-autoconf",	-IN6_IFF_AUTOCONF,	setip6flags),
+	DEF_CMD("accept_rtadv",	ND6_IFF_ACCEPT_RTADV,	setnd6flags),
+	DEF_CMD("-accept_rtadv",-ND6_IFF_ACCEPT_RTADV,	setnd6flags),
+	DEF_CMD("defaultif",	1,			setnd6defif),
+	DEF_CMD("-defaultif",	-1,			setnd6defif),
+	DEF_CMD("ifdisabled",	ND6_IFF_IFDISABLED,	setnd6flags),
+	DEF_CMD("-ifdisabled",	-ND6_IFF_IFDISABLED,	setnd6flags),
+	DEF_CMD("nud",		ND6_IFF_PERFORMNUD,	setnd6flags),
+	DEF_CMD("-nud",		-ND6_IFF_PERFORMNUD,	setnd6flags),
+	DEF_CMD("prefer_source",ND6_IFF_PREFER_SOURCE,	setnd6flags),
+	DEF_CMD("-prefer_source",-ND6_IFF_PREFER_SOURCE,setnd6flags),
+	DEF_CMD("auto_linklocal",ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
+	DEF_CMD("-auto_linklocal",-ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
 	DEF_CMD_ARG("pltime",        			setip6pltime),
 	DEF_CMD_ARG("vltime",        			setip6vltime),
 	DEF_CMD("eui64",	0,			setip6eui64),

Added: head/sbin/ifconfig/af_nd6.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sbin/ifconfig/af_nd6.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2009 Hiroki Sato.  All rights reserved.
+ *
+ * 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 REGENTS 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 REGENTS 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.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+  "$FreeBSD$";
+#endif /* not lint */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "ifconfig.h"
+
+#define	MAX_SYSCTL_TRY	5
+
+static struct nd6_opt_list {
+	const char *label;
+	u_int mask;
+} nd6_opts[]  = {
+	{ "IFDISABLED",		ND6_IFF_IFDISABLED, },
+	{ "PERFORMNUD",		ND6_IFF_PERFORMNUD, },
+	{ "ACCEPT_RTADV",	ND6_IFF_ACCEPT_RTADV,	},
+	{ "PREFER_SOURCE",	ND6_IFF_PREFER_SOURCE,	},
+	{ "AUTO_LINKLOCAL",	ND6_IFF_AUTO_LINKLOCAL,	},
+};
+
+static int isnd6defif(int);
+void setnd6flags(const char *, int, int, const struct afswtch *);
+void setnd6defif(const char *, int, int, const struct afswtch *);
+
+void
+setnd6flags(const char *dummyaddr __unused,
+	int d, int s,
+	const struct afswtch *afp)
+{
+	struct in6_ndireq nd;
+	int error;
+
+	memset(&nd, 0, sizeof(nd));
+	strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname));
+	error = ioctl(s, SIOCGIFINFO_IN6, &nd);
+	if (error) {
+		warn("ioctl(SIOCGIFINFO_IN6)");
+		return;
+	}
+	if (d < 0)
+		nd.ndi.flags &= ~(-d);
+	else
+		nd.ndi.flags |= d;
+	error = ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd);
+	if (error)
+		warn("ioctl(SIOCSIFINFO_IN6)");
+}
+
+void
+setnd6defif(const char *dummyaddr __unused,
+	int d, int s,
+	const struct afswtch *afp)
+{
+	struct in6_ndifreq ndifreq;
+	int ifindex;
+	int error;
+
+	memset(&ndifreq, 0, sizeof(ndifreq));
+	strncpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname));
+
+	if (d < 0) {
+		if (isnd6defif(s)) {
+			/* ifindex = 0 means to remove default if */
+			ifindex = 0;
+		} else
+			return;
+	} else if ((ifindex = if_nametoindex(ndifreq.ifname)) == 0) {
+		warn("if_nametoindex(%s)", ndifreq.ifname);
+		return;
+	}
+
+	ndifreq.ifindex = ifindex;
+	error = ioctl(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq);
+	if (error)
+		warn("ioctl(SIOCSDEFIFACE_IN6)");
+}
+
+static int
+isnd6defif(int s)
+{
+	struct in6_ndifreq ndifreq;
+	unsigned int ifindex;
+	int error;
+
+	memset(&ndifreq, 0, sizeof(ndifreq));
+	strncpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname));
+
+	ifindex = if_nametoindex(ndifreq.ifname);
+	error = ioctl(s, SIOCGDEFIFACE_IN6, (caddr_t)&ndifreq);
+	if (error) {
+		warn("ioctl(SIOCGDEFIFACE_IN6)");
+		return (error);
+	}
+	return (ndifreq.ifindex == ifindex);
+}
+
+static void
+nd6_status(int s)
+{
+	struct in6_ndireq nd;
+	struct rt_msghdr *rtm;
+	size_t needed;
+	char *buf, *next;
+	int mib[6], ntry;
+	int s6;
+	int i, error;
+	int isinet6, isdefif;
+	int nopts;
+
+	/* Check if the interface has at least one IPv6 address. */
+	mib[0] = CTL_NET;
+	mib[1] = PF_ROUTE;
+	mib[2] = 0;
+	mib[3] = AF_INET6;
+	mib[4] = NET_RT_IFLIST;
+	mib[5] = if_nametoindex(ifr.ifr_name);
+
+	/* Try to prevent a race between two sysctls. */
+	ntry = 0;
+	do {
+		error = sysctl(mib, 6, NULL, &needed, NULL, 0);
+		if (error) {
+			warn("sysctl(NET_RT_IFLIST)/estimate");
+			return;
+		}
+		buf = malloc(needed);
+		if (buf == NULL) {
+			warn("malloc for sysctl(NET_RT_IFLIST) failed");
+			return;
+		}
+		if ((error = sysctl(mib, 6, buf, &needed, NULL, 0)) < 0) {
+			if (errno != ENOMEM || ++ntry >= MAX_SYSCTL_TRY) {
+				warn("sysctl(NET_RT_IFLIST)/get");
+				free(buf);
+				return;
+			}
+			free(buf);
+			buf = NULL;
+		}
+	} while (buf == NULL);
+	
+	isinet6 = 0;
+	for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
+		rtm = (struct rt_msghdr *)next;
+
+		if (rtm->rtm_version != RTM_VERSION)
+			continue;
+		if (rtm->rtm_type == RTM_NEWADDR) {
+			isinet6 = 1;
+			break;
+		}
+	}
+	free(buf);
+	if (!isinet6)
+		return;
+
+	memset(&nd, 0, sizeof(nd));
+	strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname));
+	if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+		warn("socket(AF_INET6, SOCK_DGRAM)");
+		return;
+	}
+	error = ioctl(s6, SIOCGIFINFO_IN6, &nd);
+	if (error) {
+		warn("ioctl(SIOCGIFINFO_IN6)");
+		close(s6);
+		return;
+	}
+	isdefif = isnd6defif(s6);
+	close(s6);
+	if (nd.ndi.flags == 0 && !isdefif)
+		return;
+
+	nopts = 0;
+	printf("\tnd6 options=%d<", nd.ndi.flags);
+	for (i=0; i < sizeof(nd6_opts)/sizeof(nd6_opts[0]); i++) {
+		if (nd.ndi.flags & nd6_opts[i].mask) {
+			if (nopts++)
+				printf(",");
+			printf("%s", nd6_opts[i].label);
+		}
+	}
+	if (isdefif) {
+		if (nopts)
+			printf(",");
+		printf("DEFAULTIF");
+	}
+	printf(">\n");
+}
+
+static struct afswtch af_nd6 = {
+	.af_name	= "nd6",
+	.af_af		= AF_LOCAL,
+	.af_other_status= nd6_status,
+};
+
+static __constructor void
+nd6_ctor(void)
+{
+	af_register(&af_nd6);
+}

Modified: head/sbin/ifconfig/ifconfig.8
==============================================================================
--- head/sbin/ifconfig/ifconfig.8	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sbin/ifconfig/ifconfig.8	Sat Sep 12 22:08:20 2009	(r197138)
@@ -28,7 +28,7 @@
 .\"     From: @(#)ifconfig.8	8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd July 8, 2009
+.Dd September 2, 2009
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -598,6 +598,48 @@ If the interface was reset when previous
 the hardware will be re-initialized.
 .El
 .Pp
+The following parameters are for ICMPv6 Neightbor Discovery Protocol:
+.Bl -tag -width indent
+.It Cm accept_rtadv
+Set a flag to enable accepting ICMPv6 Router Advertisement messages.
+.It Cm -accept_rtadv
+Clear a flag
+.Cm accept_rtadv .
+.It Cm auto_linklocal
+Set a flag to perform automatic link-local address configuration when
+the interface becomes avalilable.
+.It Cm -auto_linklocal
+Clear a flag
+.Cm auto_linklocal .
+.It Cm defaultif
+Set the specified interface as the default route when there is no
+default router.
+.It Cm -defaultif
+Clear a flag
+.Cm defaultif .
+.It Cm ifdisabled
+Set a flag to disable all of IPv6 network communications on the
+specified interface.
+.It Cm -ifdisabled
+Clear a flag
+.Cm ifdisabled .
+When this flag is cleared and 
+.Cm auto_linklocal
+flag is enabled, automatic configuration of a link-local address is
+performed.
+.It Cm nud
+Set a flag to enable Neighbor Unreachability Detection.
+.It Cm -nud
+Clear a flag
+.Cm nud .
+.It Cm prefer_source
+Set a flag to prefer addesses on the interface as candidates of the
+source address for outgoing packets.
+.It Cm -prefer_source
+Clear a flag
+.Cm prefer_source .
+.El
+.Pp
 The following parameters are specific to cloning
 IEEE 802.11 wireless interfaces with the
 .Cm create
@@ -2421,6 +2463,9 @@ from the interface
 .Li ed0 :
 .Dl # ifconfig ed0 inet 192.0.2.45 -alias
 .Pp
+Enable IPv6 functionality of the interface:
+.Dl # ifconfig em0 inet6 -ifdisabled
+.Pp
 Add the IPv6 address
 .Li 2001:DB8:DBDB::123/48
 to the interface
@@ -2475,12 +2520,13 @@ utility appeared in
 Basic IPv6 node operation requires a link-local address on each
 interface configured for IPv6.
 Normally, such an address is automatically configured by the
-kernel on each interface added to the system; this behaviour may
-be disabled by setting the sysctl MIB variable
-.Va net.inet6.ip6.auto_linklocal
-to 0.
-.Pp
-If you delete such an address using
-.Nm ,
-the kernel may act very odd.
-Do this at your own risk.
+kernel on each interface added to the system or enabled; this behavior may
+be disabled by setting per-interface flag
+.Cm -auto_linklocal .
+The default value of this flag is 1 and can be disabled by using the sysctl
+MIB variable
+.Va net.inet6.ip6.auto_linklocal .
+.Pp
+Do not configure IPv6 addresses with no link-local address by using
+.Nm .
+It can result in unexpected behaviors of the kernel.

Modified: head/share/man/man4/inet6.4
==============================================================================
--- head/share/man/man4/inet6.4	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/share/man/man4/inet6.4	Sat Sep 12 22:08:20 2009	(r197138)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 29, 1999
+.Dd September 2, 2009
 .Dt INET6 4
 .Os
 .Sh NAME
@@ -307,7 +307,8 @@ Integer: default maximum number of fragm
 The flag is provided basically for avoiding possible DoS attacks.
 .It Dv IPV6CTL_ACCEPT_RTADV
 .Pq ip6.accept_rtadv
-Boolean: enable/disable receiving of
+Boolean: the default value of a per-interface flag to
+enable/disable receiving of
 .Tn ICMPv6
 router advertisement packets,
 and autoconfiguration of address prefixes and default routers.
@@ -315,6 +316,11 @@ The node must be a host
 (not a router)
 for the option to be meaningful.
 Defaults to off.
+.It Dv IPV6CTL_AUTO_LINKLOCAL
+.Pq ip6.auto_linklocal
+Boolean: the default value of a per-interface flag to
+enable/disable performing automatic link-local address configuration.
+Defaults to on.
 .It Dv IPV6CTL_KEEPFAITH
 .Pq ip6.keepfaith
 Boolean: enable/disable

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/in6.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -917,6 +917,10 @@ in6_update_ifa(struct ifnet *ifp, struct
 	if (hostIsNew && in6if_do_dad(ifp))
 		ia->ia6_flags |= IN6_IFF_TENTATIVE;
 
+	/* DAD should be performed after ND6_IFF_IFDISABLED is cleared. */
+	if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)
+		ia->ia6_flags |= IN6_IFF_TENTATIVE;
+
 	/*
 	 * We are done if we have simply modified an existing address.
 	 */
@@ -954,7 +958,7 @@ in6_update_ifa(struct ifnet *ifp, struct
 			 * being configured.  It also means delaying
 			 * transmission of the corresponding MLD report to
 			 * avoid report collision.
-			 * [draft-ietf-ipv6-rfc2462bis-02.txt]
+			 * [RFC 4861, Section 6.3.7]
 			 */
 			delay = arc4random() %
 			    (MAX_RTR_SOLICITATION_DELAY * hz);
@@ -2197,6 +2201,9 @@ in6if_do_dad(struct ifnet *ifp)
 	if ((ifp->if_flags & IFF_LOOPBACK) != 0)
 		return (0);
 
+	if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)
+		return (0);
+
 	switch (ifp->if_type) {
 #ifdef IFT_DUMMY
 	case IFT_DUMMY:

Modified: head/sys/netinet6/in6_ifattach.c
==============================================================================
--- head/sys/netinet6/in6_ifattach.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/in6_ifattach.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -750,14 +750,18 @@ in6_ifattach(struct ifnet *ifp, struct i
 	/*
 	 * assign a link-local address, if there's none.
 	 */
-	if (V_ip6_auto_linklocal && ifp->if_type != IFT_BRIDGE) {
+	if (ifp->if_type != IFT_BRIDGE &&
+	    !(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
+	    ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
+		int error;
+
 		ia = in6ifa_ifpforlinklocal(ifp, 0);
 		if (ia == NULL) {
-			if (in6_ifattach_linklocal(ifp, altifp) == 0) {
-				/* linklocal address assigned */
-			} else {
-				/* failed to assign linklocal address. bark? */
-			}
+			error = in6_ifattach_linklocal(ifp, altifp);
+			if (error)
+				log(LOG_NOTICE, "in6_ifattach_linklocal: "
+				    "failed to add a link-local addr to %s\n",
+				    if_name(ifp));
 		} else
 			ifa_free(&ia->ia_ifa);
 	}

Modified: head/sys/netinet6/in6_proto.c
==============================================================================
--- head/sys/netinet6/in6_proto.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/in6_proto.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -497,7 +497,9 @@ SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6C
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets,
 	CTLFLAG_RW, &VNET_NAME(ip6_maxfragpackets), 0, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV, accept_rtadv,
-	CTLFLAG_RW, &VNET_NAME(ip6_accept_rtadv), 0, "");
+	CTLFLAG_RW, &VNET_NAME(ip6_accept_rtadv), 0,
+	"Default value of per-interface flag for accepting ICMPv6 Router"
+	"Advertisement messages");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_KEEPFAITH, keepfaith, CTLFLAG_RW,
 	&VNET_NAME(ip6_keepfaith), 0, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_LOG_INTERVAL, log_interval,
@@ -527,7 +529,9 @@ SYSCTL_VNET_PROC(_net_inet6_ip6, IPV6CTL
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_V6ONLY, v6only,	CTLFLAG_RW,
 	&VNET_NAME(ip6_v6only), 0, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_AUTO_LINKLOCAL, auto_linklocal,
-	CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0, "");
+	CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0,
+	"Default value of per-interface flag for automatically adding an IPv6"
+	" link-local address to interfaces when attached");
 SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD,
 	&VNET_NAME(rip6stat), rip6stat, "");
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, prefer_tempaddr,

Modified: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/ip6_input.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -175,7 +175,7 @@ ip6_init(void)
 #ifdef IP6_AUTO_LINKLOCAL
 	V_ip6_auto_linklocal = IP6_AUTO_LINKLOCAL;
 #else
-	V_ip6_auto_linklocal = 1;	/* enable by default */
+	V_ip6_auto_linklocal = 1;	/* enabled by default */
 #endif
 	TUNABLE_INT_FETCH("net.inet6.ip6.auto_linklocal",
 	    &V_ip6_auto_linklocal);
@@ -196,7 +196,7 @@ ip6_init(void)
 	V_ip6_sendredirects = IPV6_SENDREDIRECTS;
 	V_ip6_defhlim = IPV6_DEFHLIM;
 	V_ip6_defmcasthlim = IPV6_DEFAULT_MULTICAST_HOPS;
-	V_ip6_accept_rtadv = 0;	 /* "IPV6FORWARDING ? 0 : 1" is dangerous */
+	V_ip6_accept_rtadv = 0;
 	V_ip6_log_interval = 5;
 	V_ip6_hdrnestlimit = 15; /* How many header options will we process? */
 	V_ip6_dad_count = 1;	 /* DupAddrDetectionTransmits */

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/nd6.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -212,12 +213,16 @@ nd6_ifattach(struct ifnet *ifp)
 	nd->basereachable = REACHABLE_TIME;
 	nd->reachable = ND_COMPUTE_RTIME(nd->basereachable);
 	nd->retrans = RETRANS_TIMER;
-	/*
-	 * Note that the default value of ip6_accept_rtadv is 0, which means
-	 * we won't accept RAs by default even if we set ND6_IFF_ACCEPT_RTADV
-	 * here.
-	 */
-	nd->flags = (ND6_IFF_PERFORMNUD | ND6_IFF_ACCEPT_RTADV);
+
+	nd->flags = ND6_IFF_PERFORMNUD;
+
+	/* A loopback interface always has ND6_IFF_AUTO_LINKLOCAL. */
+	if (V_ip6_auto_linklocal || (ifp->if_flags & IFF_LOOPBACK))
+		nd->flags |= ND6_IFF_AUTO_LINKLOCAL;
+
+	/* A loopback interface does not need to accept RTADV. */
+	if (V_ip6_accept_rtadv && !(ifp->if_flags & IFF_LOOPBACK))
+		nd->flags |= ND6_IFF_ACCEPT_RTADV;
 
 	/* XXX: we cannot call nd6_setmtu since ifp is not fully initialized */
 	nd6_setmtu0(ifp, nd);
@@ -843,13 +848,9 @@ nd6_purge(struct ifnet *ifp)
 	if (V_nd6_defifindex == ifp->if_index)
 		nd6_setdefaultiface(0);
 
-	if (!V_ip6_forwarding && V_ip6_accept_rtadv) { /* XXX: too restrictive? */
-		/* refresh default router list
-		 *
-		 * 
-		 */
+	if (!V_ip6_forwarding && ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) {
+		/* Refresh default router list. */
 		defrouter_select();
-
 	}
 
 	/* XXXXX
@@ -1296,6 +1297,69 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
 			ND_IFINFO(ifp)->chlim = ND.chlim;
 		/* FALLTHROUGH */
 	case SIOCSIFINFO_FLAGS:
+	{
+		struct ifaddr *ifa;
+		struct in6_ifaddr *ia;
+
+		if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
+		    !(ND.flags & ND6_IFF_IFDISABLED)) {
+			/* ifdisabled 1->0 transision */
+
+			/*
+			 * If the interface is marked as ND6_IFF_IFDISABLED and
+			 * has an link-local address with IN6_IFF_DUPLICATED,
+			 * do not clear ND6_IFF_IFDISABLED.
+			 * See RFC 4862, Section 5.4.5.
+			 */
+			int duplicated_linklocal = 0;
+
+			IF_ADDR_LOCK(ifp);
+			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+				if (ifa->ifa_addr->sa_family != AF_INET6)
+					continue;
+				ia = (struct in6_ifaddr *)ifa;
+				if ((ia->ia6_flags & IN6_IFF_DUPLICATED) &&
+				    IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr)) {
+					duplicated_linklocal = 1;
+					break;
+				}
+			}
+			IF_ADDR_UNLOCK(ifp);
+
+			if (duplicated_linklocal) {
+				ND.flags |= ND6_IFF_IFDISABLED;
+				log(LOG_ERR, "Cannot enable an interface"
+				    " with a link-local address marked"
+				    " duplicate.\n");
+			} else {
+				ND_IFINFO(ifp)->flags &= ~ND6_IFF_IFDISABLED;
+				in6_if_up(ifp);
+			}
+		} else if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
+			    (ND.flags & ND6_IFF_IFDISABLED)) {
+			/* ifdisabled 0->1 transision */
+			/* Mark all IPv6 address as tentative. */
+
+			ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED;
+			IF_ADDR_LOCK(ifp);
+			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+				if (ifa->ifa_addr->sa_family != AF_INET6)
+					continue;
+				ia = (struct in6_ifaddr *)ifa;
+				ia->ia6_flags |= IN6_IFF_TENTATIVE;
+			}
+			IF_ADDR_UNLOCK(ifp);
+		}
+
+		if (!(ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) &&
+		    (ND.flags & ND6_IFF_AUTO_LINKLOCAL)) {
+			/* auto_linklocal 0->1 transision */
+
+			/* If no link-local address on ifp, configure */
+			ND_IFINFO(ifp)->flags |= ND6_IFF_AUTO_LINKLOCAL;
+			in6_ifattach(ifp, NULL);
+		}
+	}
 		ND_IFINFO(ifp)->flags = ND.flags;
 		break;
 #undef ND
@@ -1633,7 +1697,8 @@ nd6_cache_lladdr(struct ifnet *ifp, stru
 	 * for those are not autoconfigured hosts, we explicitly avoid such
 	 * cases for safety.
 	 */
-	if (do_update && router && !V_ip6_forwarding && V_ip6_accept_rtadv) {
+	if (do_update && router && !V_ip6_forwarding &&
+	    ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) {
 		/*
 		 * guaranteed recursion
 		 */

Modified: head/sys/netinet6/nd6.h
==============================================================================
--- head/sys/netinet6/nd6.h	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/nd6.h	Sat Sep 12 22:08:20 2009	(r197138)
@@ -84,6 +84,7 @@ struct nd_ifinfo {
 				     * DAD failure.  (XXX: not ND-specific)
 				     */
 #define ND6_IFF_DONT_SET_IFROUTE	0x10
+#define ND6_IFF_AUTO_LINKLOCAL	0x20
 
 #define	ND6_CREATE		LLE_CREATE
 #define	ND6_EXCLUSIVE		LLE_EXCLUSIVE

Modified: head/sys/netinet6/nd6_nbr.c
==============================================================================
--- head/sys/netinet6/nd6_nbr.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/nd6_nbr.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -1198,6 +1198,8 @@ nd6_dad_start(struct ifaddr *ifa, int de
 	if (!(ifa->ifa_ifp->if_flags & IFF_UP)) {
 		return;
 	}
+	if (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED)
+		return;
 	if (nd6_dad_find(ifa) != NULL) {
 		/* DAD already in progress */
 		return;
@@ -1402,7 +1404,7 @@ nd6_dad_duplicated(struct ifaddr *ifa)
 	 * identifier based on the hardware address which is supposed to be
 	 * uniquely assigned (e.g., EUI-64 for an Ethernet interface), IP
 	 * operation on the interface SHOULD be disabled.
-	 * [rfc2462bis-03 Section 5.4.5]
+	 * [RFC 4862, Section 5.4.5]
 	 */
 	if (IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr)) {
 		struct in6_addr in6;

Modified: head/sys/netinet6/nd6_rtr.c
==============================================================================
--- head/sys/netinet6/nd6_rtr.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/sys/netinet6/nd6_rtr.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -126,7 +126,7 @@ nd6_rs_input(struct mbuf *m, int off, in
 	char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
 	/* If I'm not a router, ignore it. */
-	if (V_ip6_accept_rtadv != 0 || V_ip6_forwarding != 1)
+	if (!V_ip6_forwarding)
 		goto freeit;
 
 	/* Sanity checks */
@@ -212,12 +212,10 @@ nd6_ra_input(struct mbuf *m, int off, in
 
 	/*
 	 * We only accept RAs only when
-	 * the system-wide variable allows the acceptance, and
+	 * the node is not a router and
 	 * per-interface variable allows RAs on the receiving interface.
 	 */
-	if (V_ip6_accept_rtadv == 0)
-		goto freeit;
-	if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV))
+	if (V_ip6_forwarding || !(ndi->flags & ND6_IFF_ACCEPT_RTADV))
 		goto freeit;
 
 	if (ip6->ip6_hlim != 255) {
@@ -557,7 +555,7 @@ defrtrlist_del(struct nd_defrouter *dr)
 	 * Flush all the routing table entries that use the router
 	 * as a next hop.
 	 */
-	if (!V_ip6_forwarding && V_ip6_accept_rtadv) /* XXX: better condition? */
+	if (!V_ip6_forwarding)
 		rt6_flush(&dr->rtaddr, dr->ifp);
 
 	if (dr->installed) {
@@ -621,10 +619,10 @@ defrouter_select(void)
 	 * if the node is not an autoconfigured host, we explicitly exclude
 	 * such cases here for safety.
 	 */
-	if (V_ip6_forwarding || !V_ip6_accept_rtadv) {
+	if (V_ip6_forwarding) {
 		nd6log((LOG_WARNING,
-		    "defrouter_select: called unexpectedly (forwarding=%d, "
-		    "accept_rtadv=%d)\n", V_ip6_forwarding, V_ip6_accept_rtadv));
+		    "defrouter_select: called unexpectedly (forwarding=%d)\n",
+		    V_ip6_forwarding));
 		splx(s);
 		return;
 	}

Modified: head/usr.sbin/ndp/ndp.8
==============================================================================
--- head/usr.sbin/ndp/ndp.8	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/usr.sbin/ndp/ndp.8	Sat Sep 12 22:08:20 2009	(r197138)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 17, 1998
+.Dd September 2, 2009
 .Dt NDP 8
 .Os
 .\"
@@ -182,11 +182,16 @@ NUD is usually turned on by default.
 Specify whether or not to accept Router Advertisement messages
 received on the
 .Ar interface .
-Note that the kernel does not accept Router Advertisement messages
-unless the
-.Li net.inet6.ip6.accept_rtadv
-variable is non-0, even if the flag is on.
-This flag is set to 1 by default.
+This flag is set by
+.Va net.inet6.ip6.accept_rtadv
+sysctl variable.
+.It Ic auto_linklocal
+Specify whether or not to perform automatic link-local address configuration
+on
+.Ar interface .
+This flag is set by
+.Va net.inet6.ip6.auto_linklocal
+sysctl variable.
 .It Ic prefer_source
 Prefer addresses on the
 .Ar interface
@@ -204,9 +209,8 @@ In the sending case, an error of ENETDOW
 application.
 This flag is typically set automatically in the kernel as a result of
 a certain failure of Duplicate Address Detection.
-While the flag can be set or cleared by hand with the
-.Nm
-command, it is not generally advisable to modify this flag manually.
+If the auto_linklocal per-interface flag is set, automatic link-local
+address configuration is performed again when this flag is cleared.
 .It Ic basereachable Ns Li = Ns Pq Ar number
 Specify the BaseReachbleTimer on the interface in millisecond.
 .It Ic retrans Ns Li = Ns Pq Ar number
@@ -253,6 +257,10 @@ Most useful when used with
 The
 .Nm
 utility first appeared in the WIDE Hydrangea IPv6 protocol stack kit.
+The
+.Fl I Ar auto_linklocal
+flag first appeared in
+.Fx 8.0 .
 .\"
 .\" .Sh BUGS
 .\" (to be written)

Modified: head/usr.sbin/ndp/ndp.c
==============================================================================
--- head/usr.sbin/ndp/ndp.c	Sat Sep 12 21:44:34 2009	(r197137)
+++ head/usr.sbin/ndp/ndp.c	Sat Sep 12 22:08:20 2009	(r197138)
@@ -1004,6 +1004,9 @@ ifinfo(ifname, argc, argv)
 #ifdef ND6_IFF_ACCEPT_RTADV
 		SETFLAG("accept_rtadv", ND6_IFF_ACCEPT_RTADV);
 #endif
+#ifdef ND6_IFF_AUTO_LINKLOCAL
+		SETFLAG("auto_linklocal", ND6_IFF_AUTO_LINKLOCAL);
+#endif
 #ifdef ND6_IFF_PREFER_SOURCE
 		SETFLAG("prefer_source", ND6_IFF_PREFER_SOURCE);
 #endif
@@ -1076,6 +1079,10 @@ ifinfo(ifname, argc, argv)
 		if ((ND.flags & ND6_IFF_ACCEPT_RTADV))
 			printf("accept_rtadv ");
 #endif
+#ifdef ND6_IFF_AUTO_LINKLOCAL
+		if ((ND.flags & ND6_IFF_AUTO_LINKLOCAL))
+			printf("auto_linklocal ");
+#endif
 #ifdef ND6_IFF_PREFER_SOURCE
 		if ((ND.flags & ND6_IFF_PREFER_SOURCE))
 			printf("prefer_source ");

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:13:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F09F106566B;
	Sat, 12 Sep 2009 22:13:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3DA8D8FC08;
	Sat, 12 Sep 2009 22:13:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMDfsJ098898;
	Sat, 12 Sep 2009 22:13:41 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMDfdW098895;
	Sat, 12 Sep 2009 22:13:41 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122213.n8CMDfdW098895@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:13:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197139 - in head/etc: . rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:13:41 -0000

Author: hrs
Date: Sat Sep 12 22:13:41 2009
New Revision: 197139
URL: http://svn.freebsd.org/changeset/base/197139

Log:
  Integrate rc.d/network_ipv6 into rc.d/netif:
  
  - Add rc.d/stf and rc.d/faith for stf(4) and faith(4).
  - Remove rc.d/auto_linklocal and rc.d/network_ipv6.
  - Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif
    depends on some sysctl variables.
  
  Reviewed by:	brooks
  MFC after:	3 days

Added:
  head/etc/rc.d/faith   (contents, props changed)
  head/etc/rc.d/stf   (contents, props changed)
Deleted:
  head/etc/rc.d/auto_linklocal
  head/etc/rc.d/network_ipv6
Modified:
  head/etc/network.subr
  head/etc/rc.d/Makefile
  head/etc/rc.d/NETWORKING
  head/etc/rc.d/addswap
  head/etc/rc.d/defaultroute
  head/etc/rc.d/devd
  head/etc/rc.d/ip6addrctl
  head/etc/rc.d/mroute6d
  head/etc/rc.d/netif
  head/etc/rc.d/routing
  head/etc/rc.d/sysctl

Modified: head/etc/network.subr
==============================================================================
--- head/etc/network.subr	Sat Sep 12 22:08:20 2009	(r197138)
+++ head/etc/network.subr	Sat Sep 12 22:13:41 2009	(r197139)
@@ -45,13 +45,14 @@ ifn_start()
 	ifscript_up ${ifn} && cfg=0
 	ifconfig_up ${ifn} && cfg=0
 	ipv4_up ${ifn} && cfg=0
+	ipv6_up ${ifn} && cfg=0
 	ipx_up ${ifn} && cfg=0
-	childif_create ${ifn}
+	childif_create ${ifn} && cfg=0
 
 	return $cfg
 }
 
-# ifn_start ifn
+# ifn_stop ifn
 # Shutdown and de-configure an interface.  If action is taken print the
 # interface name.
 #
@@ -61,13 +62,14 @@ ifn_stop()
 	ifn="$1"
 	cfg=1
 
-	[ -z "$ifn" ] && return 1
+	[ -z "$ifn" ] && err 1 "ifn_stop called without an interface"
 
 	ipx_down ${ifn} && cfg=0
+	ipv6_down ${ifn} && cfg=0
 	ipv4_down ${ifn} && cfg=0
 	ifconfig_down ${ifn} && cfg=0
 	ifscript_down ${ifn} && cfg=0
-	childif_destroy ${ifn}
+	childif_destroy ${ifn} && cfg=0
 
 	return $cfg
 }
@@ -81,15 +83,53 @@ ifn_stop()
 #
 ifconfig_up()
 {
+	local _cfg _ipv6_opts ifconfig_args
 	_cfg=1
 
+	# ifconfig_IF
 	ifconfig_args=`ifconfig_getargs $1`
 	if [ -n "${ifconfig_args}" ]; then
 		ifconfig $1 ${ifconfig_args}
-		ifconfig $1 up
 		_cfg=0
 	fi
 
+	# inet6 specific
+	if afexists inet6; then
+		if ipv6if $1; then
+			if checkyesno ipv6_gateway_enable; then
+				_ipv6_opts="-accept_rtadv auto_linklocal"
+			else
+				_ipv6_opts="auto_linklocal"
+			fi
+		else
+			_ipv6_opts="-auto_linklocal ifdisabled"
+		fi
+
+		ifconfig $1 inet6 ${_ipv6_opts}
+
+		# ifconfig_IF_ipv6
+		ifconfig_args=`ifconfig_getargs $1 ipv6`
+		if [ -n "${ifconfig_args}" ]; then
+			ifconfig $1 inet6 -ifdisabled
+			ifconfig $1 ${ifconfig_args}
+			_cfg=0
+		fi
+
+		# backward compatiblity: $ipv6_ifconfig_IF
+		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF`
+		if [ -n "${ifconfig_args}" ]; then
+			warn "\$ipv6_ifconfig_$1 is obsolete." \
+			    "  Use ifconfig_$1_ipv6 instead."
+			ifconfig $1 inet6 -ifdisabled
+			ifconfig $1 inet6 ${ifconfig_args}
+			_cfg=0
+		fi
+	fi
+
+	if [ ${_cfg} -eq 0 ]; then
+		ifconfig $1 up
+	fi
+
 	if wpaif $1; then
 		/etc/rc.d/wpa_supplicant start $1
 		_cfg=0		# XXX: not sure this should count
@@ -114,7 +154,7 @@ ifconfig_up()
 #
 ifconfig_down()
 {
-	[ -z "$1" ] && return 1
+	local _cfg
 	_cfg=1
 
 	if wpaif $1; then
@@ -143,6 +183,8 @@ ifconfig_down()
 #       $default if given.
 get_if_var()
 {
+	local _if _punct _var _default prefix suffix
+
 	if [ $# -ne 2 -a $# -ne 3 ]; then
 		err 3 'USAGE: get_if_var name var [default]'
 	fi
@@ -160,26 +202,30 @@ get_if_var()
 	eval echo \${${prefix}${_if}${suffix}-${_default}}
 }
 
-# _ifconfig_getargs if
+# _ifconfig_getargs if [af]
 #	Echos the arguments for the supplied interface to stdout.
 #	returns 1 if empty.  In general, ifconfig_getargs should be used
 #	outside this file.
 _ifconfig_getargs()
 {
+	local _ifn _af
 	_ifn=$1
+	_af=${2+_$2}
+
 	if [ -z "$_ifn" ]; then
 		return 1
 	fi
 
-	get_if_var $_ifn ifconfig_IF "$ifconfig_DEFAULT"
+	get_if_var $_ifn ifconfig_IF$_af "$ifconfig_DEFAULT"
 }
 
-# ifconfig_getargs if
+# ifconfig_getargs if [af]
 #	Takes the result from _ifconfig_getargs and removes pseudo
 #	args such as DHCP and WPA.
 ifconfig_getargs()
 {
-	_tmpargs=`_ifconfig_getargs $1`
+	local _tmpargs _arg _args
+	_tmpargs=`_ifconfig_getargs $1 $2`
 	if [ $? -eq 1 ]; then
 		return 1
 	fi
@@ -206,7 +252,9 @@ ifconfig_getargs()
 #	boot time and 1 otherwise.
 autoif()
 {
+	local _tmpargs _arg
 	_tmpargs=`_ifconfig_getargs $1`
+
 	for _arg in $_tmpargs; do
 		case $_arg in
 		[Nn][Oo][Aa][Uu][Tt][Oo])
@@ -214,6 +262,7 @@ autoif()
 			;;
 		esac
 	done
+
 	return 0
 }
 
@@ -221,7 +270,9 @@ autoif()
 #	Returns 0 if the interface is a DHCP interface and 1 otherwise.
 dhcpif()
 {
+	local _tmpargs _arg
 	_tmpargs=`_ifconfig_getargs $1`
+
 	for _arg in $_tmpargs; do
 		case $_arg in
 		[Dd][Hh][Cc][Pp])
@@ -235,6 +286,7 @@ dhcpif()
 			;;
 		esac
 	done
+
 	return 1
 }
 
@@ -243,7 +295,9 @@ dhcpif()
 #	1 otherwise.
 syncdhcpif()
 {
+	local _tmpargs _arg
 	_tmpargs=`_ifconfig_getargs $1`
+
 	for _arg in $_tmpargs; do
 		case $_arg in
 		[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp])
@@ -254,18 +308,17 @@ syncdhcpif()
 			;;
 		esac
 	done
-	if checkyesno synchronous_dhclient; then
-		return 0
-	else
-		return 1
-	fi
+
+	checkyesno synchronous_dhclient
 }
 
 # wpaif if
 #	Returns 0 if the interface is a WPA interface and 1 otherwise.
 wpaif()
 {
+	local _tmpargs _arg
 	_tmpargs=`_ifconfig_getargs $1`
+
 	for _arg in $_tmpargs; do
 		case $_arg in
 		[Ww][Pp][Aa])
@@ -273,6 +326,54 @@ wpaif()
 			;;
 		esac
 	done
+
+	return 1
+}
+
+# afexists af
+#	Returns 0 if the address family is enabled in the kernel
+#	1 otherwise.
+afexists()
+{
+	local _af
+	_af=$1
+
+	case ${_af} in
+	inet)
+		${SYSCTL_N} net.inet > /dev/null 2>&1
+		;;
+	inet6)
+		${SYSCTL_N} net.inet6 > /dev/null 2>&1
+		;;
+	*)
+		err 1 "afexists(): Unsupported address family: $_af"
+		;;
+	esac
+}
+
+# noafif if
+#	Returns 0 if the interface has no af configuration and 1 otherwise.
+noafif()
+{
+	local _if
+	_if=$1
+
+	case $_if in
+	pflog[0-9]*|\
+	pfsync[0-9]*|\
+	an[0-9]*|\
+	ath[0-9]*|\
+	ipw[0-9]*|\
+	iwi[0-9]*|\
+	iwn[0-9]*|\
+	ral[0-9]*|\
+	wi[0-9]*|\
+	wl[0-9]*|\
+	wpi[0-9]*)
+		return 0
+		;;
+	esac
+
 	return 1
 }
 
@@ -281,9 +382,20 @@ wpaif()
 #	1 otherwise.
 ipv6if()
 {
-	if ! checkyesno ipv6_enable; then
+	local _if i
+	_if=$1
+
+	if ! afexists inet6; then
 		return 1
 	fi
+
+	# lo0 is always IPv6-enabled
+	case $_if in
+	lo0)
+		return 0
+		;;
+	esac
+
 	case "${ipv6_network_interfaces}" in
 	[Aa][Uu][Tt][Oo])
 		return 0
@@ -292,11 +404,53 @@ ipv6if()
 		return 1
 		;;
 	esac
-	for v6if in ${ipv6_network_interfaces}; do
-		if [ "${v6if}" = "${1}" ]; then
+
+	for i in ${ipv6_network_interfaces}; do
+		if [ "$i" = "$_if" ]; then
 			return 0
 		fi
 	done
+
+	return 1
+}
+
+# ipv6_autoconfif if
+#	Returns 0 if the interface should be configured for IPv6 with
+#	Stateless Address Configuration, 1 otherwise.
+ipv6_autoconfif()
+{
+	local _if _tmpargs _arg
+	_if=$1
+
+	if ! ipv6if $_if; then
+		return 1
+	fi
+	if noafif $_if; then
+		return 1
+	fi
+	if checkyesno ipv6_gateway_enable; then
+		return 1
+	fi
+
+	case $_if in
+	lo0|\
+	stf[0-9]*|\
+	faith[0-9]*|\
+	lp[0-9]*|\
+	sl[0-9]*)
+		return 1
+		;;
+	esac
+
+	_tmpargs=`_ifconfig_getargs $_if ipv6`
+	for _arg in $_tmpargs; do
+		case $_arg in
+		accept_rtadv)
+			return 0
+			;;
+		esac
+	done
+
 	return 1
 }
 
@@ -304,6 +458,7 @@ ipv6if()
 #	Returns 0 if the interface exists and 1 otherwise.
 ifexists()
 {
+	[ -z "$1" ] && return 1
 	ifconfig -n $1 > /dev/null 2>&1
 }
 
@@ -311,21 +466,48 @@ ifexists()
 #  add IPv4 addresses to the interface $if 
 ipv4_up()
 {
+	local _if _ret
+	_if=$1
+	_ret=1
+
+	ifalias_up ${_if} inet && _ret=0
+	ipv4_addrs_common ${_if} alias && _ret=0
+
+	return $_ret
+}
+
+# ipv6_up if
+#	add IPv6 addresses to the interface $if
+ipv6_up()
+{
+	local _if _ret
 	_if=$1
-	ifalias_up ${_if}
-	ipv4_addrs_common ${_if} alias
+	_ret=1
+
+	if ! ipv6if $_if; then
+		return 0
+	fi
+
+	ifalias_up ${_if} inet6 && _ret=0
+	ipv6_prefix_hostid_addr_up ${_if} && _ret=0
+	ipv6_accept_rtadv_up ${_if} && _ret=0
+
+	# wait for DAD
+	sleep `${SYSCTL_N} net.inet6.ip6.dad_count`
+	sleep 1
+
+	return $_ret
 }
 
 # ipv4_down if
 #  remove IPv4 addresses from the interface $if
 ipv4_down()
 {
+	local _if _ifs _ret inetList oldifs _inet
 	_if=$1
 	_ifs="^"
 	_ret=1
 
-	ifexists ${_if} || return 1
-
 	inetList="`ifconfig ${_if} | grep 'inet ' | tr "\n" "$_ifs"`"
 
 	oldifs="$IFS"
@@ -343,17 +525,55 @@ ipv4_down()
 	done
 	IFS="$oldifs"
 
-	ifalias_down ${_if} && _ret=0
+	ifalias_down ${_if} inet && _ret=0
 	ipv4_addrs_common ${_if} -alias && _ret=0
 
 	return $_ret
 }
 
+# ipv6_down if
+#	remove IPv6 addresses from the interface $if
+ipv6_down()
+{
+	local _if _ifs _ret inetList oldifs _inet6
+	_if=$1
+	_ifs="^"
+	_ret=1
+
+	if ! ipv6if $_if; then
+		return 0
+	fi
+
+	ipv6_accept_rtadv_down ${_if} && _ret=0
+	ifalias_down ${_if} inet6 && _ret=0
+
+	inetList="`ifconfig ${_if} | grep 'inet6 ' | tr "\n" "$_ifs"`"
+
+	oldifs="$IFS"
+	IFS="$_ifs"
+	for _inet6 in $inetList ; do
+		# get rid of extraneous line
+		[ -z "$_inet6" ] && break
+
+		_inet6=`expr "$_inet6" : '.*\(inet6 \([0-9a-f:]*\)\).*'`
+
+		IFS="$oldifs"
+		ifconfig ${_if} ${_inet6} -alias
+		IFS="$_ifs"
+		_ret=0
+	done
+	IFS="$oldifs"
+
+	return $_ret
+}
+
 # ipv4_addrs_common if action
 #   Evaluate the ifconfig_if_ipv4 arguments for interface $if
 #   and use $action to add or remove IPv4 addresses from $if.
 ipv4_addrs_common()
 {  
+	local _ret _if _action _cidr _cidr_addr
+	local _ipaddr _netmask _range _ipnet _iplow _iphigh _ipcount 
 	_ret=1
 	_if=$1
 	_action=$2
@@ -386,53 +606,239 @@ ipv4_addrs_common()
 			fi
 		done
 	done
+
 	return $_ret
 }
 
-# ifalias_up if
+# ifalias_up if af
 #	Configure aliases for network interface $if.
 #	It returns 0 if at least one alias was configured or
 #	1 if there were none.
 #
 ifalias_up()
 {
+	local _ret
+	_ret=1
+
+	case "$2" in
+	inet)
+		_ret=`ifalias_ipv4_up "$1"`
+		;;
+	inet6)
+		_ret=`ifalias_ipv6_up "$1"`
+		;;
+	esac
+
+	return $_ret
+}
+
+# ifalias_ipv4_up if
+#	Helper function for ifalias_up().  Handles IPv4.
+#
+ifalias_ipv4_up()
+{
+	local _ret alias ifconfig_args
 	_ret=1
+
+	# ifconfig_IF_aliasN which starts with "inet"
 	alias=0
 	while : ; do
 		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
-		if [ -n "${ifconfig_args}" ]; then
-			ifconfig $1 ${ifconfig_args} alias
+		case "${ifconfig_args}" in
+		inet\ *)
+			ifconfig $1 ${ifconfig_args} alias && _ret=0
+			;;
+		"")
+			break
+			;;
+		esac
 			alias=$((${alias} + 1))
-			_ret=0
-		else
+	done
+
+	return $_ret
+}
+
+# ifalias_ipv6_up if
+#	Helper function for ifalias_up().  Handles IPv6.
+#
+ifalias_ipv6_up()
+{
+	local _ret alias ifconfig_args
+	_ret=1
+
+	# ifconfig_IF_aliasN which starts with "inet6"
+	alias=0
+	while : ; do
+		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
+		case "${ifconfig_args}" in
+		inet6\ *)
+			ifconfig $1 ${ifconfig_args} alias && _ret=0
+			;;
+		"")
 			break
-		fi
+			;;
+		esac
+		alias=$((${alias} + 1))
+	done
+
+	# backward compatibility: ipv6_ifconfig_IF_aliasN.
+	alias=0
+	while : ; do
+		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF_alias${alias}`
+		case "${ifconfig_args}" in
+		"")
+			break
+			;;
+		*)
+			ifconfig $1 inet6 ${ifconfig_args} alias && _ret=0
+			warn "\$ipv6_ifconfig_$1_alias${alias} is obsolete."
+			    "  Use ifconfig_$1_aliasN instead."
+			;;
+		esac
+		alias=$((${alias} + 1))
 	done
+
 	return $_ret
 }
 
-#ifalias_down if
+#ifalias_down if af
 #	Remove aliases for network interface $if.
 #	It returns 0 if at least one alias was removed or
 #	1 if there were none.
 #
 ifalias_down()
 {
+	local _ret
+	_ret=1
+
+	case "$2" in
+	inet)
+		_ret=`ifalias_ipv4_down "$1"`
+		;;
+	inet6)
+		_ret=`ifalias_ipv6_down "$1"`
+		;;
+	esac
+
+	return $_ret
+}
+
+#ifalias_ipv4_down if
+#	Helper function for ifalias_down().  Handles IPv4.
+#
+ifalias_ipv4_down()
+{
+	local _ret alias ifconfig_args
 	_ret=1
+
+	# ifconfig_IF_aliasN which starts with "inet"
 	alias=0
 	while : ; do
 		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
-		if [ -n "${ifconfig_args}" ]; then
-			ifconfig $1 ${ifconfig_args} -alias
+		case "${ifconfig_args}" in
+		inet\ *)
+			ifconfig $1 ${ifconfig_args} -alias && _ret=0
+			;;
+		"")
+			break
+			;;
+		esac
 			alias=$((${alias} + 1))
-			_ret=0
-		else
+	done
+
+	return $_ret
+}
+
+#ifalias_ipv6_down if
+#	Helper function for ifalias_down().  Handles IPv6.
+#
+ifalias_ipv6_down()
+{
+	local _ret alias ifconfig_args
+	_ret=1
+
+	# ifconfig_IF_aliasN which starts with "inet6"
+	alias=0
+	while : ; do
+		ifconfig_args=`get_if_var $1 ifconfig_IF_alias${alias}`
+		case "${ifconfig_args}" in
+		inet6\ *)
+			ifconfig $1 ${ifconfig_args} -alias && _ret=0
+			;;
+		"")
 			break
-		fi
+			;;
+		esac
+		alias=$((${alias} + 1))
+	done
+
+	# backward compatibility: ipv6_ifconfig_IF_aliasN.
+	while : ; do
+		ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF_alias${alias}`
+		case "${ifconfig_args}" in
+		"")
+			break
+			;;
+		*)
+			ifconfig $1 inet6 ${ifconfig_args} -alias
+			alias=$((${alias} + 1))
+			warn "\$ipv6_ifconfig_$1_alias${alias} is obsolete."
+			    "  Use ifconfig_$1_aliasN instead."
+			_ret=0
+			;;
+		esac
 	done
+
 	return $_ret
 }
 
+# ipv6_prefix_hostid_addr_up if
+#	add IPv6 prefix + hostid addr to the interface $if
+ipv6_prefix_hostid_addr_up()
+{
+	local _if prefix laddr hostid j address
+	_if=$1
+	prefix=`get_if_var ${_if} ipv6_prefix_IF`
+
+	if [ -n "${prefix}" ]; then
+		laddr=`network6_getladdr ${_if}`
+		hostid=${laddr#fe80::}
+		hostid=${hostid%\%*}
+
+		for j in ${prefix}; do
+			address=$j\:${hostid}
+			ifconfig ${_if} inet6 ${address} prefixlen 64 alias
+
+			# if I am a router, add subnet router
+			# anycast address (RFC 2373).
+			if checkyesno ipv6_gateway_enable; then
+				ifconfig ${_if} inet6 $j:: prefixlen 64 \
+					alias anycast
+			fi
+		done
+	fi
+}
+
+# ipv6_accept_rtadv_up if
+#	Enable accepting Router Advertisement and send Router
+#	Solicitation message
+ipv6_accept_rtadv_up()
+{
+	if ipv6_autoconfif $1; then
+		ifconfig $1 inet6 accept_rtadv up
+		rtsol ${rtsol_flags} $1
+	fi
+}
+
+# ipv6_accept_rtadv_down if
+#	Disable accepting Router Advertisement
+ipv6_accept_rtadv_down()
+{
+	if ipv6_autoconfif $1; then
+		ifconfig $1 inet6 -accept_rtadv
+	fi
+}
+
 # ifscript_up if
 #	Evaluate a startup script for the $if interface.
 #	It returns 0 if a script was found and processed or
@@ -443,8 +849,9 @@ ifscript_up()
 	if [ -r /etc/start_if.$1 ]; then
 		. /etc/start_if.$1
 		return 0
+	else
+		return 1
 	fi
-	return 1
 }
 
 # ifscript_down if
@@ -457,16 +864,20 @@ ifscript_down()
 	if [ -r /etc/stop_if.$1 ]; then
 		. /etc/stop_if.$1
 		return 0
+	else
+		return 1
 	fi
-	return 1
 }
 
 # Create cloneable interfaces.
 #
 clone_up()
 {
+	local _prefix _list ifn
 	_prefix=
 	_list=
+
+	# create_args_IF
 	for ifn in ${cloned_interfaces}; do
 		ifconfig ${ifn} create `get_if_var ${ifn} create_args_IF`
 		if [ $? -eq 0 ]; then
@@ -482,8 +893,10 @@ clone_up()
 #
 clone_down()
 {
+	local _prefix _list ifn
 	_prefix=
 	_list=
+
 	for ifn in ${cloned_interfaces}; do
 		ifconfig ${ifn} destroy
 		if [ $? -eq 0 ]; then
@@ -501,7 +914,6 @@ childif_create()
 {
 	local cfg child child_wlans create_args debug_flags ifn i
 	cfg=1
-
 	ifn=$1
 
 	# Create wireless interfaces
@@ -536,11 +948,14 @@ childif_create()
 childif_destroy()
 {
 	local cfg child child_wlans ifn
+	cfg=1
 
 	child_wlans="`get_if_var $ifn wlans_IF` `get_if_var $ifn vaps_IF`"
 	for child in ${child_wlans}; do
 		ifconfig $child destroy && cfg=0
 	done
+
+	return ${cfg}
 }
 
 # Create netgraph nodes.
@@ -553,6 +968,8 @@ EOF
 }
 
 ng_create_one() {
+	local t
+
 	ng_mkpeer $* | while read line; do
 		t=`expr "${line}" : '.* name="\([a-z]*[0-9]*\)" .*'`
 		if [ -n "${t}" ]; then
@@ -563,6 +980,8 @@ ng_create_one() {
 }
 
 gif_up() {
+	local i peers
+
 	for i in ${gif_interfaces}; do
 		peers=`get_if_var $i gifconfig_IF`
 		case ${peers} in
@@ -586,7 +1005,8 @@ gif_up() {
 # ng_fec_create ifn
 # Configure Fast EtherChannel for interface $ifn. Returns 0 if FEC
 # arguments were found and configured; returns !0 otherwise.
-ng_fec_create() {
+ng_fec_create()
+{
 	 local req_iface iface bogus
 	 req_iface="$1"
 
@@ -610,6 +1030,8 @@ ng_fec_create() {
 }
 
 fec_up() {
+	local i j
+
 	for i in ${fec_interfaces}; do
 		ng_fec_create $i
 		for j in `get_if_var $i fecconfig_IF`; do
@@ -632,12 +1054,16 @@ fec_up() {
 #
 ipx_up()
 {
+	local ifn
 	ifn="$1"
-	ifconfig_args=`get_if_var $ifn ifconfig_IF_ipx`
+
+	# ifconfig_IF_ipx
+	ifconfig_args=`_ifconfig_getargs $ifn ipx`
 	if [ -n "${ifconfig_args}" ]; then
 		ifconfig ${ifn} ${ifconfig_args}
 		return 0
 	fi
+
 	return 1
 }
 
@@ -647,15 +1073,13 @@ ipx_up()
 #
 ipx_down()
 {
-	[ -z "$1" ] && return 1
+	local _if _ifs _ret ipxList oldifs _ipx
+	_if=$1
 	_ifs="^"
 	_ret=1
-
-	ifexists $1 || return 1
-
-	ipxList="`ifconfig $1 | grep 'ipx ' | tr "\n" "$_ifs"`"
-
+	ipxList="`ifconfig ${_if} | grep 'ipx ' | tr "\n" "$_ifs"`"
 	oldifs="$IFS"
+
 	IFS="$_ifs"
 	for _ipx in $ipxList ; do
 		# get rid of extraneous line
@@ -664,7 +1088,7 @@ ipx_down()
 		_ipx=`expr "$_ipx" : '.*\(ipx [0-9a-h]\{1,8\}H*\.[0-9a-h]\{1,12\}\).*'`
 
 		IFS="$oldifs"
-		ifconfig $1 ${_ipx} delete
+		ifconfig ${_if} ${_ipx} delete
 		IFS="$_ifs"
 		_ret=0
 	done
@@ -678,25 +1102,29 @@ ipx_down()
 #
 ifnet_rename()
 {
+	local _if _ifname
 
-	_ifn_list="`ifconfig -l`"
-	[ -z "$_ifn_list" ] && return 0
-	for _if in ${_ifn_list} ; do
+	# ifconfig_IF_name
+	for _if in `ifconfig -l`; do
 		_ifname=`get_if_var $_if ifconfig_IF_name`
 		if [ ! -z "$_ifname" ]; then
 			ifconfig $_if name $_ifname
 		fi
 	done
+
 	return 0
 }
 
-#
 # list_net_interfaces type
 #	List all network interfaces. The type of interface returned
 #	can be controlled by the type argument. The type
 #	argument can be any of the following:
 #		nodhcp - all interfaces, excluding DHCP configured interfaces
 #		dhcp   - list only DHCP configured interfaces
+#		noautoconf	- all interfaces, excluding IPv6 Stateless
+#				  Address Autoconf configured interfaces
+#		autoconf	- list only IPv6 Stateless Address Autoconf
+#				  configured interfaces
 #	If no argument is specified all network interfaces are output.
 #	Note that the list will include cloned interfaces if applicable.
 #	Cloned interfaces must already exist to have a chance to appear
@@ -704,13 +1132,14 @@ ifnet_rename()
 #
 list_net_interfaces()
 {
+	local type _tmplist _list _autolist _lo _if
 	type=$1
 
 	# Get a list of ALL the interfaces and make lo0 first if it's there.
 	#
+	_tmplist=
 	case ${network_interfaces} in
 	[Aa][Uu][Tt][Oo])
-		_prefix=''
 		_autolist="`ifconfig -l`"
 		_lo=
 		for _if in ${_autolist} ; do
@@ -718,12 +1147,11 @@ list_net_interfaces()
 				if [ "$_if" = "lo0" ]; then
 					_lo="lo0 "
 				else
-					_tmplist="${_tmplist}${_prefix}${_if}"
-					[ -z "$_prefix" ] && _prefix=' '
+					_tmplist="${_tmplist} ${_if}"
 				fi
 			fi
 		done
-		_tmplist="${_lo}${_tmplist}"
+		_tmplist="${_lo}${_tmplist# }"
 		;;
 	*)
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
@@ -737,33 +1165,45 @@ list_net_interfaces()
 		;;
 	esac
 
-	if [ -z "$type" ]; then
-		echo $_tmplist
-		return 0
+	_list=
+	case "$type" in
+	nodhcp)
+		for _if in ${_tmplist} ; do
+			if ! dhcpif $_if && \
+			   [ -n "`_ifconfig_getargs $_if`" ]; then
+				_list="${_list# } ${_if}"
 	fi
-
-	# Separate out dhcp and non-dhcp interfaces
-	#
-	_aprefix=
-	_bprefix=
+		done
+		;;
+	dhcp)
 	for _if in ${_tmplist} ; do
 		if dhcpif $_if; then
-			_dhcplist="${_dhcplist}${_aprefix}${_if}"
-			[ -z "$_aprefix" ] && _aprefix=' '
-		elif [ -n "`_ifconfig_getargs $_if`" ]; then
-			_nodhcplist="${_nodhcplist}${_bprefix}${_if}"
-			[ -z "$_bprefix" ] && _bprefix=' '
+				_list="${_list# } ${_if}"
 		fi
 	done
-
-	case "$type" in
-	nodhcp)
-		echo $_nodhcplist
 		;;
-	dhcp)
-		echo $_dhcplist
+	noautoconf)
+		for _if in ${_tmplist} ; do
+			if ! ipv6_autoconfif $_if && \
+			   [ -n "`_ifconfig_getargs $_if ipv6`" ]; then
+				_list="${_list# } ${_if}"
+			fi
+		done
+		;;
+	autoconf)
+		for _if in ${_tmplist} ; do
+			if ipv6_autoconfif $_if; then
+				_list="${_list# } ${_if}"
+			fi
+		done
+		;;
+	*)
+		_list=${_tmplist}
 		;;
 	esac
+
+	echo $_list
+
 	return 0
 }
 
@@ -773,12 +1213,12 @@ list_net_interfaces()
 #
 get_default_if()

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:14:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8A8C106568B;
	Sat, 12 Sep 2009 22:14:21 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B86B68FC18;
	Sat, 12 Sep 2009 22:14:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMELeI098948;
	Sat, 12 Sep 2009 22:14:21 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMEL8F098946;
	Sat, 12 Sep 2009 22:14:21 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122214.n8CMEL8F098946@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:14:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197140 - head/etc/rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:14:21 -0000

Author: hrs
Date: Sat Sep 12 22:14:21 2009
New Revision: 197140
URL: http://svn.freebsd.org/changeset/base/197140

Log:
  - Add "AUTO" keyword support in $rtadvd_interfaces.
  - Wrap a long line.
  
  MFC after:	3 days

Modified:
  head/etc/rc.d/rtadvd

Modified: head/etc/rc.d/rtadvd
==============================================================================
--- head/etc/rc.d/rtadvd	Sat Sep 12 22:13:41 2009	(r197139)
+++ head/etc/rc.d/rtadvd	Sat Sep 12 22:14:21 2009	(r197140)
@@ -40,10 +40,25 @@ rtadvd_precmd()
 	# get a list of interfaces and enable it on them
 	#
 	case ${rtadvd_interfaces} in
-	'')
+	[Aa][Uu][Tt][Oo]|'')
 		for i in `ifconfig -l` ; do
 			case $i in
-			lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*)
+			lo0|\
+			stf[0-9]*|\
+			faith[0-9]*|\
+			lp[0-9]*|\
+			sl[0-9]*|\
+			pflog[0-9]*|\
+			pfsync[0-9]*|\
+			an[0-9]*|\
+			ath[0-9]*|\
+			ipw[0-9]*|\
+			iwi[0-9]*|\
+			iwn[0-9]*|\
+			ral[0-9]*|\
+			wi[0-9]*|\
+			wl[0-9]*|\
+			wpi[0-9]*)
 				continue
 				;;
 			*)

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:14:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9AC14106568B;
	Sat, 12 Sep 2009 22:14:58 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 89E928FC1A;
	Sat, 12 Sep 2009 22:14:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMEw1A098999;
	Sat, 12 Sep 2009 22:14:58 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMEw6t098994;
	Sat, 12 Sep 2009 22:14:58 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122214.n8CMEw6t098994@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:14:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197141 - head/usr.sbin/rtsold
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:14:58 -0000

Author: hrs
Date: Sat Sep 12 22:14:58 2009
New Revision: 197141
URL: http://svn.freebsd.org/changeset/base/197141

Log:
  Add support for ND6_IFF_IFDISABLED and ND6_IFF_ACCEPT_RTADV to
  the -F flag.
  
  MFC after:	3 days

Modified:
  head/usr.sbin/rtsold/if.c
  head/usr.sbin/rtsold/rtsold.8
  head/usr.sbin/rtsold/rtsold.c
  head/usr.sbin/rtsold/rtsold.h

Modified: head/usr.sbin/rtsold/if.c
==============================================================================
--- head/usr.sbin/rtsold/if.c	Sat Sep 12 22:14:21 2009	(r197140)
+++ head/usr.sbin/rtsold/if.c	Sat Sep 12 22:14:58 2009	(r197141)
@@ -48,6 +48,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -78,9 +79,15 @@ int
 interface_up(char *name)
 {
 	struct ifreq ifr;
+	struct in6_ndireq nd;
 	int llflag;
+	int s;
+	int error;
 
+	memset(&ifr, 0, sizeof(ifr));
 	strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+	memset(&nd, 0, sizeof(nd));
+	strlcpy(nd.ifname, name, sizeof(nd.ifname));
 
 	if (ioctl(ifsock, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
 		warnmsg(LOG_WARNING, __func__, "ioctl(SIOCGIFFLAGS): %s",
@@ -94,9 +101,56 @@ interface_up(char *name)
 			    "ioctl(SIOCSIFFLAGS): %s", strerror(errno));
 		return(-1);
 	}
+	if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+		warnmsg(LOG_WARNING, __func__, "socket(AF_INET6, SOCK_DGRAM): %s",
+		    strerror(errno));
+		return(-1);
+	}
+	if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) {
+		warnmsg(LOG_WARNING, __func__, "ioctl(SIOCGIFINFO_IN6): %s",
+		    strerror(errno));
+		close(s);
+		return(-1);
+	}
 
 	warnmsg(LOG_DEBUG, __func__, "checking if %s is ready...", name);
 
+	if (nd.ndi.flags & ND6_IFF_IFDISABLED) {
+		if (Fflag) {
+			nd.ndi.flags &= ~ND6_IFF_IFDISABLED;
+			if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd)) {
+				warnmsg(LOG_WARNING, __func__,
+				    "ioctl(SIOCSIFINFO_IN6): %s",
+		    		    strerror(errno));
+				close(s);
+				return(-1);
+			}
+		} else {
+			warnmsg(LOG_WARNING, __func__,
+			    "%s is disabled.", name);
+			close(s);
+			return(-1);
+		}
+	}
+	if (!(nd.ndi.flags & ND6_IFF_ACCEPT_RTADV)) {
+		if (Fflag) {
+			nd.ndi.flags |= ND6_IFF_ACCEPT_RTADV;
+			if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd)) {
+				warnmsg(LOG_WARNING, __func__,
+				    "ioctl(SIOCSIFINFO_IN6): %s",
+		    		    strerror(errno));
+				close(s);
+				return(-1);
+			}
+		} else {
+			warnmsg(LOG_WARNING, __func__,
+			    "%s does not accept Router Advertisement.", name);
+			close(s);
+			return(-1);
+		}
+	}
+	close(s);
+
 	llflag = get_llflag(name);
 	if (llflag < 0) {
 		warnmsg(LOG_WARNING, __func__,

Modified: head/usr.sbin/rtsold/rtsold.8
==============================================================================
--- head/usr.sbin/rtsold/rtsold.8	Sat Sep 12 22:14:21 2009	(r197140)
+++ head/usr.sbin/rtsold/rtsold.8	Sat Sep 12 22:14:58 2009	(r197141)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 17, 1998
+.Dd September 2, 2009
 .Dt RTSOLD 8
 .Os
 .\"
@@ -186,7 +186,9 @@ if they are incompatible with proper ope
 warning messages will be generated,
 but Router Solicitations will still be sent.
 The settings may be changed manually with
-.Xr sysctl 8 .
+.Xr sysctl 8
+and
+.Xr ifconfig 8 .
 .It Fl m
 Enable mobility support.
 If this option is specified,

Modified: head/usr.sbin/rtsold/rtsold.c
==============================================================================
--- head/usr.sbin/rtsold/rtsold.c	Sat Sep 12 22:14:21 2009	(r197140)
+++ head/usr.sbin/rtsold/rtsold.c	Sat Sep 12 22:14:58 2009	(r197141)
@@ -62,8 +62,8 @@ struct ifinfo *iflist;
 struct timeval tm_max =	{0x7fffffff, 0x7fffffff};
 static int log_upto = 999;
 static int fflag = 0;
-static int Fflag = 0;	/* force setting sysctl parameters */
 
+int Fflag = 0;	/* force setting sysctl parameters */
 int aflag = 0;
 int dflag = 0;
 
@@ -197,12 +197,8 @@ main(int argc, char **argv)
 #endif
 
 	if (Fflag) {
-		setinet6sysctl(IPV6CTL_ACCEPT_RTADV, 1);
 		setinet6sysctl(IPV6CTL_FORWARDING, 0);
 	} else {
-		/* warn if accept_rtadv is down */
-		if (!getinet6sysctl(IPV6CTL_ACCEPT_RTADV))
-			warnx("kernel is configured not to accept RAs");
 		/* warn if forwarding is up */
 		if (getinet6sysctl(IPV6CTL_FORWARDING))
 			warnx("kernel is configured as a router, not a host");

Modified: head/usr.sbin/rtsold/rtsold.h
==============================================================================
--- head/usr.sbin/rtsold/rtsold.h	Sat Sep 12 22:14:21 2009	(r197140)
+++ head/usr.sbin/rtsold/rtsold.h	Sat Sep 12 22:14:58 2009	(r197141)
@@ -67,6 +67,7 @@ struct ifinfo {
 extern struct timeval tm_max;
 extern int dflag;
 extern int aflag;
+extern int Fflag;
 extern char *otherconf_script;
 extern int ifconfig(char *);
 extern void iflist_init(void);

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:17:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1AD181065679;
	Sat, 12 Sep 2009 22:17:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B709E8FC15;
	Sat, 12 Sep 2009 22:17:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMHDqo099084;
	Sat, 12 Sep 2009 22:17:13 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMHDfS099082;
	Sat, 12 Sep 2009 22:17:13 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122217.n8CMHDfS099082@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:17:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197142 - head/sbin/ifconfig
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:17:14 -0000

Author: hrs
Date: Sat Sep 12 22:17:13 2009
New Revision: 197142
URL: http://svn.freebsd.org/changeset/base/197142

Log:
  Document accept_rev_ethip_ver and send_rev_ethip_ver flags of
  EtherIP (gif(4) + if_bridge(8)).
  
  MFC after:	3 days

Modified:
  head/sbin/ifconfig/ifconfig.8

Modified: head/sbin/ifconfig/ifconfig.8
==============================================================================
--- head/sbin/ifconfig/ifconfig.8	Sat Sep 12 22:14:58 2009	(r197141)
+++ head/sbin/ifconfig/ifconfig.8	Sat Sep 12 22:17:13 2009	(r197142)
@@ -2239,6 +2239,24 @@ interfaces previously configured with
 Another name for the
 .Fl tunnel
 parameter.
+.It Cm accept_rev_ethip_ver
+Set a flag to acccept both correct EtherIP packets and ones
+with reversed version field.  Enabled by default.
+This is for backward compatibility with
+.Fx 6.1 ,
+6.2, 6.3, 7.0, and 7.1.
+.It Cm -accept_rev_ethip_ver
+Clear a flag
+.Cm accept_rev_ethip_ver .
+.It Cm send_rev_ethip_ver
+Set a flag to send EtherIP packets with reversed version
+field intentionally.  Disabled by default.
+This is for backward compatibility with
+.Fx 6.1 ,
+6.2, 6.3, 7.0, and 7.1.
+.It Cm -send_rev_ethip_ver
+Clear a flag
+.Cm send_rev_ethip_ver .
 .El
 .Pp
 The following parameters are specific to GRE tunnel interfaces,
@@ -2502,6 +2520,7 @@ tried to alter an interface's configurat
 .Sh SEE ALSO
 .Xr netstat 1 ,
 .Xr carp 4 ,
+.Xr gif 4 ,
 .Xr netintro 4 ,
 .Xr pfsync 4 ,
 .Xr polling 4 ,

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:17:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 215C6106566C;
	Sat, 12 Sep 2009 22:17:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 110098FC14;
	Sat, 12 Sep 2009 22:17:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMHq02099136;
	Sat, 12 Sep 2009 22:17:52 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMHqLb099134;
	Sat, 12 Sep 2009 22:17:52 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122217.n8CMHqLb099134@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:17:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197143 - head/etc/rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:17:54 -0000

Author: hrs
Date: Sat Sep 12 22:17:52 2009
New Revision: 197143
URL: http://svn.freebsd.org/changeset/base/197143

Log:
  Use RCng coding convention.
  
  MFC after:	3 days

Modified:
  head/etc/rc.d/netoptions

Modified: head/etc/rc.d/netoptions
==============================================================================
--- head/etc/rc.d/netoptions	Sat Sep 12 22:17:13 2009	(r197142)
+++ head/etc/rc.d/netoptions	Sat Sep 12 22:17:52 2009	(r197143)
@@ -5,10 +5,15 @@
 
 # PROVIDE: netoptions
 # REQUIRE: FILESYSTEMS
+# BEFORE: netif
 # KEYWORD: nojail
 
 . /etc/rc.subr
 
+name="netoptions"
+start_cmd="netoptions_start"
+stop_cmd=:
+
 _netoptions_initdone=
 netoptions_init()
 {
@@ -18,75 +23,58 @@ netoptions_init()
 	fi
 }
 
-load_rc_config 'XXX'
+netoptions_start()
+{
+	if checkyesno log_in_vain; then
+		netoptions_init
+		echo -n " log_in_vain=${log_in_vain}"
+		${SYSCTL_W} net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null
+		${SYSCTL_W} net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null
+	fi
+
+	if checkyesno tcp_extensions; then
+		netoptions_init
+		echo -n ' rfc1323 extensions=NO'
+		${SYSCTL_W} net.inet.tcp.rfc1323=0 >/dev/null
+	fi
+
+	if ! checkyesno tcp_keepalive; then
+		netoptions_init
+		echo -n ' TCP keepalive=NO'
+		${SYSCTL_W} net.inet.tcp.always_keepalive=0 >/dev/null
+	fi
+
+	if checkyesno tcp_drop_synfin; then
+		netoptions_init
+		echo -n ' drop SYN+FIN packets=YES'
+		${SYSCTL_W} net.inet.tcp.drop_synfin=1 >/dev/null
+	fi
 
-case ${log_in_vain} in
-[Nn][Oo] | '')
-	log_in_vain=0
-	;;
-[Yy][Ee][Ss])
-	log_in_vain=1
-	;;
-[0-9]*)
-	;;
-*)
-	netoptions_init
-	echo " invalid log_in_vain setting: ${log_in_vain}"
-	log_in_vain=0
-	;;
-esac
-
-if [ "${log_in_vain}" -ne 0 ]; then
-	netoptions_init
-	echo -n " log_in_vain=${log_in_vain}"
-	sysctl net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null
-	sysctl net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null
-fi
-
-case ${tcp_extensions} in
-[Yy][Ee][Ss] | '')
-	;;
-*)
-	netoptions_init
-	echo -n ' tcp extensions=NO'
-	sysctl net.inet.tcp.rfc1323=0 >/dev/null
-	;;
-esac
-
-case ${tcp_keepalive} in
-[Nn][Oo])
-	netoptions_init
-	echo -n ' TCP keepalive=NO'
-	sysctl net.inet.tcp.always_keepalive=0 >/dev/null
-	;;
-esac
-
-case ${tcp_drop_synfin} in
-[Yy][Ee][Ss])
-	netoptions_init
-	echo -n ' drop SYN+FIN packets=YES'
-	sysctl net.inet.tcp.drop_synfin=1 >/dev/null
-	;;
-esac
-
-case ${ip_portrange_first} in
-[Nn][Oo] | '')
-	;;
-*)
-	netoptions_init
-	echo -n " ip_portrange_first=$ip_portrange_first"
-	sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
-	;;
-esac
-
-case ${ip_portrange_last} in
-[Nn][Oo] | '')
-	;;
-*)
-	netoptions_init
-	echo -n " ip_portrange_last=$ip_portrange_last"
-	sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
-	;;
-esac
+	case ${ip_portrange_first} in
+	[0-9]*)
+		netoptions_init
+		echo -n " ip_portrange_first=$ip_portrange_first"
+		${SYSCTL_W} net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
+		;;
+	esac
+
+	case ${ip_portrange_last} in
+	[0-9]*)
+		netoptions_init
+		echo -n " ip_portrange_last=$ip_portrange_last"
+		${SYSCTL_W} net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
+		;;
+	esac
+
+	if checkyesno ipv6_ipv4mapping; then
+		${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null
+	else
+		echo -n " no-ipv4-mapped-ipv6"
+		${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null
+	fi
+
+	[ -n "${_netoptions_initdone}" ] && echo '.'
+}
 
-[ -n "${_netoptions_initdone}" ] && echo '.'
+load_rc_config $name
+run_rc_command $1

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:19:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AF4CD106566C;
	Sat, 12 Sep 2009 22:19:48 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9E1E08FC08;
	Sat, 12 Sep 2009 22:19:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMJmUB099212;
	Sat, 12 Sep 2009 22:19:48 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMJmOL099208;
	Sat, 12 Sep 2009 22:19:48 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122219.n8CMJmOL099208@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:19:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197144 - in head/etc: . rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:19:48 -0000

Author: hrs
Date: Sat Sep 12 22:19:48 2009
New Revision: 197144
URL: http://svn.freebsd.org/changeset/base/197144

Log:
  Add an extension of set_rcvar(), a new function set_rcvar_obsolete(),
  and $desc.
  
  The set_rcvar_obsolete() is for displaying an obsolete variable
  and the new one.  More specifically, a warning is displayed when
  a variable is removed or changed in the source tree and the user
  still defines the old one.
  
  $router* and $ipv6_router* are replaced with $routed_* and
  $route6d_* for consistency.  The old variables still work but
  can be removed in the future.
  
  MFC after:	3 days

Modified:
  head/etc/rc.d/route6d
  head/etc/rc.d/routed
  head/etc/rc.subr

Modified: head/etc/rc.d/route6d
==============================================================================
--- head/etc/rc.d/route6d	Sat Sep 12 22:17:52 2009	(r197143)
+++ head/etc/rc.d/route6d	Sat Sep 12 22:19:48 2009	(r197144)
@@ -4,22 +4,17 @@
 #
 
 # PROVIDE: route6d
-# REQUIRE: network_ipv6
+# REQUIRE: netif routing
 # KEYWORD: nojail
 
 . /etc/rc.subr
 
 name="route6d"
+rcvar=`set_rcvar`
 
-# XXX - Executable may be in a different location. The $name variable
-#       is different from the variable in rc.conf(5) so the
-#       subroutines in rc.subr won't catch it. In this case, it
-#	is also needed by the eval statement in the FreeBSD conditional.
-#
-load_rc_config $name
-
-rcvar="ipv6_router_enable"
-command="${ipv6_router:-/usr/sbin/${name}}"
-eval ${name}_flags=\"${ipv6_router_flags}\"
+set_rcvar_obsolete ipv6_router_enable route6d_enable
+set_rcvar_obsolete ipv6_router route6d_program
+set_rcvar_obsolete ipv6_router_flags route6d_flags
 
+load_rc_config $name
 run_rc_command "$1"

Modified: head/etc/rc.d/routed
==============================================================================
--- head/etc/rc.d/routed	Sat Sep 12 22:17:52 2009	(r197143)
+++ head/etc/rc.d/routed	Sat Sep 12 22:19:48 2009	(r197144)
@@ -10,13 +10,12 @@
 . /etc/rc.subr
 
 name="routed"
+desc="network RIP and router discovery routing daemon"
+rcvar=`set_rcvar`
+
+set_rcvar_obsolete router_enable routed_enable
+set_rcvar_obsolete router routed_program
+set_rcvar_obsolete router_flags	routed_flags
 
-# XXX - Executable may be in a different location. The $name variable
-#       is different from the variable in rc.conf(5) so the
-#       subroutines in rc.subr won't catch it.
-#
 load_rc_config $name
-rcvar="router_enable"
-command="${router:-/sbin/${name}}"
-eval ${name}_flags=\"${router_flags}\"
 run_rc_command "$1"

Modified: head/etc/rc.subr
==============================================================================
--- head/etc/rc.subr	Sat Sep 12 22:17:52 2009	(r197143)
+++ head/etc/rc.subr	Sat Sep 12 22:19:48 2009	(r197144)
@@ -72,37 +72,63 @@ esac
 #	functions
 #	---------
 
+# set_rcvar [var] [defval] [desc]
 #
-# set_rcvar base_var
-#	Set the variable name enabling a specific service.
-#	FreeBSD uses ${service}_enable, while NetBSD uses
-#	just the name of the service. For example:
-#	FreeBSD: sendmail_enable="YES"
-#	NetBSD : sendmail="YES"
-#	$1 - if $name is not the base to work of off, specify
-#	     a different one
+#	Echo or define a rc.conf(5) variable name.  Global variable
+#	$rcvars is used.
+#
+#	If no argument is specified, echo "${name}_enable".
+#
+#	If only a var is specified, echo "${var}_enable".
+#
+#	If var and defval are specified, the ${var} is defined as
+#	rc.conf(5) variable and the default value is ${defvar}.  An
+#	optional argument $desc can also be specified to add a
+#	description for that.
 #
 set_rcvar()
 {
-	if [ -z "$1" ]; then
-		base_var=${name}
-	else
-		base_var="$1"
-	fi
-
-	case ${OSTYPE} in
-	FreeBSD)
-		echo ${base_var}_enable
+	case $# in
+	0)
+		echo ${name}_enable
 		;;
-	NetBSD)
-		echo ${base_var}
+	1)
+		echo ${1}_enable
 		;;
 	*)
-		echo 'XXX'
+		debug "rcvar_define: \$$1=$2 is added" \
+		    " as a rc.conf(5) variable."
+
+		local _var
+		_var=$1
+		rcvars="${rcvars# } $_var"
+		eval ${_var}_defval=\"$2\"
+		shift 2
+		# encode multiple lines of _desc
+		for l in "$@"; do
+			eval ${_var}_desc=\"\${${_var}_desc#^^}^^$l\"
+		done
+		eval ${_var}_desc=\"\${${_var}_desc#^^}\"
 		;;
 	esac
 }
 
+# set_rcvar_obsolete oldvar [newvar] [msg]
+#	Define obsolete variable.
+#	Global variable $rcvars_obsolete is used.
+#
+set_rcvar_obsolete()
+{
+	local _var
+	_var=$1
+	debug "rcvar_obsolete: \$$1(old) -> \$$2(new) is defined"
+
+	rcvars_obsolete="${rcvars_obsolete# } $1"
+	eval ${1}_newvar=\"$2\"
+	shift 2
+	eval ${_var}_obsolete_msg=\"$*\"
+}
+
 #
 # force_depend script
 #	Force a service to start. Intended for use by services
@@ -401,6 +427,8 @@ wait_for_pids()
 #	command_interpreter n	If not empty, command is interpreted, so
 #				call check_{pidfile,process}() appropriately.
 #
+#	desc		n	Description of script.
+#
 #	extra_commands	n	List of extra commands supported.
 #
 #	pidfile		n	If set, use check_pidfile $pidfile $command,
@@ -574,7 +602,7 @@ run_rc_command()
 	esac
 
 	eval _override_command=\$${name}_program
-	command=${command:+${_override_command:-$command}}
+	command=${command:-${_override_command}}
 
 	_keywords="start stop restart rcvar $extra_commands"
 	rc_pid=
@@ -778,14 +806,49 @@ $command $rc_flags $command_args"
 			;;
 
 		rcvar)
-			echo "# $name"
-			if [ -n "$rcvar" ]; then
-				if checkyesno ${rcvar}; then
-					echo "${rcvar}=YES"
-				else
-					echo "${rcvar}=NO"
-				fi
+			echo -n "# $name"
+			if [ -n "$desc" ]; then
+				echo " : $desc"
+			else
+				echo ""
 			fi
+			echo "#"
+			# Get unique vars in $rcvar $rcvars
+			for _v in $rcvar $rcvars; do
+				case $v in
+				$_v\ *|\ *$_v|*\ $_v\ *) ;;
+				*)	v="${v# } $_v" ;;
+				esac
+			done
+
+			# Display variables.
+			for _v in $v; do
+				if [ -z "$_v" ]; then
+					continue
+				fi
+
+				eval _desc=\$${_v}_desc
+				eval _defval=\$${_v}_defval
+				_h="-"
+
+				eval echo \"$_v=\\\"\$$_v\\\"\"
+				# decode multiple lines of _desc
+				while [ -n "$_desc" ]; do
+					case $_desc in
+					*^^*)
+						echo "# $_h ${_desc%%^^*}"
+						_desc=${_desc#*^^}
+						_h=" "
+						;;
+					*)
+						echo "# $_h ${_desc}"
+						break
+						;;
+					esac
+				done
+				echo "#   (default: \"$_defval\")"
+			done
+			echo ""
 			;;
 
 		*)
@@ -896,7 +959,8 @@ run_rc_script()
 
 	unset	name command command_args command_interpreter \
 		extra_commands pidfile procname \
-		rcvar required_dirs required_files required_vars
+		rcvar rcvars rcvars_obsolete required_dirs required_files \
+		required_vars
 	eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd
 
 	case "$_file" in
@@ -927,6 +991,7 @@ run_rc_script()
 #
 load_rc_config()
 {
+	local _name _var _defval _v _msg _new
 	_name=$1
 	if [ -z "$_name" ]; then
 		err 3 'USAGE: load_rc_config name'
@@ -953,6 +1018,36 @@ load_rc_config()
 	# Old variable names support
 	#
 	[ -n "$enable_quotas" ] && quota_enable="$enable_quotas"
+
+	# Set defaults if defined.
+	for _var in $rcvar $rcvars; do
+		_defval=`eval echo "\\\$${_var}_defval"`
+		if [ -n "$_defval" ]; then
+			eval : \${$_var:=\$${_var}_defval}
+		fi
+	done
+
+	# check obsolete rc.conf variables
+	for _var in $rcvars_obsolete; do
+		_v=`eval echo \\$$_var`
+		_msg=`eval echo \\$${_var}_obsolete_msg`
+		_new=`eval echo \\$${_var}_newvar`
+		case $_v in
+		"")
+			;;
+		*)
+			if [ -z "$_new" ]; then
+				_msg="Ignored."
+			else
+				eval $_new=\"\$$_var\"
+				if [ -z "$_msg" ]; then
+					_msg="Use \$$_new instead."
+				fi
+			fi
+			warn "\$$_var is obsolete.  $_msg"
+			;;
+		esac
+	done
 }
   
 #
@@ -1595,4 +1690,23 @@ check_required_after()
 
 fi
 
+# _echoonce var msg mode
+#	mode=0: Echo $msg if ${$var} is empty.
+#	        After doing echo, a string is set to ${$var}.
+#
+#	mode=1: Echo $msg if ${$var} is a string with non-zero length.
+#
+_echoonce()
+{
+	local _var _msg _mode
+	_var=`eval echo \\$$1`
+	_msg=$2
+	_mode=$3
+
+	case $_mode in
+	1)	[ -n "$_var" ] && echo "$_msg" ;;
+	*)	[ -z "$_var" ] && echo -n "$_msg" && eval "$1=finished" ;;
+	esac
+}
+
 _rc_subr_loaded=:

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:22:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4C7B7106566C;
	Sat, 12 Sep 2009 22:22:33 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3A81C8FC13;
	Sat, 12 Sep 2009 22:22:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CMMV5J099314;
	Sat, 12 Sep 2009 22:22:31 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CMMV3d099311;
	Sat, 12 Sep 2009 22:22:31 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122222.n8CMMV3d099311@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 22:22:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197145 - in head: etc/defaults share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:22:33 -0000

Author: hrs
Date: Sat Sep 12 22:22:31 2009
New Revision: 197145
URL: http://svn.freebsd.org/changeset/base/197145

Log:
  The following changes are added because of
  network_ipv6->rc.d/netif integration:
  
  - $ipv6_enable is now obsolete.  Instead, IPv6 is enabled by
    default if the kernel supports it, and $ipv6_network_interfaces
    is "none" by default.  If you want to use IPv6, define
    $ipv6_network_interfaces and $ifconfig_xxx_ipv6.
  
    An interface which is in $network_interfaces and not in
    $ipv6_network_interfaces will be marked as "inet6
    -auto_linklocal ifdisabled" (see ifconfig(8)).
  
  - $ipv6_ifconfig_xxx is renamed to ifconfig_xxx_ipv6 for
    consistency with other address families.  The old variables
    still work but can be removed in the future.  Note that
    ipv6_ifconfig_xxx="..." should be replaced with
    ifconfig_xxx_ipv6="inet6 ...".
  
  - Receiving ICMPv6 Router Advertisement is not automatically
    enabled even if there is no manual configuration of IPv6 in
    rc.conf.  If you want it, define
    ifconfig_xxx_ipv6="inet6 ... accept_rtadv".
  
  - The rc.d/ip6addrctl now chooses address selection policy based
    on $ipv6_prefer, not $ipv6_enable.  The default is
    ipv6_prefer=NO.
  
  - $router* and $ipv6_router* are replaced with $routed_* and
    $route6d_* for consistency.  The old variables still work but
    can be removed in the future.
  
  MFC after:	3 days

Modified:
  head/etc/defaults/rc.conf
  head/share/man/man5/rc.conf.5

Modified: head/etc/defaults/rc.conf
==============================================================================
--- head/etc/defaults/rc.conf	Sat Sep 12 22:19:48 2009	(r197144)
+++ head/etc/defaults/rc.conf	Sat Sep 12 22:22:31 2009	(r197145)
@@ -196,6 +196,8 @@ cloned_interfaces=""		# List of cloned n
 ifconfig_lo0="inet 127.0.0.1"	# default loopback device configuration.
 #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
 #ifconfig_ed0_ipx="ipx 0x00010010"	# Sample IPX address family entry.
+#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry
+#ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias
 #ifconfig_fxp0_name="net0"	# Change interface name from fxp0 to net0.
 #wlans_ath0="wlan0"		# wlan(4) interfaces for ath0 device
 #wlandebug_wlan0="scan+auth+assoc"	# Set debug flags with wlanddebug(8)
@@ -361,9 +363,9 @@ static_arp_pairs=""		# Set to static ARP
 static_routes=""		# Set to static route list (or leave empty).
 natm_static_routes=""		# Set to static route list for NATM (or leave empty).
 gateway_enable="NO"		# Set to YES if this host will be a gateway.
-router_enable="NO"		# Set to YES to enable a routing daemon.
-router="/sbin/routed"		# Name of routing daemon to use if enabled.
-router_flags="-q"		# Flags for routing daemon.
+routed_enable="NO"		# Set to YES to enable a routing daemon.
+routed_program="/sbin/routed"	# Name of routing daemon to use if enabled.
+routed_flags="-q"		# Flags for routing daemon.
 mrouted_enable="NO"		# Do IPv4 multicast routing.
 mrouted_program="/usr/local/sbin/mrouted"	# Name of IPv4 multicast
 						# routing daemon.  You need to
@@ -418,8 +420,8 @@ rfcomm_pppd_server_two_channel="3"	# Ove
 icmp_bmcastecho="NO"	# respond to broadcast ping packets
 
 ### IPv6 options: ###
-ipv6_enable="NO"		# Set to YES to set up for IPv6.
-ipv6_network_interfaces="auto"	# List of network interfaces (or "auto").
+ipv6_network_interfaces="none"	# List of IPv6 network interfaces
+				# (or "auto" or "none").
 ipv6_defaultrouter="NO"		# Set to IPv6 default gateway (or NO).
 #ipv6_defaultrouter="2002:c058:6301::"	# Use this for 6to4 (RFC 3068)
 ipv6_static_routes=""		# Set to static route list (or leave empty).
@@ -427,20 +429,19 @@ ipv6_static_routes=""		# Set to static r
 				#  route toward loopback interface.
 #ipv6_route_xxx="fec0:0000:0000:0006:: -prefixlen 64 ::1"
 ipv6_gateway_enable="NO"	# Set to YES if this host will be a gateway.
-ipv6_router_enable="NO"		# Set to YES to enable an IPv6 routing daemon.
-ipv6_router="/usr/sbin/route6d"	# Name of IPv6 routing daemon.
-ipv6_router_flags=""		# Flags to IPv6 routing daemon.
-#ipv6_router_flags="-l"		# Example for route6d with only IPv6 site local
+
+route6d_enable="NO"		# Set to YES to enable an IPv6 routing daemon.
+route6d_program="/usr/sbin/route6d"	# Name of IPv6 routing daemon.
+route6d_flags=""		# Flags to IPv6 routing daemon.
+#route6d_flags="-l"		# Example for route6d with only IPv6 site local
 				# addrs.
-#ipv6_router_flags="-q"		# If you want to run a routing daemon on an end
+#route6d_flags="-q"		# If you want to run a routing daemon on an end
 				# node, you should stop advertisement.
 #ipv6_network_interfaces="ed0 ep0"	# Examples for router
 					# or static configuration for end node.
 					# Choose correct prefix value.
 #ipv6_prefix_ed0="fec0:0000:0000:0001 fec0:0000:0000:0002"  # Examples for rtr.
 #ipv6_prefix_ep0="fec0:0000:0000:0003 fec0:0000:0000:0004"  # Examples for rtr.
-#ipv6_ifconfig_ed0="fec0:0:0:5::1 prefixlen 64"	# Sample manual assign entry
-#ipv6_ifconfig_ed0_alias0="fec0:0:0:5::2 prefixlen 64" # Sample alias entry.
 ipv6_default_interface="NO"	# Default output interface for scoped addrs.
 				# Now this works only for IPv6 link local
 				# multicast addrs.
@@ -482,6 +483,7 @@ ipv6_ipfilter_rules="/etc/ipf6.rules"	# 
 					# for examples
 ip6addrctl_enable="YES"	# Set to YES to enable default address selection
 ip6addrctl_verbose="NO"	# Set to YES to enable verbose configuration messages
+ipv6_prefer="NO"	# Use IPv6 when both IPv4 and IPv6 can be used
 
 ##############################################################
 ###  System console options  #################################

Modified: head/share/man/man5/rc.conf.5
==============================================================================
--- head/share/man/man5/rc.conf.5	Sat Sep 12 22:19:48 2009	(r197144)
+++ head/share/man/man5/rc.conf.5	Sat Sep 12 22:22:31 2009	(r197145)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 25, 2009
+.Dd September 2, 2009
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -344,11 +344,6 @@ If
 .Xr dhclient 8
 is used to set the hostname via DHCP,
 this variable should be set to an empty string.
-.It Va ipv6_enable
-.Pq Vt bool
-Enable support for IPv6 networking.
-Note that this requires that the kernel has been compiled with
-.Cd "options INET6" .
 .It Va nisdomainname
 .Pq Vt str
 The NIS domain name of this host, or
@@ -1251,28 +1246,45 @@ This is the IPv6 equivalent of
 Instead of setting the ifconfig variables as
 .Va ifconfig_ Ns Aq Ar interface
 they should be set as
-.Va ipv6_ifconfig_ Ns Aq Ar interface .
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6.
 Aliases should be set as
-.Va ipv6_ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n .
+.Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n .
 .Va ipv6_prefix_ Ns Aq Ar interface
 does something.
-Interfaces that do not have a
-.Va ipv6_ifconfig_ Ns Aq Ar interface
-setting will be auto configured by
+Interfaces that have a
+.Fl accept_rtadv
+flag in
+.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6
+setting will be automatically configured by
 .Xr rtsol 8
 if the
 .Va ipv6_gateway_enable
 is set to
 .Dq Li NO .
-Note that the IPv6 networking code does not support the
-.Pa /etc/start_if. Ns Aq Ar interface
-files.
 .It Va ipv6_default_interface
 .Pq Vt str
 If not set to
 .Dq Li NO ,
 this is the default output interface for scoped addresses.
 Now this works only for IPv6 link local multicast addresses.
+.It Va ip6addrctl_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+install default address selection policy table
+.Pq RFC 3484 .
+If a file
+.Pa /etc/ip6addrctl.conf
+is found the
+.Xr ip6addrctl 8
+reads and installs it.
+If not, a pre-defined policy table will be installed.
+There are two pre-defined ones; IPv4-preferred and IPv6-preferred.
+If set
+.Va ipv6_prefer
+variable to
+.Dq Li YES
+the IPv6-preferred one is used. Default is IPv4-preferred.
 .It Va cloned_interfaces
 .Pq Vt str
 Set to the list of clonable network interfaces to create on this host.
@@ -2300,48 +2312,48 @@ between interfaces.
 .Pq Vt bool
 The IPv6 equivalent of
 .Va gateway_enable .
-.It Va router_enable
+.It Va routed_enable
 .Pq Vt bool
 If set to
 .Dq Li YES ,
 run a routing daemon of some sort, based on the
 settings of
-.Va router
+.Va routed_program
 and
-.Va router_flags .
-.It Va ipv6_router_enable
+.Va routed_flags .
+.It Va route6d_enable
 .Pq Vt bool
 The IPv6 equivalent of
-.Va router_enable .
+.Va routed_enable .
 If set to
 .Dq Li YES ,
 run a routing daemon of some sort, based on the
 settings of
-.Va ipv6_router
+.Va route6d_program
 and
-.Va ipv6_router_flags .
-.It Va router
+.Va route6d_flags .
+.It Va routed_program
 .Pq Vt str
 If
-.Va router_enable
+.Va routed_enable
 is set to
 .Dq Li YES ,
 this is the name of the routing daemon to use.
-.It Va ipv6_router
+.It Va route6d_program
 .Pq Vt str
 The IPv6 equivalent of
-.Va router .
-.It Va router_flags
+.Va routed_program .
+.It Va routed_flags
 .Pq Vt str
 If
-.Va router_enable
+.Va routed_enable
 is set to
 .Dq Li YES ,
 these are the flags to pass to the routing daemon.
-.It Va ipv6_router_flags
+.It Va route6d_flags
 .Pq Vt str
 The IPv6 equivalent of
-.Va router_flags .
+.Va routed_flags .
 .It Va mrouted_enable
 .Pq Vt bool
 If set to

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 22:26:28 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 03ED61065670;
	Sat, 12 Sep 2009 22:26:28 +0000 (UTC) (envelope-from sam@errno.com)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id CAD7F8FC16;
	Sat, 12 Sep 2009 22:26:26 +0000 (UTC)
Received: from ice.local ([10.0.0.115]) (authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n8CMQPKJ098685
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 12 Sep 2009 15:26:26 -0700 (PDT) (envelope-from sam@errno.com)
Message-ID: <4AAC2011.1010308@errno.com>
Date: Sat, 12 Sep 2009 15:26:25 -0700
From: Sam Leffler 
User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
MIME-Version: 1.0
To: Hiroki Sato 
References: <200909122214.n8CMEL8F098946@svn.freebsd.org>
In-Reply-To: <200909122214.n8CMEL8F098946@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r197140 - head/etc/rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 22:26:28 -0000

Hiroki Sato wrote:
> Author: hrs
> Date: Sat Sep 12 22:14:21 2009
> New Revision: 197140
> URL: http://svn.freebsd.org/changeset/base/197140
> 
> Log:
>   - Add "AUTO" keyword support in $rtadvd_interfaces.
>   - Wrap a long line.
>   
>   MFC after:	3 days
> 
> Modified:
>   head/etc/rc.d/rtadvd
> 
> Modified: head/etc/rc.d/rtadvd
> ==============================================================================
> --- head/etc/rc.d/rtadvd	Sat Sep 12 22:13:41 2009	(r197139)
> +++ head/etc/rc.d/rtadvd	Sat Sep 12 22:14:21 2009	(r197140)
> @@ -40,10 +40,25 @@ rtadvd_precmd()
>  	# get a list of interfaces and enable it on them
>  	#
>  	case ${rtadvd_interfaces} in
> -	'')
> +	[Aa][Uu][Tt][Oo]|'')
>  		for i in `ifconfig -l` ; do
>  			case $i in
> -			lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*)
> +			lo0|\
> +			stf[0-9]*|\
> +			faith[0-9]*|\
> +			lp[0-9]*|\
> +			sl[0-9]*|\
> +			pflog[0-9]*|\
> +			pfsync[0-9]*|\
> +			an[0-9]*|\
> +			ath[0-9]*|\
> +			ipw[0-9]*|\
> +			iwi[0-9]*|\
> +			iwn[0-9]*|\
> +			ral[0-9]*|\
> +			wi[0-9]*|\
> +			wl[0-9]*|\
> +			wpi[0-9]*)
>  				continue
>  				;;
>  			*)
> 
> 

You look to be enumerating wireless devices.  If so you should use the 
media type instead of device names.

	Sam

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 23:00:02 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4352B1065676;
	Sat, 12 Sep 2009 23:00:02 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D8EF8FC13;
	Sat, 12 Sep 2009 23:00:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CN02sl000132;
	Sat, 12 Sep 2009 23:00:02 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CN02Gm000130;
	Sat, 12 Sep 2009 23:00:02 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122300.n8CN02Gm000130@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 23:00:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197146 - head/etc/rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 23:00:02 -0000

Author: hrs
Date: Sat Sep 12 23:00:01 2009
New Revision: 197146
URL: http://svn.freebsd.org/changeset/base/197146

Log:
  Use is_wired_interface() instead of hard-coded interface device
  names.
  
  Pointed out by:	sam

Modified:
  head/etc/rc.d/rtadvd

Modified: head/etc/rc.d/rtadvd
==============================================================================
--- head/etc/rc.d/rtadvd	Sat Sep 12 22:22:31 2009	(r197145)
+++ head/etc/rc.d/rtadvd	Sat Sep 12 23:00:01 2009	(r197146)
@@ -9,6 +9,7 @@
 # KEYWORD: nojail shutdown
 
 . /etc/rc.subr
+. /etc/network.subr
 
 name="rtadvd"
 rcvar=`set_rcvar`
@@ -42,29 +43,9 @@ rtadvd_precmd()
 	case ${rtadvd_interfaces} in
 	[Aa][Uu][Tt][Oo]|'')
 		for i in `ifconfig -l` ; do
-			case $i in
-			lo0|\
-			stf[0-9]*|\
-			faith[0-9]*|\
-			lp[0-9]*|\
-			sl[0-9]*|\
-			pflog[0-9]*|\
-			pfsync[0-9]*|\
-			an[0-9]*|\
-			ath[0-9]*|\
-			ipw[0-9]*|\
-			iwi[0-9]*|\
-			iwn[0-9]*|\
-			ral[0-9]*|\
-			wi[0-9]*|\
-			wl[0-9]*|\
-			wpi[0-9]*)
-				continue
-				;;
-			*)
+			if is_wired_interface $1; then
 				rtadvd_interfaces="${rtadvd_interfaces} ${i}"
-				;;
-			esac
+			fi
 		done
 		;;
 	esac

From owner-svn-src-all@FreeBSD.ORG  Sat Sep 12 23:01:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B914C1065679;
	Sat, 12 Sep 2009 23:01:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9CF0C8FC16;
	Sat, 12 Sep 2009 23:01:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8CN1aFS000200;
	Sat, 12 Sep 2009 23:01:36 GMT (envelope-from hrs@svn.freebsd.org)
Received: (from hrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8CN1aj6000198;
	Sat, 12 Sep 2009 23:01:36 GMT (envelope-from hrs@svn.freebsd.org)
Message-Id: <200909122301.n8CN1aj6000198@svn.freebsd.org>
From: Hiroki Sato 
Date: Sat, 12 Sep 2009 23:01:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r197147 - head/etc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 23:01:36 -0000

Author: hrs
Date: Sat Sep 12 23:01:36 2009
New Revision: 197147
URL: http://svn.freebsd.org/changeset/base/197147

Log:
  Add missing comments and whitespace clean-ups.

Modified:
  head/etc/network.subr

Modified: head/etc/network.subr
==============================================================================
--- head/etc/network.subr	Sat Sep 12 23:00:01 2009	(r197146)
+++ head/etc/network.subr	Sat Sep 12 23:01:36 2009	(r197147)
@@ -31,8 +31,8 @@
 #
 
 # ifn_start ifn
-# Bring up and configure an interface.  If some configuration is applied
-# print the interface configuration.
+#	Bring up and configure an interface.  If some configuration is
+#	applied print the interface configuration.
 #
 ifn_start()
 {
@@ -53,8 +53,8 @@ ifn_start()
 }
 
 # ifn_stop ifn
-# Shutdown and de-configure an interface.  If action is taken print the
-# interface name.
+#	Shutdown and de-configure an interface.  If action is taken
+#	print the interface name.
 #
 ifn_stop()
 {
@@ -176,11 +176,11 @@ ifconfig_down()
 }
 
 # get_if_var if var [default]
-#       Return the value of the pseudo-hash corresponding to $if where
-#       $var is a string containg the sub-string "IF" which will be
-#       replaced with $if after the characters defined in _punct are
-#       replaced with '_'. If the variable is unset, replace it with
-#       $default if given.
+#	Return the value of the pseudo-hash corresponding to $if where
+#	$var is a string containg the sub-string "IF" which will be
+#	replaced with $if after the characters defined in _punct are
+#	replaced with '_'. If the variable is unset, replace it with
+#	$default if given.
 get_if_var()
 {
 	local _if _punct _var _default prefix suffix
@@ -463,7 +463,7 @@ ifexists()
 }
 
 # ipv4_up if
-#  add IPv4 addresses to the interface $if 
+#	add IPv4 addresses to the interface $if 
 ipv4_up()
 {
 	local _if _ret
@@ -500,7 +500,7 @@ ipv6_up()
 }
 
 # ipv4_down if
-#  remove IPv4 addresses from the interface $if
+#	remove IPv4 addresses from the interface $if
 ipv4_down()
 {
 	local _if _ifs _ret inetList oldifs _inet
@@ -568,10 +568,10 @@ ipv6_down()
 }
 
 # ipv4_addrs_common if action
-#   Evaluate the ifconfig_if_ipv4 arguments for interface $if
-#   and use $action to add or remove IPv4 addresses from $if.
+#	Evaluate the ifconfig_if_ipv4 arguments for interface $if and
+#	use $action to add or remove IPv4 addresses from $if.
 ipv4_addrs_common()
-{  
+{
 	local _ret _if _action _cidr _cidr_addr
 	local _ipaddr _netmask _range _ipnet _iplow _iphigh _ipcount 
 	_ret=1
@@ -652,7 +652,7 @@ ifalias_ipv4_up()
 			break
 			;;
 		esac
-			alias=$((${alias} + 1))
+		alias=$((${alias} + 1))
 	done
 
 	return $_ret
@@ -701,7 +701,7 @@ ifalias_ipv6_up()
 	return $_ret
 }
 
-#ifalias_down if af
+# ifalias_down if af
 #	Remove aliases for network interface $if.
 #	It returns 0 if at least one alias was removed or
 #	1 if there were none.
@@ -723,7 +723,7 @@ ifalias_down()
 	return $_ret
 }
 
-#ifalias_ipv4_down if
+# ifalias_ipv4_down if
 #	Helper function for ifalias_down().  Handles IPv4.
 #
 ifalias_ipv4_down()
@@ -743,13 +743,13 @@ ifalias_ipv4_down()
 			break
 			;;
 		esac
-			alias=$((${alias} + 1))
+		alias=$((${alias} + 1))
 	done
 
 	return $_ret
 }
 
-#ifalias_ipv6_down if
+# ifalias_ipv6_down if
 #	Helper function for ifalias_down().  Handles IPv6.
 #
 ifalias_ipv6_down()
@@ -869,7 +869,8 @@ ifscript_down()
 	fi
 }
 
-# Create cloneable interfaces.
+# clone_up
+#	Create cloneable interfaces.
 #
 clone_up()
 {
@@ -888,8 +889,9 @@ clone_up()
 	debug "Cloned: ${_list}"
 }
 
-# Destroy cloned interfaces. Destroyed interfaces are echoed
-# to standard output.
+# clone_down
+#	Destroy cloned interfaces. Destroyed interfaces are echoed to
+#	standard output.
 #
 clone_down()
 {
@@ -907,8 +909,9 @@ clone_down()
 	debug "Destroyed clones: ${_list}"
 }
 
-# Create and configure child interfaces.
-# Return 0 if child interfaces are created.
+# childif_create
+#	Create and configure child interfaces.  Return 0 if child
+#	interfaces are created.
 #
 childif_create()
 {
@@ -943,7 +946,8 @@ childif_create()
 	return ${cfg}
 }
 
-# Destroy child interfaces.
+# childif_destroy
+#	Destroy child interfaces.
 #
 childif_destroy()
 {
@@ -958,16 +962,22 @@ childif_destroy()
 	return ${cfg}
 }
 
-# Create netgraph nodes.
+# ng_mkpeer
+#	Create netgraph nodes.
 #
-ng_mkpeer() {
+ng_mkpeer()
+{
 	ngctl -f - 2> /dev/null <
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2EB7C1065672;
	Sat, 12 Sep 2009 23:12:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org)
Received: from mail.allbsd.org (gatekeeper-int.allbsd.org
	[IPv6:2001:2f0:104:e002::2])
	by mx1.freebsd.org (Postfix) with ESMTP id B038B8FC14;
	Sat, 12 Sep 2009 23:12:35 +0000 (UTC)
Received: from delta.allbsd.org (p4121-ipbf1805funabasi.chiba.ocn.ne.jp
	[114.146.83.121]) (authenticated bits=128)
	by mail.allbsd.org (8.14.3/8.14.3) with ESMTP id n8CNCJlB061312;
	Sun, 13 Sep 2009 08:12:30 +0900 (JST) (envelope-from hrs@FreeBSD.org)
Received: from localhost (alph.allbsd.org [192.168.0.10])
	(authenticated bits=0)
	by delta.allbsd.org (8.13.4/8.13.4) with ESMTP id n8CNCACx099849;
	Sun, 13 Sep 2009 08:12:13 +0900 (JST) (envelope-from hrs@FreeBSD.org)
Date: Sun, 13 Sep 2009 08:10:54 +0900 (JST)
Message-Id: <20090913.081054.72289827.hrs@allbsd.org>
To: sam@errno.com
From: Hiroki Sato 
In-Reply-To: <4AAC2011.1010308@errno.com>
References: <200909122214.n8CMEL8F098946@svn.freebsd.org>
	<4AAC2011.1010308@errno.com>
X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530  FFD7 4F2C D3D8 2793 CF2D
X-Mailer: Mew version 6.2.51 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Multipart/Signed; protocol="application/pgp-signature";
	micalg=pgp-sha1;
	boundary="--Security_Multipart(Sun_Sep_13_08_10_54_2009_361)--"
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.95.2 at gatekeeper.allbsd.org
X-Virus-Status: Clean
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3
	(mail.allbsd.org [133.31.130.32]);
	Sun, 13 Sep 2009 08:12:31 +0900 (JST)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r197140 - head/etc/rc.d
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 12 Sep 2009 23:12:36 -0000

----Security_Multipart(Sun_Sep_13_08_10_54_2009_361)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Sam Leffler  wrote
  in <4AAC2011.1010308@errno.com>:

sa> Hiroki Sato wrote:
sa> > Author: hrs
sa> > Date: Sat Sep 12 22:14:21 2009
sa> > New Revision: 197140
sa> > URL: http://svn.freebsd.org/changeset/base/197140
sa> > Log:
sa> >   - Add "AUTO" keyword support in $rtadvd_interfaces.
sa> >   - Wrap a long line.
sa> >     MFC after:	3 days
sa> > Modified:
sa> >   head/etc/rc.d/rtadvd
(snip)
sa> >
sa>
sa> You look to be enumerating wireless devices.  If so you should use the
sa> media type instead of device names.

 Thanks, I committed a patch to use is_wired_interface() instead of
 the lengthy case statement just now.

-- Hiroki

----Security_Multipart(Sun_Sep_13_08_10_54_2009_361)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEABECAAYFAkqsKn4ACgkQTyzT2CeTzy3x4QCgutXgsap5oGyFiloy2jjtW/Be
1CwAnRLMRJscvf8MJ8Zqo7uu55quLZdz
=S3tc
-----END PGP SIGNATURE-----

----Security_Multipart(Sun_Sep_13_08_10_54_2009_361)----